directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r662292 - in /directory/shared/trunk/ldap/src: main/antlr/ test/java/org/apache/directory/shared/ldap/schema/syntax/parser/
Date Sun, 01 Jun 2008 21:26:54 GMT
Author: seelmann
Date: Sun Jun  1 14:26:54 2008
New Revision: 662292

URL: http://svn.apache.org/viewvc?rev=662292&view=rev
Log:
Partial fix for DIRSHARED-8:
o allow tabs instead of spaces,
o allow more than one space
o allow missing spaces before or after '(' and ')' 


Modified:
    directory/shared/trunk/ldap/src/main/antlr/schema-extension.g
    directory/shared/trunk/ldap/src/main/antlr/schema-value.g
    directory/shared/trunk/ldap/src/main/antlr/schema.g
    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
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/DITContentRuleDescriptionSchemaParserTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/DITStructureRuleDescriptionSchemaParserTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/LdapSyntaxDescriptionSchemaParserTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/MatchingRuleDescriptionSchemaParserTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/MatchingRuleUseDescriptionSchemaParserTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/NameFormDescriptionSchemaParserTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/NormalizerDescriptionSchemaParserTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/ObjectClassDescriptionSchemaParserTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/SchemaParserTestUtils.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/SyntaxCheckerDescriptionSchemaParserTest.java

Modified: directory/shared/trunk/ldap/src/main/antlr/schema-extension.g
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/antlr/schema-extension.g?rev=662292&r1=662291&r2=662292&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/antlr/schema-extension.g (original)
+++ directory/shared/trunk/ldap/src/main/antlr/schema-extension.g Sun Jun  1 14:26:54 2008
@@ -63,7 +63,7 @@
 XKEY : xstring:XSTRING { setText(xstring.getText().trim()); }; 
 XVALUES : values:VALUES { setText(values.getText().trim()); };
 
-protected XSTRING : ( "X-" ( 'a'..'z' | 'A'..'Z' | '-' | '_' )+ WHSP ) ; 
+protected XSTRING : ( "X-" ( 'a'..'z' | 'A'..'Z' | '-' | '_' )+ (WHSP)? ) ; 
 protected VALUES : ( VALUE | '('  VALUE ( ('$')? VALUE )* ')' ) ;
 protected VALUE : (WHSP)? ( QUOTED_STRING ) (options {greedy=true;}: WHSP)? ;
 protected QUOTED_STRING : ( QUOTE (~'\'')* QUOTE ) ;

Modified: directory/shared/trunk/ldap/src/main/antlr/schema-value.g
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/antlr/schema-value.g?rev=662292&r1=662291&r2=662292&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/antlr/schema-value.g (original)
+++ directory/shared/trunk/ldap/src/main/antlr/schema-value.g Sun Jun  1 14:26:54 2008
@@ -42,9 +42,7 @@
     defaultErrorHandler = false ;
 }
 
-//WHSP : (' ') {$setType(Token.SKIP);} ;
-//SP : ( ' ' )+ { setText(" "); };
-SP
+WHSP
     :
     ( options {greedy=true;} :
     ' '
@@ -114,7 +112,7 @@
 numericoid returns [String numericoid=null]
     : 
     (
-        (SP)? n:NUMERICOID (SP)? { numericoid = n.getText(); } 
+        (WHSP)? n:NUMERICOID (WHSP)? { numericoid = n.getText(); } 
     )
     ;
 
@@ -132,13 +130,13 @@
 oid returns [String oid=null]
     : 
     (
-        (SP)? 
+        (WHSP)? 
         (
             n:NUMERICOID { oid = n.getText(); }
         | 
             d:DESCR { oid = d.getText(); }
         )
-        (SP)?
+        (WHSP)?
     )
     ;
 
@@ -177,7 +175,7 @@
 qdescr returns [String qdescr=null]
     : 
     ( 
-        (SP)?
+        (WHSP)?
         QUOTE 
         d:DESCR { qdescr = d.getText(); } 
         QUOTE
@@ -204,10 +202,10 @@
             LPAR 
             qdescr=qdescr { qdescrs.add(qdescr); } 
             (
-                SP
+                (options {greedy=true;} : WHSP)?
                 qdescr=qdescr { qdescrs.add(qdescr); } 
             )* 
-            (SP)?
+            (WHSP)?
             RPAR 
         )
     )
@@ -221,7 +219,7 @@
 ruleid returns [Integer ruleid=null]
     : 
     (
-        (SP)? 
+        (WHSP)? 
         n:NUMBER { ruleid = Integer.parseInt(n.getText()); }
     )
     ;
@@ -246,10 +244,10 @@
             LPAR 
             ruleid=ruleid { ruleids.add(ruleid); } 
             ( 
-                SP
+                WHSP
                 ruleid=ruleid { ruleids.add(ruleid); } 
             )* 
-            (SP)?
+            (WHSP)?
             RPAR 
         )
     )

Modified: directory/shared/trunk/ldap/src/main/antlr/schema.g
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/antlr/schema.g?rev=662292&r1=662291&r2=662292&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/antlr/schema.g (original)
+++ directory/shared/trunk/ldap/src/main/antlr/schema.g Sun Jun  1 14:26:54 2008
@@ -86,23 +86,23 @@
 ATTRIBUTETYPE : ( "attributetype" (WHSP)? ) ;
 
 STARTNUMERICOID : ( LPAR ( numericoid:VALUE ) ) { setText(numericoid.getText().trim()); } ;
-NAME : ( "NAME" WHSP qdstrings:VALUES ) { setText(qdstrings.getText().trim()); } ;
-DESC : ( "DESC" WHSP qdstring:VALUES ) { setText(qdstring.getText().trim()); } ;
-SUP : ( "SUP" WHSP sup:VALUES ) { setText(sup.getText().trim()); } ;
-MUST : ( "MUST" WHSP must:VALUES ) { setText(must.getText().trim()); } ;
-MAY : ( "MAY" WHSP may:VALUES ) { setText(may.getText()); } ;
-AUX : ( "AUX" WHSP aux:VALUES ) { setText(aux.getText()); } ;
-NOT : ( "NOT" WHSP not:VALUES ) { setText(not.getText()); } ;
-FORM : ( "FORM" WHSP form:VALUES ) { setText(form.getText()); } ;
-OC : ( "OC" WHSP oc:VALUES ) { setText(oc.getText()); } ;
-EQUALITY : ( "EQUALITY" WHSP equality:VALUES ) { setText(equality.getText().trim()); } ;
-ORDERING : ( "ORDERING" WHSP ordering:VALUES ) { setText(ordering.getText().trim()); } ;
-SUBSTR : ( "SUBSTR" WHSP substr:VALUES ) { setText(substr.getText().trim()); } ;
-SYNTAX : ( "SYNTAX" WHSP syntax:VALUES (len:LEN)? ) { setText(syntax.getText().trim() + (len!=null?len.getText().trim():"")); } ;
-APPLIES : ( "APPLIES" WHSP applies:VALUES ) { setText(applies.getText().trim()); } ;
-EXTENSION : x:( "X-" ( 'a'..'z' | 'A'..'Z' | '-' | '_' )+ WHSP VALUES ) ; 
-FQCN : ( "FQCN" WHSP fqcn:FQCN_VALUE ) { setText(fqcn.getText().trim()); } ;
-BYTECODE : ( "BYTECODE" WHSP bytecode:BYTECODE_VALUE ) { setText(bytecode.getText().trim()); } ;
+NAME : ( "NAME" (options {greedy=true;} : WHSP)? qdstrings:VALUES ) { setText(qdstrings.getText().trim()); } ;
+DESC : ( "DESC" (options {greedy=true;} : WHSP)? qdstring:VALUES ) { setText(qdstring.getText().trim()); } ;
+SUP : ( "SUP" (options {greedy=true;} : WHSP)? sup:VALUES ) { setText(sup.getText().trim()); } ;
+MUST : ( "MUST" (options {greedy=true;} : WHSP)? must:VALUES ) { setText(must.getText().trim()); } ;
+MAY : ( "MAY" (options {greedy=true;} : WHSP)? may:VALUES ) { setText(may.getText()); } ;
+AUX : ( "AUX" (options {greedy=true;} : WHSP)? aux:VALUES ) { setText(aux.getText()); } ;
+NOT : ( "NOT" (options {greedy=true;} : WHSP)? not:VALUES ) { setText(not.getText()); } ;
+FORM : ( "FORM" (options {greedy=true;} : WHSP)? form:VALUES ) { setText(form.getText()); } ;
+OC : ( "OC" (options {greedy=true;} : WHSP)? oc:VALUES ) { setText(oc.getText()); } ;
+EQUALITY : ( "EQUALITY" (options {greedy=true;} : WHSP)? equality:VALUES ) { setText(equality.getText().trim()); } ;
+ORDERING : ( "ORDERING" (options {greedy=true;} : WHSP)? ordering:VALUES ) { setText(ordering.getText().trim()); } ;
+SUBSTR : ( "SUBSTR" (options {greedy=true;} : WHSP)? substr:VALUES ) { setText(substr.getText().trim()); } ;
+SYNTAX : ( "SYNTAX" (options {greedy=true;} : WHSP)? syntax:VALUES (len:LEN)? ) { setText(syntax.getText().trim() + (len!=null?len.getText().trim():"")); } ;
+APPLIES : ( "APPLIES" (options {greedy=true;} : WHSP)? applies:VALUES ) { setText(applies.getText().trim()); } ;
+EXTENSION : x:( "X-" ( options {greedy=true;} : 'a'..'z' | 'A'..'Z' | '-' | '_' )+ (options {greedy=true;} : WHSP)? VALUES ) ; 
+FQCN : ( "FQCN" (options {greedy=true;} : WHSP)? fqcn:FQCN_VALUE ) { setText(fqcn.getText().trim()); } ;
+BYTECODE : ( "BYTECODE" (options {greedy=true;} : WHSP)? bytecode:BYTECODE_VALUE ) { setText(bytecode.getText().trim()); } ;
 
 protected VALUES : ( VALUE | LPAR  VALUE ( (DOLLAR)? VALUE )* RPAR ) ;
 protected VALUE : (WHSP)? ( QUOTED_STRING | UNQUOTED_STRING ) (options {greedy=true;}: WHSP)? ;

