From 2ee035bf164fe1976b7c51b0f248322ae6dcb33e Mon Sep 17 00:00:00 2001
From: coulbeck <coulbeck@localhost>
Date: Thu, 26 Apr 2007 21:37:38 +0000
Subject: [PATCH] Fix issue 1516: encode-password with --encodedPasswordFile doesn't work.

---
 opends/tests/unit-tests-testng/src/server/org/opends/server/tools/EncodePasswordTestCase.java |   35 ++++++++++++++++++++++++++---------
 1 files changed, 26 insertions(+), 9 deletions(-)

diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/EncodePasswordTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/EncodePasswordTestCase.java
index 75c71a7..63b43b8 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/EncodePasswordTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/tools/EncodePasswordTestCase.java
@@ -29,7 +29,6 @@
 
 
 import java.io.File;
-import java.io.FileWriter;
 import java.util.ArrayList;
 
 import org.testng.annotations.BeforeClass;
@@ -37,18 +36,11 @@
 import org.testng.annotations.Test;
 
 import org.opends.server.TestCaseUtils;
-import org.opends.server.core.AddOperation;
 import org.opends.server.core.DirectoryServer;
-import org.opends.server.protocols.internal.InternalClientConnection;
 import org.opends.server.protocols.ldap.LDAPResultCode;
-import org.opends.server.types.Entry;
-import org.opends.server.types.OperatingSystem;
-import org.opends.server.types.ResultCode;
-import org.opends.server.util.Base64;
 
 import static org.testng.Assert.*;
 
-import static org.opends.server.util.ServerConstants.*;
 
 
 
@@ -61,9 +53,12 @@
   // The path to the Directory Server configuration file.
   private String configFilePath;
 
-  // The path to the temporary file containing a password.
+  // The path to the temporary file containing a clear-text password.
   private String passwordFilePath;
 
+  // The path to the temporary file containing an encoded password.
+  private String encodedPasswordFilePath;
+
 
 
   /**
@@ -81,6 +76,9 @@
                      "config" + File.separator + "config.ldif";
 
     passwordFilePath = TestCaseUtils.createTempFile("password");
+
+    encodedPasswordFilePath =
+         TestCaseUtils.createTempFile("{SHA}C5wmJdwh7wX2rU3fR8XyA4N6oyw=");
   }
 
 
@@ -462,6 +460,25 @@
 
   /**
    * Tests the EncodePassword tool by performing a comparison of clear-text
+   * with a valid matching encoded password.
+   */
+  @Test()
+  public void testCompareMatchingEncodedPasswordsFromFile()
+  {
+    String[] args =
+    {
+      "--configFile", configFilePath,
+      "--clearPasswordFile", passwordFilePath,
+      "--encodedPasswordFile", encodedPasswordFilePath
+    };
+
+    assertEquals(EncodePassword.encodePassword(args, false, null, null), 0);
+  }
+
+
+
+  /**
+   * Tests the EncodePassword tool by performing a comparison of clear-text
    * with a valid matching auth password.
    */
   @Test()

--
Gitblit v1.10.0