directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r655234 - /directory/apacheds/branches/bigbang/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/
Date Sun, 11 May 2008 03:24:00 GMT
Author: akarasulu
Date: Sat May 10 20:23:59 2008
New Revision: 655234

URL: http://svn.apache.org/viewvc?rev=655234&view=rev
Log:
fixed breakage due to stricter ServerEntry requirements on schema element 
dependencies within registries

 o created some bogus attribute types, syntaxes and matching rules for tests
 o added everything used in tests to the proper registries


Added:
    directory/apacheds/branches/bigbang/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/BogusSyntax.java
    directory/apacheds/branches/bigbang/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/NoMatchingRuleAttributeType.java
    directory/apacheds/branches/bigbang/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/OrderingOnlyMatchingRuleAttributeType.java
Modified:
    directory/apacheds/branches/bigbang/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
    directory/apacheds/branches/bigbang/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java

Added: directory/apacheds/branches/bigbang/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/BogusSyntax.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/BogusSyntax.java?rev=655234&view=auto
==============================================================================
--- directory/apacheds/branches/bigbang/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/BogusSyntax.java
(added)
+++ directory/apacheds/branches/bigbang/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/BogusSyntax.java
Sat May 10 20:23:59 2008
@@ -0,0 +1,89 @@
+/*
+ *  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.server.xdbm.search.impl;
+
+
+import org.apache.directory.shared.ldap.schema.Syntax;
+import org.apache.directory.shared.ldap.schema.syntax.SyntaxChecker;
+import org.apache.directory.shared.ldap.schema.syntax.AcceptAllSyntaxChecker;
+
+import javax.naming.NamingException;
+
+
+/**
+ * A dummy syntax for testing.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class BogusSyntax implements Syntax
+{
+    public boolean isHumanReadable()
+    {
+        return false;
+    }
+
+
+    public SyntaxChecker getSyntaxChecker() throws NamingException
+    {
+        return new AcceptAllSyntaxChecker();
+    }
+
+
+    public boolean isObsolete()
+    {
+        return false;
+    }
+
+
+    public String getOid()
+    {
+        return "1.3.6.1.4.1.18060.0.4.1.1.100000";
+    }
+
+
+    public String[] getNames()
+    {
+        return new String[] { "bogus" };
+    }
+
+
+    public String getName()
+    {
+        return "bogus";
+    }
+
+
+    public String getDescription()
+    {
+        return "bogus";
+    }
+
+
+    public String getSchema()
+    {
+        return "bogus";
+    }
+
+
+    public void setSchema( String schemaName )
+    {
+    }
+}

Modified: directory/apacheds/branches/bigbang/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java?rev=655234&r1=655233&r2=655234&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
(original)
+++ directory/apacheds/branches/bigbang/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/GreaterEqTest.java
Sat May 10 20:23:59 2008
@@ -37,6 +37,7 @@
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.filter.GreaterEqNode;
 import org.apache.directory.shared.ldap.schema.*;
+import org.apache.directory.shared.ldap.schema.syntax.SyntaxCheckerDescription;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.commons.io.FileUtils;
 import org.junit.Before;
@@ -48,9 +49,7 @@
 
 import javax.naming.NamingException;
 import java.io.File;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.Comparator;
+import java.util.*;
 
 import jdbm.helper.StringComparator;
 
@@ -663,122 +662,18 @@
     @Test ( expected = IllegalStateException.class )
     public void testEvaluatorAttributeNoMatchingRule() throws Exception
     {
-        AttributeType at = new AttributeType()
-        {
-
-            public boolean isSingleValue()
-            {
-                return false;
-            }
-
-
-            public boolean isCanUserModify()
-            {
-                return false;
-            }
-
-
-            public boolean isCollective()
-            {
-                return false;
-            }
-
-
-            public UsageEnum getUsage()
-            {
-                return null;
-            }
-
-
-            public AttributeType getSuperior() throws NamingException
-            {
-                return null;
-            }
-
-
-            public Syntax getSyntax() throws NamingException
-            {
-                return null;
-            }
-
-
-            public int getLength()
-            {
-                return 0;
-            }
-
-
-            public MatchingRule getEquality() throws NamingException
-            {
-                return null;
-            }
-
-
-            public MatchingRule getOrdering() throws NamingException
-            {
-                return null;
-            }
-
-
-            public MatchingRule getSubstr() throws NamingException
-            {
-                return null;
-            }
-
-
-            public boolean isAncestorOf( AttributeType descendant ) throws NamingException
-            {
-                return false;
-            }
-
-
-            public boolean isDescentantOf( AttributeType ancestor ) throws NamingException
-            {
-                return false;
-            }
-
-
-            public boolean isObsolete()
-            {
-                return false;
-            }
-
-
-            public String getOid()
-            {
-                return SchemaConstants.ATTRIBUTE_TYPES_AT_OID + ".2000";
-            }
-
-
-            public String[] getNames()
-            {
-                return new String[] { "bogus" };
-            }
-
-
-            public String getName()
-            {
-                return "bogus";
-            }
-
-
-            public String getDescription()
-            {
-                return "";
-            }
-
-
-            public String getSchema()
-            {
-                return "other";
-            }
-
-
-            public void setSchema( String schemaName )
-            {
-            }
-        };
+        AttributeType at = new NoMatchingRuleAttributeType();
         registries.getAttributeTypeRegistry().register( at );
+        registries.getSyntaxRegistry().register( at.getSyntax() );
+        SyntaxCheckerDescription desc = new SyntaxCheckerDescription();
+        desc.setDescription( "bogus" );
+        desc.setFqcn( BogusSyntax.class.getName() );
+        List<String> names = new ArrayList<String>();
+        names.add( "bogus" );
+        desc.setNames( names );
+        desc.setNumericOid( at.getSyntax().getOid() );
+        desc.setObsolete( false );
+        registries.getSyntaxCheckerRegistry().register( desc, at.getSyntax().getSyntaxChecker()
);
 
         GreaterEqNode node = new GreaterEqNode( at.getOid(), new ServerStringValue( at, "3"
) );
         new GreaterEqEvaluator( node, store, registries );
@@ -789,182 +684,18 @@
     @Test
     public void testEvaluatorAttributeOrderingMatchingRule() throws Exception
     {
-        AttributeType at = new AttributeType()
-        {
-
-            public boolean isSingleValue()
-            {
-                return false;
-            }
-
-
-            public boolean isCanUserModify()
-            {
-                return false;
-            }
-
-
-            public boolean isCollective()
-            {
-                return false;
-            }
-
-
-            public UsageEnum getUsage()
-            {
-                return null;
-            }
-
-
-            public AttributeType getSuperior() throws NamingException
-            {
-                return null;
-            }
-
-
-            public Syntax getSyntax() throws NamingException
-            {
-                return null;
-            }
-
-
-            public int getLength()
-            {
-                return 0;
-            }
-
-
-            public MatchingRule getEquality() throws NamingException
-            {
-                return null;
-            }
-
-
-            public MatchingRule getOrdering() throws NamingException
-            {
-                return new MatchingRule()
-                {
-
-                    public Syntax getSyntax() throws NamingException
-                    {
-                        return null;
-                    }
-
-
-                    public Comparator getComparator() throws NamingException
-                    {
-                        return new StringComparator();
-                    }
-
-
-                    public Normalizer getNormalizer() throws NamingException
-                    {
-                        return new NoOpNormalizer();
-                    }
-
-
-                    public boolean isObsolete()
-                    {
-                        return false;
-                    }
-
-
-                    public String getOid()
-                    {
-                        return null;
-                    }
-
-
-                    public String[] getNames()
-                    {
-                        return new String[0];
-                    }
-
-
-                    public String getName()
-                    {
-                        return null;
-                    }
-
-
-                    public String getDescription()
-                    {
-                        return null;
-                    }
-
-
-                    public String getSchema()
-                    {
-                        return null;
-                    }
-
-
-                    public void setSchema( String schemaName )
-                    {
-                    }
-                };
-            }
-
-
-            public MatchingRule getSubstr() throws NamingException
-            {
-                return null;
-            }
-
-
-            public boolean isAncestorOf( AttributeType descendant ) throws NamingException
-            {
-                return false;
-            }
-
-
-            public boolean isDescentantOf( AttributeType ancestor ) throws NamingException
-            {
-                return false;
-            }
-
-
-            public boolean isObsolete()
-            {
-                return false;
-            }
-
-
-            public String getOid()
-            {
-                return SchemaConstants.ATTRIBUTE_TYPES_AT_OID + ".2000";
-            }
-
-
-            public String[] getNames()
-            {
-                return new String[] { "bogus" };
-            }
-
-
-            public String getName()
-            {
-                return "bogus";
-            }
-
-
-            public String getDescription()
-            {
-                return "";
-            }
-
-
-            public String getSchema()
-            {
-                return "other";
-            }
-
-
-            public void setSchema( String schemaName )
-            {
-            }
-        };
+        AttributeType at = new OrderingOnlyMatchingRuleAttributeType();
         registries.getAttributeTypeRegistry().register( at );
+        registries.getSyntaxRegistry().register( at.getSyntax() );
+        SyntaxCheckerDescription desc = new SyntaxCheckerDescription();
+        desc.setDescription( "bogus" );
+        desc.setFqcn( BogusSyntax.class.getName() );
+        List<String> names = new ArrayList<String>();
+        names.add( "bogus" );
+        desc.setNames( names );
+        desc.setNumericOid( at.getSyntax().getOid() );
+        desc.setObsolete( false );
+        registries.getSyntaxCheckerRegistry().register( desc, at.getSyntax().getSyntaxChecker()
);
 
         GreaterEqNode node = new GreaterEqNode( at.getOid(), new ServerStringValue( at, "3"
) );
         new GreaterEqEvaluator( node, store, registries );

Modified: directory/apacheds/branches/bigbang/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java?rev=655234&r1=655233&r2=655234&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java
(original)
+++ directory/apacheds/branches/bigbang/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/LessEqTest.java
Sat May 10 20:23:59 2008
@@ -37,8 +37,10 @@
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.filter.LessEqNode;
 import org.apache.directory.shared.ldap.schema.*;
+import org.apache.directory.shared.ldap.schema.syntax.SyntaxCheckerDescription;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.commons.io.FileUtils;
+import org.apache.commons.collections.CollectionUtils;
 import org.junit.Before;
 import org.junit.After;
 import org.junit.Test;import static org.junit.Assert.assertTrue;import static org.junit.Assert.assertFalse;
@@ -47,9 +49,7 @@
 import static org.junit.Assert.fail;
 
 import java.io.File;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.Comparator;
+import java.util.*;
 
 import jdbm.helper.StringComparator;
 
@@ -706,121 +706,7 @@
     @Test ( expected = IllegalStateException.class )
     public void testEvaluatorAttributeNoMatchingRule() throws Exception
     {
-        AttributeType at = new AttributeType()
-        {
-
-            public boolean isSingleValue()
-            {
-                return false;
-            }
-
-
-            public boolean isCanUserModify()
-            {
-                return false;
-            }
-
-
-            public boolean isCollective()
-            {
-                return false;
-            }
-
-
-            public UsageEnum getUsage()
-            {
-                return null;
-            }
-
-
-            public AttributeType getSuperior() throws NamingException
-            {
-                return null;
-            }
-
-
-            public Syntax getSyntax() throws NamingException
-            {
-                return null;
-            }
-
-
-            public int getLength()
-            {
-                return 0;
-            }
-
-
-            public MatchingRule getEquality() throws NamingException
-            {
-                return null;
-            }
-
-
-            public MatchingRule getOrdering() throws NamingException
-            {
-                return null;
-            }
-
-
-            public MatchingRule getSubstr() throws NamingException
-            {
-                return null;
-            }
-
-
-            public boolean isAncestorOf( AttributeType descendant ) throws NamingException
-            {
-                return false;
-            }
-
-
-            public boolean isDescentantOf( AttributeType ancestor ) throws NamingException
-            {
-                return false;
-            }
-
-
-            public boolean isObsolete()
-            {
-                return false;
-            }
-
-
-            public String getOid()
-            {
-                return SchemaConstants.ATTRIBUTE_TYPES_AT_OID + ".2000";
-            }
-
-
-            public String[] getNames()
-            {
-                return new String[] { "bogus" };
-            }
-
-
-            public String getName()
-            {
-                return "bogus";
-            }
-
-
-            public String getDescription()
-            {
-                return "";
-            }
-
-
-            public String getSchema()
-            {
-                return "other";
-            }
-
-
-            public void setSchema( String schemaName )
-            {
-            }
-        };
+        AttributeType at = new NoMatchingRuleAttributeType();
         registries.getAttributeTypeRegistry().register( at );
 
         LessEqNode node = new LessEqNode( at.getOid(), new ServerStringValue( at, "3" ) );
@@ -833,182 +719,18 @@
     @Test
     public void testEvaluatorAttributeOrderingMatchingRule() throws Exception
     {
-        AttributeType at = new AttributeType()
-        {
-
-            public boolean isSingleValue()
-            {
-                return false;
-            }
-
-
-            public boolean isCanUserModify()
-            {
-                return false;
-            }
-
-
-            public boolean isCollective()
-            {
-                return false;
-            }
-
-
-            public UsageEnum getUsage()
-            {
-                return null;
-            }
-
-
-            public AttributeType getSuperior() throws NamingException
-            {
-                return null;
-            }
-
-
-            public Syntax getSyntax() throws NamingException
-            {
-                return null;
-            }
-
-
-            public int getLength()
-            {
-                return 0;
-            }
-
-
-            public MatchingRule getEquality() throws NamingException
-            {
-                return null;
-            }
-
-
-            public MatchingRule getOrdering() throws NamingException
-            {
-                return new MatchingRule()
-                {
-
-                    public Syntax getSyntax() throws NamingException
-                    {
-                        return null;
-                    }
-
-
-                    public Comparator getComparator() throws NamingException
-                    {
-                        return new StringComparator();
-                    }
-
-
-                    public Normalizer getNormalizer() throws NamingException
-                    {
-                        return new NoOpNormalizer();
-                    }
-
-
-                    public boolean isObsolete()
-                    {
-                        return false;
-                    }
-
-
-                    public String getOid()
-                    {
-                        return null;
-                    }
-
-
-                    public String[] getNames()
-                    {
-                        return new String[0];
-                    }
-
-
-                    public String getName()
-                    {
-                        return null;
-                    }
-
-
-                    public String getDescription()
-                    {
-                        return null;
-                    }
-
-
-                    public String getSchema()
-                    {
-                        return null;
-                    }
-
-
-                    public void setSchema( String schemaName )
-                    {
-                    }
-                };
-            }
-
-
-            public MatchingRule getSubstr() throws NamingException
-            {
-                return null;
-            }
-
-
-            public boolean isAncestorOf( AttributeType descendant ) throws NamingException
-            {
-                return false;
-            }
-
-
-            public boolean isDescentantOf( AttributeType ancestor ) throws NamingException
-            {
-                return false;
-            }
-
-
-            public boolean isObsolete()
-            {
-                return false;
-            }
-
-
-            public String getOid()
-            {
-                return SchemaConstants.ATTRIBUTE_TYPES_AT_OID + ".2000";
-            }
-
-
-            public String[] getNames()
-            {
-                return new String[] { "bogus" };
-            }
-
-
-            public String getName()
-            {
-                return "bogus";
-            }
-
-
-            public String getDescription()
-            {
-                return "";
-            }
-
-
-            public String getSchema()
-            {
-                return "other";
-            }
-
-
-            public void setSchema( String schemaName )
-            {
-            }
-        };
+        AttributeType at = new OrderingOnlyMatchingRuleAttributeType();
         registries.getAttributeTypeRegistry().register( at );
+        registries.getSyntaxRegistry().register( at.getSyntax() );
+        SyntaxCheckerDescription desc = new SyntaxCheckerDescription();
+        desc.setDescription( "bogus" );
+        desc.setFqcn( BogusSyntax.class.getName() );
+        List<String> names = new ArrayList<String>();
+        names.add( "bogus" );
+        desc.setNames( names );
+        desc.setNumericOid( at.getSyntax().getOid() );
+        desc.setObsolete( false );
+        registries.getSyntaxCheckerRegistry().register( desc, at.getSyntax().getSyntaxChecker()
);
 
         LessEqNode node = new LessEqNode( at.getOid(), new ServerStringValue( at, "3" ) );
         new LessEqEvaluator( node, store, registries );

Added: directory/apacheds/branches/bigbang/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/NoMatchingRuleAttributeType.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/NoMatchingRuleAttributeType.java?rev=655234&view=auto
==============================================================================
--- directory/apacheds/branches/bigbang/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/NoMatchingRuleAttributeType.java
(added)
+++ directory/apacheds/branches/bigbang/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/NoMatchingRuleAttributeType.java
Sat May 10 20:23:59 2008
@@ -0,0 +1,153 @@
+/*
+ *  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.server.xdbm.search.impl;
+
+
+import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.UsageEnum;
+import org.apache.directory.shared.ldap.schema.Syntax;
+import org.apache.directory.shared.ldap.schema.MatchingRule;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
+
+import javax.naming.NamingException;
+
+
+/**
+ * An attributeType used for testing situations when there is no matchingRule
+ * for one.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $$Rev$$
+ */
+public class NoMatchingRuleAttributeType implements AttributeType
+{
+
+    public boolean isSingleValue()
+    {
+        return false;
+    }
+
+
+    public boolean isCanUserModify()
+    {
+        return false;
+    }
+
+
+    public boolean isCollective()
+    {
+        return false;
+    }
+
+
+    public UsageEnum getUsage()
+    {
+        return null;
+    }
+
+
+    public AttributeType getSuperior() throws NamingException
+    {
+        return null;
+    }
+
+
+    public Syntax getSyntax() throws NamingException
+    {
+        return new BogusSyntax();
+    }
+
+
+    public int getLength()
+    {
+        return 0;
+    }
+
+
+    public MatchingRule getEquality() throws NamingException
+    {
+        return null;
+    }
+
+
+    public MatchingRule getOrdering() throws NamingException
+    {
+        return null;
+    }
+
+
+    public MatchingRule getSubstr() throws NamingException
+    {
+        return null;
+    }
+
+
+    public boolean isAncestorOf( AttributeType descendant ) throws NamingException
+    {
+        return false;
+    }
+
+
+    public boolean isDescentantOf( AttributeType ancestor ) throws NamingException
+    {
+        return false;
+    }
+
+
+    public boolean isObsolete()
+    {
+        return false;
+    }
+
+
+    public String getOid()
+    {
+        return SchemaConstants.ATTRIBUTE_TYPES_AT_OID + ".2000";
+    }
+
+
+    public String[] getNames()
+    {
+        return new String[] { "bogus" };
+    }
+
+
+    public String getName()
+    {
+        return "bogus";
+    }
+
+
+    public String getDescription()
+    {
+        return "";
+    }
+
+
+    public String getSchema()
+    {
+        return "other";
+    }
+
+
+    public void setSchema( String schemaName )
+    {
+    }
+}