Modified: 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?rev=662292&r1=662291&r2=662292&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/AttributeTypeDescriptionSchemaParserTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/AttributeTypeDescriptionSchemaParserTest.java Sun Jun  1 14:26:54 2008
@@ -115,8 +115,13 @@
         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 )";
+        // SUP descr, no space
+        value = "(1.1 SYNTAX1.1 SUPabcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789)";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", atd.getSuperType() );
+
+        // SUP descr, newline
+        value = "\t(\t1.1\tSYNTAX\t1.1\tSUP\tabcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789\t)\t";
         atd = parser.parseAttributeTypeDescription( value );
         assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", atd.getSuperType() );
 
@@ -203,8 +208,13 @@
         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 )";
+        // EQUALITY descr, no space
+        value = "(1.1 SYNTAX1.1 EQUALITYabcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789)";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", atd.getEqualityMatchingRule() );
+
+        // EQUALITY descr, newline
+        value = "\n(\n1.1\nSYNTAX\n1.1\nEQUALITY\nabcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789\n)\n";
         atd = parser.parseAttributeTypeDescription( value );
         assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", atd.getEqualityMatchingRule() );
 
@@ -233,18 +243,23 @@
         String value = null;
         AttributeTypeDescription atd = null;
 
-        // no EQUALITY
+        // no ORDERING
         value = "( 1.1 SYNTAX 1.1 )";
         atd = parser.parseAttributeTypeDescription( value );
         assertNull( atd.getOrderingMatchingRule() );
 
-        // EQUALITY numericoid
+        // ORDERING 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 )";
+        // ORDERING descr, no space
+        value = "(1.1 SYNTAX1.1 ORDERINGabcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789)";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", atd.getOrderingMatchingRule() );
+
+        // ORDERING descr, newline
+        value = "\r(\r1.1\rSYNTAX\r1.1\rORDERING\rabcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789\r)\r";
         atd = parser.parseAttributeTypeDescription( value );
         assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", atd.getOrderingMatchingRule() );
 
@@ -273,18 +288,24 @@
         String value = null;
         AttributeTypeDescription atd = null;
 
-        // no EQUALITY
+        // no SUBSTR
         value = "( 1.1 SYNTAX 1.1 )";
         atd = parser.parseAttributeTypeDescription( value );
         assertNull( atd.getSubstringsMatchingRule() );
 
-        // EQUALITY numericoid
+        // SUBSTR 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 )";
+        // SUBSTR descr, no space
+        value = "(1.1 SYNTAX1.1 SUBSTRabcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789)";
+        atd = parser.parseAttributeTypeDescription( value );
+        assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", atd
+            .getSubstringsMatchingRule() );
+
+        // SUBSTR descr, newline
+        value = "\r\n(\r\n1.1\r\nSYNTAX\r\n1.1\r\nSUBSTR\r\nabcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789\r\n)\r\n";
         atd = parser.parseAttributeTypeDescription( value );
         assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", atd
             .getSubstringsMatchingRule() );
@@ -325,14 +346,20 @@
         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} )";
+        // SYNTAX numericoid and length, no spaces
+        value = "(1.1 SYNTAX1.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, with tabs
+        value = "\t(\t1.1\tSYNTAX\t1.2.3.4567.8.9.0\t{1234567890}\t)\t";
         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} )";
+        value = "( 1.1 SYNTAX 1.2.3 {0} )";
         atd = parser.parseAttributeTypeDescription( value );
         assertEquals( "1.2.3", atd.getSyntax() );
         assertEquals( 0, atd.getSyntaxLength() );
@@ -437,7 +464,7 @@
         atd = parser.parseAttributeTypeDescription( value );
         assertTrue( atd.isSingleValued() );
 
-        // ivalid
+        // invalid
         value = "(1.1 SYNTAX 1.1 NAME 'test' DESC 'Descripton' SINGLE-VALU )";
         try
         {
@@ -554,13 +581,13 @@
         atd = parser.parseAttributeTypeDescription( value );
         assertEquals( UsageEnum.DIRECTORY_OPERATION, atd.getUsage() );
 
-        // AUXILIARY
-        value = "( 1.1 SYNTAX 1.1 USAGE distributedOperation )";
+        // distributedOperation, tabs
+        value = "\t(\t1.1\tSYNTAX\t1.1\tUSAGE\tdistributedOperation\t)\t";
         atd = parser.parseAttributeTypeDescription( value );
         assertEquals( UsageEnum.DISTRIBUTED_OPERATION, atd.getUsage() );
 
-        // STRUCTURAL
-        value = "( 1.1 SYNTAX 1.1 USAGE dSAOperation )";
+        // dSAOperation, no space
+        value = "(1.1 SYNTAX1.1 USAGEdSAOperation)";
         atd = parser.parseAttributeTypeDescription( value );
         assertEquals( UsageEnum.DSA_OPERATION, atd.getUsage() );
 
@@ -633,7 +660,7 @@
         assertEquals( "test2-2", atd.getExtensions().get( "X-TEST-b" ).get( 1 ) );
     }
 
