directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: rev 54224 - in incubator/directory/eve/trunk/backend/tools/src: antlr test/org/apache/eve/tools/schema
Date Sun, 10 Oct 2004 07:47:41 GMT
Author: akarasulu
Date: Sun Oct 10 00:47:40 2004
New Revision: 54224

Modified:
   incubator/directory/eve/trunk/backend/tools/src/antlr/openldap.g
   incubator/directory/eve/trunk/backend/tools/src/test/org/apache/eve/tools/schema/OpenLdapSchemaParserTest.java
Log:
Commit changes ...
 
 o added test for multiple names in attributeTypes
 o fixed bug on revieled by test on multiple names on attributeTypes production



Modified: incubator/directory/eve/trunk/backend/tools/src/antlr/openldap.g
==============================================================================
--- incubator/directory/eve/trunk/backend/tools/src/antlr/openldap.g	(original)
+++ incubator/directory/eve/trunk/backend/tools/src/antlr/openldap.g	Sun Oct 10 00:47:40 2004
@@ -436,20 +436,17 @@
     ArrayList list = new ArrayList();
 }
     :
+        "NAME"
     (
-        "NAME" QUOTE id0:IDENTIFIER QUOTE
-        {
-            list.add( id0.getText() );
-        }
-        |
-        ( OPEN_PAREN QUOTE id1:IDENTIFIER
-        {
-            list.add( id1.getText() );
-        } QUOTE
-        ( QUOTE id2:IDENTIFIER QUOTE
-        {
-            list.add( id2.getText() );
-        } )* CLOSE_PAREN )
+        QUOTE id0:IDENTIFIER QUOTE { list.add( id0.getText() ); } |
+        ( OPEN_PAREN
+            ( QUOTE id1:IDENTIFIER
+                {
+                    list.add( id1.getText() );
+                }
+              QUOTE
+            )+
+        CLOSE_PAREN )
     )
     {
         type.setNames( ( String[] ) list.toArray( EMPTY ) );

Modified: incubator/directory/eve/trunk/backend/tools/src/test/org/apache/eve/tools/schema/OpenLdapSchemaParserTest.java
==============================================================================
--- incubator/directory/eve/trunk/backend/tools/src/test/org/apache/eve/tools/schema/OpenLdapSchemaParserTest.java
(original)
+++ incubator/directory/eve/trunk/backend/tools/src/test/org/apache/eve/tools/schema/OpenLdapSchemaParserTest.java
Sun Oct 10 00:47:40 2004
@@ -54,10 +54,31 @@
         parser = null;
     }
 
-    public void testParser() throws Exception
+
+    public void testSimpleAttributeType() throws Exception
     {
         String attributeTypeData = "# adding a comment  \n" +
             "attributetype ( 2.5.4.2 NAME 'knowledgeInformation'\n" +
+            "        DESC 'RFC2256: knowledge information'\n" +
+            "        EQUALITY caseIgnoreMatch\n" +
+            "        SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{32768} )";
+        parser.parse( attributeTypeData );
+        Map attributeTypes = parser.getAttributeTypes();
+        AttributeTypeLiteral type = ( AttributeTypeLiteral ) attributeTypes.get( "2.5.4.2"
);
+
+        assertNotNull( type );
+        assertEquals( "2.5.4.2", type.getOid() );
+        assertEquals( "knowledgeInformation", type.getNames()[0] );
+        assertEquals( "RFC2256: knowledge information", type.getDescription() );
+        assertEquals( "1.3.6.1.4.1.1466.115.121.1.15", type.getSyntax() );
+        assertEquals( 32768, type.getLength() );
+    }
+
+
+    public void testComplexAttributeType() throws Exception
+    {
+        String attributeTypeData = "# adding a comment  \n" +
+            "attributetype ( 2.5.4.2 NAME ( 'knowledgeInformation' 'asdf' ) \n" +
             "        DESC 'RFC2256: knowledge information'\n" +
             "        EQUALITY caseIgnoreMatch\n" +
             "        SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{32768} )";

Mime
View raw message