Added: directory/apacheds/branches/bigbang/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/OrderingOnlyMatchingRuleAttributeType.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/OrderingOnlyMatchingRuleAttributeType.java?rev=655234&view=auto
==============================================================================
--- directory/apacheds/branches/bigbang/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/OrderingOnlyMatchingRuleAttributeType.java
(added)
+++ directory/apacheds/branches/bigbang/xdbm-search/src/test/java/org/apache/directory/server/xdbm/search/impl/OrderingOnlyMatchingRuleAttributeType.java
Sat May 10 20:23:59 2008
@@ -0,0 +1,213 @@
+/*
+ *  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.server.xdbm.search.impl;
+
+
+import org.apache.directory.shared.ldap.schema.*;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
+
+import javax.naming.NamingException;
+import java.util.Comparator;
+
+import jdbm.helper.StringComparator;
+
+
+/**
+ * An attributeType used for testing situations when there is only an ordering
+ * matchingRule for one.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $$Rev$$
+ */
+public class OrderingOnlyMatchingRuleAttributeType implements AttributeType
+{
+
+    public boolean isSingleValue()
+    {
+        return false;
+    }
+
+
+    public boolean isCanUserModify()
+    {
+        return false;
+    }
+
+
+    public boolean isCollective()
+    {
+        return false;
+    }
+
+
+    public UsageEnum getUsage()
+    {
+        return null;
+    }
+
+
+    public AttributeType getSuperior() throws NamingException
+    {
+        return null;
+    }
+
+
+    public Syntax getSyntax() throws NamingException
+    {
+        return new BogusSyntax();
+    }
+
+
+    public int getLength()
+    {
+        return 0;
+    }
+
+
+    public MatchingRule getEquality() throws NamingException
+    {
+        return null;
+    }
+
+
+    public MatchingRule getOrdering() throws NamingException
+    {
+        return new MatchingRule()
+        {
+
+            public Syntax getSyntax() throws NamingException
+            {
+                return new BogusSyntax();
+            }
+
+
+            public Comparator getComparator() throws NamingException
+            {
+                return new StringComparator();
+            }
+
+
+            public Normalizer getNormalizer() throws NamingException
+            {
+                return new NoOpNormalizer();
+            }
+
+
+            public boolean isObsolete()
+            {
+                return false;
+            }
+
+
+            public String getOid()
+            {
+                return null;
+            }
+
+
+            public String[] getNames()
+            {
+                return new String[0];
+            }
+
+
+            public String getName()
+            {
+                return null;
+            }
+
+
+            public String getDescription()
+            {
+                return null;
+            }
+
+
+            public String getSchema()
+            {
+                return null;
+            }
+
+
+            public void setSchema( String schemaName )
+            {
+            }
+        };
+    }
+
+
+    public MatchingRule getSubstr() throws NamingException
+    {
+        return null;
+    }
+
+
+    public boolean isAncestorOf( AttributeType descendant ) throws NamingException
+    {
+        return false;
+    }
+
+
+    public boolean isDescentantOf( AttributeType ancestor ) throws NamingException
+    {
+        return false;
+    }
+
+
+    public boolean isObsolete()
+    {
+        return false;
+    }
+
+
+    public String getOid()
+    {
+        return SchemaConstants.ATTRIBUTE_TYPES_AT_OID + ".2000";
+    }
+
+
+    public String[] getNames()
+    {
+        return new String[] { "bogus" };
+    }
+
+
+    public String getName()
+    {
+        return "bogus";
+    }
+
+
+    public String getDescription()
+    {
+        return "";
+    }
+
+
+    public String getSchema()
+    {
+        return "other";
+    }
+
+
+    public void setSchema( String schemaName )
+    {
+    }
+}
\ No newline at end of file



Mime
View raw message