directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r506134 - in /directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax: ./ parser/
Date Sun, 11 Feb 2007 21:03:25 GMT
Author: seelmann
Date: Sun Feb 11 13:03:24 2007
New Revision: 506134

URL: http://svn.apache.org/viewvc?view=rev&rev=506134
Log:
Moved schema parser tests down into parser directory. Merged Alex' tests. Renamed class names.

Added:
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/AttributeTypeDescriptionSchemaParserTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/ComparatorDescriptionSchemaParserTest.java
      - copied, changed from r506124, directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserComparatorDescriptionTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/DITContentRuleDescriptionSchemaParserTest.java
      - copied, changed from r506124, directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserDITContentRuleDescriptionTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/DITStructureRuleDescriptionSchemaParserTest.java
      - copied, changed from r506124, directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserDITStructureRuleDescriptionTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/LdapSyntaxDescriptionSchemaParserTest.java
      - copied, changed from r506124, directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserLdapSyntaxDescriptionTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/MatchingRuleDescriptionSchemaParserTest.java
      - copied, changed from r506124, directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserMatchingRuleDescriptionTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/MatchingRuleUseDescriptionSchemaParserTest.java
      - copied, changed from r506124, directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserMatchingRuleUseDescriptionTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/NameFormDescriptionSchemaParserTest.java
      - copied, changed from r506124, directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserNameFormDescriptionTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/NormalizerDescriptionSchemaParserTest.java
      - copied, changed from r506124, directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserNormalizerDescriptionTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/ObjectClassDescriptionSchemaParserTest.java
      - copied, changed from r506124, directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserObjectClassDescriptionTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/SchemaParserTestUtils.java
      - copied, changed from r506124, directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserTestUtils.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/SyntaxCheckerDescriptionSchemaParserTest.java
Removed:
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserAttributeTypeDescriptionTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserComparatorDescriptionTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserDITContentRuleDescriptionTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserDITStructureRuleDescriptionTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserLdapSyntaxDescriptionTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserMatchingRuleDescriptionTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserMatchingRuleUseDescriptionTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserNameFormDescriptionTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserNormalizerDescriptionTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserObjectClassDescriptionTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserSyntaxCheckerDescriptionTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserTestUtils.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/SyntaxDescriptionSchemaParserTest.java

