From 87af512c6c96ff1c80f1a460b572b874157ad712 Mon Sep 17 00:00:00 2001
From: Violette Roche-Montane <violette.roche-montane@forgerock.com>
Date: Thu, 28 Nov 2013 13:44:11 +0000
Subject: [PATCH] Test case added for OPENDJ-1200

---
 opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldif/LDIFEntryReaderTestCase.java |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldif/LDIFEntryReaderTestCase.java b/opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldif/LDIFEntryReaderTestCase.java
index 54a3653..fc3a452 100644
--- a/opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldif/LDIFEntryReaderTestCase.java
+++ b/opendj-sdk/opendj-core/src/test/java/org/forgerock/opendj/ldif/LDIFEntryReaderTestCase.java
@@ -52,6 +52,7 @@
 import org.forgerock.opendj.ldap.schema.SchemaValidationPolicy.Action;
 import org.testng.Assert;
 import org.testng.annotations.Test;
+
 import static org.fest.assertions.Assertions.assertThat;
 import static org.mockito.Matchers.any;
 import static org.mockito.Matchers.anyListOf;
@@ -1154,6 +1155,53 @@
         }
     }
 
+
+  /**
+   * Tries to read an entry composed by multi-valued attributes. The
+   * multi-valued attributes contains an interesting case where two of them
+   * represents the same value, one in uppercase and the other in lower case.
+   *
+   * @throws Exception
+   */
+    @Test(enabled = false)
+    public void testLDIFEntryReaderMultiplesAttributeValuesDifferentLetterCase() throws Exception {
+
+        // @formatter:off
+        final String[] strEntry = {
+            "dn: cn=Character Set,cn=Password Validators,cn=config",
+            "objectClass: ds-cfg-character-set-password-validator",
+            "objectClass: ds-cfg-password-validator",
+            "objectClass: top",
+            "ds-cfg-enabled: true",
+            "ds-cfg-java-class: org.opends.server.extensions.CharacterSetPasswordValidator",
+            "ds-cfg-allow-unclassified-characters: true",
+            "ds-cfg-character-set: 1:abcdefghijklmnopqrstuvwxyz",
+            "ds-cfg-character-set: 1:ABCDEFGHIJKLMNOPQRSTUVWXYZ",
+            "ds-cfg-character-set: 1:0123456789",
+            "ds-cfg-character-set: 1:~!@#$%^&*()-_=+[]{}|;:,.<>/?",
+            "cn: Character Set"
+        };
+        // @formatter:on
+        final String path = TestCaseUtils.createTempFile(strEntry);
+        final FileInputStream in = new FileInputStream(path);
+        final LDIFEntryReader reader = new LDIFEntryReader(in);
+
+        try {
+            assertThat(reader.hasNext());
+            final Entry entry = reader.readEntry();
+            assertThat(entry.getName().toString()).isEqualTo(
+                    "cn=Character Set,cn=Password Validators,cn=config");
+            // List the attributes : objectClass ds-cfg-enabled ds-cfg-java-class
+            // ds-cfg-allow-unclassified-characters ds-cfg-character-set cn
+            assertThat(entry.getAttributeCount()).isEqualTo(6);
+            assertThat(entry.getAttribute("ds-cfg-character-set")).isNotEmpty();
+            assertThat(entry.getAttribute("ds-cfg-character-set").toArray().length).isEqualTo(4);
+            assertThat(reader.hasNext()).isFalse();
+        } finally {
+            reader.close();
+        }
+    }
+
     /**
      * Testing to read an entry which containing empty required attributes.
      *

--
Gitblit v1.10.0