directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r503376 - in /directory/shared/trunk/ldap/src: main/java/org/apache/directory/shared/ldap/schema/ test/java/org/apache/directory/shared/ldap/schema/syntax/parser/
Date Sun, 04 Feb 2007 09:37:12 GMT
Author: akarasulu
Date: Sun Feb  4 01:37:11 2007
New Revision: 503376

URL: http://svn.apache.org/viewvc?view=rev&rev=503376
Log:
changes ...

 o added test case for syntax parser
 o added ability to render schema and binary extensions
 

Added:
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/SyntaxDescriptionSchemaParserTest.java
Modified:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaUtils.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/AttributeTypeDescriptionSchemaParserTest.java

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaUtils.java?view=diff&rev=503376&r1=503375&r2=503376
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaUtils.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaUtils.java
Sun Feb  4 01:37:11 2007
@@ -441,6 +441,10 @@
             buf.append( " MAY " );
             render( buf, oc.getMayList() );
         }
+        
+        buf.append( " X-SCHEMA '" );
+        buf.append( oc.getSchema() );
+        buf.append( "'" );
 
         // @todo extensions are not presently supported and skipped
         // the extensions would go here before closing off the description
@@ -575,6 +579,10 @@
             buf.append( " USAGE " ).append( UsageEnum.render( at.getUsage() ) );
         }
 
+        buf.append( " X-SCHEMA '" );
+        buf.append( at.getSchema() );
+        buf.append( "'" );
+
         // @todo extensions are not presently supported and skipped
         // the extensions would go here before closing off the description
 
@@ -649,6 +657,10 @@
             buf.append( " SYNTAX " ).append( mr.getSyntax().getOid() );
         }
 
+        buf.append( " X-SCHEMA '" );
+        buf.append( mr.getSchema() );
+        buf.append( "'" );
+
         // @todo extensions are not presently supported and skipped
         // the extensions would go here before closing off the description
 
@@ -692,6 +704,18 @@
             buf.append( "DESC " ).append( "'" ).append( syntax.getDescription() ).append(
"' " );
         }
 
+        buf.append( " X-SCHEMA '" );
+        buf.append( syntax.getSchema() );
+        
+        if ( syntax.isHumanReadible() )
+        {
+            buf.append( "' X-IS-HUMAN-READABLE 'true'" );
+        }
+        else
+        {
+            buf.append( "' X-IS-HUMAN-READABLE 'false'" );
+        }
+
         // @todo extensions are not presently supported and skipped
         // the extensions would go here before closing off the description
 
@@ -715,6 +739,10 @@
             buf.append( "DESC " ).append( "'" ).append( mru.getDescription() ).append( "'
" );
         }
 
+        buf.append( " X-SCHEMA '" );
+        buf.append( mru.getSchema() );
+        buf.append( "'" );
+
         // @todo extensions are not presently supported and skipped
         // the extensions would go here before closing off the description
 
@@ -738,6 +766,10 @@
             buf.append( "DESC " ).append( "'" ).append( dcr.getDescription() ).append( "'
" );
         }
 
+        buf.append( " X-SCHEMA '" );
+        buf.append( dcr.getSchema() );
+        buf.append( "'" );
+
         // @todo extensions are not presently supported and skipped
         // the extensions would go here before closing off the description
 
@@ -761,6 +793,10 @@
             buf.append( "DESC " ).append( "'" ).append( dsr.getDescription() ).append( "'
" );
         }
 
+        buf.append( " X-SCHEMA '" );
+        buf.append( dsr.getSchema() );
+        buf.append( "'" );
+
         // @todo extensions are not presently supported and skipped
         // the extensions would go here before closing off the description
 
@@ -783,6 +819,10 @@
         {
             buf.append( "DESC " ).append( "'" ).append( nf.getDescription() ).append( "'
" );
         }
+
+        buf.append( " X-SCHEMA '" );
+        buf.append( nf.getSchema() );
+        buf.append( "'" );
 
         // @todo extensions are not presently supported and skipped
         // the extensions would go here before closing off the description

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?view=diff&rev=503376&r1=503375&r2=503376
==============================================================================
--- 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 Feb  4 01:37:11 2007
@@ -20,10 +20,10 @@
 package org.apache.directory.shared.ldap.schema.syntax.parser;
 
 
-import org.apache.directory.shared.ldap.schema.syntax.AttributeTypeDescription;
-
 import junit.framework.TestCase;
 
+import org.apache.directory.shared.ldap.schema.syntax.AttributeTypeDescription;
+
 
 /**
  * Tests the AttributeTypeDescriptionSchemaParser.
@@ -56,7 +56,7 @@
     /**
      * Tests the parse of a simple AttributeType with the schema extension.
      */
-    public void testAddAttributeTypeWithSchemaExtension() throws Exception
+    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' )";

Added: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/SyntaxDescriptionSchemaParserTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/SyntaxDescriptionSchemaParserTest.java?view=auto&rev=503376
==============================================================================
--- 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/SyntaxDescriptionSchemaParserTest.java
Sun Feb  4 01:37:11 2007
@@ -0,0 +1,50 @@
+/*
+ *  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 org.apache.directory.shared.ldap.schema.syntax.LdapSyntaxDescription;
+
+import junit.framework.TestCase;
+
+
+/**
+ * Document me!
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class SyntaxDescriptionSchemaParserTest extends TestCase
+{
+    private LdapSyntaxDescriptionSchemaParser parser = new LdapSyntaxDescriptionSchemaParser();
+    
+    
+    /**
+     * 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" ) );
+    }
+}



Mime
View raw message