-    
+
     /**
      * Test unique elements.
      * 
@@ -642,25 +669,18 @@
     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' )" 
-            };
+            { "( 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.
      * 
@@ -675,12 +695,12 @@
         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() );
@@ -698,7 +718,8 @@
         }
 
     }
-    
+
+
     /**
      * Test collective constraint:
      * COLLECTIVE requires USAGE userApplications
@@ -713,13 +734,13 @@
         value = "( 1.1 SYNTAX 1.1 COLLECTIVE )";
         atd = parser.parseAttributeTypeDescription( value );
         assertTrue( atd.isCollective() );
-        assertEquals( UsageEnum.USER_APPLICATIONS , atd.getUsage() );
-        
+        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() );
-        
+        assertEquals( UsageEnum.USER_APPLICATIONS, atd.getUsage() );
+
         value = "( 1.1 SYNTAX 1.1 COLLECTIVE USAGE directoryOperation )";
         try
         {
@@ -730,7 +751,7 @@
         {
             // expected
         }
-        
+
         value = "( 1.1 SYNTAX 1.1 COLLECTIVE USAGE dSAOperation )";
         try
         {
@@ -741,7 +762,7 @@
         {
             // expected
         }
-        
+
         value = "( 1.1 SYNTAX 1.1 COLLECTIVE USAGE distributedOperation )";
         try
         {
@@ -752,10 +773,10 @@
         {
             // expected
         }
-        
+
     }
-    
-    
+
+
     /**
      * Test no-user-modification constraint:
      * NO-USER-MODIFICATION requires an operational USAGE
@@ -766,22 +787,22 @@
     {
         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() );
-        
+        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() );
-        
+        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() );
-        
+        assertEquals( UsageEnum.DISTRIBUTED_OPERATION, atd.getUsage() );
+
         value = "( 1.1 SYNTAX 1.1 NO-USER-MODIFICATION USAGE userApplications )";
         try
         {
@@ -792,7 +813,7 @@
         {
             // expected
         }
-        
+
         value = "( 1.1 SYNTAX 1.1 NO-USER-MODIFICATION )";
         try
         {
@@ -804,8 +825,8 @@
             // expected
         }
     }
-    
-    
+
+
     /**
      * Ensure that element order is ignored
      * 
@@ -861,13 +882,14 @@
         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 )";
+        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 ) );
@@ -877,14 +899,14 @@
         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' )";
+        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 ) );
@@ -893,8 +915,8 @@
         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.

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/ComparatorDescriptionSchemaParserTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/ComparatorDescriptionSchemaParserTest.java?rev=662292&r1=662291&r2=662292&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/ComparatorDescriptionSchemaParserTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/ComparatorDescriptionSchemaParserTest.java Sun Jun  1 14:26:54 2008
@@ -58,29 +58,25 @@
 
     public void testDescription() throws ParseException
     {
-        SchemaParserTestUtils
-            .testDescription( parser, "1.1", "FQCN org.apache.directory.SimpleComparator" );
+        SchemaParserTestUtils.testDescription( parser, "1.1", "FQCN org.apache.directory.SimpleComparator" );
     }
 
 
     public void testFqcn() throws ParseException
     {
-
         String value = null;
         ComparatorDescription cd = null;
 
-        // FQCN simple p
+        // FQCN simple
         value = "( 1.1 FQCN org.apache.directory.SimpleComparator )";
         cd = parser.parseComparatorDescription( value );
         assertNotNull( cd.getFqcn() );
         assertEquals( "org.apache.directory.SimpleComparator", cd.getFqcn() );
-
     }
 
 
     public void testBytecode() throws ParseException
     {
-
         String value = null;
         ComparatorDescription cd = null;
 
@@ -90,6 +86,17 @@
         assertNotNull( cd.getBytecode() );
         assertEquals( "ABCDEFGHIJKLMNOPQRSTUVWXYZ+/abcdefghijklmnopqrstuvwxyz0123456789====", cd.getBytecode() );
 
+        // FQCN simple, no spaces
+        value = "(1.1 FQCNorg.apache.directory.SimpleComparator BYTECODEABCDEFGHIJKLMNOPQRSTUVWXYZ+/abcdefghijklmnopqrstuvwxyz0123456789====)";
+        cd = parser.parseComparatorDescription( value );
+        assertNotNull( cd.getBytecode() );
+        assertEquals( "ABCDEFGHIJKLMNOPQRSTUVWXYZ+/abcdefghijklmnopqrstuvwxyz0123456789====", cd.getBytecode() );
+
+        // FQCN simple, tabs
+        value = "\t(\t1.1\tFQCN\torg.apache.directory.SimpleComparator\tBYTECODE\tABCDEFGHIJKLMNOPQRSTUVWXYZ+/abcdefghijklmnopqrstuvwxyz0123456789====\t)\t";
+        cd = parser.parseComparatorDescription( value );
+        assertNotNull( cd.getBytecode() );
+        assertEquals( "ABCDEFGHIJKLMNOPQRSTUVWXYZ+/abcdefghijklmnopqrstuvwxyz0123456789====", cd.getBytecode() );
     }
 
 

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/DITContentRuleDescriptionSchemaParserTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/DITContentRuleDescriptionSchemaParserTest.java?rev=662292&r1=662291&r2=662292&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/DITContentRuleDescriptionSchemaParserTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/DITContentRuleDescriptionSchemaParserTest.java Sun Jun  1 14:26:54 2008
@@ -156,7 +156,7 @@
         assertEquals( "top2", dcrd.getAuxiliaryObjectClasses().get( 2 ) );
 
         // AUX multi mixed no space
-        value = "( 1.1 AUX (TOP-1$1.2.3.4$TOP-2) )";
+        value = "(1.1 AUX(TOP-1$1.2.3.4$TOP-2))";
         dcrd = parser.parseDITContentRuleDescription( value );
         assertEquals( 3, dcrd.getAuxiliaryObjectClasses().size() );
         assertEquals( "TOP-1", dcrd.getAuxiliaryObjectClasses().get( 0 ) );
@@ -255,7 +255,7 @@
     {
         String value = null;
         DITContentRuleDescription dcrd = null;
-        
+
         // no MUST
         value = "( 1.1 )";
         dcrd = parser.parseDITContentRuleDescription( value );
@@ -346,6 +346,7 @@
         }
     }
 
+
     /**
      * Test NOT and its values.
      * Very similar to AUX, so here are less test cases. 
@@ -389,7 +390,7 @@
             // expected
         }
     }
-    
+
 
     /**
      * Test extensions.
@@ -449,7 +450,7 @@
         assertEquals( "test2-2", dcrd.getExtensions().get( "X-TEST-b" ).get( 1 ) );
     }
 
-    
+
     /**
      * Test unique elements.
      * 
@@ -458,20 +459,13 @@
     public void testUniqueElements()
     {
         String[] testValues = new String[]
-            { 
-                "( 1.1 NAME 'test1' NAME 'test2' )", 
-                "( 1.1 DESC 'test1' DESC 'test2' )",
-                "( 1.1 OBSOLETE OBSOLETE )", 
-                "( 1.1 AUX test1 AUX test2 )",
-                "( 1.1 MUST test1 MUST test2 )",
-                "( 1.1 MAY test1 MAY test2 )",
-                "( 1.1 NOT test1 NOT test2 )",
-                "( 1.1 X-TEST 'test1' X-TEST 'test2' )" 
-            };
+            { "( 1.1 NAME 'test1' NAME 'test2' )", "( 1.1 DESC 'test1' DESC 'test2' )", "( 1.1 OBSOLETE OBSOLETE )",
+                "( 1.1 AUX test1 AUX test2 )", "( 1.1 MUST test1 MUST test2 )", "( 1.1 MAY test1 MAY test2 )",
+                "( 1.1 NOT test1 NOT test2 )", "( 1.1 X-TEST 'test1' X-TEST 'test2' )" };
         SchemaParserTestUtils.testUnique( parser, testValues );
     }
-    
-    
+
+
     /**
      * Tests the multithreaded use of a single parser.
      */

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/DITStructureRuleDescriptionSchemaParserTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/DITStructureRuleDescriptionSchemaParserTest.java?rev=662292&r1=662291&r2=662292&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/DITStructureRuleDescriptionSchemaParserTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/DITStructureRuleDescriptionSchemaParserTest.java Sun Jun  1 14:26:54 2008
@@ -196,6 +196,16 @@
         dsrd = parser.parseDITStructureRuleDescription( value );
         assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", dsrd.getForm() );
 
+        // descr, no space
+        value = "(1 FORMabc)";
+        dsrd = parser.parseDITStructureRuleDescription( value );
+        assertEquals( "abc", dsrd.getForm() );
+
+        // descr, tab
+        value = "\t(\t1\tFORM\tabc\t)\t";
+        dsrd = parser.parseDITStructureRuleDescription( value );
+        assertEquals( "abc", dsrd.getForm() );
+
         // no quote allowed
         value = "( 1 FORM '1.2.3.4.5.6.7.8.9.0' )";
         try
@@ -287,7 +297,7 @@
         assertEquals( new Integer( 1 ), dsrd.getSuperRules().get( 0 ) );
 
         // SUP multi number
-        value = "( 1 FORM 1.1 SUP (12345 67890) )";
+        value = "( 1 FORM 1.1 SUP(12345 67890))";
         dsrd = parser.parseDITStructureRuleDescription( value );
         assertEquals( 2, dsrd.getSuperRules().size() );
         assertEquals( new Integer( 12345 ), dsrd.getSuperRules().get( 0 ) );
@@ -353,9 +363,9 @@
         assertTrue( dsrd.isObsolete() );
         assertEquals( "2.3.4.5.6.7.8.9.0.1", dsrd.getForm() );
         assertEquals( 3, dsrd.getSuperRules().size() );
-        assertEquals( new Integer(1), dsrd.getSuperRules().get( 0 ) );
-        assertEquals( new Integer(1234567890), dsrd.getSuperRules().get( 1 ) );
-        assertEquals( new Integer(5), dsrd.getSuperRules().get( 2 ) );
+        assertEquals( new Integer( 1 ), dsrd.getSuperRules().get( 0 ) );
+        assertEquals( new Integer( 1234567890 ), dsrd.getSuperRules().get( 1 ) );
+        assertEquals( new Integer( 5 ), dsrd.getSuperRules().get( 2 ) );
         assertEquals( 2, dsrd.getExtensions().size() );
         assertNotNull( dsrd.getExtensions().get( "X-TEST-a" ) );
         assertEquals( 2, dsrd.getExtensions().get( "X-TEST-a" ).size() );
