From 0ebfbbfd2dda7a836b8d25d9473612e8cb8c85c5 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Fri, 21 Sep 2007 00:12:01 +0000
Subject: [PATCH] Update the way the server normalizes schema element definitions so that they are more correctly handled and are more forgiving with regard to things like extra spaces in the definition.

---
 opends/tests/unit-tests-testng/src/server/org/opends/server/backends/SchemaBackendTestCase.java |   42 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/SchemaBackendTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/SchemaBackendTestCase.java
index d6ed54e..9c7db9c 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/SchemaBackendTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/SchemaBackendTestCase.java
@@ -5330,6 +5330,48 @@
 
 
   /**
+   * Tests the ability to properly handle adding and removing a schema
+   * definition in which the definition has extra spaces.  This was added as a
+   * test case for issue #2171.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void testAddAndDeleteDefinitionWithExtraSpaces()
+         throws Exception
+  {
+    int resultCode = TestCaseUtils.applyModifications(
+      "dn: cn=schema",
+      "changetype: modify",
+      "add: objectClasses",
+      "objectClasses: ( testaddanddeletedefinitionwithextraspaces-oid",
+      "  NAME 'testAddAndDeleteDefinitionWithExtraSpaces'  SUP person",
+      "  MAY ( street $ c) X-ORIGIN 'user defined' )");
+    assertEquals(resultCode, 0);
+
+    assertNotNull(DirectoryServer.getObjectClass(
+                       "testaddanddeletedefinitionwithextraspaces"));
+    assertNotNull(DirectoryServer.getObjectClass(
+                       "testaddanddeletedefinitionwithextraspaces-oid"));
+
+    resultCode = TestCaseUtils.applyModifications(
+      "dn: cn=schema",
+      "changetype: modify",
+      "delete: objectClasses",
+      "objectClasses: ( testaddanddeletedefinitionwithextraspaces-oid",
+      "  NAME 'testAddAndDeleteDefinitionWithExtraSpaces'  SUP person",
+      "  MAY ( street $ c) X-ORIGIN 'user defined' )");
+    assertEquals(resultCode, 0);
+
+    assertNull(DirectoryServer.getObjectClass(
+                    "testaddanddeletedefinitionwithextraspaces"));
+    assertNull(DirectoryServer.getObjectClass(
+                    "testaddanddeletedefinitionwithextraspaces-oid"));
+  }
+
+
+
+  /**
    * Tests the {@code exportLDIF} method with a valid configuration.
    *
    * @throws  Exception  If an unexpected problem occurs.

--
Gitblit v1.10.0