From a2435ec46d9041f48870c10d0939d8d24800653a Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Thu, 09 Jun 2011 09:51:00 +0000
Subject: [PATCH] Partial fix OPENDJ-194: Minor improvements to change log content and configuration

---
 opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ExternalChangeLogTest.java |   38 ++++++++++++++++++++++++++++----------
 1 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ExternalChangeLogTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ExternalChangeLogTest.java
index c5fb180..0267b11 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ExternalChangeLogTest.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ExternalChangeLogTest.java
@@ -218,7 +218,7 @@
    * Launcher.
    */
   @Test(enabled=true)
-  public void ECLReplicationServerTest()
+  public void ECLReplicationServerTest() throws Exception
   {
     // No RSDomain created yet => RS only case => ECL is not a supported
     ECLIsNotASupportedSuffix();
@@ -3982,7 +3982,7 @@
    * Test ECl entry attributes, and there configuration.
    *
    */
-  private void ECLIncludeAttributes()
+  private void ECLIncludeAttributes() throws Exception
   {
     String tn = "ECLIncludeAttributes";
     debugInfo(tn, "Starting test\n\n");
@@ -4176,28 +4176,32 @@
           s += "Entry:" + resultEntry.toLDIFString();
 
           String targetdn = getAttributeValue(resultEntry, "targetdn");
+
           if ((targetdn.endsWith("cn=robert hue,o=test3"))
             ||(targetdn.endsWith("cn=robert hue2,o=test3")))
           {
+            Entry targetEntry = parseIncludedAttributes(resultEntry,
+                targetdn);
+
             HashSet<String> eoc = new HashSet<String>();
             eoc.add("person");eoc.add("inetOrgPerson");eoc.add("organizationalPerson");eoc.add("top");
-            checkValues(resultEntry,"targetobjectclass",eoc);
+            assertEquals(targetEntry.getAttributes().size(), 0); // objectClass is handled separately
+            checkValues(targetEntry,"objectclass",eoc);
           }
           if (targetdn.endsWith("cn=fiona jensen,o=test2"))
           {
-            checkValue(resultEntry,"targetsn","jensen");
-            checkValue(resultEntry,"targetcn","Fiona Jensen");
+            Entry targetEntry = parseIncludedAttributes(resultEntry,
+                targetdn);
+
+            assertEquals(targetEntry.getAttributes().size(), 2);
+            checkValue(targetEntry,"sn","jensen");
+            checkValue(targetEntry,"cn","Fiona Jensen");
           }
           checkValue(resultEntry,"changeinitiatorsname", "cn=Internal Client,cn=Root DNs,cn=config");
         }
       }
       assertEquals(entries.size(),8, "Entries number returned by search" + s);
     }
-    catch(Exception e)
-    {
-      fail("Ending "+tn+" test with exception:\n"
-          +  stackTraceToSingleLineString(e));
-    }
     finally
     {
       try
@@ -4239,6 +4243,20 @@
     debugInfo(tn, "Ending test with success");
   }
 
+  private Entry parseIncludedAttributes(
+      SearchResultEntry resultEntry, String targetdn)
+      throws Exception
+  {
+    // Parse includedAttributes as an entry.
+    String includedAttributes = getAttributeValue(resultEntry, "includedattributes");
+    String[] ldifAttributeLines = includedAttributes.split("\\n");
+    String[] ldif = new String[ldifAttributeLines.length + 1];
+    System.arraycopy(ldifAttributeLines, 0, ldif, 1, ldifAttributeLines.length);
+    ldif[0] = "dn: " + targetdn;
+    Entry targetEntry = TestCaseUtils.makeEntry(ldif);
+    return targetEntry;
+  }
+
   private void waitOpResult(AbstractOperation operation,
       ResultCode expectedResult)
   {

--
Gitblit v1.10.0