@@ -367,7 +377,7 @@
         assertEquals( "test2-2", dsrd.getExtensions().get( "X-TEST-b" ).get( 1 ) );
     }
 
-    
+
     /**
      * Test unique elements.
      * 
@@ -376,18 +386,13 @@
     public void testUniqueElements()
     {
         String[] testValues = new String[]
-            { 
-                "( 1 FORM 1.1 NAME 'test1' NAME 'test2' )", 
-                "( 1 FORM 1.1 DESC 'test1' DESC 'test2' )",
-                "( 1 FORM 1.1 OBSOLETE OBSOLETE )", 
-                "( 1 FORM 1.1 FORM test1 FORM test2 )",
-                "( 1 FORM 1.1 SUP 1 SUP 2 )",
-                "( 1 FORM 1.1 X-TEST 'test1' X-TEST 'test2' )" 
-            };
+            { "( 1 FORM 1.1 NAME 'test1' NAME 'test2' )", "( 1 FORM 1.1 DESC 'test1' DESC 'test2' )",
+                "( 1 FORM 1.1 OBSOLETE OBSOLETE )", "( 1 FORM 1.1 FORM test1 FORM test2 )",
+                "( 1 FORM 1.1 SUP 1 SUP 2 )", "( 1 FORM 1.1 X-TEST 'test1' X-TEST 'test2' )" };
         SchemaParserTestUtils.testUnique( parser, testValues );
     }
-    
-    
+
+
     /**
      * Test required elements.
      * 
@@ -412,7 +417,7 @@
         {
             // expected
         }
-        
+
     }
 
 

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/LdapSyntaxDescriptionSchemaParserTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/LdapSyntaxDescriptionSchemaParserTest.java?rev=662292&r1=662291&r2=662292&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/LdapSyntaxDescriptionSchemaParserTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/LdapSyntaxDescriptionSchemaParserTest.java Sun Jun  1 14:26:54 2008
@@ -119,13 +119,10 @@
     public void testUniqueElements()
     {
         String[] testValues = new String[]
-            { 
-                "( 1.1 DESC 'test1' DESC 'test2' )",
-                "( 1.1 X-TEST 'test1' X-TEST 'test2' )" 
-            };
+            { "( 1.1 DESC 'test1' DESC 'test2' )", "( 1.1 X-TEST 'test1' X-TEST 'test2' )" };
         SchemaParserTestUtils.testUnique( parser, testValues );
     }
-    
+
 
     ////////////////////////////////////////////////////////////////
     //         Some real-world attribute type definitions         //
@@ -144,7 +141,7 @@
         assertEquals( "TRUE", lsd.getExtensions().get( "X-NOT-HUMAN-READABLE" ).get( 0 ) );
     }
 
-    
+
     /**
      * Tests the parse of a simple AttributeType with the schema extension.
      */
@@ -157,15 +154,15 @@
         assertNotNull( desc.getExtensions().get( "X-IS-HUMAN-READABLE" ) );
     }
 
