directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r489503 - in /directory/trunks/shared/ldap/src: main/java/org/apache/directory/shared/ldap/schema/syntax/ test/java/org/apache/directory/shared/ldap/schema/syntax/
Date Thu, 21 Dec 2006 23:36:11 GMT
Author: elecharny
Date: Thu Dec 21 15:36:10 2006
New Revision: 489503

URL: http://svn.apache.org/viewvc?view=rev&rev=489503
Log:
Added two more binary SyntaxCheckers, and there tests

Added:
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/MHSORAddressSyntaxChecker.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/MasterAndShadowAccessPointSyntaxChecker.java
    directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/MHSORAddressSyntaxCheckerTest.java
    directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/MasterAndShadowAccessPointSyntaxCheckerTest.java

Added: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/MHSORAddressSyntaxChecker.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/MHSORAddressSyntaxChecker.java?view=auto&rev=489503
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/MHSORAddressSyntaxChecker.java
(added)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/MHSORAddressSyntaxChecker.java
Thu Dec 21 15:36:10 2006
@@ -0,0 +1,63 @@
+/*
+ *  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 
+ * MHSORAddress.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 488616 $
+ */
+public class MHSORAddressSyntaxChecker extends AbstractSyntaxChecker
+{
+    /** 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.33";
+
+
+    /**
+     * Private default constructor to prevent unnecessary instantiation.
+     */
+    public MHSORAddressSyntaxChecker()
+    {
+        super( SC_OID );
+    }
+
+    /**
+     * 
+     * Creates a new instance of MHSORAddressSyntaxChecker.
+     * 
+     * @param the oid to associate with this new SyntaxChecker
+     *
+     */
+    protected MHSORAddressSyntaxChecker( 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/main/java/org/apache/directory/shared/ldap/schema/syntax/MasterAndShadowAccessPointSyntaxChecker.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/MasterAndShadowAccessPointSyntaxChecker.java?view=auto&rev=489503
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/MasterAndShadowAccessPointSyntaxChecker.java
(added)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/MasterAndShadowAccessPointSyntaxChecker.java
Thu Dec 21 15:36:10 2006
@@ -0,0 +1,63 @@
+/*
+ *  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 
+ * MasterAndShadowAccessPoint.
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev: 488616 $
+ */
+public class MasterAndShadowAccessPointSyntaxChecker extends AbstractSyntaxChecker
+{
+    /** 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.29";
+
+
+    /**
+     * Private default constructor to prevent unnecessary instantiation.
+     */
+    public MasterAndShadowAccessPointSyntaxChecker()
+    {
+        super( SC_OID );
+    }
+
+    /**
+     * 
+     * Creates a new instance of MasterAndShadowAccessPoints.
+     * 
+     * @param the oid to associate with this new SyntaxChecker
+     *
+     */
+    protected MasterAndShadowAccessPointSyntaxChecker( 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/MHSORAddressSyntaxCheckerTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/MHSORAddressSyntaxCheckerTest.java?view=auto&rev=489503
==============================================================================
--- directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/MHSORAddressSyntaxCheckerTest.java
(added)
+++ directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/MHSORAddressSyntaxCheckerTest.java
Thu Dec 21 15:36:10 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 MHSORAddressSyntaxChecker.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class MHSORAddressSyntaxCheckerTest extends TestCase
+{
+    MHSORAddressSyntaxChecker checker = new MHSORAddressSyntaxChecker();
+
+
+    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.33", checker.getSyntaxOid() );
+    }
+
+    public void testCorrectCase()
+    {
+        assertTrue( checker.isValidSyntax( "FALSE" ) );
+        assertTrue( checker.isValidSyntax( new byte[]{0x01, (byte)0xFF} ) );
+    }
+}

Added: directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/MasterAndShadowAccessPointSyntaxCheckerTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/MasterAndShadowAccessPointSyntaxCheckerTest.java?view=auto&rev=489503
==============================================================================
--- directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/MasterAndShadowAccessPointSyntaxCheckerTest.java
(added)
+++ directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/MasterAndShadowAccessPointSyntaxCheckerTest.java
Thu Dec 21 15:36:10 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 MasterAndShadowAccessPointSyntaxChecker.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class MasterAndShadowAccessPointSyntaxCheckerTest extends TestCase
+{
+    MasterAndShadowAccessPointSyntaxChecker checker = new MasterAndShadowAccessPointSyntaxChecker();
+
+
+    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.29", checker.getSyntaxOid() );
+    }
+
+    public void testCorrectCase()
+    {
+        assertTrue( checker.isValidSyntax( "FALSE" ) );
+        assertTrue( checker.isValidSyntax( new byte[]{0x01, (byte)0xFF} ) );
+    }
+}



Mime
View raw message