Hi Emmanuel,

Why is SS SC added as a binary syntax checker? It's human readable, isn't it?

On 12/23/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Author: elecharny
Date: Fri Dec 22 15:02:34 2006
New Revision: 489796

URL: http://svn.apache.org/viewvc?view=rev&rev=489796
Log:
Added the subtree specification binary SC

Added:
    
directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/SubtreeSpecificationSyntaxChecker.java
    
directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SubtreeSpecificationSyntaxCheckerTest.java

Added: 
directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/SubtreeSpecificationSyntaxChecker.java
URL: 
http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/SubtreeSpecificationSyntaxChecker.java?view=auto&rev=489796
==============================================================================
--- 
directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/SubtreeSpecificationSyntaxChecker.java
 (added)
+++ 
directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/SubtreeSpecificationSyntaxChecker.java
 Fri Dec 22 15:02:34 2006
@@ -0,0 +1,64 @@
+/*
+ *  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;
+
+
+/**
+ * A SyntaxChecker which verifies that a value is a subtree specification.
+ *
+ * It has been removed in RFC 4517
+ *
+ * @author <a href="mailto:[email protected]";>Apache Directory 
Project</a>
+ * @version $Rev: 488616 $
+ */
+public class SubtreeSpecificationSyntaxChecker extends BinarySyntaxChecker
+{
+    /** the Apache assigned internal OID for this syntax checker */
+    private static final String SC_OID = "1.3.6.1.4.1.1466.115.121.1.45";
+
+
+    /**
+     * Private default constructor to prevent unnecessary instantiation.
+     */
+    public SubtreeSpecificationSyntaxChecker()
+    {
+        super( SC_OID );
+    }
+
+    /**
+     *
+     * Creates a new instance of SubtreeSpecificationSyntaxChecker.
+     *
+     * @param the oid to associate with this new SyntaxChecker
+     *
+     */
+    protected SubtreeSpecificationSyntaxChecker( String oid )
+    {
+        super( oid );
+    }
+
+    /**
+     * @see 
org.apache.directory.shared.ldap.schema.syntax.SyntaxChecker#isValidSyntax(Object)
+     */
+    public boolean isValidSyntax( Object value )
+    {
+        return true;
+    }
+}

Added: 
directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SubtreeSpecificationSyntaxCheckerTest.java
URL: 
http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SubtreeSpecificationSyntaxCheckerTest.java?view=auto&rev=489796
==============================================================================
--- 
directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SubtreeSpecificationSyntaxCheckerTest.java
 (added)
+++ 
directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/SubtreeSpecificationSyntaxCheckerTest.java
 Fri Dec 22 15:02:34 2006
@@ -0,0 +1,56 @@
+/*
+ *  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;
+
+import junit.framework.TestCase;
+
+/**
+ * Test cases for SubtreeSpecificationSyntaxChecker.
+ *
+ * @author <a href="mailto:[email protected]";>Apache Directory 
Project</a>
+ * @version $Rev$
+ */
+public class SubtreeSpecificationSyntaxCheckerTest extends TestCase
+{
+    SubtreeSpecificationSyntaxChecker checker = new 
SubtreeSpecificationSyntaxChecker();
+
+
+    public void testNullString()
+    {
+        assertTrue( checker.isValidSyntax( null ) );
+    }
+
+
+    public void testEmptyString()
+    {
+        assertTrue( checker.isValidSyntax( "" ) );
+    }
+
+    public void testOid()
+    {
+        assertEquals( "1.3.6.1.4.1.1466.115.121.1.45", checker.getSyntaxOid() 
);
+    }
+
+    public void testCorrectCase()
+    {
+        assertTrue( checker.isValidSyntax( "FALSE" ) );
+        assertTrue( checker.isValidSyntax( new byte[]{0x01, (byte)0xFF} ) );
+    }
+}





--
Ersin

Reply via email to