-    
+
     /**
      * Tests the multithreaded use of a single parser.
      */
     public void testMultiThreaded() throws Exception
     {
         String[] testValues = new String[]
-            { 
-                "( 1.1 )", 
+            {
+                "( 1.1 )",
                 "( 1.3.6.1.4.1.1466.115.121.1.36 DESC 'Numeric String' )",
                 "( 1.3.6.1.4.1.1466.115.121.1.5 DESC 'Binary' X-NOT-HUMAN-READABLE 'TRUE' )",
                 "( 1.2.3.4.5.6.7.8.9.0 DESC 'Descripton \u00E4\u00F6\u00FC\u00DF \u90E8\u9577' X-TEST-a ('test1-1' 'test1-2') X-TEST-b ('test2-1' 'test2-2') )" };

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/MatchingRuleDescriptionSchemaParserTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/MatchingRuleDescriptionSchemaParserTest.java?rev=662292&r1=662291&r2=662292&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/MatchingRuleDescriptionSchemaParserTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/MatchingRuleDescriptionSchemaParserTest.java Sun Jun  1 14:26:54 2008
@@ -37,6 +37,7 @@
     /** the parser instance */
     private MatchingRuleDescriptionSchemaParser parser;
 
+
     protected void setUp() throws Exception
     {
         parser = new MatchingRuleDescriptionSchemaParser();
@@ -75,7 +76,6 @@
 
     public void testSyntax() throws ParseException
     {
-
         String value = null;
         MatchingRuleDescription mrd = null;
 
@@ -85,7 +85,7 @@
         assertEquals( "0.1.2.3.4.5.6.7.8.9", mrd.getSyntax() );
 
         // simple
-        value = "( 1.1 SYNTAX 123.456.789.0 )";
+        value = "(1.1 SYNTAX 123.456.789.0)";
         mrd = parser.parseMatchingRuleDescription( value );
         assertEquals( "123.456.789.0", mrd.getSyntax() );
 
@@ -118,7 +118,7 @@
             // expected
         }
 
-        // OC must only appear once
+        // SYNTAX must only appear once
         value = "( 1.1 SYNTAX 2.2 SYNTAX 3.3 )";
         try
         {
@@ -129,7 +129,7 @@
         {
             assertTrue( true );
         }
-        
+
     }
 
 
@@ -164,8 +164,8 @@
         assertEquals( "test2-1", mrd.getExtensions().get( "X-TEST-b" ).get( 0 ) );
         assertEquals( "test2-2", mrd.getExtensions().get( "X-TEST-b" ).get( 1 ) );
     }
-    
-    
+
+
     /**
      * Test unique elements.
      * 
@@ -174,13 +174,9 @@
     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 SYNTAX 2.2 SYNTAX 3.3 )",
-                "( 1.1 SYNTAX 1.1 X-TEST 'test1' X-TEST 'test2' )" 
-            };
+            { "( 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 SYNTAX 2.2 SYNTAX 3.3 )",
+                "( 1.1 SYNTAX 1.1 X-TEST 'test1' X-TEST 'test2' )" };
         SchemaParserTestUtils.testUnique( parser, testValues );
     }
 
@@ -211,8 +207,8 @@
         }
 
     }
-    
-    
+
+
     ////////////////////////////////////////////////////////////////
     //         Some real-world matching rule descriptons          //
     ////////////////////////////////////////////////////////////////

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/MatchingRuleUseDescriptionSchemaParserTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/MatchingRuleUseDescriptionSchemaParserTest.java?rev=662292&r1=662291&r2=662292&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/MatchingRuleUseDescriptionSchemaParserTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/MatchingRuleUseDescriptionSchemaParserTest.java Sun Jun  1 14:26:54 2008
@@ -100,7 +100,7 @@
         assertEquals( "123.4567.890", mrud.getApplicableAttributes().get( 0 ) );
 
         // APPLIES single descr
-        value = "( 1.1 APPLIES ( a-z-A-Z-0-9 ) )";
+        value = "(1.1 APPLIES(a-z-A-Z-0-9))";
         mrud = parser.parseMatchingRuleUseDescription( value );
         assertEquals( 1, mrud.getApplicableAttributes().size() );
         assertEquals( "a-z-A-Z-0-9", mrud.getApplicableAttributes().get( 0 ) );
@@ -120,8 +120,8 @@
         assertEquals( "test1", mrud.getApplicableAttributes().get( 0 ) );
         assertEquals( "test2", mrud.getApplicableAttributes().get( 1 ) );
 
-        // APPLIES multi mixed
-        value = "( 1.1 APPLIES ( test1 $ 1.2.3.4 $ test2 ) )";
+        // APPLIES multi mixed, tabs
+        value = "\t(\t1.1\tAPPLIES\t(\ttest1\t$\t1.2.3.4\t$\ttest2\t)\t)\t";
         mrud = parser.parseMatchingRuleUseDescription( value );
         assertEquals( 3, mrud.getApplicableAttributes().size() );
         assertEquals( "test1", mrud.getApplicableAttributes().get( 0 ) );
@@ -129,7 +129,7 @@
         assertEquals( "test2", mrud.getApplicableAttributes().get( 2 ) );
 
         // APPLIES multi mixed no space
-        value = "( 1.1 APPLIES (TEST-1$1.2.3.4$TEST-2) )";
+        value = "(1.1 APPLIES(TEST-1$1.2.3.4$TEST-2))";
         mrud = parser.parseMatchingRuleUseDescription( value );
         assertEquals( 3, mrud.getApplicableAttributes().size() );
         assertEquals( "TEST-1", mrud.getApplicableAttributes().get( 0 ) );
@@ -215,7 +215,7 @@
         {
             // expected
         }
-        
+
         // APPLIES is required
         value = "( 1.1 )";
         try
@@ -286,17 +286,13 @@
     public void testUniqueElements()
     {
         String[] testValues = new String[]
-            { 
-                "( 1.1 APPLIES 1.1 NAME 'test1' NAME 'test2' )",
-                "( 1.1 APPLIES 1.1 DESC 'test1' DESC 'test2' )",
-                "( 1.1 APPLIES 1.1 OBSOLETE OBSOLETE )", 
-                "( 1.1 APPLIES 1.1 APPLIES test1 APPLIES test2 )",
-                "( 1.1 APPLIES 1.1 X-TEST 'test1' X-TEST 'test2' )" 
-            };
+            { "( 1.1 APPLIES 1.1 NAME 'test1' NAME 'test2' )", "( 1.1 APPLIES 1.1 DESC 'test1' DESC 'test2' )",
+                "( 1.1 APPLIES 1.1 OBSOLETE OBSOLETE )", "( 1.1 APPLIES 1.1 APPLIES test1 APPLIES test2 )",
+                "( 1.1 APPLIES 1.1 X-TEST 'test1' X-TEST 'test2' )" };
         SchemaParserTestUtils.testUnique( parser, testValues );
-    }    
-    
-    
+    }
+
+
     /**
      * Test required elements.
      * 
@@ -323,8 +319,8 @@
         }
 
     }
-    
-    
+
+
     ////////////////////////////////////////////////////////////////
     //       Some real-world matching rule use descriptons        //
     ////////////////////////////////////////////////////////////////

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/NameFormDescriptionSchemaParserTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/NameFormDescriptionSchemaParserTest.java?rev=662292&r1=662291&r2=662292&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/NameFormDescriptionSchemaParserTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/NameFormDescriptionSchemaParserTest.java Sun Jun  1 14:26:54 2008
@@ -400,15 +400,10 @@
     public void testUniqueElements()
     {
         String[] testValues = new String[]
-            { 
-                "( 1.1 OC o MUST m NAME 'test1' NAME 'test2' )", 
-                "( 1.1 OC o MUST m DESC 'test1' DESC 'test2' )",
-                "( 1.1 OC o MUST m OBSOLETE OBSOLETE )", 
-                "( 1.1 OC o MUST m OC test1 OC test2 )",
-                "( 1.1 OC o MUST m MUST test1 MUST test2 )",
-                "( 1.1 OC o MUST m MAY test1 MAY test2 )",
-                "( 1.1 OC o MUST m X-TEST 'test1' X-TEST 'test2' )" 
-            };
+            { "( 1.1 OC o MUST m NAME 'test1' NAME 'test2' )", "( 1.1 OC o MUST m DESC 'test1' DESC 'test2' )",
+                "( 1.1 OC o MUST m OBSOLETE OBSOLETE )", "( 1.1 OC o MUST m OC test1 OC test2 )",
+                "( 1.1 OC o MUST m MUST test1 MUST test2 )", "( 1.1 OC o MUST m MAY test1 MAY test2 )",
+                "( 1.1 OC o MUST m X-TEST 'test1' X-TEST 'test2' )" };
         SchemaParserTestUtils.testUnique( parser, testValues );
     }
 
@@ -452,47 +447,46 @@
     }
 
 
-//    /**
-//     * Test if MUST and MAY are disjoint.
-//     * 
-//     * Problem: What if MUST is a numeric oid and MAY is a name?
-//     * 
-//     * @throws ParseException
-//     */
-//    public void testDisjoint() throws ParseException
-//    {
-//        String value = null;
-//        NameFormDescription nfd = null;
-//
-//        value = "( 1.2.3.4.5.6.7.8.9.0 OC o MUST test1 MAY test2 )";
-//        nfd = parser.parseNameFormDescription( value );
-//        assertNotNull( nfd.getStructuralObjectClass() );
-//        assertEquals( 1, nfd.getMustAttributeTypes().size() );
-//
-//        value = "( 1.2.3.4.5.6.7.8.9.0 OC o MUST test1 MAY test1 )";
-//        try
-//        {
-//            nfd = parser.parseNameFormDescription( value );
-//            fail( "Exception expected, MUST and MAY must be disjoint" );
-//        }
-//        catch ( ParseException pe )
-//        {
-//            // expected
-//        }
-//
-//        value = "( 1.2.3.4.5.6.7.8.9.0 OC o MUST ( test1 $ test2 ) MAY ( test4 $ test3 $ test2 ) )";
-//        try
-//        {
-//            nfd = parser.parseNameFormDescription( value );
-//            fail( "Exception expected, MUST and MAY must be disjoint" );
-//        }
-//        catch ( ParseException pe )
-//        {
-//            // expected
-//        }
-//
-//    }
-
+    //    /**
+    //     * Test if MUST and MAY are disjoint.
+    //     * 
+    //     * Problem: What if MUST is a numeric oid and MAY is a name?
+    //     * 
+    //     * @throws ParseException
+    //     */
+    //    public void testDisjoint() throws ParseException
+    //    {
+    //        String value = null;
+    //        NameFormDescription nfd = null;
+    //
+    //        value = "( 1.2.3.4.5.6.7.8.9.0 OC o MUST test1 MAY test2 )";
+    //        nfd = parser.parseNameFormDescription( value );
+    //        assertNotNull( nfd.getStructuralObjectClass() );
+    //        assertEquals( 1, nfd.getMustAttributeTypes().size() );
+    //
+    //        value = "( 1.2.3.4.5.6.7.8.9.0 OC o MUST test1 MAY test1 )";
+    //        try
+    //        {
+    //            nfd = parser.parseNameFormDescription( value );
+    //            fail( "Exception expected, MUST and MAY must be disjoint" );
+    //        }
+    //        catch ( ParseException pe )
+    //        {
+    //            // expected
+    //        }
+    //
+    //        value = "( 1.2.3.4.5.6.7.8.9.0 OC o MUST ( test1 $ test2 ) MAY ( test4 $ test3 $ test2 ) )";
+    //        try
+    //        {
+    //            nfd = parser.parseNameFormDescription( value );
+    //            fail( "Exception expected, MUST and MAY must be disjoint" );
+    //        }
+    //        catch ( ParseException pe )
+    //        {
+    //            // expected
+    //        }
+    //
+    //    }
 
     /**
      * Tests the multithreaded use of a single parser.

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/NormalizerDescriptionSchemaParserTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/NormalizerDescriptionSchemaParserTest.java?rev=662292&r1=662291&r2=662292&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/NormalizerDescriptionSchemaParserTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/NormalizerDescriptionSchemaParserTest.java Sun Jun  1 14:26:54 2008
@@ -58,14 +58,12 @@
 
     public void testDescription() throws ParseException
     {
-        SchemaParserTestUtils
-            .testDescription( parser, "1.1", "FQCN org.apache.directory.SimpleComparator" );
+        SchemaParserTestUtils.testDescription( parser, "1.1", "FQCN org.apache.directory.SimpleComparator" );
     }
 
 
     public void testFqcn() throws ParseException
     {
-
         String value = null;
         NormalizerDescription nd = null;
 
@@ -74,13 +72,11 @@
         nd = parser.parseNormalizerDescription( value );
         assertNotNull( nd.getFqcn() );
         assertEquals( "org.apache.directory.SimpleComparator", nd.getFqcn() );
-
     }
 
 
     public void testBytecode() throws ParseException
     {
-
         String value = null;
         NormalizerDescription nd = null;
 
@@ -89,7 +85,6 @@
         nd = parser.parseNormalizerDescription( value );
         assertNotNull( nd.getBytecode() );
         assertEquals( "ABCDEFGHIJKLMNOPQRSTUVWXYZ+/abcdefghijklmnopqrstuvwxyz0123456789====", nd.getBytecode() );
-
     }
 
 

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/ObjectClassDescriptionSchemaParserTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/ObjectClassDescriptionSchemaParserTest.java?rev=662292&r1=662291&r2=662292&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/ObjectClassDescriptionSchemaParserTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/ObjectClassDescriptionSchemaParserTest.java Sun Jun  1 14:26:54 2008
@@ -148,16 +148,16 @@
         assertEquals( "top1", ocd.getSuperiorObjectClasses().get( 0 ) );
         assertEquals( "top2", ocd.getSuperiorObjectClasses().get( 1 ) );
 
-        // SUP multi mixed
-        value = "( 1.1 SUP ( top1 $ 1.2.3.4 $ top2 ) )";
+        // SUP multi mixed, tabs
+        value = "\t(\t1.1\tSUP\t(\ttop1\t$\t1.2.3.4\t$\ttop2\t)\t)\t";
         ocd = parser.parseObjectClassDescription( value );
         assertEquals( 3, ocd.getSuperiorObjectClasses().size() );
         assertEquals( "top1", ocd.getSuperiorObjectClasses().get( 0 ) );
         assertEquals( "1.2.3.4", ocd.getSuperiorObjectClasses().get( 1 ) );
         assertEquals( "top2", ocd.getSuperiorObjectClasses().get( 2 ) );
 
-        // SUP multi mixed no space
-        value = "( 1.1 SUP (TOP-1$1.2.3.4$TOP-2) )";
+        // SUP multi mixed, no space
+        value = "(1.1 SUP(TOP-1$1.2.3.4$TOP-2))";
         ocd = parser.parseObjectClassDescription( value );
         assertEquals( 3, ocd.getSuperiorObjectClasses().size() );
         assertEquals( "TOP-1", ocd.getSuperiorObjectClasses().get( 0 ) );
@@ -266,13 +266,13 @@
         ocd = parser.parseObjectClassDescription( value );
         assertEquals( ObjectClassTypeEnum.ABSTRACT, ocd.getKind() );
 
-        // AUXILIARY
-        value = "( 1.1 AUXILIARY )";
+        // AUXILIARY, tab
+        value = "\t(\t1.1\tAUXILIARY\t)\t";
         ocd = parser.parseObjectClassDescription( value );
         assertEquals( ObjectClassTypeEnum.AUXILIARY, ocd.getKind() );
 
-        // STRUCTURAL
-        value = "( 1.1 STRUCTURAL )";
+        // STRUCTURAL, no space
+        value = "(1.1 STRUCTURAL)";
         ocd = parser.parseObjectClassDescription( value );
         assertEquals( ObjectClassTypeEnum.STRUCTURAL, ocd.getKind() );
 
@@ -313,7 +313,7 @@
         assertEquals( "1.2.3", ocd.getMustAttributeTypes().get( 0 ) );
 
         // MUST mulitple
-        value = "(1.1 MUST (cn$sn       $11.22.33.44.55         $  objectClass   ))";
+        value = "(1.1 MUST(cn$sn\r$11.22.33.44.55         $  objectClass   ))";
         ocd = parser.parseObjectClassDescription( value );
         assertEquals( 4, ocd.getMustAttributeTypes().size() );
         assertEquals( "cn", ocd.getMustAttributeTypes().get( 0 ) );
@@ -370,7 +370,7 @@
         assertEquals( "1.2.3", ocd.getMayAttributeTypes().get( 0 ) );
 
         // MAY mulitple
-        value = "(1.1 MAY (cn$sn       $11.22.33.44.55         $  objectClass   ))";
+        value = "(1.1 MAY(cn$sn       $11.22.33.44.55\n$  objectClass   ))";
         ocd = parser.parseObjectClassDescription( value );
         assertEquals( 4, ocd.getMayAttributeTypes().size() );
         assertEquals( "cn", ocd.getMayAttributeTypes().get( 0 ) );

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/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?rev=662292&r1=662291&r2=662292&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/SchemaParserTestUtils.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/SchemaParserTestUtils.java Sun Jun  1 14:26:54 2008
@@ -36,7 +36,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class SchemaParserTestUtils 
+public class SchemaParserTestUtils
 {
 
     /**
@@ -74,22 +74,32 @@
         }
 
         // simple
-        value = "( 0.1.2.3.4.5.6.7.8.9 "+required+" )";
+        value = "( 0.1.2.3.4.5.6.7.8.9 " + required + " )";
         asd = parser.parse( value );
         Assert.assertEquals( "0.1.2.3.4.5.6.7.8.9", asd.getNumericOid() );
 
         // simple
-        value = "( 123.4567.890 "+required+")";
+        value = "( 123.4567.890 " + required + ")";
         asd = parser.parse( value );
         Assert.assertEquals( "123.4567.890", asd.getNumericOid() );
-        
-        // simple with spaces
-        value = "(          0.1.2.3.4.5.6.7.8.9         "+required+" )";
+
+        // simple with multiple spaces
+        value = "(          0.1.2.3.4.5.6.7.8.9         " + required + " )";
+        asd = parser.parse( value );
+        Assert.assertEquals( "0.1.2.3.4.5.6.7.8.9", asd.getNumericOid() );
+
+        // simple w/o spaces
+        value = "(0.1.2.3.4.5.6.7.8.9 " + required + ")";
+        asd = parser.parse( value );
+        Assert.assertEquals( "0.1.2.3.4.5.6.7.8.9", asd.getNumericOid() );
+
+        // simple with tabs, newline, comment.
+        value = "(\t0.1.2.3.4.5.6.7.8.9\n#comment\n\t" + required + "\r\n)\r";
         asd = parser.parse( value );
         Assert.assertEquals( "0.1.2.3.4.5.6.7.8.9", asd.getNumericOid() );
 
         // non-numeric not allowed
-        value = "( test "+required+" )";
+        value = "( test " + required + " )";
         try
         {
             parser.parse( value );
@@ -101,7 +111,7 @@
         }
 
         // to short
-        value = "( 1 "+required+" )";
+        value = "( 1 " + required + " )";
         try
         {
             parser.parse( value );
@@ -113,7 +123,7 @@
         }
 
         // dot only
-        value = "( . "+required+" )";
+        value = "( . " + required + " )";
         try
         {
             parser.parse( value );
@@ -125,7 +135,7 @@
         }
 
         // ends with dot
-        value = "( 1.1. "+required+" )";
+        value = "( 1.1. " + required + " )";
         try
         {
             parser.parse( value );
@@ -137,7 +147,7 @@
         }
 
         // quotes not allowed
-        value = "( '1.1' "+required+" )";
+        value = "( '1.1' " + required + " )";
         try
         {
             parser.parse( value );
@@ -149,7 +159,7 @@
         }
 
         // leading 0 not allowed
-        value = "( 01.1 "+required+" )";
+        value = "( 01.1 " + required + " )";
         try
         {
             parser.parse( value );
@@ -161,7 +171,7 @@
         }
 
         // alpha not allowed
-        value = "( 1.2.a.4 "+required+" )";
+        value = "( 1.2.a.4 " + required + " )";
         try
         {
             parser.parse( value );
@@ -171,9 +181,10 @@
         {
             Assert.assertTrue( true );
         }
-        
+
     }
-    
+
+
     /**
      * Tests NAME and its values
      * 
@@ -185,38 +196,40 @@
         AbstractSchemaDescription asd = null;
 
         // alpha
-        value = "( "+oid+" "+required+" NAME 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' )";
+        value = "( " + oid + " " + required + " NAME 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' )";
         asd = parser.parse( value );
         Assert.assertEquals( 1, asd.getNames().size() );
         Assert.assertEquals( "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", asd.getNames().get( 0 ) );
 
         // alpha-num-hypen
-        value = "( "+oid+" "+required+" NAME 'abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789' )";
+        value = "( " + oid + " " + required
+            + " NAME 'abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789' )";
         asd = parser.parse( value );
         Assert.assertEquals( 1, asd.getNames().size() );
-        Assert.assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", asd.getNames().get( 0 ) );
+        Assert
+            .assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", asd.getNames().get( 0 ) );
 
         // with parentheses
-        value = "( "+oid+" "+required+" NAME ( 'a-z-0-9' ) )";
+        value = "( " + oid + " " + required + " NAME ( 'a-z-0-9' ) )";
         asd = parser.parse( value );
         Assert.assertEquals( 1, asd.getNames().size() );
         Assert.assertEquals( "a-z-0-9", asd.getNames().get( 0 ) );
 
         // with parentheses, without space
-        value = "( "+oid+" "+required+" NAME ('a-z-0-9') )";
+        value = "(" + oid + " " + required + " NAME('a-z-0-9'))";
         asd = parser.parse( value );
         Assert.assertEquals( 1, asd.getNames().size() );
         Assert.assertEquals( "a-z-0-9", asd.getNames().get( 0 ) );
 
         // multi with space
-        value = "( "+oid+" "+required+" NAME ( 'test1' 'test2' ) )";
+        value = " ( " + oid + " " + required + " NAME ( 'test1' 'test2' ) ) ";
         asd = parser.parse( value );
         Assert.assertEquals( 2, asd.getNames().size() );
         Assert.assertEquals( "test1", asd.getNames().get( 0 ) );
         Assert.assertEquals( "test2", asd.getNames().get( 1 ) );
 
         // multi without space
-        value = "( "+oid+" "+required+" NAME ('test1' 'test2' 'test3') )";
+        value = "(" + oid + " " + required + " NAME('test1''test2''test3'))";
         asd = parser.parse( value );
         Assert.assertEquals( 3, asd.getNames().size() );
         Assert.assertEquals( "test1", asd.getNames().get( 0 ) );
@@ -224,7 +237,17 @@
         Assert.assertEquals( "test3", asd.getNames().get( 2 ) );
 
         // multi with many spaces
-        value = "(          "+oid+" "+required+"          NAME          (          'test1'          'test2'          'test3'          )          )";
+        value = "(          " + oid + " " + required
+            + "          NAME          (          'test1'          'test2'          'test3'          )          )";
+        asd = parser.parse( value );
+        Assert.assertEquals( 3, asd.getNames().size() );
+        Assert.assertEquals( "test1", asd.getNames().get( 0 ) );
+        Assert.assertEquals( "test2", asd.getNames().get( 1 ) );
+        Assert.assertEquals( "test3", asd.getNames().get( 2 ) );
+
+        // multi with tabs, newline, comment, etc.
+        value = "(\r\n" + oid + "\r" + required
+            + "\nNAME\t(\t\t\t'test1'\t\n\t'test2'\t\r\t'test3'\t\r\n\t)\n#comment\n)";
         asd = parser.parse( value );
         Assert.assertEquals( 3, asd.getNames().size() );
         Assert.assertEquals( "test1", asd.getNames().get( 0 ) );
@@ -232,7 +255,7 @@
         Assert.assertEquals( "test3", asd.getNames().get( 2 ) );
 
         // lowercase
-        value = "( "+oid+" "+required+" name 'test' )";
+        value = "( " + oid + " " + required + " name 'test' )";
         try
         {
             parser.parse( value );
@@ -244,7 +267,7 @@
         }
 
         // unquoted
-        value = "( "+oid+" "+required+" NAME test )";
+        value = "( " + oid + " " + required + " NAME test )";
         try
         {
             parser.parse( value );
@@ -256,7 +279,7 @@
         }
 
         // start with number
-        value = "( "+oid+" "+required+" NAME '1test' )";
+        value = "( " + oid + " " + required + " NAME '1test' )";
         try
         {
             parser.parse( value );
@@ -268,7 +291,7 @@
         }
 
         // start with hypen
-        value = "( "+oid+" "+required+" NAME '-test' )";
+        value = "( " + oid + " " + required + " NAME '-test' )";
         try
         {
             parser.parse( value );
@@ -280,7 +303,7 @@
         }
 
         // invalid character
-        value = "( "+oid+" "+required+" NAME 'te_st' )";
+        value = "( " + oid + " " + required + " NAME 'te_st' )";
         try
         {
             parser.parse( value );
@@ -292,7 +315,7 @@
         }
 
         // NAM unknown
-        value = "( "+oid+" "+required+" NAM 'test' )";
+        value = "( " + oid + " " + required + " NAM 'test' )";
         try
         {
             parser.parse( value );
@@ -304,7 +327,7 @@
         }
 
         // one valid, one invalid
-        value = "( "+oid+" "+required+" NAME ( 'test' 'te_st' ) )";
+        value = "( " + oid + " " + required + " NAME ( 'test' 'te_st' ) )";
         try
         {
             parser.parse( value );
@@ -314,57 +337,56 @@
         {
             // expected
         }
-
-        // no space between values
-        value = "( "+oid+" "+required+" NAME ( 'test1''test2' ) )";
-        try
-        {
-            asd = parser.parse( value );
-            Assert.fail( "Exception expected, invalid NAME values (no space between values)" );
-        }
-        catch ( ParseException pe )
-        {
-            Assert.assertTrue( true );
-        }
     }
-    
-    
+
+
     /**
      * Tests DESC
      * 
      * @throws ParseException
      */
-    public static void testDescription( AbstractSchemaParser parser, String oid, String required ) throws ParseException
+    public static void testDescription( AbstractSchemaParser parser, String oid, String required )
+        throws ParseException
     {
         String value = null;
         AbstractSchemaDescription asd = null;
 
         // simple
-        value = "("+oid+" "+required+" DESC 'Descripton')";
+        value = "(" + oid + " " + required + " DESC 'Descripton')";
+        asd = parser.parse( value );
+        Assert.assertEquals( "Descripton", asd.getDescription() );
+
+        // simple with tabs, newline, comment, etc.
+        value = "(" + oid + "\n" + required + "\tDESC#comment\n\n\r\n\r\t'Descripton')";
+        asd = parser.parse( value );
+        Assert.assertEquals( "Descripton", asd.getDescription() );
+
+        // simple w/o space
+        value = "(" + oid + " " + required + " DESC'Descripton')";
         asd = parser.parse( value );
         Assert.assertEquals( "Descripton", asd.getDescription() );
 
         // unicode
-        value = "( "+oid+" "+required+" DESC 'Descripton \u00E4\u00F6\u00FC\u00DF \u90E8\u9577' )";
+        value = "( " + oid + " " + required + " DESC 'Descripton \u00E4\u00F6\u00FC\u00DF \u90E8\u9577' )";
         asd = parser.parse( value );
         Assert.assertEquals( "Descripton \u00E4\u00F6\u00FC\u00DF \u90E8\u9577", asd.getDescription() );
-        
+
         // escaped characters
-        value = "( "+oid+" "+required+" DESC 'test\\5Ctest' )";
+        value = "( " + oid + " " + required + " DESC 'test\\5Ctest' )";
         asd = parser.parse( value );
         Assert.assertEquals( "test\\test", asd.getDescription() );
-        value = "( "+oid+" "+required+" DESC 'test\\5ctest' )";
+        value = "( " + oid + " " + required + " DESC 'test\\5ctest' )";
         asd = parser.parse( value );
         Assert.assertEquals( "test\\test", asd.getDescription() );
-        value = "( "+oid+" "+required+" DESC 'test\\27test' )";
+        value = "( " + oid + " " + required + " DESC 'test\\27test' )";
         asd = parser.parse( value );
         Assert.assertEquals( "test'test", asd.getDescription() );
-        value = "( "+oid+" "+required+" DESC '\\5C\\27\\5c' )";
+        value = "( " + oid + " " + required + " DESC '\\5C\\27\\5c' )";
         asd = parser.parse( value );
         Assert.assertEquals( "\\'\\", asd.getDescription() );
-        
+
         // lowercase
-        value = "( "+oid+" "+required+" desc 'Descripton' )";
+        value = "( " + oid + " " + required + " desc 'Descripton' )";
         try
         {
             parser.parse( value );
@@ -374,10 +396,10 @@
         {
             Assert.assertTrue( true );
         }
-        
+
     }
-    
-    
+
+
     /**
      * Test extensions.
      * 
@@ -389,12 +411,12 @@
         AbstractSchemaDescription asd = null;
 
         // no extension
-        value = "( "+oid+" "+required+" )";
+        value = "( " + oid + " " + required + " )";
         asd = parser.parse( value );
         Assert.assertEquals( 0, asd.getExtensions().size() );
 
         // single extension with one value
-        value = "( "+oid+" "+required+" X-TEST 'test' )";
+        value = "( " + oid + " " + required + " X-TEST 'test' )";
         asd = parser.parse( value );
         Assert.assertEquals( 1, asd.getExtensions().size() );
         Assert.assertNotNull( asd.getExtensions().get( "X-TEST" ) );
@@ -402,7 +424,8 @@
         Assert.assertEquals( "test", asd.getExtensions().get( "X-TEST" ).get( 0 ) );
 
         // single extension with multiple values
-        value = "( "+oid+" "+required+" X-TEST-ABC ('test1' 'test \u00E4\u00F6\u00FC\u00DF'       'test \u90E8\u9577' ) )";
+        value = "( " + oid + " " + required
+            + " X-TEST-ABC ('test1' 'test \u00E4\u00F6\u00FC\u00DF'       'test \u90E8\u9577' ) )";
         asd = parser.parse( value );
         Assert.assertEquals( 1, asd.getExtensions().size() );
         Assert.assertNotNull( asd.getExtensions().get( "X-TEST-ABC" ) );
@@ -412,7 +435,34 @@
         Assert.assertEquals( "test \u90E8\u9577", asd.getExtensions().get( "X-TEST-ABC" ).get( 2 ) );
 
         // multiple extensions
-        value = "("+oid+" "+required+" X-TEST-a ('test1-1' 'test1-2') X-TEST-b ('test2-1' 'test2-2'))";
+        value = "(" + oid + " " + required + " X-TEST-a ('test1-1' 'test1-2') X-TEST-b ('test2-1' 'test2-2'))";
+        asd = parser.parse( value );
+        Assert.assertEquals( 2, asd.getExtensions().size() );
+        Assert.assertNotNull( asd.getExtensions().get( "X-TEST-a" ) );
+        Assert.assertEquals( 2, asd.getExtensions().get( "X-TEST-a" ).size() );
+        Assert.assertEquals( "test1-1", asd.getExtensions().get( "X-TEST-a" ).get( 0 ) );
+        Assert.assertEquals( "test1-2", asd.getExtensions().get( "X-TEST-a" ).get( 1 ) );
+        Assert.assertNotNull( asd.getExtensions().get( "X-TEST-b" ) );
+        Assert.assertEquals( 2, asd.getExtensions().get( "X-TEST-b" ).size() );
+        Assert.assertEquals( "test2-1", asd.getExtensions().get( "X-TEST-b" ).get( 0 ) );
+        Assert.assertEquals( "test2-2", asd.getExtensions().get( "X-TEST-b" ).get( 1 ) );
+
+        // multiple extensions, no spaces
+        value = "(" + oid + " " + required + " X-TEST-a('test1-1''test1-2')X-TEST-b('test2-1''test2-2'))";
+        asd = parser.parse( value );
+        Assert.assertEquals( 2, asd.getExtensions().size() );
+        Assert.assertNotNull( asd.getExtensions().get( "X-TEST-a" ) );
+        Assert.assertEquals( 2, asd.getExtensions().get( "X-TEST-a" ).size() );
+        Assert.assertEquals( "test1-1", asd.getExtensions().get( "X-TEST-a" ).get( 0 ) );
+        Assert.assertEquals( "test1-2", asd.getExtensions().get( "X-TEST-a" ).get( 1 ) );
+        Assert.assertNotNull( asd.getExtensions().get( "X-TEST-b" ) );
+        Assert.assertEquals( 2, asd.getExtensions().get( "X-TEST-b" ).size() );
+        Assert.assertEquals( "test2-1", asd.getExtensions().get( "X-TEST-b" ).get( 0 ) );
+        Assert.assertEquals( "test2-2", asd.getExtensions().get( "X-TEST-b" ).get( 1 ) );
+
+        // multiple extensions, tabs, newline, comments
+        value = "(" + oid + "\n#comment\n" + required
+            + "\nX-TEST-a\n(\t'test1-1'\t\n'test1-2'\n\r)\tX-TEST-b\n(\n'test2-1'\t'test2-2'\t)\r)";
         asd = parser.parse( value );
         Assert.assertEquals( 2, asd.getExtensions().size() );
         Assert.assertNotNull( asd.getExtensions().get( "X-TEST-a" ) );
@@ -425,15 +475,18 @@
         Assert.assertEquals( "test2-2", asd.getExtensions().get( "X-TEST-b" ).get( 1 ) );
 
         // some more complicated
-        value = "("+oid+" "+required+" X-_-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ('\\5C\\27\\5c'))";
+        value = "(" + oid + " " + required
+            + " X-_-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ('\\5C\\27\\5c'))";
         asd = parser.parse( value );
         Assert.assertEquals( 1, asd.getExtensions().size() );
         Assert.assertNotNull( asd.getExtensions().get( "X-_-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" ) );
-        Assert.assertEquals( 1, asd.getExtensions().get( "X-_-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" ).size() );
-        Assert.assertEquals( "\\'\\", asd.getExtensions().get( "X-_-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" ).get( 0 ) );
-        
+        Assert.assertEquals( 1, asd.getExtensions().get( "X-_-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" )
+            .size() );
+        Assert.assertEquals( "\\'\\", asd.getExtensions().get(
+            "X-_-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" ).get( 0 ) );
+
         // invalid extension, no number allowed
-        value = "( "+oid+" "+required+" X-TEST1 'test' )";
+        value = "( " + oid + " " + required + " X-TEST1 'test' )";
         try
         {
             asd = parser.parse( value );
@@ -446,7 +499,7 @@
 
     }
 
-    
+
     /**
      * Tests OBSOLETE
      * 
@@ -458,27 +511,27 @@
         AbstractSchemaDescription asd = null;
 
         // not obsolete
-        value = "( "+oid+" "+required+" )";
+        value = "( " + oid + " " + required + " )";
         asd = parser.parse( value );
         Assert.assertFalse( asd.isObsolete() );
 
         // not obsolete
-        value = "( "+oid+" "+required+" NAME 'test' DESC 'Descripton' )";
+        value = "( " + oid + " " + required + " NAME 'test' DESC 'Descripton' )";
         asd = parser.parse( value );
         Assert.assertFalse( asd.isObsolete() );
-        
+
         // obsolete
-        value = "("+oid+" "+required+" NAME 'test' DESC 'Descripton' OBSOLETE)";
+        value = "(" + oid + " " + required + " NAME 'test' DESC 'Descripton' OBSOLETE)";
         asd = parser.parse( value );
         Assert.assertTrue( asd.isObsolete() );
 
         // obsolete 
-        value = "("+oid+" "+required+" OBSOLETE)";
+        value = "(" + oid + " " + required + " OBSOLETE)";
         asd = parser.parse( value );
         Assert.assertTrue( asd.isObsolete() );
 
-        // ivalid
-        value = "("+oid+" "+required+" NAME 'test' DESC 'Descripton' OBSOLET )";
+        // invalid
+        value = "(" + oid + " " + required + " NAME 'test' DESC 'Descripton' OBSOLET )";
         try
         {
             asd = parser.parse( value );
@@ -488,9 +541,9 @@
         {
             // expected
         }
-        
+
         // trailing value not allowed
-        value = "("+oid+" "+required+" NAME 'test' DESC 'Descripton' OBSOLETE 'true' )";
+        value = "(" + oid + " " + required + " NAME 'test' DESC 'Descripton' OBSOLETE 'true' )";
         try
         {
             asd = parser.parse( value );
@@ -500,11 +553,10 @@
         {
             Assert.assertTrue( true );
         }
-        
+
     }
-    
-    
-    
+
+
     /**
      * Tests for unique elements.
      * 
@@ -518,17 +570,17 @@
             try
             {
                 parser.parse( testValue );
-                Assert.fail( "Exception expected, element appears twice in "+testValue );
+                Assert.fail( "Exception expected, element appears twice in " + testValue );
             }
             catch ( ParseException pe )
             {
                 Assert.assertTrue( true );
             }
         }
-        
+
     }
-    
-    
+
+
     /**
      * Tests the multithreaded use of a single parser.
      */
@@ -536,7 +588,7 @@
     {
         final boolean[] isSuccessMultithreaded = new boolean[1];
         isSuccessMultithreaded[0] = true;
-        
+
         // start up and track all threads (40 threads)
         List<Thread> threads = new ArrayList<Thread>();
         for ( int ii = 0; ii < 10; ii++ )
@@ -565,7 +617,7 @@
 
         // check that no one thread failed to parse and generate a SS object
         Assert.assertTrue( isSuccessMultithreaded[0] );
-        
+
     }
 
     static class ParseSpecification implements Runnable
@@ -573,17 +625,18 @@
         private final AbstractSchemaParser parser;
         private final String value;
         private final boolean[] isSuccessMultithreaded;
-        
+
         private AbstractSchemaDescription result;
-        
+
+
         public ParseSpecification( AbstractSchemaParser parser, String value, boolean[] isSuccessMultithreaded )
         {
             this.parser = parser;
             this.value = value;
             this.isSuccessMultithreaded = isSuccessMultithreaded;
         }
-        
-        
+
+
         public void run()
         {
             try
@@ -594,10 +647,9 @@
             {
                 e.printStackTrace();
             }
-            
+
             isSuccessMultithreaded[0] = isSuccessMultithreaded[0] && ( result != null );
         }
     }
-    
-    
+
 }

Modified: 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?rev=662292&r1=662291&r2=662292&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/SyntaxCheckerDescriptionSchemaParserTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/SyntaxCheckerDescriptionSchemaParserTest.java Sun Jun  1 14:26:54 2008
@@ -70,7 +70,6 @@
 
     public void testFqcn() throws ParseException
     {
-
         String value = null;
         SyntaxCheckerDescription scd = null;
 
@@ -79,13 +78,11 @@
         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;
 
@@ -94,7 +91,6 @@
         scd = parser.parseSyntaxCheckerDescription( value );
         assertNotNull( scd.getBytecode() );
         assertEquals( "ABCDEFGHIJKLMNOPQRSTUVWXYZ+/abcdefghijklmnopqrstuvwxyz0123456789====", scd.getBytecode() );
-
     }
 
 



Mime
View raw message