From 7c8329a904420b71e3bf9a5297c447d2f1c7f281 Mon Sep 17 00:00:00 2001
From: dugan <dugan@localhost>
Date: Tue, 18 Aug 2009 04:06:27 +0000
Subject: [PATCH] Some unit test fixes. Also, comment a unit test out until I figure out what the problem is.
---
opends/src/server/org/opends/server/tools/ImportLDIF.java | 70 ++++++++++++++++-------------------
1 files changed, 32 insertions(+), 38 deletions(-)
diff --git a/opends/src/server/org/opends/server/tools/ImportLDIF.java b/opends/src/server/org/opends/server/tools/ImportLDIF.java
index e45b1c1..b1b956e 100644
--- a/opends/src/server/org/opends/server/tools/ImportLDIF.java
+++ b/opends/src/server/org/opends/server/tools/ImportLDIF.java
@@ -362,8 +362,10 @@
threadCount = new IntegerArgument("threadCount", null, "threadCount",
- false, true,
+ false, false, true,
INFO_LDIFIMPORT_THREAD_COUNT_PLACEHOLDER.get(),
+ 0, null,
+ true, 1, false, Integer.MAX_VALUE,
INFO_LDIFIMPORT_DESCRIPTION_THREAD_COUNT.get());
argParser.addArgument(threadCount);
@@ -547,6 +549,13 @@
attributes.add(new LDAPAttribute(ATTR_IMPORT_RANDOM_SEED, values));
}
+
+ if (threadCount.getValue() != null) {
+ values = new ArrayList<ByteString>(1);
+ values.add(ByteString.valueOf(threadCount.getValue()));
+ attributes.add(new LDAPAttribute(ATTR_IMPORT_THREAD_COUNT, values));
+ }
+
//
// Optional attributes
//
@@ -680,16 +689,6 @@
}
- if (threadCount.getValue() != null &&
- !threadCount.getValue().equals(
- threadCount.getDefaultValue())) {
- values = new ArrayList<ByteString>(1);
- values.add(ByteString.valueOf(threadCount.getValue()));
- attributes.add(new LDAPAttribute(ATTR_IMPORT_THREAD_COUNT, values));
- }
-
-
-
if (isCompressed.getValue() != null &&
!isCompressed.getValue().equals(
isCompressed.getDefaultValue())) {
@@ -1335,39 +1334,34 @@
importConfig = new LDIFImportConfig(tf);
}
- int tc = -1;
- if(threadCount.isPresent())
- {
+
+ // Create the LDIF import configuration to use when reading the LDIF.
+ importConfig.setAppendToExistingData(append.isPresent());
+ importConfig.setReplaceExistingEntries(replaceExisting.isPresent());
+ importConfig.setCompressed(isCompressed.isPresent());
+ importConfig.setClearBackend(clearBackend.isPresent());
+ importConfig.setEncrypted(isEncrypted.isPresent());
+ importConfig.setExcludeAttributes(excludeAttributes);
+ importConfig.setExcludeBranches(excludeBranches);
+ importConfig.setExcludeFilters(excludeFilters);
+ importConfig.setIncludeAttributes(includeAttributes);
+ importConfig.setIncludeBranches(includeBranches);
+ importConfig.setIncludeFilters(includeFilters);
+ importConfig.setValidateSchema(!skipSchemaValidation.isPresent());
+ importConfig.setSkipDNValidation(skipDNValidation.isPresent());
+ importConfig.setTmpDirectory(tmpDirectory.getValue());
+
try
{
- tc = threadCount.getIntValue();
+ importConfig.setThreadCount(threadCount.getIntValue());
}
catch(Exception e)
{
- Message msg = ERR_LDIFIMPORT_CANNOT_PARSE_THREAD_COUNT.get(
- threadCount.getValue(), e.getMessage());
- logError(msg);
- return 1;
+ Message msg = ERR_LDIFIMPORT_CANNOT_PARSE_THREAD_COUNT.get(
+ threadCount.getValue(), e.getMessage());
+ logError(msg);
+ return 1;
}
- }
-
-
- // Create the LDIF import configuration to use when reading the LDIF.
- importConfig.setAppendToExistingData(append.isPresent());
- importConfig.setReplaceExistingEntries(replaceExisting.isPresent());
- importConfig.setCompressed(isCompressed.isPresent());
- importConfig.setClearBackend(clearBackend.isPresent());
- importConfig.setEncrypted(isEncrypted.isPresent());
- importConfig.setExcludeAttributes(excludeAttributes);
- importConfig.setExcludeBranches(excludeBranches);
- importConfig.setExcludeFilters(excludeFilters);
- importConfig.setIncludeAttributes(includeAttributes);
- importConfig.setIncludeBranches(includeBranches);
- importConfig.setIncludeFilters(includeFilters);
- importConfig.setValidateSchema(!skipSchemaValidation.isPresent());
- importConfig.setSkipDNValidation(skipDNValidation.isPresent());
- importConfig.setTmpDirectory(tmpDirectory.getValue());
- importConfig.setThreadCount(tc);
importConfig.setBufferSize(LDIF_BUFFER_SIZE);
importConfig.setExcludeAllUserAttributes(
--
Gitblit v1.10.0