Added: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/AttributeTypeDescriptionSchemaParserTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/AttributeTypeDescriptionSchemaParserTest.java?view=auto&rev=506134
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/AttributeTypeDescriptionSchemaParserTest.java (added)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/AttributeTypeDescriptionSchemaParserTest.java Sun Feb 11 13:03:24 2007
@@ -0,0 +1,913 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.schema.syntax.parser;
+
+
+import java.text.ParseException;
+
+import junit.framework.TestCase;
+
+import org.apache.directory.shared.ldap.schema.UsageEnum;
+import org.apache.directory.shared.ldap.schema.syntax.AttributeTypeDescription;
+
+
+/**
+ * Tests the AttributeTypeDescriptionSchemaParser class.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class AttributeTypeDescriptionSchemaParserTest extends TestCase
+{
+    /** the parser instance */
+    private AttributeTypeDescriptionSchemaParser parser;
+
+
+    protected void setUp() throws Exception
+    {
+        parser = new AttributeTypeDescriptionSchemaParser();
+    }
+
+
+    protected void tearDown() throws Exception
+    {
+        parser = null;
+    }
+
+
+    /**
+     * Test numericoid
+     * 
+     * @throws ParseException
+     */
+    public void testNumericOid() throws ParseException
+    {
+        SchemaParserTestUtils.testNumericOid( parser, "SYNTAX 1.1" );
+    }
+
+
+    /**
+     * Tests NAME and its values
+     * 
+     * @throws ParseException
+     */
+    public void testNames() throws ParseException
+    {
+        SchemaParserTestUtils.testNames( parser, "1.1", "SYNTAX 1.1" );
+    }
+
+
+    /**
+     * Tests DESC
+     * 
+     * @throws ParseException
+     */
+    public void testDescription() throws ParseException
+    {
+        SchemaParserTestUtils.testDescription( parser, "1.1", "SYNTAX 1.1" );
+    }
+
+
+    /**
+     * Tests OBSOLETE
+     * 
+     * @throws ParseException
+     */
+    public void testObsolete() throws ParseException
+    {
+        SchemaParserTestUtils.testObsolete( parser, "1.1", "SYNTAX 1.1" );
+    }
+
+
+    /**
+     * Test SUP and its value.
+     * 
+     * @throws ParseException
+     */
+    public void testSuperType() throws ParseException
+    {
+        String value = null;
+        AttributeTypeDescription atd = null;
+
+        // no SUP
+        value = "( 1.1 SYNTAX 1.1 )";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertNull( atd.getSuperType() );
+
+        // SUP numericoid
+        value = "( 1.1 SYNTAX 1.1 SUP 1.2.3.4.5.6.7.8.9.0 )";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertEquals( "1.2.3.4.5.6.7.8.9.0", atd.getSuperType() );
+
+        // SUP descr
+        value = "( 1.1 SYNTAX 1.1 SUP abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789 )";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", atd.getSuperType() );
+
+        // no quote allowed
+        value = "( 1.1 SYNTAX 1.1 SUP 'name' )";
+        try
+        {
+            atd = parser.parseAttributeTypeDescription( value );
+            fail( "Exception expected, invalid SUP 'name' (quoted)" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+
+        // no quote allowed
+        value = "( 1.1 SYNTAX 1.1 SUP '1.2.3.4' )";
+        try
+        {
+            atd = parser.parseAttributeTypeDescription( value );
+            fail( "Exception expected, invalid SUP '1.2.3.4' (quoted)" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+
+        // invalid character
+        value = "( 1.1 SYNTAX 1.1 SUP 1.2.3.4.A )";
+        try
+        {
+            atd = parser.parseAttributeTypeDescription( value );
+            fail( "Exception expected, invalid SUP '1.2.3.4.A' (invalid character)" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+
+        // only single SUP allowed
+        value = "( 1.1 SYNTAX 1.1 SUP ( name1 $ name2 ) )";
+        try
+        {
+            atd = parser.parseAttributeTypeDescription( value );
+            fail( "Exception expected, only single SUP allowed" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+
+        // empty sup
+        value = "( 1.1 SYNTAX 1.1 SUP )";
+        try
+        {
+            atd = parser.parseAttributeTypeDescription( value );
+            fail( "Exception expected, no SUP value" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+    }
+
+
+    /**
+     * Tests EQUALITY and its values.
+     * Very similar to SUP, so here are less test cases. 
+     * 
+     * @throws ParseException
+     */
+    public void testEquality() throws ParseException
+    {
+        String value = null;
+        AttributeTypeDescription atd = null;
+
+        // no EQUALITY
+        value = "( 1.1 SYNTAX 1.1 )";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertNull( atd.getEqualityMatchingRule() );
+
+        // EQUALITY numericoid
+        value = "( 1.1 SYNTAX 1.1 EQUALITY 1.2.3.4567.8.9.0 )";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertEquals( "1.2.3.4567.8.9.0", atd.getEqualityMatchingRule() );
+
+        // EQUALITY descr
+        value = "( 1.1 SYNTAX 1.1 EQUALITY abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789 )";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", atd.getEqualityMatchingRule() );
+
+        // no quote allowed
+        value = "( 1.1 SYNTAX 1.1 EQUALITY 'caseExcactMatch' )";
+        try
+        {
+            atd = parser.parseAttributeTypeDescription( value );
+            fail( "Exception expected, invalid EQUALITY 'caseExcactMatch' (quoted)" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+    }
+
+
+    /**
+     * Tests ORDERING and its values.
+     * Very similar to SUP, so here are less test cases. 
+     * 
+     * @throws ParseException
+     */
+    public void testOrdering() throws ParseException
+    {
+        String value = null;
+        AttributeTypeDescription atd = null;
+
+        // no EQUALITY
+        value = "( 1.1 SYNTAX 1.1 )";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertNull( atd.getOrderingMatchingRule() );
+
+        // EQUALITY numericoid
+        value = "( 1.1 SYNTAX 1.1 ORDERING 1.2.3.4567.8.9.0 )";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertEquals( "1.2.3.4567.8.9.0", atd.getOrderingMatchingRule() );
+
+        // EQUALITY descr
+        value = "( 1.1 SYNTAX 1.1 ORDERING abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789 )";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", atd.getOrderingMatchingRule() );
+
+        // no quote allowed
+        value = "( 1.1 SYNTAX 1.1 ORDERING 'generalizedTimeOrderingMatch' )";
+        try
+        {
+            atd = parser.parseAttributeTypeDescription( value );
+            fail( "Exception expected, invalid ORDERING 'generalizedTimeOrderingMatch' (quoted)" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+    }
+
+
+    /**
+     * Tests SUBSTRING and its values.
+     * Very similar to SUP, so here are less test cases. 
+     * 
+     * @throws ParseException
+     */
+    public void testSubstring() throws ParseException
+    {
+        String value = null;
+        AttributeTypeDescription atd = null;
+
+        // no EQUALITY
+        value = "( 1.1 SYNTAX 1.1 )";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertNull( atd.getSubstringsMatchingRule() );
+
+        // EQUALITY numericoid
+        value = "( 1.1 SYNTAX 1.1 SUBSTR 1.2.3.4567.8.9.0 )";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertEquals( "1.2.3.4567.8.9.0", atd.getSubstringsMatchingRule() );
+
+        // EQUALITY descr
+        value = "( 1.1 SYNTAX 1.1 SUBSTR abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789 )";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", atd
+            .getSubstringsMatchingRule() );
+
+        // no quote allowed
+        value = "( 1.1 SYNTAX 1.1 SUBSTR 'caseIgnoreSubstringsMatch' )";
+        try
+        {
+            atd = parser.parseAttributeTypeDescription( value );
+            fail( "Exception expected, invalid SUBSTR 'caseIgnoreSubstringsMatch' (quoted)" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+    }
+
+
+    /**
+     * Tests SYNTAX
+     * 
+     * @throws ParseException
+     */
+    public void testSyntax() throws ParseException
+    {
+        String value = null;
+        AttributeTypeDescription atd = null;
+
+        // no SYNTAX
+        value = "( 1.1 SUP 1.1 )";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertNull( atd.getSyntax() );
+        assertEquals( 0, atd.getSyntaxLength() );
+
+        // SYNTAX numericoid
+        value = "( 1.1 SYNTAX 1.2.3.4567.8.9.0 )";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertEquals( "1.2.3.4567.8.9.0", atd.getSyntax() );
+        assertEquals( 0, atd.getSyntaxLength() );
+
+        // SYNTAX numericoid and length
+        value = "( 1.1 SYNTAX 1.2.3.4567.8.9.0{1234567890} )";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertEquals( "1.2.3.4567.8.9.0", atd.getSyntax() );
+        assertEquals( 1234567890, atd.getSyntaxLength() );
+
+        // SYNTAX numericoid and zero length
+        value = "( 1.1 SYNTAX 1.2.3{0} )";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertEquals( "1.2.3", atd.getSyntax() );
+        assertEquals( 0, atd.getSyntaxLength() );
+
+        // no quote allowed
+        value = "( 1.1 SYNTAX '1.2.3{32}' )";
+        try
+        {
+            atd = parser.parseAttributeTypeDescription( value );
+            fail( "Exception expected, invalid SYNTAX '1.2.3{32}' (quoted)" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+
+        // empty syntax
+        value = "( 1.1 SYNTAX 1.2.3.4{} )";
+        try
+        {
+            atd = parser.parseAttributeTypeDescription( value );
+            fail( "Exception expected, invalid SYNTAX 1.2.3.4{} (empty length)" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+
+        // leading zero in length
+        value = "( 1.1 SYNTAX 1.2.3.4{01} )";
+        try
+        {
+            atd = parser.parseAttributeTypeDescription( value );
+            fail( "Exception expected, invalid SYNTAX 1.2.3.4{01} (leading zero in length)" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+
+        // invalid syntax
+        value = "( 1.1 SYNTAX 1.2.3.4{X} )";
+        try
+        {
+            atd = parser.parseAttributeTypeDescription( value );
+            fail( "Exception expected, invalid SYNTAX 1.2.3.4{X} (invalid length)" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+
+        // no syntax
+        value = "( 1.1 SYNTAX {32} )";
+        try
+        {
+            atd = parser.parseAttributeTypeDescription( value );
+            fail( "Exception expected, invalid SYNTAX {32} (no syntax)" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+
+        // length overflow
+        value = "( 1.1 SYNTAX 1.2.3.4{123456789012} )";
+        try
+        {
+            atd = parser.parseAttributeTypeDescription( value );
+            fail( "Exception expected, invalid SYNTAX 1.2.3.4{123456789012} (length overflow)" );
+        }
+        catch ( NumberFormatException nfe )
+        {
+            // expected
+        }
+
+    }
+
+
+    /**
+     * Tests SINGLE-VALUE
+     * 
+     * @throws ParseException
+     */
+    public void testSingleValue() throws ParseException
+    {
+        String value = null;
+        AttributeTypeDescription atd = null;
+
+        // not single-value
+        value = "( 1.1 SYNTAX 1.1 NAME 'test' DESC 'Descripton' )";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertFalse( atd.isSingleValued() );
+
+        // single-value
+        value = "(1.1 SYNTAX 1.1 NAME 'test' DESC 'Descripton' SINGLE-VALUE)";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertTrue( atd.isSingleValued() );
+
+        // single-value 
+        value = "(1.1 SYNTAX 1.1 SINGLE-VALUE)";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertTrue( atd.isSingleValued() );
+
+        // ivalid
+        value = "(1.1 SYNTAX 1.1 NAME 'test' DESC 'Descripton' SINGLE-VALU )";
+        try
+        {
+            atd = parser.parseAttributeTypeDescription( value );
+            fail( "Exception expected, invalid SINGLE-VALUE value" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+    }
+
+
+    /**
+     * Tests COLLECTIVE
+     * 
+     * @throws ParseException
+     */
+    public void testCollective() throws ParseException
+    {
+        String value = null;
+        AttributeTypeDescription atd = null;
+
+        // not collective
+        value = "( 1.1 SYNTAX 1.1 NAME 'test' DESC 'Descripton' )";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertFalse( atd.isCollective() );
+
+        // single-value
+        value = "(1.1 SYNTAX 1.1 NAME 'test' DESC 'Descripton' COLLECTIVE )";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertTrue( atd.isCollective() );
+
+        // single-value 
+        value = "(1.1 SYNTAX 1.1 COLLECTIVE)";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertTrue( atd.isCollective() );
+
+        // ivalid
+        value = "(1.1 SYNTAX 1.1 NAME 'test' DESC 'Descripton' COLLECTIV )";
+        try
+        {
+            atd = parser.parseAttributeTypeDescription( value );
+            fail( "Exception expected, invalid COLLECTIVE value" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+    }
+
+
+    /**
+     * Tests NO-USER-MODIFICATION
+     * 
+     * @throws ParseException
+     */
+    public void testNoUserModification() throws ParseException
+    {
+        String value = null;
+        AttributeTypeDescription atd = null;
+
+        // not NO-USER-MODIFICATION
+        value = "( 1.1 SYNTAX 1.1 NAME 'test' DESC 'Descripton' )";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertTrue( atd.isUserModifiable() );
+
+        // NO-USER-MODIFICATION
+        value = "(1.1 SYNTAX 1.1 NAME 'test' DESC 'Descripton' NO-USER-MODIFICATION USAGE directoryOperation )";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertFalse( atd.isUserModifiable() );
+
+        // NO-USER-MODIFICATION 
+        value = "(1.1 SYNTAX 1.1 NO-USER-MODIFICATION USAGE directoryOperation )";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertFalse( atd.isUserModifiable() );
+
+        // ivalid
+        value = "(1.1 SYNTAX 1.1 NAME 'test' DESC 'Descripton' NO-USER-MODIFICATIO USAGE directoryOperation )";
+        try
+        {
+            atd = parser.parseAttributeTypeDescription( value );
+            fail( "Exception expected, invalid NO-USER-MODIFICATION value" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+    }
+
+
+    /**
+     * Tests usage 
+     * 
+     * @throws ParseException
+     */
+    public void testUsage() throws ParseException
+    {
+        String value = null;
+        AttributeTypeDescription atd = null;
+
+        // DEFAULT is userApplications
+        value = "( 1.1 SYNTAX 1.1 )";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertEquals( UsageEnum.USER_APPLICATIONS, atd.getUsage() );
+
+        // userApplications
+        value = "( 1.1 SYNTAX 1.1 USAGE userApplications )";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertEquals( UsageEnum.USER_APPLICATIONS, atd.getUsage() );
+
+        // directoryOperation
+        value = "( 1.1 SYNTAX 1.1 USAGE directoryOperation )";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertEquals( UsageEnum.DIRECTORY_OPERATION, atd.getUsage() );
+
+        // AUXILIARY
+        value = "( 1.1 SYNTAX 1.1 USAGE distributedOperation )";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertEquals( UsageEnum.DISTRIBUTED_OPERATION, atd.getUsage() );
+
+        // STRUCTURAL
+        value = "( 1.1 SYNTAX 1.1 USAGE dSAOperation )";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertEquals( UsageEnum.DSA_OPERATION, atd.getUsage() );
+
+        // TODO: case insensitive?
+
+        // ivalid
+        value = "( 1.1 SYNTAX 1.1 USAGE abc )";
+        try
+        {
+            atd = parser.parseAttributeTypeDescription( value );
+            fail( "Exception expected, invalid USAGE value" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+    }
+
+
+    /**
+     * Test extensions.
+     * 
+     * @throws ParseException
+     */
+    public void testExtensions() throws ParseException
+    {
+        SchemaParserTestUtils.testExtensions( parser, "1.1", "SYNTAX 1.1" );
+    }
+
+
+    /**
+     * Test full attribute type description.
+     * 
+     * @throws ParseException
+     */
+    public void testFull() throws ParseException
+    {
+        String value = null;
+        AttributeTypeDescription atd = null;
+
+        value = "( 1.2.3.4.5.6.7.8.9.0 NAME ( 'abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789' 'test' ) DESC 'Descripton \u00E4\u00F6\u00FC\u00DF \u90E8\u9577' OBSOLETE SUP abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789 EQUALITY 2.3.4.5.6.7.8.9.0.1 ORDERING 3.4.5.6.7.8.9.0.1.2 SUBSTR 4.5.6.7.8.9.0.1.2.3 SYNTAX 5.6.7.8.9.0.1.2.3.4{1234567890} SINGLE-VALUE NO-USER-MODIFICATION USAGE dSAOperation X-TEST-a ('test1-1' 'test1-2') X-TEST-b ('test2-1' 'test2-2') )";
+        atd = parser.parseAttributeTypeDescription( value );
+
+        assertEquals( "1.2.3.4.5.6.7.8.9.0", atd.getNumericOid() );
+        assertEquals( 2, atd.getNames().size() );
+        assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", atd.getNames().get( 0 ) );
+        assertEquals( "test", atd.getNames().get( 1 ) );
+        assertEquals( "Descripton \u00E4\u00F6\u00FC\u00DF \u90E8\u9577", atd.getDescription() );
+        assertTrue( atd.isObsolete() );
+        assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", atd.getSuperType() );
+        assertEquals( "2.3.4.5.6.7.8.9.0.1", atd.getEqualityMatchingRule() );
+        assertEquals( "3.4.5.6.7.8.9.0.1.2", atd.getOrderingMatchingRule() );
+        assertEquals( "4.5.6.7.8.9.0.1.2.3", atd.getSubstringsMatchingRule() );
+        assertEquals( "5.6.7.8.9.0.1.2.3.4", atd.getSyntax() );
+        assertEquals( 1234567890, atd.getSyntaxLength() );
+
+        assertTrue( atd.isSingleValued() );
+        assertFalse( atd.isCollective() );
+        assertFalse( atd.isUserModifiable() );
+        assertEquals( UsageEnum.DSA_OPERATION, atd.getUsage() );
+
+        assertEquals( 2, atd.getExtensions().size() );
+        assertNotNull( atd.getExtensions().get( "X-TEST-a" ) );
+        assertEquals( 2, atd.getExtensions().get( "X-TEST-a" ).size() );
+        assertEquals( "test1-1", atd.getExtensions().get( "X-TEST-a" ).get( 0 ) );
+        assertEquals( "test1-2", atd.getExtensions().get( "X-TEST-a" ).get( 1 ) );
+        assertNotNull( atd.getExtensions().get( "X-TEST-b" ) );
+        assertEquals( 2, atd.getExtensions().get( "X-TEST-b" ).size() );
+        assertEquals( "test2-1", atd.getExtensions().get( "X-TEST-b" ).get( 0 ) );
+        assertEquals( "test2-2", atd.getExtensions().get( "X-TEST-b" ).get( 1 ) );
+    }
+
+    
+    /**
+     * Test unique elements.
+     * 
+     * @throws ParseException
+     */
+    public void testUniqueElements()
+    {
+        String[] testValues = new String[]
+            { 
+                "( 1.1 SYNTAX 1.1 NAME 'test1' NAME 'test2' )", 
+                "( 1.1 SYNTAX 1.1 DESC 'test1' DESC 'test2' )",
+                "( 1.1 SYNTAX 1.1 OBSOLETE OBSOLETE )", 
+                "( 1.1 SYNTAX 1.1 SUP test1 SUP test2 )",
+                "( 1.1 SYNTAX 1.1 EQUALITY test1 EQUALITY test2 )",
+                "( 1.1 SYNTAX 1.1 ORDERING test1 ORDERING test2 )",
+                "( 1.1 SYNTAX 1.1 SUBSTR test1 SUBSTR test2 )",
+                "( 1.1 SYNTAX 1.1 SYNTAX 2.2 SYNTAX 3.3 )",
+                "( 1.1 SYNTAX 1.1 SINGLE-VALUE SINGLE-VALUE )",
+                "( 1.1 SYNTAX 1.1 COLLECTIVE COLLECTIVE )", 
+                "( 1.1 SYNTAX 1.1 USAGE directoryOperation NO-USER-MODIFICATION NO-USER-MODIFICATION )", 
+                "( 1.1 SYNTAX 1.1 USAGE directoryOperation USAGE userApplications )", 
+                "( 1.1 SYNTAX 1.1 X-TEST 'test1' X-TEST 'test2' )" 
+            };
+        SchemaParserTestUtils.testUnique( parser, testValues );
+    }
+    
+    
+    /**
+     * Test required elements.
+     * 
+     * @throws ParseException
+     */
+    public void testRequiredElements() throws ParseException
+    {
+        String value = null;
+        AttributeTypeDescription atd = null;
+
+        value = "( 1.2.3.4.5.6.7.8.9.0 SYNTAX 1.1 SUP 1.1 )";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertNotNull( atd.getSyntax() );
+        assertNotNull( atd.getSuperType() );
+        
+        value = "( 1.2.3.4.5.6.7.8.9.0 SYNTAX 1.1 )";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertNotNull( atd.getSyntax() );
+        assertNull( atd.getSuperType() );
+        
+        value = "( 1.2.3.4.5.6.7.8.9.0 SUP 1.1 )";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertNull( atd.getSyntax() );
+        assertNotNull( atd.getSuperType() );
+
+        value = "( 1.2.3.4.5.6.7.8.9.0 )";
+        try
+        {
+            parser.parseAttributeTypeDescription( value );
+            fail( "Exception expected, SYNTAX or SUP is required" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+
+    }
+    
+    /**
+     * Test collective constraint:
+     * COLLECTIVE requires USAGE userApplications
+     * 
+     * @throws ParseException
+     */
+    public void testCollecitveConstraint() throws ParseException
+    {
+        String value = null;
+        AttributeTypeDescription atd = null;
+
+        value = "( 1.1 SYNTAX 1.1 COLLECTIVE )";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertTrue( atd.isCollective() );
+        assertEquals( UsageEnum.USER_APPLICATIONS , atd.getUsage() );
+        
+        value = "( 1.1 SYNTAX 1.1 COLLECTIVE USAGE userApplications )";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertTrue( atd.isCollective() );
+        assertEquals( UsageEnum.USER_APPLICATIONS , atd.getUsage() );
+        
+        value = "( 1.1 SYNTAX 1.1 COLLECTIVE USAGE directoryOperation )";
+        try
+        {
+            parser.parseAttributeTypeDescription( value );
+            fail( "Exception expected, COLLECTIVE requires USAGE userApplications" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+        
+        value = "( 1.1 SYNTAX 1.1 COLLECTIVE USAGE dSAOperation )";
+        try
+        {
+            parser.parseAttributeTypeDescription( value );
+            fail( "Exception expected, COLLECTIVE requires USAGE userApplications" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+        
+        value = "( 1.1 SYNTAX 1.1 COLLECTIVE USAGE distributedOperation )";
+        try
+        {
+            parser.parseAttributeTypeDescription( value );
+            fail( "Exception expected, COLLECTIVE requires USAGE userApplications" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+        
+    }
+    
+    
+    /**
+     * Test no-user-modification constraint:
+     * NO-USER-MODIFICATION requires an operational USAGE
+     * 
+     * @throws ParseException
+     */
+    public void testNoUserModificatonConstraint() throws ParseException
+    {
+        String value = null;
+        AttributeTypeDescription atd = null;
+        
+        value = "( 1.1 SYNTAX 1.1 NO-USER-MODIFICATION USAGE directoryOperation )";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertFalse( atd.isUserModifiable() );
+        assertEquals( UsageEnum.DIRECTORY_OPERATION , atd.getUsage() );
+        
+        value = "( 1.1 SYNTAX 1.1 NO-USER-MODIFICATION USAGE dSAOperation )";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertFalse( atd.isUserModifiable() );
+        assertEquals( UsageEnum.DSA_OPERATION , atd.getUsage() );
+        
+        value = "( 1.1 SYNTAX 1.1 NO-USER-MODIFICATION USAGE distributedOperation )";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertFalse( atd.isUserModifiable() );
+        assertEquals( UsageEnum.DISTRIBUTED_OPERATION , atd.getUsage() );
+        
+        value = "( 1.1 SYNTAX 1.1 NO-USER-MODIFICATION USAGE userApplications )";
+        try
+        {
+            parser.parseAttributeTypeDescription( value );
+            fail( "Exception expected, NO-USER-MODIFICATION requires an operational USAGE" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+        
+        value = "( 1.1 SYNTAX 1.1 NO-USER-MODIFICATION )";
+        try
+        {
+            parser.parseAttributeTypeDescription( value );
+            fail( "Exception expected, NO-USER-MODIFICATION requires an operational USAGE" );
+        }
+        catch ( ParseException pe )
+        {
+            // expected
+        }
+    }
+    
+    
+    /**
+     * Ensure that element order is ignored
+     * 
+     * @throws ParseException
+     */
+    public void testIgnoreElementOrder() throws ParseException
+    {
+        String value = "( 2.5.4.3 SUP name SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 USAGE userApplications DESC 'RFC2256: common name(s) for which the entity is known by'  EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch NAME ( 'cn' 'commonName' )  )";
+        AttributeTypeDescription atd = parser.parseAttributeTypeDescription( value );
+
+        assertEquals( "2.5.4.3", atd.getNumericOid() );
+        assertEquals( 2, atd.getNames().size() );
+        assertEquals( "cn", atd.getNames().get( 0 ) );
+        assertEquals( "commonName", atd.getNames().get( 1 ) );
+        assertEquals( "RFC2256: common name(s) for which the entity is known by", atd.getDescription() );
+        assertEquals( "name", atd.getSuperType() );
+        assertEquals( "caseIgnoreMatch", atd.getEqualityMatchingRule() );
+        assertEquals( "caseIgnoreSubstringsMatch", atd.getSubstringsMatchingRule() );
+        assertEquals( "1.3.6.1.4.1.1466.115.121.1.15", atd.getSyntax() );
+        assertEquals( UsageEnum.USER_APPLICATIONS, atd.getUsage() );
+        assertEquals( 0, atd.getExtensions().size() );
+    }
+
+
+    ////////////////////////////////////////////////////////////////
+    //         Some real-world attribute type definitions         //
+    ////////////////////////////////////////////////////////////////
+
+    public void testRfcUid() throws ParseException
+    {
+        String value = "( 0.9.2342.19200300.100.1.1 NAME ( 'uid' 'userid' ) DESC 'RFC1274: user identifier' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{256} USAGE userApplications )";
+        AttributeTypeDescription atd = parser.parseAttributeTypeDescription( value );
+
+        assertEquals( "0.9.2342.19200300.100.1.1", atd.getNumericOid() );
+        assertEquals( 2, atd.getNames().size() );
+        assertEquals( "uid", atd.getNames().get( 0 ) );
+        assertEquals( "userid", atd.getNames().get( 1 ) );
+        assertEquals( "RFC1274: user identifier", atd.getDescription() );
+        assertNull( atd.getSuperType() );
+
+        assertEquals( "caseIgnoreMatch", atd.getEqualityMatchingRule() );
+        assertEquals( "caseIgnoreSubstringsMatch", atd.getSubstringsMatchingRule() );
+        assertNull( atd.getOrderingMatchingRule() );
+        assertEquals( "1.3.6.1.4.1.1466.115.121.1.15", atd.getSyntax() );
+        assertEquals( 256, atd.getSyntaxLength() );
+        assertEquals( UsageEnum.USER_APPLICATIONS, atd.getUsage() );
+
+        assertFalse( atd.isObsolete() );
+        assertFalse( atd.isCollective() );
+        assertFalse( atd.isSingleValued() );
+        assertTrue( atd.isUserModifiable() );
+
+        assertEquals( 0, atd.getExtensions().size() );
+    }
+
+    /**
+     * Tests the parse of a simple AttributeType
+     */
+    public void testAddAttributeType() throws Exception
+    {
+        String substrate = "( 1.3.6.1.4.1.18060.0.4.0.2.10000 NAME ( 'bogus' 'bogusName' ) " +
+                "DESC 'bogus description' SUP name SINGLE-VALUE )";
+        AttributeTypeDescription desc = parser.parseAttributeTypeDescription( substrate );
+        assertEquals( "1.3.6.1.4.1.18060.0.4.0.2.10000", desc.getNumericOid() );
+        assertEquals( "bogus", desc.getNames().get( 0 ) );
+        assertEquals( "bogusName", desc.getNames().get( 1 ) );
+        assertEquals( "bogus description", desc.getDescription() );
+        assertEquals( "name", desc.getSuperType() );
+        assertEquals( true, desc.isSingleValued() );
+    }
+
+    
+    /**
+     * Tests the parse of a simple AttributeType with the schema extension.
+     */
+    public void testAttributeTypeWithSchemaExtension() throws Exception
+    {
+        String substrate = "( 1.3.6.1.4.1.18060.0.4.0.2.10000 NAME ( 'bogus' 'bogusName' ) " +
+                "DESC 'bogus description' SUP name SINGLE-VALUE X-SCHEMA 'blah' )";
+        AttributeTypeDescription desc = parser.parseAttributeTypeDescription( substrate );
+        assertEquals( "1.3.6.1.4.1.18060.0.4.0.2.10000", desc.getNumericOid() );
+        assertEquals( "bogus", desc.getNames().get( 0 ) );
+        assertEquals( "bogusName", desc.getNames().get( 1 ) );
+        assertEquals( "bogus description", desc.getDescription() );
+        assertEquals( "name", desc.getSuperType() );
+        assertEquals( true, desc.isSingleValued() );
+        assertEquals( "blah", desc.getExtensions().get( "X-SCHEMA" ).get( 0 ) );
+    }    
+    
+
+    /**
+     * Tests the multithreaded use of a single parser.
+     */
+    public void testMultiThreaded() throws Exception
+    {
+        String[] testValues = new String[]
+            {
+                "( 1.1 SYNTAX 1.1 )",
+                "( 2.5.4.41 NAME 'name' DESC 'RFC2256: common supertype of name attributes'  EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{32768} USAGE userApplications )",
+                "( 2.5.4.3 NAME ( 'cn' 'commonName' ) DESC 'RFC2256: common name(s) for which the entity is known by'  SUP name EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 USAGE userApplications )",
+                "( 1.2.3.4.5.6.7.8.9.0 NAME ( 'abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789' 'test' ) DESC 'Descripton \u00E4\u00F6\u00FC\u00DF \u90E8\u9577' OBSOLETE SUP abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789 EQUALITY 2.3.4.5.6.7.8.9.0.1 ORDERING 3.4.5.6.7.8.9.0.1.2 SUBSTR 4.5.6.7.8.9.0.1.2.3 SYNTAX 5.6.7.8.9.0.1.2.3.4{1234567890} SINGLE-VALUE NO-USER-MODIFICATION USAGE dSAOperation X-TEST-a ('test1-1' 'test1-2') X-TEST-b ('test2-1' 'test2-2') )" };
+        SchemaParserTestUtils.testMultiThreaded( parser, testValues );
+    }
+
+}

Copied: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/ComparatorDescriptionSchemaParserTest.java (from r506124, directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserComparatorDescriptionTest.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/ComparatorDescriptionSchemaParserTest.java?view=diff&rev=506134&p1=directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserComparatorDescriptionTest.java&r1=506124&p2=directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/ComparatorDescriptionSchemaParserTest.java&r2=506134
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserComparatorDescriptionTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/ComparatorDescriptionSchemaParserTest.java Sun Feb 11 13:03:24 2007
@@ -17,14 +17,14 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap.schema.syntax;
+package org.apache.directory.shared.ldap.schema.syntax.parser;
 
 
 import java.text.ParseException;
 
 import junit.framework.TestCase;
 
-import org.apache.directory.shared.ldap.schema.syntax.parser.ComparatorDescriptionSchemaParser;
+import org.apache.directory.shared.ldap.schema.syntax.ComparatorDescription;
 
 
 /**
@@ -32,7 +32,7 @@
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class SchemaParserComparatorDescriptionTest extends TestCase
+public class ComparatorDescriptionSchemaParserTest extends TestCase
 {
     /** the parser instance */
     private ComparatorDescriptionSchemaParser parser;

Copied: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/DITContentRuleDescriptionSchemaParserTest.java (from r506124, directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserDITContentRuleDescriptionTest.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/DITContentRuleDescriptionSchemaParserTest.java?view=diff&rev=506134&p1=directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserDITContentRuleDescriptionTest.java&r1=506124&p2=directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/DITContentRuleDescriptionSchemaParserTest.java&r2=506134
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserDITContentRuleDescriptionTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/DITContentRuleDescriptionSchemaParserTest.java Sun Feb 11 13:03:24 2007
@@ -17,14 +17,14 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap.schema.syntax;
+package org.apache.directory.shared.ldap.schema.syntax.parser;
 
 
 import java.text.ParseException;
 
 import junit.framework.TestCase;
 
-import org.apache.directory.shared.ldap.schema.syntax.parser.DITContentRuleDescriptionSchemaParser;
+import org.apache.directory.shared.ldap.schema.syntax.DITContentRuleDescription;
 
 
 /**
@@ -32,7 +32,7 @@
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class SchemaParserDITContentRuleDescriptionTest extends TestCase
+public class DITContentRuleDescriptionSchemaParserTest extends TestCase
 {
     /** the parser instance */
     private DITContentRuleDescriptionSchemaParser parser;

Copied: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/DITStructureRuleDescriptionSchemaParserTest.java (from r506124, directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserDITStructureRuleDescriptionTest.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/DITStructureRuleDescriptionSchemaParserTest.java?view=diff&rev=506134&p1=directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserDITStructureRuleDescriptionTest.java&r1=506124&p2=directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/DITStructureRuleDescriptionSchemaParserTest.java&r2=506134
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserDITStructureRuleDescriptionTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/DITStructureRuleDescriptionSchemaParserTest.java Sun Feb 11 13:03:24 2007
@@ -17,14 +17,14 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap.schema.syntax;
+package org.apache.directory.shared.ldap.schema.syntax.parser;
 
 
 import java.text.ParseException;
 
 import junit.framework.TestCase;
 
-import org.apache.directory.shared.ldap.schema.syntax.parser.DITStructureRuleDescriptionSchemaParser;
+import org.apache.directory.shared.ldap.schema.syntax.DITStructureRuleDescription;
 
 
 /**
@@ -32,7 +32,7 @@
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class SchemaParserDITStructureRuleDescriptionTest extends TestCase
+public class DITStructureRuleDescriptionSchemaParserTest extends TestCase
 {
     /** the parser instance */
     private DITStructureRuleDescriptionSchemaParser parser;

Copied: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/LdapSyntaxDescriptionSchemaParserTest.java (from r506124, directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserLdapSyntaxDescriptionTest.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/LdapSyntaxDescriptionSchemaParserTest.java?view=diff&rev=506134&p1=directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserLdapSyntaxDescriptionTest.java&r1=506124&p2=directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/LdapSyntaxDescriptionSchemaParserTest.java&r2=506134
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserLdapSyntaxDescriptionTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/LdapSyntaxDescriptionSchemaParserTest.java Sun Feb 11 13:03:24 2007
@@ -17,14 +17,14 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap.schema.syntax;
+package org.apache.directory.shared.ldap.schema.syntax.parser;
 
 
 import java.text.ParseException;
 
 import junit.framework.TestCase;
 
-import org.apache.directory.shared.ldap.schema.syntax.parser.LdapSyntaxDescriptionSchemaParser;
+import org.apache.directory.shared.ldap.schema.syntax.LdapSyntaxDescription;
 
 
 /**
@@ -32,7 +32,7 @@
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class SchemaParserLdapSyntaxDescriptionTest extends TestCase
+public class LdapSyntaxDescriptionSchemaParserTest extends TestCase
 {
     /** the parser instance */
     private LdapSyntaxDescriptionSchemaParser parser;
@@ -144,7 +144,20 @@
         assertEquals( "TRUE", lsd.getExtensions().get( "X-NOT-HUMAN-READABLE" ).get( 0 ) );
     }
 
+    
+    /**
+     * Tests the parse of a simple AttributeType with the schema extension.
+     */
+    public void testSyntaxWithExtensions() throws Exception
+    {
+        String substrate = "( 1.3.6.1.4.1.18060.0.4.0.2.10000 DESC 'bogus description' X-SCHEMA 'blah' X-IS-HUMAN-READABLE 'true' )";
+        LdapSyntaxDescription desc = parser.parseLdapSyntaxDescription( substrate );
+        assertEquals( "1.3.6.1.4.1.18060.0.4.0.2.10000", desc.getNumericOid() );
+        assertEquals( "bogus description", desc.getDescription() );
+        assertNotNull( desc.getExtensions().get( "X-IS-HUMAN-READABLE" ) );
+    }
 
+    
     /**
      * Tests the multithreaded use of a single parser.
      */

Copied: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/MatchingRuleDescriptionSchemaParserTest.java (from r506124, directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserMatchingRuleDescriptionTest.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/MatchingRuleDescriptionSchemaParserTest.java?view=diff&rev=506134&p1=directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserMatchingRuleDescriptionTest.java&r1=506124&p2=directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/MatchingRuleDescriptionSchemaParserTest.java&r2=506134
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserMatchingRuleDescriptionTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/MatchingRuleDescriptionSchemaParserTest.java Sun Feb 11 13:03:24 2007
@@ -17,14 +17,14 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap.schema.syntax;
+package org.apache.directory.shared.ldap.schema.syntax.parser;
 
 
 import java.text.ParseException;
 
 import junit.framework.TestCase;
 
-import org.apache.directory.shared.ldap.schema.syntax.parser.MatchingRuleDescriptionSchemaParser;
+import org.apache.directory.shared.ldap.schema.syntax.MatchingRuleDescription;
 
 
 /**
@@ -32,7 +32,7 @@
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class SchemaParserMatchingRuleDescriptionTest extends TestCase
+public class MatchingRuleDescriptionSchemaParserTest extends TestCase
 {
     /** the parser instance */
     private MatchingRuleDescriptionSchemaParser parser;

Copied: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/MatchingRuleUseDescriptionSchemaParserTest.java (from r506124, directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserMatchingRuleUseDescriptionTest.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/MatchingRuleUseDescriptionSchemaParserTest.java?view=diff&rev=506134&p1=directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserMatchingRuleUseDescriptionTest.java&r1=506124&p2=directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/MatchingRuleUseDescriptionSchemaParserTest.java&r2=506134
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserMatchingRuleUseDescriptionTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/MatchingRuleUseDescriptionSchemaParserTest.java Sun Feb 11 13:03:24 2007
@@ -17,14 +17,14 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap.schema.syntax;
+package org.apache.directory.shared.ldap.schema.syntax.parser;
 
 
 import java.text.ParseException;
 
 import junit.framework.TestCase;
 
-import org.apache.directory.shared.ldap.schema.syntax.parser.MatchingRuleUseDescriptionSchemaParser;
+import org.apache.directory.shared.ldap.schema.syntax.MatchingRuleUseDescription;
 
 
 /**
@@ -32,7 +32,7 @@
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class SchemaParserMatchingRuleUseDescriptionTest extends TestCase
+public class MatchingRuleUseDescriptionSchemaParserTest extends TestCase
 {
     /** the parser instance */
     private MatchingRuleUseDescriptionSchemaParser parser;

Copied: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/NameFormDescriptionSchemaParserTest.java (from r506124, directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserNameFormDescriptionTest.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/NameFormDescriptionSchemaParserTest.java?view=diff&rev=506134&p1=directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserNameFormDescriptionTest.java&r1=506124&p2=directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/NameFormDescriptionSchemaParserTest.java&r2=506134
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserNameFormDescriptionTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/NameFormDescriptionSchemaParserTest.java Sun Feb 11 13:03:24 2007
@@ -17,14 +17,14 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap.schema.syntax;
+package org.apache.directory.shared.ldap.schema.syntax.parser;
 
 
 import java.text.ParseException;
 
 import junit.framework.TestCase;
 
-import org.apache.directory.shared.ldap.schema.syntax.parser.NameFormDescriptionSchemaParser;
+import org.apache.directory.shared.ldap.schema.syntax.NameFormDescription;
 
 
 /**
@@ -32,7 +32,7 @@
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class SchemaParserNameFormDescriptionTest extends TestCase
+public class NameFormDescriptionSchemaParserTest extends TestCase
 {
     /** the parser instance */
     private NameFormDescriptionSchemaParser parser;

Copied: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/NormalizerDescriptionSchemaParserTest.java (from r506124, directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserNormalizerDescriptionTest.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/NormalizerDescriptionSchemaParserTest.java?view=diff&rev=506134&p1=directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserNormalizerDescriptionTest.java&r1=506124&p2=directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/NormalizerDescriptionSchemaParserTest.java&r2=506134
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserNormalizerDescriptionTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/NormalizerDescriptionSchemaParserTest.java Sun Feb 11 13:03:24 2007
@@ -17,14 +17,14 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap.schema.syntax;
+package org.apache.directory.shared.ldap.schema.syntax.parser;
 
 
 import java.text.ParseException;
 
 import junit.framework.TestCase;
 
-import org.apache.directory.shared.ldap.schema.syntax.parser.NormalizerDescriptionSchemaParser;
+import org.apache.directory.shared.ldap.schema.syntax.NormalizerDescription;
 
 
 /**
@@ -32,7 +32,7 @@
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class SchemaParserNormalizerDescriptionTest extends TestCase
+public class NormalizerDescriptionSchemaParserTest extends TestCase
 {
     /** the parser instance */
     private NormalizerDescriptionSchemaParser parser;

Copied: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/ObjectClassDescriptionSchemaParserTest.java (from r506124, directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserObjectClassDescriptionTest.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/ObjectClassDescriptionSchemaParserTest.java?view=diff&rev=506134&p1=directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserObjectClassDescriptionTest.java&r1=506124&p2=directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/ObjectClassDescriptionSchemaParserTest.java&r2=506134
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserObjectClassDescriptionTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/ObjectClassDescriptionSchemaParserTest.java Sun Feb 11 13:03:24 2007
@@ -17,7 +17,7 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap.schema.syntax;
+package org.apache.directory.shared.ldap.schema.syntax.parser;
 
 
 import java.text.ParseException;
@@ -25,7 +25,7 @@
 import junit.framework.TestCase;
 
 import org.apache.directory.shared.ldap.schema.ObjectClassTypeEnum;
-import org.apache.directory.shared.ldap.schema.syntax.parser.ObjectClassDescriptionSchemaParser;
+import org.apache.directory.shared.ldap.schema.syntax.ObjectClassDescription;
 
 
 /**
@@ -33,7 +33,7 @@
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class SchemaParserObjectClassDescriptionTest extends TestCase
+public class ObjectClassDescriptionSchemaParserTest extends TestCase
 {
     /** the parser instance */
     private ObjectClassDescriptionSchemaParser parser;

Copied: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/SchemaParserTestUtils.java (from r506124, directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserTestUtils.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/SchemaParserTestUtils.java?view=diff&rev=506134&p1=directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserTestUtils.java&r1=506124&p2=directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/SchemaParserTestUtils.java&r2=506134
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SchemaParserTestUtils.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/SchemaParserTestUtils.java Sun Feb 11 13:03:24 2007
@@ -1,4 +1,23 @@
-package org.apache.directory.shared.ldap.schema.syntax;
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.schema.syntax.parser;
 
 
 import java.text.ParseException;
@@ -7,9 +26,16 @@
 
 import junit.framework.Assert;
 
-import org.apache.directory.shared.ldap.schema.syntax.parser.AbstractSchemaParser;
+import org.apache.directory.shared.ldap.schema.syntax.AbstractSchemaDescription;
 
 
+/**
+ * Utils for schema parser test. Contains tests that are common
+ * for many schema parsers like OID, name, desc, extension.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
 public class SchemaParserTestUtils 
 {
 
@@ -480,7 +506,7 @@
     
     
     /**
-     * Test extensions.
+     * Tests for unique elements.
      * 
      * @throws ParseException
      */

Added: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/SyntaxCheckerDescriptionSchemaParserTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/SyntaxCheckerDescriptionSchemaParserTest.java?view=auto&rev=506134
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/SyntaxCheckerDescriptionSchemaParserTest.java (added)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/SyntaxCheckerDescriptionSchemaParserTest.java Sun Feb 11 13:03:24 2007
@@ -0,0 +1,212 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.schema.syntax.parser;
+
+
+import java.text.ParseException;
+
+import junit.framework.TestCase;
+
+import org.apache.directory.shared.ldap.schema.syntax.SyntaxCheckerDescription;
+
+
+/**
+ * Tests the SyntaxCheckerDescriptionSchemaParser class.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class SyntaxCheckerDescriptionSchemaParserTest extends TestCase
+{
+    private static final String OID = "1.3.6.1.4.1.18060.0.4.0.2.10000";
+    private static final String FQCN = "org.foo.Bar";
+    private static final String DESC = "bogus desc";
+    private static final String BYTECODE = "14561234";
+
+    /** the parser instance */
+    private SyntaxCheckerDescriptionSchemaParser parser;
+
+
+    protected void setUp() throws Exception
+    {
+        parser = new SyntaxCheckerDescriptionSchemaParser();
+    }
+
+
+    protected void tearDown() throws Exception
+    {
+        parser = null;
+    }
+
+
+    public void testNumericOid() throws Exception
+    {
+        SchemaParserTestUtils.testNumericOid( parser, "FQCN org.apache.directory.SimpleComparator" );
+    }
+
+
+    public void testDescription() throws ParseException
+    {
+        SchemaParserTestUtils.testDescription( parser, "1.1", "FQCN org.apache.directory.SimpleComparator" );
+    }
+
+
+    public void testFqcn() throws ParseException
+    {
+
+        String value = null;
+        SyntaxCheckerDescription scd = null;
+
+        // FQCN simple p
+        value = "( 1.1 FQCN org.apache.directory.SimpleComparator )";
+        scd = parser.parseSyntaxCheckerDescription( value );
+        assertNotNull( scd.getFqcn() );
+        assertEquals( "org.apache.directory.SimpleComparator", scd.getFqcn() );
+
+    }
+
+
+    public void testBytecode() throws ParseException
+    {
+
+        String value = null;
+        SyntaxCheckerDescription scd = null;
+
+        // FQCN simple p
+        value = "( 1.1 FQCN org.apache.directory.SimpleComparator BYTECODE ABCDEFGHIJKLMNOPQRSTUVWXYZ+/abcdefghijklmnopqrstuvwxyz0123456789==== )";
+        scd = parser.parseSyntaxCheckerDescription( value );
+        assertNotNull( scd.getBytecode() );
+        assertEquals( "ABCDEFGHIJKLMNOPQRSTUVWXYZ+/abcdefghijklmnopqrstuvwxyz0123456789====", scd.getBytecode() );
+
+    }
+
+
+    public void testExtensions() throws ParseException
+    {
+        SchemaParserTestUtils.testExtensions( parser, "1.1", "FQCN org.apache.directory.SimpleComparator" );
+    }
+
+
+    public void testFull() throws ParseException
+    {
+        // TODO
+    }
+
+
+    /**
+     * Test unique elements.
+     * 
+     * @throws ParseException
+     */
+    public void testUniqueElements()
+    {
+        // TODO
+    }
+
+
+    /**
+     * Test required elements.
+     * 
+     * @throws ParseException
+     */
+    public void testRequiredElements() throws ParseException
+    {
+        // TODO
+    }
+
+
+    public void testSimpleSyntaxChecker() throws Exception
+    {
+        String simple = "( " + OID + " FQCN " + FQCN + " )";
+        SyntaxCheckerDescription desc = parser.parseSyntaxCheckerDescription( simple );
+        assertNotNull( desc );
+        assertEquals( OID, desc.getNumericOid() );
+        assertEquals( FQCN, desc.getFqcn() );
+        assertNull( desc.getBytecode() );
+        assertNull( desc.getDescription() );
+    }
+
+
+    public void testSyntaxCheckerWithDesc() throws Exception
+    {
+        String simple = "( " + OID + " DESC '" + DESC + "' FQCN " + FQCN + " )";
+        SyntaxCheckerDescription desc = parser.parseSyntaxCheckerDescription( simple );
+        assertNotNull( desc );
+        assertEquals( OID, desc.getNumericOid() );
+        assertEquals( FQCN, desc.getFqcn() );
+        assertNull( desc.getBytecode() );
+        assertEquals( DESC, desc.getDescription() );
+    }
+
+
+    public void testSyntaxCheckerWithDescAndByteCode() throws Exception
+    {
+        String simple = "( " + OID + " DESC '" + DESC + "' FQCN " + FQCN + " BYTECODE " + BYTECODE + " )";
+        SyntaxCheckerDescription desc = parser.parseSyntaxCheckerDescription( simple );
+        assertNotNull( desc );
+        assertEquals( OID, desc.getNumericOid() );
+        assertEquals( FQCN, desc.getFqcn() );
+        assertEquals( BYTECODE, desc.getBytecode() );
+        assertEquals( DESC, desc.getDescription() );
+    }
+
+
+    public void testSyntaxCheckerExample() throws Exception
+    {
+        String simple = "( 1.3.6.1.4.1.18060.0.4.1.0.10000 DESC 'bogus desc' FQCN org.apache.directory.shared.ldap.schema.syntax.AcceptAllSyntaxChecker )";
+        SyntaxCheckerDescription desc = parser.parseSyntaxCheckerDescription( simple );
+        assertNotNull( desc );
+    }
+
+
+    public void testRealByteCodeExample() throws Exception
+    {
+        String simple = "( 1.3.6.1.4.1.18060.0.4.1.0.10002 DESC 'bogus desc' "
+            + "FQCN DummySyntaxChecker BYTECODE yv66vgAAADEAHgoABAAYCQADABkHABoHABsHABwBAANvaWQBABJMam"
+            + "F2YS9sYW5nL1N0cmluZzsBAAY8aW5pdD4BABUoTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51b"
+            + "WJlclRhYmxlAQADKClWAQAMc2V0U3ludGF4T2lkAQAMZ2V0U3ludGF4T2lkAQAUKClMamF2YS9sYW5nL1N0cmlu"
+            + "ZzsBAA1pc1ZhbGlkU3ludGF4AQAVKExqYXZhL2xhbmcvT2JqZWN0OylaAQAMYXNzZXJ0U3ludGF4AQAVKExqYXZ"
+            + "hL2xhbmcvT2JqZWN0OylWAQAKRXhjZXB0aW9ucwcAHQEAClNvdXJjZUZpbGUBABdEdW1teVN5bnRheENoZWNrZX"
+            + "IuamF2YQwACAAMDAAGAAcBABJEdW1teVN5bnRheENoZWNrZXIBABBqYXZhL2xhbmcvT2JqZWN0AQA8b3JnL2FwY"
+            + "WNoZS9kaXJlY3Rvcnkvc2hhcmVkL2xkYXAvc2NoZW1hL3N5bnRheC9TeW50YXhDaGVja2VyAQAcamF2YXgvbmFt"
+            + "aW5nL05hbWluZ0V4Y2VwdGlvbgAhAAMABAABAAUAAQACAAYABwAAAAYAAQAIAAkAAQAKAAAAKgACAAIAAAAKKrc"
+            + "AASortQACsQAAAAEACwAAAA4AAwAAAAsABAAMAAkADQABAAgADAABAAoAAAAhAAEAAQAAAAUqtwABsQAAAAEACw"
+            + "AAAAoAAgAAABEABAASAAEADQAJAAEACgAAACIAAgACAAAABiortQACsQAAAAEACwAAAAoAAgAAABcABQAYAAEAD"
+            + "gAPAAEACgAAAB0AAQABAAAABSq0AAKwAAAAAQALAAAABgABAAAAHQABABAAEQABAAoAAAAaAAEAAgAAAAIErAAA"
+            + "AAEACwAAAAYAAQAAACMAAQASABMAAgAKAAAAGQAAAAIAAAABsQAAAAEACwAAAAYAAQAAACkAFAAAAAQAAQAVAAE"
+            + "AFgAAAAIAFw== X-SCHEMA 'nis' )";
+        SyntaxCheckerDescription desc = parser.parseSyntaxCheckerDescription( simple );
+        assertNotNull( desc );
+        assertEquals( "1.3.6.1.4.1.18060.0.4.1.0.10002", desc.getNumericOid() );
+        assertEquals( "DummySyntaxChecker", desc.getFqcn() );
+        assertNotNull( desc.getBytecode() );
+        assertEquals( "bogus desc", desc.getDescription() );
+    }
+
+
+    /**
+     * Tests the multithreaded use of a single parser.
+     */
+    public void testMultiThreaded() throws Exception
+    {
+        // TODO
+    }
+
+}



Mime
View raw message