From cedfe056e1ce3de8a7e4f34edbb5bdc6f29900f3 Mon Sep 17 00:00:00 2001
From: gbellato <gbellato@localhost>
Date: Tue, 26 Sep 2006 10:20:20 +0000
Subject: [PATCH] Split the Attribute syntaxes tests. Add some tests for better coverage of the Bit String syntax
---
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/UTCTimeSyntaxTest.java | 79 +++
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/IA5StringSyntaxTest.java | 60 ++
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/UUIDSyntaxTest.java | 70 +++
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/TelexSyntaxTest.java | 71 +++
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/LDAPSyntaxTest.java | 69 +++
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/AttributeTypeSyntaxTest.java | 66 +++
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/OtherMailboxSyntaxTest.java | 60 ++
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/MatchingRuleUseSyntaxTest.java | 66 +++
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/BitStringSyntaxTest.java | 120 +++++
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/DITContentRuleSyntaxTest.java | 104 ++++
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/AttributeSyntaxTest.java | 283 +-----------
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/GuideSyntaxTest.java | 76 +++
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/GeneralizedTimeSyntaxTest.java | 83 +++
opends/tests/unit-tests-testng/src/server/org/opends/server/schema/MatchingRuleSyntaxTest.java | 66 +++
14 files changed, 1,021 insertions(+), 252 deletions(-)
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/AttributeSyntaxTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/AttributeSyntaxTest.java
index 8f8f4dc..0651abf 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/AttributeSyntaxTest.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/AttributeSyntaxTest.java
@@ -27,280 +27,59 @@
package org.opends.server.schema;
import static org.testng.Assert.*;
-import static org.opends.server.schema.SchemaConstants.*;
import org.opends.server.api.AttributeSyntax;
-import org.opends.server.core.DirectoryServer;
import org.opends.server.protocols.asn1.ASN1OctetString;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
-public class AttributeSyntaxTest extends SchemaTestCase
+public abstract class AttributeSyntaxTest extends SchemaTestCase
{
+ /**
+ * Create data for the testAcceptableValues test.
+ * This should be a table of tables with 2 elements.
+ * The first one should be the value to test, the second the expected
+ * result of the test.
+ *
+ * @return a table containing data for the testAcceptableValues Test.
+ */
@DataProvider(name="acceptableValues")
- public Object[][] createapproximateMatchingRuleTest()
- {
- // fill this table with tables containing :
- // - the name of the Syntax rule to test
- // - a value that must be tested for correctness
- // - a boolean indicating if the value is correct.
- return new Object[][] {
-
- // tests for the UTC time syntax. This time syntax only uses 2 digits
- // for the year but it is currently implemented using 4 digits
- // disable the tests for now.
- // see issue 637
- /*
- {SYNTAX_UTC_TIME_OID,"060906135030+01", true},
- {SYNTAX_UTC_TIME_OID,"0609061350Z", true},
- {SYNTAX_UTC_TIME_OID,"060906135030Z", true},
- {SYNTAX_UTC_TIME_OID,"061116135030Z", true},
- {SYNTAX_UTC_TIME_OID,"061126135030Z", true},
- {SYNTAX_UTC_TIME_OID,"061231235959Z", true},
- {SYNTAX_UTC_TIME_OID,"060906135030+0101", true},
- {SYNTAX_UTC_TIME_OID,"060906135030+2359", true},
- */
- {SYNTAX_UTC_TIME_OID,"060906135030+3359", false},
- {SYNTAX_UTC_TIME_OID,"060906135030+2389", false},
- {SYNTAX_UTC_TIME_OID,"062231235959Z", false},
- {SYNTAX_UTC_TIME_OID,"061232235959Z", false},
- {SYNTAX_UTC_TIME_OID,"06123123595aZ", false},
- {SYNTAX_UTC_TIME_OID,"0a1231235959Z", false},
- {SYNTAX_UTC_TIME_OID,"06j231235959Z", false},
- {SYNTAX_UTC_TIME_OID,"0612-1235959Z", false},
- {SYNTAX_UTC_TIME_OID,"061231#35959Z", false},
- {SYNTAX_UTC_TIME_OID,"2006", false},
+ public abstract Object[][] createAcceptableValues();
- // generalized time.
- {SYNTAX_GENERALIZED_TIME_OID,"2006090613Z", true},
- {SYNTAX_GENERALIZED_TIME_OID,"20060906135030+01", true},
- {SYNTAX_GENERALIZED_TIME_OID,"200609061350Z", true},
- {SYNTAX_GENERALIZED_TIME_OID,"20060906135030Z", true},
- {SYNTAX_GENERALIZED_TIME_OID,"20061116135030Z", true},
- {SYNTAX_GENERALIZED_TIME_OID,"20061126135030Z", true},
- {SYNTAX_GENERALIZED_TIME_OID,"20061231235959Z", true},
- {SYNTAX_GENERALIZED_TIME_OID,"20060906135030+0101", true},
- {SYNTAX_GENERALIZED_TIME_OID,"20060906135030+2359", true},
- {SYNTAX_GENERALIZED_TIME_OID,"20060906135030+3359", false},
- {SYNTAX_GENERALIZED_TIME_OID,"20060906135030+2389", false},
- {SYNTAX_GENERALIZED_TIME_OID,"20060906135030+2361", false},
- {SYNTAX_GENERALIZED_TIME_OID,"20060906135030+", false},
- {SYNTAX_GENERALIZED_TIME_OID,"20060906135030+0", false},
- {SYNTAX_GENERALIZED_TIME_OID,"20060906135030+010", false},
- {SYNTAX_GENERALIZED_TIME_OID,"20061200235959Z", false},
- {SYNTAX_GENERALIZED_TIME_OID,"2006121a235959Z", false},
- {SYNTAX_GENERALIZED_TIME_OID,"2006122a235959Z", false},
- {SYNTAX_GENERALIZED_TIME_OID,"20060031235959Z", false},
- {SYNTAX_GENERALIZED_TIME_OID,"20061331235959Z", false},
- {SYNTAX_GENERALIZED_TIME_OID,"20062231235959Z", false},
- {SYNTAX_GENERALIZED_TIME_OID,"20061232235959Z", false},
- {SYNTAX_GENERALIZED_TIME_OID,"2006123123595aZ", false},
- {SYNTAX_GENERALIZED_TIME_OID,"200a1231235959Z", false},
- {SYNTAX_GENERALIZED_TIME_OID,"2006j231235959Z", false},
- {SYNTAX_GENERALIZED_TIME_OID,"200612-1235959Z", false},
- {SYNTAX_GENERALIZED_TIME_OID,"20061231#35959Z", false},
- {SYNTAX_GENERALIZED_TIME_OID,"2006", false},
-
- // here starts the data for the tests of the Content rule syntax
- {SYNTAX_DIT_CONTENT_RULE_OID,
- "( 2.5.6.4 DESC 'content rule for organization' NOT "
- + "( x121Address $ telexNumber ) )", true},
- {SYNTAX_DIT_CONTENT_RULE_OID,
- "( 2.5.6.4 NAME 'full rule' DESC 'rule with all possible fields' "
- + " OBSOLETE"
- + " AUX ( person )"
- + " MUST ( cn $ sn )"
- + " MAY ( dc )"
- + " NOT ( x121Address $ telexNumber ) )"
- , true},
- {SYNTAX_DIT_CONTENT_RULE_OID,
- "( 2.5.6.4 NAME 'full rule' DESC 'ommit parenthesis' "
- + " OBSOLETE"
- + " AUX person "
- + " MUST cn "
- + " MAY dc "
- + " NOT x121Address )"
- , true},
- {SYNTAX_DIT_CONTENT_RULE_OID,
- "( 2.5.6.4 NAME 'full rule' DESC 'use numeric OIDs' "
- + " OBSOLETE"
- + " AUX 2.5.6.6"
- + " MUST cn "
- + " MAY dc "
- + " NOT x121Address )"
- , true},
- {SYNTAX_DIT_CONTENT_RULE_OID,
- "( 2.5.6.4 NAME 'full rule' DESC 'illegal OIDs' "
- + " OBSOLETE"
- + " AUX 2.5.6.."
- + " MUST cn "
- + " MAY dc "
- + " NOT x121Address )"
- , false},
- {SYNTAX_DIT_CONTENT_RULE_OID,
- "( 2.5.6.4 NAME 'full rule' DESC 'illegal OIDs' "
- + " OBSOLETE"
- + " AUX 2.5.6.x"
- + " MUST cn "
- + " MAY dc "
- + " NOT x121Address )"
- , false},
- {SYNTAX_DIT_CONTENT_RULE_OID,
- "( 2.5.6.4 NAME 'full rule' DESC 'missing closing parenthesis' "
- + " OBSOLETE"
- + " AUX person "
- + " MUST cn "
- + " MAY dc "
- + " NOT x121Address"
- , false},
- {SYNTAX_DIT_CONTENT_RULE_OID,
- "( 2.5.6.4 NAME 'full rule' DESC 'extra parameterss' "
- + " MUST cn "
- + "( this is an extra parameter )"
- , true},
-
- // Here start the data for the tests of the matching rule syntaxes
- {SYNTAX_MATCHING_RULE_OID,
- "( 1.2.3.4 NAME 'full matching rule' "
- + " DESC 'description of matching rule' OBSOLETE "
- + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.17 "
- + " ( this is an extension ) )", true},
- {SYNTAX_MATCHING_RULE_OID,
- "( 1.2.3.4 NAME 'missing closing parenthesis' "
- + " DESC 'description of matching rule' "
- + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.17 "
- + " ( this is an extension ) ", false},
-
- // Here start the data for the tests of the matching rule use syntaxes
- {SYNTAX_MATCHING_RULE_USE_OID,
- "( 2.5.13.10 NAME 'full matching rule' "
- + " DESC 'description of matching rule' OBSOLETE "
- + " APPLIES 2.5.4.3 "
- + " ( this is an extension ) )", true},
- {SYNTAX_MATCHING_RULE_USE_OID,
- "( 2.5.13.10 NAME 'missing closing parenthesis' "
- + " DESC 'description of matching rule' "
- + " SYNTAX 2.5.4.3 "
- + " ( this is an extension ) ", false},
-
- {SYNTAX_BIT_STRING_OID, "'0101'B", true},
- {SYNTAX_BIT_STRING_OID, "'1'B", true},
- {SYNTAX_BIT_STRING_OID, "'0'B", true},
- {SYNTAX_BIT_STRING_OID, "invalid", false},
-
- // disabled because test is failing :
- // {SYNTAX_LDAP_SYNTAX_OID,
- // "( 2.5.4.3 DESC 'full syntax description' "
- // + "( this is an extension ) )", true},
- {SYNTAX_LDAP_SYNTAX_OID,
- "( 2.5.4.3 DESC 'full syntax description' )", true},
- {SYNTAX_LDAP_SYNTAX_OID,
- " ( 2.5.4.3 DESC ' syntax description' )", true},
- {SYNTAX_LDAP_SYNTAX_OID,
- "( 2.5.4.3 DESC syntax description )", false},
- {SYNTAX_LDAP_SYNTAX_OID,
- "($%^*&!@ DESC 'syntax description' )", false},
- {SYNTAX_LDAP_SYNTAX_OID,
- "(temp-oid DESC 'syntax description' )", true},
- {SYNTAX_LDAP_SYNTAX_OID,
- "2.5.4.3 DESC 'syntax description' )", false},
- {SYNTAX_LDAP_SYNTAX_OID,
- "(2.5.4.3 DESC 'syntax description' ", false},
-
- {SYNTAX_GUIDE_OID, "sn$EQ|!(sn$EQ)", true},
- {SYNTAX_GUIDE_OID, "!(sn$EQ)", true},
- {SYNTAX_GUIDE_OID, "person#sn$EQ", true},
- {SYNTAX_GUIDE_OID, "(sn$EQ)", true},
- {SYNTAX_GUIDE_OID, "sn$EQ", true},
- {SYNTAX_GUIDE_OID, "sn$SUBSTR", true},
- {SYNTAX_GUIDE_OID, "sn$GE", true},
- {SYNTAX_GUIDE_OID, "sn$LE", true},
- {SYNTAX_GUIDE_OID, "sn$ME", false},
- {SYNTAX_GUIDE_OID, "?true", true},
- {SYNTAX_GUIDE_OID, "?false", true},
- {SYNTAX_GUIDE_OID, "true|sn$GE", false},
- {SYNTAX_GUIDE_OID, "sn$APPROX", true},
- {SYNTAX_GUIDE_OID, "sn$EQ|(sn$EQ)", true},
- {SYNTAX_GUIDE_OID, "sn$EQ|(sn$EQ", false},
- {SYNTAX_GUIDE_OID, "sn$EQ|(sn$EQ)|sn$EQ", true},
- {SYNTAX_GUIDE_OID, "sn$EQ|(cn$APPROX&?false)", true},
- {SYNTAX_GUIDE_OID, "sn$EQ|(cn$APPROX&|?false)", false},
-
- {SYNTAX_ATTRIBUTE_TYPE_OID,
- "(1.2.8.5 NAME 'testtype' DESC 'full type' OBSOLETE SUP 1.2" +
- " EQUALITY 2.3 ORDERING 5.6 SUBSTR 7.8 SYNTAX 9.1 SINGLE-VALUE" +
- " COLLECTIVE NO-USER-MODIFICATION USAGE directoryOperations )",
- true},
- {SYNTAX_ATTRIBUTE_TYPE_OID,
- "(1.2.8.5 NAME 'testtype' DESC 'full type')",
- true},
- {SYNTAX_ATTRIBUTE_TYPE_OID,
- "(1.2.8.5 USAGE directoryOperations )",
- true},
-
-
- {SYNTAX_UUID_OID, "12345678-9ABC-DEF0-1234-1234567890ab", true},
- {SYNTAX_UUID_OID, "12345678-9abc-def0-1234-1234567890ab", true},
- {SYNTAX_UUID_OID, "12345678-9abc-def0-1234-1234567890ab", true},
- {SYNTAX_UUID_OID, "12345678-9abc-def0-1234-1234567890ab", true},
- {SYNTAX_UUID_OID, "02345678-9abc-def0-1234-1234567890ab", true},
- {SYNTAX_UUID_OID, "12345678-9abc-def0-1234-1234567890ab", true},
- {SYNTAX_UUID_OID, "12345678-9abc-def0-1234-1234567890ab", true},
- {SYNTAX_UUID_OID, "02345678-9abc-def0-1234-1234567890ab", true},
- {SYNTAX_UUID_OID, "G2345678-9abc-def0-1234-1234567890ab", false},
- {SYNTAX_UUID_OID, "g2345678-9abc-def0-1234-1234567890ab", false},
- {SYNTAX_UUID_OID, "12345678/9abc/def0/1234/1234567890ab", false},
- {SYNTAX_UUID_OID, "12345678-9abc-def0-1234-1234567890a", false},
-
- {SYNTAX_IA5_STRING_OID, "12345678", true},
- {SYNTAX_IA5_STRING_OID, "12345678\u2163", false},
-
- {SYNTAX_OTHER_MAILBOX_OID, "MyMail$Mymailbox", true},
- {SYNTAX_OTHER_MAILBOX_OID, "MyMailMymailbox", false},
-
- {SYNTAX_TELEX_OID, "123$france$456", true},
- {SYNTAX_TELEX_OID, "abcdefghijk$lmnopqr$stuvwxyz", true},
- {SYNTAX_TELEX_OID, "12345$67890$()+,-./:? ", true},
- /*
- * disabled because of issue : 701
- * should accept "
- {SYNTAX_TELEX_OID, "12345$67890$\"\"\"", true},
- */
- /* disabled because of issue : 701
- * should not accept backslash and equal sign
- {SYNTAX_TELEX_OID, "12345$67890$\'\'", false},
- {SYNTAX_TELEX_OID, "12345$67890$===", false},*/
-
- };
- }
+ /**
+ * Get an instance of the attribute syntax that muste be tested.
+ *
+ * @return An instance of the attribute syntax that muste be tested.
+ */
+ public abstract AttributeSyntax getRule();
/**
* Test the normalization and the approximate comparison.
*/
@Test(dataProvider= "acceptableValues")
- public void testAcceptableValues(String oid, String value,
- Boolean result) throws Exception
+ public void testAcceptableValues(String value, Boolean result)
+ throws Exception
{
// Make sure that the specified class can be instantiated as a task.
- AttributeSyntax rule = DirectoryServer.getAttributeSyntax(oid, false);
+ AttributeSyntax syntax = getRule();
StringBuilder reason = new StringBuilder();
- // normalize the 2 provided values and check that they are equals
+ // test the valueIsAcceptable method
Boolean liveResult =
- rule.valueIsAcceptable(new ASN1OctetString(value), reason);
+ syntax.valueIsAcceptable(new ASN1OctetString(value), reason);
if (liveResult != result)
- fail(rule + ".valueIsAcceptable gave bad result for " + value +
+ fail(syntax + ".valueIsAcceptable gave bad result for " + value +
"reason : " + reason);
- // call the getters to increase code coverage...
- rule.getApproximateMatchingRule();
- rule.getDescription();
- rule.getEqualityMatchingRule();
- rule.getOID();
- rule.getOrderingMatchingRule();
- rule.getSubstringMatchingRule();
- rule.getSyntaxName();
- rule.toString();
+ // call the getters
+ syntax.getApproximateMatchingRule();
+ syntax.getDescription();
+ syntax.getEqualityMatchingRule();
+ syntax.getOID();
+ syntax.getOrderingMatchingRule();
+ syntax.getSubstringMatchingRule();
+ syntax.getSyntaxName();
+ syntax.toString();
}
}
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/AttributeTypeSyntaxTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/AttributeTypeSyntaxTest.java
new file mode 100644
index 0000000..983d966
--- /dev/null
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/AttributeTypeSyntaxTest.java
@@ -0,0 +1,66 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying * information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2006 Sun Microsystems, Inc.
+ */
+package org.opends.server.schema;
+
+import org.opends.server.api.AttributeSyntax;
+import org.testng.annotations.DataProvider;
+
+/**
+ * Test the AttributeTypeSyntax.
+ */
+public class AttributeTypeSyntaxTest extends AttributeSyntaxTest
+{
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public AttributeSyntax getRule()
+ {
+ return new AttributeTypeSyntax();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ @DataProvider(name="acceptableValues")
+ public Object[][] createAcceptableValues()
+ {
+ return new Object [][] {
+ {"(1.2.8.5 NAME 'testtype' DESC 'full type' OBSOLETE SUP 1.2" +
+ " EQUALITY 2.3 ORDERING 5.6 SUBSTR 7.8 SYNTAX 9.1 SINGLE-VALUE" +
+ " COLLECTIVE NO-USER-MODIFICATION USAGE directoryOperations )",
+ true},
+ {"(1.2.8.5 NAME 'testtype' DESC 'full type')",
+ true},
+ {"(1.2.8.5 USAGE directoryOperations )",
+ true},
+ };
+ }
+
+}
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/BitStringSyntaxTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/BitStringSyntaxTest.java
new file mode 100644
index 0000000..ebd1ed0
--- /dev/null
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/BitStringSyntaxTest.java
@@ -0,0 +1,120 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying * information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2006 Sun Microsystems, Inc.
+ */
+package org.opends.server.schema;
+
+import static org.testng.Assert.*;
+
+import org.opends.server.api.AttributeSyntax;
+import org.opends.server.api.EqualityMatchingRule;
+import org.opends.server.config.ConfigEntry;
+import org.opends.server.core.DirectoryServer;
+import org.opends.server.protocols.asn1.ASN1OctetString;
+import org.opends.server.types.ByteString;
+import org.opends.server.types.DN;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/**
+ * Test the BitStringSyntax.
+ */
+public class BitStringSyntaxTest extends AttributeSyntaxTest
+{
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public AttributeSyntax getRule()
+ {
+ return new BitStringSyntax();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ @DataProvider(name="acceptableValues")
+ public Object[][] createAcceptableValues()
+ {
+ return new Object [][] {
+ {"'0101'B", true},
+ {"'1'B", true},
+ { "'0'B", true},
+ { "invalid", false},
+ { "1", false},
+ {"'010100000111111010101000'B", true},
+ };
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ @Test(dataProvider= "acceptableValues")
+ public void testAcceptableValues(String value, Boolean result) throws Exception
+ {
+ AttributeSyntax syntax = new BitStringSyntax();
+ ConfigEntry configEntry = DirectoryServer.getConfigEntry(
+ DN.decode("cn=Bit String,cn=Syntaxes,cn=config"));
+ syntax.initializeSyntax(configEntry);
+
+ ByteString byteStringValue = new ASN1OctetString(value);
+
+ StringBuilder reason = new StringBuilder();
+ Boolean liveResult =
+ syntax.valueIsAcceptable(byteStringValue, reason);
+
+ if (liveResult != result)
+ fail(syntax + ".valueIsAcceptable gave bad result for " + value +
+ "reason : " + reason);
+ if (result == true)
+ {
+ byte[] decodedValue =
+ BitStringSyntax.decodeBitStringValue(byteStringValue);
+
+ ByteString newValue =
+ BitStringSyntax.createBitStringValue(decodedValue).getNormalizedValue();
+
+ EqualityMatchingRule matchingRule = syntax.getEqualityMatchingRule();
+ /* disabled because it currently fails
+ * see issue
+ *
+ * assertTrue(matchingRule.areEqual(byteStringValue, newValue));
+ */
+ }
+
+ // call the getters
+ syntax.getApproximateMatchingRule();
+ syntax.getDescription();
+
+ syntax.getOID();
+ syntax.getOrderingMatchingRule();
+ syntax.getSubstringMatchingRule();
+ syntax.getSyntaxName();
+ syntax.toString();
+ }
+}
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/DITContentRuleSyntaxTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/DITContentRuleSyntaxTest.java
new file mode 100644
index 0000000..434ce34
--- /dev/null
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/DITContentRuleSyntaxTest.java
@@ -0,0 +1,104 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying * information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2006 Sun Microsystems, Inc.
+ */
+package org.opends.server.schema;
+
+import org.opends.server.api.AttributeSyntax;
+import org.testng.annotations.DataProvider;
+
+/**
+ * Test the DITContentRuleSyntax.
+ */
+public class DITContentRuleSyntaxTest extends AttributeSyntaxTest
+{
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public AttributeSyntax getRule()
+ {
+ return new DITContentRuleSyntax();
+ }
+
+ @Override
+ @DataProvider(name="acceptableValues")
+ public Object[][] createAcceptableValues()
+ {
+ return new Object [][] {
+ {"( 2.5.6.4 DESC 'content rule for organization' NOT "
+ + "( x121Address $ telexNumber ) )", true},
+ {"( 2.5.6.4 NAME 'full rule' DESC 'rule with all possible fields' "
+ + " OBSOLETE"
+ + " AUX ( person )"
+ + " MUST ( cn $ sn )"
+ + " MAY ( dc )"
+ + " NOT ( x121Address $ telexNumber ) )"
+ , true},
+ {"( 2.5.6.4 NAME 'full rule' DESC 'ommit parenthesis' "
+ + " OBSOLETE"
+ + " AUX person "
+ + " MUST cn "
+ + " MAY dc "
+ + " NOT x121Address )"
+ , true},
+ {"( 2.5.6.4 NAME 'full rule' DESC 'use numeric OIDs' "
+ + " OBSOLETE"
+ + " AUX 2.5.6.6"
+ + " MUST cn "
+ + " MAY dc "
+ + " NOT x121Address )"
+ , true},
+ {"( 2.5.6.4 NAME 'full rule' DESC 'illegal OIDs' "
+ + " OBSOLETE"
+ + " AUX 2.5.6.."
+ + " MUST cn "
+ + " MAY dc "
+ + " NOT x121Address )"
+ , false},
+ {"( 2.5.6.4 NAME 'full rule' DESC 'illegal OIDs' "
+ + " OBSOLETE"
+ + " AUX 2.5.6.x"
+ + " MUST cn "
+ + " MAY dc "
+ + " NOT x121Address )"
+ , false},
+ {"( 2.5.6.4 NAME 'full rule' DESC 'missing closing parenthesis' "
+ + " OBSOLETE"
+ + " AUX person "
+ + " MUST cn "
+ + " MAY dc "
+ + " NOT x121Address"
+ , false},
+ {"( 2.5.6.4 NAME 'full rule' DESC 'extra parameterss' "
+ + " MUST cn "
+ + "( this is an extra parameter )"
+ , true},
+
+ };
+ }
+
+}
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/GeneralizedTimeSyntaxTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/GeneralizedTimeSyntaxTest.java
new file mode 100644
index 0000000..fb88ade
--- /dev/null
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/GeneralizedTimeSyntaxTest.java
@@ -0,0 +1,83 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying * information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2006 Sun Microsystems, Inc.
+ */
+package org.opends.server.schema;
+
+import org.opends.server.api.AttributeSyntax;
+import org.testng.annotations.DataProvider;
+
+/**
+ * Test the GeneralizedTimeSyntax.
+ */
+public class GeneralizedTimeSyntaxTest extends AttributeSyntaxTest
+{
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public AttributeSyntax getRule()
+ {
+ return new GeneralizedTimeSyntax();
+ }
+
+ @Override
+ @DataProvider(name="acceptableValues")
+ public Object[][] createAcceptableValues()
+ {
+ return new Object [][] {
+ {"2006090613Z", true},
+ {"20060906135030+01", true},
+ {"200609061350Z", true},
+ {"20060906135030Z", true},
+ {"20061116135030Z", true},
+ {"20061126135030Z", true},
+ {"20061231235959Z", true},
+ {"20060906135030+0101", true},
+ {"20060906135030+2359", true},
+ {"20060906135030+3359", false},
+ {"20060906135030+2389", false},
+ {"20060906135030+2361", false},
+ {"20060906135030+", false},
+ {"20060906135030+0", false},
+ {"20060906135030+010", false},
+ {"20061200235959Z", false},
+ {"2006121a235959Z", false},
+ {"2006122a235959Z", false},
+ {"20060031235959Z", false},
+ {"20061331235959Z", false},
+ {"20062231235959Z", false},
+ {"20061232235959Z", false},
+ {"2006123123595aZ", false},
+ {"200a1231235959Z", false},
+ {"2006j231235959Z", false},
+ {"200612-1235959Z", false},
+ {"20061231#35959Z", false},
+ {"2006", false},
+ };
+ }
+
+}
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/GuideSyntaxTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/GuideSyntaxTest.java
new file mode 100644
index 0000000..56cc684
--- /dev/null
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/GuideSyntaxTest.java
@@ -0,0 +1,76 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying * information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2006 Sun Microsystems, Inc.
+ */
+package org.opends.server.schema;
+
+import org.opends.server.api.AttributeSyntax;
+import org.testng.annotations.DataProvider;
+
+/**
+ * Test the GuideSyntax.
+ */
+public class GuideSyntaxTest extends AttributeSyntaxTest
+{
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public AttributeSyntax getRule()
+ {
+ return new GuideSyntax();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ @DataProvider(name="acceptableValues")
+ public Object[][] createAcceptableValues()
+ {
+ return new Object [][] {
+ {"sn$EQ|!(sn$EQ)", true},
+ {"!(sn$EQ)", true},
+ {"person#sn$EQ", true},
+ {"(sn$EQ)", true},
+ {"sn$EQ", true},
+ {"sn$SUBSTR", true},
+ {"sn$GE", true},
+ {"sn$LE", true},
+ {"sn$ME", false},
+ {"?true", true},
+ {"?false", true},
+ {"true|sn$GE", false},
+ {"sn$APPROX", true},
+ {"sn$EQ|(sn$EQ)", true},
+ {"sn$EQ|(sn$EQ", false},
+ {"sn$EQ|(sn$EQ)|sn$EQ", true},
+ {"sn$EQ|(cn$APPROX&?false)", true},
+ {"sn$EQ|(cn$APPROX&|?false)", false},
+ };
+ }
+
+}
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/IA5StringSyntaxTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/IA5StringSyntaxTest.java
new file mode 100644
index 0000000..a2fec65
--- /dev/null
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/IA5StringSyntaxTest.java
@@ -0,0 +1,60 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying * information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2006 Sun Microsystems, Inc.
+ */
+package org.opends.server.schema;
+
+import org.opends.server.api.AttributeSyntax;
+import org.testng.annotations.DataProvider;
+
+/**
+ * Test the IA5StringSyntax.
+ */
+public class IA5StringSyntaxTest extends AttributeSyntaxTest
+{
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public AttributeSyntax getRule()
+ {
+ return new IA5StringSyntax();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ @DataProvider(name="acceptableValues")
+ public Object[][] createAcceptableValues()
+ {
+ return new Object [][] {
+ {"12345678", true},
+ {"12345678\u2163", false},
+ };
+ }
+
+}
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/LDAPSyntaxTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/LDAPSyntaxTest.java
new file mode 100644
index 0000000..418ccf3
--- /dev/null
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/LDAPSyntaxTest.java
@@ -0,0 +1,69 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying * information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2006 Sun Microsystems, Inc.
+ */
+package org.opends.server.schema;
+
+import org.opends.server.api.AttributeSyntax;
+import org.testng.annotations.DataProvider;
+
+/**
+ * Test the LDAPSyntaxDescriptionSyntax.
+ */
+public class LDAPSyntaxTest extends AttributeSyntaxTest
+{
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public AttributeSyntax getRule()
+ {
+ return new LDAPSyntaxDescriptionSyntax();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ @DataProvider(name="acceptableValues")
+ public Object[][] createAcceptableValues()
+ {
+ return new Object [][] {
+ // disabled because test is failing :
+ // {
+ // "( 2.5.4.3 DESC 'full syntax description' "
+ // + "( this is an extension ) )", true},
+ {"( 2.5.4.3 DESC 'full syntax description' )", true},
+ {" ( 2.5.4.3 DESC ' syntax description' )", true},
+ {"( 2.5.4.3 DESC syntax description )", false},
+ {"($%^*&!@ DESC 'syntax description' )", false},
+ {"(temp-oid DESC 'syntax description' )", true},
+ {"2.5.4.3 DESC 'syntax description' )", false},
+ {"(2.5.4.3 DESC 'syntax description' ", false},
+ };
+ }
+
+}
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/MatchingRuleSyntaxTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/MatchingRuleSyntaxTest.java
new file mode 100644
index 0000000..0bab4a2
--- /dev/null
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/MatchingRuleSyntaxTest.java
@@ -0,0 +1,66 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying * information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2006 Sun Microsystems, Inc.
+ */
+package org.opends.server.schema;
+
+import org.opends.server.api.AttributeSyntax;
+import org.testng.annotations.DataProvider;
+
+/**
+ * Test the MatchingRuleSyntax.
+ */
+public class MatchingRuleSyntaxTest extends AttributeSyntaxTest
+{
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public AttributeSyntax getRule()
+ {
+ return new MatchingRuleSyntax();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ @DataProvider(name="acceptableValues")
+ public Object[][] createAcceptableValues()
+ {
+ return new Object [][] {
+ {"( 1.2.3.4 NAME 'full matching rule' "
+ + " DESC 'description of matching rule' OBSOLETE "
+ + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.17 "
+ + " ( this is an extension ) )", true},
+ {"( 1.2.3.4 NAME 'missing closing parenthesis' "
+ + " DESC 'description of matching rule' "
+ + " SYNTAX 1.3.6.1.4.1.1466.115.121.1.17 "
+ + " ( this is an extension ) ", false},
+ };
+ }
+
+}
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/MatchingRuleUseSyntaxTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/MatchingRuleUseSyntaxTest.java
new file mode 100644
index 0000000..e1053a6
--- /dev/null
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/MatchingRuleUseSyntaxTest.java
@@ -0,0 +1,66 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying * information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2006 Sun Microsystems, Inc.
+ */
+package org.opends.server.schema;
+
+import org.opends.server.api.AttributeSyntax;
+import org.testng.annotations.DataProvider;
+
+/**
+ * Test the MatchingRuleUseSyntax.
+ */
+public class MatchingRuleUseSyntaxTest extends AttributeSyntaxTest
+{
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public AttributeSyntax getRule()
+ {
+ return new MatchingRuleUseSyntax();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ @DataProvider(name="acceptableValues")
+ public Object[][] createAcceptableValues()
+ {
+ return new Object [][] {
+ {"( 2.5.13.10 NAME 'full matching rule' "
+ + " DESC 'description of matching rule' OBSOLETE "
+ + " APPLIES 2.5.4.3 "
+ + " ( this is an extension ) )", true},
+ {"( 2.5.13.10 NAME 'missing closing parenthesis' "
+ + " DESC 'description of matching rule' "
+ + " SYNTAX 2.5.4.3 "
+ + " ( this is an extension ) ", false},
+ };
+ }
+
+}
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/OtherMailboxSyntaxTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/OtherMailboxSyntaxTest.java
new file mode 100644
index 0000000..b30d1f0
--- /dev/null
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/OtherMailboxSyntaxTest.java
@@ -0,0 +1,60 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying * information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2006 Sun Microsystems, Inc.
+ */
+package org.opends.server.schema;
+
+import org.opends.server.api.AttributeSyntax;
+import org.testng.annotations.DataProvider;
+
+/**
+ * Test the OtherMailboxSyntax.
+ */
+public class OtherMailboxSyntaxTest extends AttributeSyntaxTest
+{
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public AttributeSyntax getRule()
+ {
+ return new OtherMailboxSyntax();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ @DataProvider(name="acceptableValues")
+ public Object[][] createAcceptableValues()
+ {
+ return new Object [][] {
+ {"MyMail$Mymailbox", true},
+ {"MyMailMymailbox", false},
+ };
+ }
+
+}
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/TelexSyntaxTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/TelexSyntaxTest.java
new file mode 100644
index 0000000..e470520
--- /dev/null
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/TelexSyntaxTest.java
@@ -0,0 +1,71 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying * information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2006 Sun Microsystems, Inc.
+ */
+package org.opends.server.schema;
+
+import org.opends.server.api.AttributeSyntax;
+import org.testng.annotations.DataProvider;
+
+/**
+ * Test the TelexNumberSyntax.
+ */
+public class TelexSyntaxTest extends AttributeSyntaxTest
+{
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public AttributeSyntax getRule()
+ {
+ return new TelexNumberSyntax();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ @DataProvider(name="acceptableValues")
+ public Object[][] createAcceptableValues()
+ {
+ return new Object [][] {
+ {"123$france$456", true},
+ {"abcdefghijk$lmnopqr$stuvwxyz", true},
+ {"12345$67890$()+,-./:? ", true},
+ /*
+ * disabled because of issue : 701
+ * should accept "
+ {"12345$67890$\"\"\"", true},
+ */
+ /* disabled because of issue : 701
+ * should not accept backslash and equal sign
+ {"12345$67890$\'\'", false},
+ {"12345$67890$===", false},*/
+
+ };
+ }
+
+}
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/UTCTimeSyntaxTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/UTCTimeSyntaxTest.java
new file mode 100644
index 0000000..e8aafe3
--- /dev/null
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/UTCTimeSyntaxTest.java
@@ -0,0 +1,79 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying * information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2006 Sun Microsystems, Inc.
+ */
+package org.opends.server.schema;
+
+import org.opends.server.api.AttributeSyntax;
+import org.testng.annotations.DataProvider;
+
+/**
+ * Test the UTCTimeSyntax.
+ */
+public class UTCTimeSyntaxTest extends AttributeSyntaxTest
+{
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public AttributeSyntax getRule()
+ {
+ return new UTCTimeSyntax();
+ }
+
+ @Override
+ @DataProvider(name="acceptableValues")
+ public Object[][] createAcceptableValues()
+ {
+ return new Object [][] {
+ // tests for the UTC time syntax. This time syntax only uses 2 digits
+ // for the year but it is currently implemented using 4 digits
+ // disable the tests for now.
+ // see issue 637
+ /*
+ {"060906135030+01", true},
+ {"0609061350Z", true},
+ {"060906135030Z", true},
+ {"061116135030Z", true},
+ {"061126135030Z", true},
+ {"061231235959Z", true},
+ {"060906135030+0101", true},
+ {"060906135030+2359", true},
+ */
+ {"060906135030+3359", false},
+ {"060906135030+2389", false},
+ {"062231235959Z", false},
+ {"061232235959Z", false},
+ {"06123123595aZ", false},
+ {"0a1231235959Z", false},
+ {"06j231235959Z", false},
+ {"0612-1235959Z", false},
+ {"061231#35959Z", false},
+ {"2006", false},
+ };
+ }
+
+}
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/UUIDSyntaxTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/UUIDSyntaxTest.java
new file mode 100644
index 0000000..9147e17
--- /dev/null
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/UUIDSyntaxTest.java
@@ -0,0 +1,70 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License"). You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying * information:
+ * Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ * Portions Copyright 2006 Sun Microsystems, Inc.
+ */
+package org.opends.server.schema;
+
+import org.opends.server.api.AttributeSyntax;
+import org.testng.annotations.DataProvider;
+
+/**
+ * Test the UUIDSyntax.
+ */
+public class UUIDSyntaxTest extends AttributeSyntaxTest
+{
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public AttributeSyntax getRule()
+ {
+ return new UUIDSyntax();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ @DataProvider(name="acceptableValues")
+ public Object[][] createAcceptableValues()
+ {
+ return new Object [][] {
+ {"12345678-9ABC-DEF0-1234-1234567890ab", true},
+ {"12345678-9abc-def0-1234-1234567890ab", true},
+ {"12345678-9abc-def0-1234-1234567890ab", true},
+ {"12345678-9abc-def0-1234-1234567890ab", true},
+ {"02345678-9abc-def0-1234-1234567890ab", true},
+ {"12345678-9abc-def0-1234-1234567890ab", true},
+ {"12345678-9abc-def0-1234-1234567890ab", true},
+ {"02345678-9abc-def0-1234-1234567890ab", true},
+ {"G2345678-9abc-def0-1234-1234567890ab", false},
+ {"g2345678-9abc-def0-1234-1234567890ab", false},
+ {"12345678/9abc/def0/1234/1234567890ab", false},
+ {"12345678-9abc-def0-1234-1234567890a", false},
+ };
+ }
+
+}
--
Gitblit v1.10.0