From ee0fbff002e17a56aca09cb8dc7da0f4fe20ad6e Mon Sep 17 00:00:00 2001
From: boli <boli@localhost>
Date: Tue, 31 Jul 2007 21:38:45 +0000
Subject: [PATCH] 

---
 opends/tests/unit-tests-testng/src/server/org/opends/server/tools/ImportLDIFTestCase.java |   36 ++++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/ImportLDIFTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/ImportLDIFTestCase.java
index 1fb1988..99e9ec8 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/ImportLDIFTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/ImportLDIFTestCase.java
@@ -51,6 +51,7 @@
   String configFilePath ;
   private String homeDirName;
   private String beID;
+  private String baseDN = "dc=example,dc=com";
 
   /**
   * Ensures that the ldif file is created with the entry.
@@ -196,6 +197,41 @@
     assertEntry(attr,true);
   }
 
+  /**
+   * Tests a simple Import LDIF using base DN with none of the attributes
+   * excluded or included. It is expected to import the entry(ies)
+   * with all the attributes in the ldif file.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test
+  public void testImportDefaultBaseDN() throws Exception
+  {
+
+    File reject = File.createTempFile("reject", ".ldif");
+    String rejectFilePath = reject.getAbsolutePath();
+    String[] args =
+    {
+      "-f", DirectoryServer.getConfigFile(),
+      "-l", ldifFilePath,
+      "-b", baseDN,
+      "-R", rejectFilePath
+    };
+    assertEquals(ImportLDIF.mainImportLDIF(args,false,System.out,System.err),0);
+    //Reject file should be empty.
+    assertRejectedFile(reject,true);
+    //check the presence of some random attributes.
+    Attribute[]  attr =
+    {
+      new Attribute ("description",
+          "This is the description for Aaccf Amar"),
+      new Attribute("mail","user.0@example.com"),
+      new Attribute ("creatorsname", "cn=Import") ,
+      new Attribute("modifiersname","cn=Import")
+    }    ;
+    assertEntry(attr,true);
+  }
+
 
 
   /**

--
Gitblit v1.10.0