directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r494169 [3/3] - in /directory/trunks/apacheds/core/src: main/java/org/apache/directory/server/core/ main/java/org/apache/directory/server/core/authn/ main/java/org/apache/directory/server/core/authz/ main/java/org/apache/directory/server/co...
Date Mon, 08 Jan 2007 19:41:50 GMT
Modified: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/schema/SchemaCheckerTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/schema/SchemaCheckerTest.java?view=diff&rev=494169&r1=494168&r2=494169
==============================================================================
--- directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/schema/SchemaCheckerTest.java
(original)
+++ directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/schema/SchemaCheckerTest.java
Mon Jan  8 11:41:45 2007
@@ -22,16 +22,24 @@
 
 import junit.framework.TestCase;
 
-import javax.naming.directory.*;
 import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.DirContext;
 
 import org.apache.directory.server.core.schema.SchemaChecker;
-import org.apache.directory.server.schema.bootstrap.*;
+import org.apache.directory.server.schema.bootstrap.ApacheSchema;
+import org.apache.directory.server.schema.bootstrap.BootstrapSchemaLoader;
+import org.apache.directory.server.schema.bootstrap.CoreSchema;
+import org.apache.directory.server.schema.bootstrap.Schema;
+import org.apache.directory.server.schema.bootstrap.SystemSchema;
 import org.apache.directory.server.schema.registries.DefaultRegistries;
 import org.apache.directory.server.schema.registries.ObjectClassRegistry;
 import org.apache.directory.server.schema.registries.OidRegistry;
 import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
+import org.apache.directory.shared.ldap.message.AttributeImpl;
+import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.StringTools;
@@ -72,7 +80,7 @@
         schemas.add( new SystemSchema() );
         schemas.add( new ApacheSchema() );
         schemas.add( new CoreSchema() );
-        loader.loadWithDependencies( schemas, ( DefaultRegistries ) registries );
+        loader.loadWithDependencies( schemas,registries );
 
         java.util.List errors = registries.checkRefInteg();
         if ( !errors.isEmpty() )
@@ -92,8 +100,8 @@
     {
         LdapDN name = new LdapDN( "uid=akarasulu,ou=users,dc=example,dc=com" );
         int mod = DirContext.REPLACE_ATTRIBUTE;
-        Attributes modifyAttributes = new BasicAttributes( true );
-        modifyAttributes.put( new BasicAttribute( "cn" ) );
+        Attributes modifyAttributes = new AttributesImpl( true );
+        modifyAttributes.put( new AttributeImpl( "cn" ) );
 
         ObjectClassRegistry ocRegistry = registries.getObjectClassRegistry();
 
@@ -102,14 +110,14 @@
 
         // this should succeed since person is still in replaced set and is structural
         modifyAttributes.remove( "cn" );
-        BasicAttribute objectClassesReplaced = new BasicAttribute( "objectClass" );
+        Attribute objectClassesReplaced = new AttributeImpl( "objectClass" );
         objectClassesReplaced.add( "top" );
         objectClassesReplaced.add( "person" );
         modifyAttributes.put( objectClassesReplaced );
         SchemaChecker.preventStructuralClassRemovalOnModifyReplace( ocRegistry, name, mod,
modifyAttributes );
 
         // this should fail since only top is left
-        objectClassesReplaced = new BasicAttribute( "objectClass" );
+        objectClassesReplaced = new AttributeImpl( "objectClass" );
         objectClassesReplaced.add( "top" );
         modifyAttributes.put( objectClassesReplaced );
         try
@@ -125,7 +133,7 @@
         // this should fail since the modify operation tries to delete all
         // objectClass attribute values
         modifyAttributes.remove( "cn" );
-        objectClassesReplaced = new BasicAttribute( "objectClass" );
+        objectClassesReplaced = new AttributeImpl( "objectClass" );
         modifyAttributes.put( objectClassesReplaced );
         try
         {
@@ -147,12 +155,12 @@
     {
         LdapDN name = new LdapDN( "uid=akarasulu,ou=users,dc=example,dc=com" );
         int mod = DirContext.REMOVE_ATTRIBUTE;
-        Attributes modifyAttributes = new BasicAttributes( true );
-        Attribute entryObjectClasses = new BasicAttribute( "objectClass" );
+        Attributes modifyAttributes = new AttributesImpl( true );
+        Attribute entryObjectClasses = new AttributeImpl( "objectClass" );
         entryObjectClasses.add( "top" );
         entryObjectClasses.add( "person" );
         entryObjectClasses.add( "organizationalPerson" );
-        modifyAttributes.put( new BasicAttribute( "cn" ) );
+        modifyAttributes.put( new AttributeImpl( "cn" ) );
 
         ObjectClassRegistry ocRegistry = registries.getObjectClassRegistry();
 
@@ -162,7 +170,7 @@
 
         // this should succeed since person is left and is structural
         modifyAttributes.remove( "cn" );
-        BasicAttribute objectClassesRemoved = new BasicAttribute( "objectClass" );
+        Attribute objectClassesRemoved = new AttributeImpl( "objectClass" );
         objectClassesRemoved.add( "person" );
         modifyAttributes.put( objectClassesRemoved );
         SchemaChecker.preventStructuralClassRemovalOnModifyRemove( ocRegistry, name, mod,
modifyAttributes,
@@ -170,7 +178,7 @@
 
         // this should fail since only top is left
         modifyAttributes.remove( "cn" );
-        objectClassesRemoved = new BasicAttribute( "objectClass" );
+        objectClassesRemoved = new AttributeImpl( "objectClass" );
         objectClassesRemoved.add( "person" );
         objectClassesRemoved.add( "organizationalPerson" );
         modifyAttributes.put( objectClassesRemoved );
@@ -188,7 +196,7 @@
         // this should fail since the modify operation tries to delete all
         // objectClass attribute values
         modifyAttributes.remove( "cn" );
-        objectClassesRemoved = new BasicAttribute( "objectClass" );
+        objectClassesRemoved = new AttributeImpl( "objectClass" );
         modifyAttributes.put( objectClassesRemoved );
         try
         {
@@ -211,14 +219,14 @@
     {
         int mod = DirContext.REMOVE_ATTRIBUTE;
         LdapDN name = new LdapDN( "ou=user,dc=example,dc=com" );
-        Attributes attributes = new BasicAttributes( true );
+        Attributes attributes = new AttributesImpl( true );
         attributes.put( "cn", "does not matter" );
 
         // postive test which should pass
         SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, attributes, registries.getOidRegistry()
);
 
         // test should fail since we are removing the ou attribute
-        attributes.put( new BasicAttribute( "ou" ) );
+        attributes.put( new AttributeImpl( "ou" ) );
         try
         {
             SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, attributes, registries.getOidRegistry()
);
@@ -231,12 +239,12 @@
 
         // test success using more than one attribute for the Rdn but not modifying rdn attribute
         name = new LdapDN( "ou=users+cn=system users,dc=example,dc=com" );
-        attributes = new BasicAttributes( true );
+        attributes = new AttributesImpl( true );
         attributes.put( "sn", "does not matter" );
         SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, attributes, registries.getOidRegistry()
);
 
         // test for failure when modifying Rdn attribute in multi attribute Rdn
-        attributes.put( new BasicAttribute( "cn" ) );
+        attributes.put( new AttributeImpl( "cn" ) );
         try
         {
             SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, attributes, registries.getOidRegistry()
);
@@ -249,12 +257,12 @@
 
         // should succeed since the value being deleted from the rdn attribute is
         // is not used when composing the Rdn
-        attributes = new BasicAttributes( true );
+        attributes = new AttributesImpl( true );
         attributes.put( "ou", "container" );
         SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, attributes, registries.getOidRegistry()
);
 
         // now let's make it fail again just by providing the right value for ou (users)
-        attributes = new BasicAttributes( true );
+        attributes = new AttributesImpl( true );
         attributes.put( "ou", "users" );
         try
         {
@@ -276,14 +284,14 @@
     {
         int mod = DirContext.REPLACE_ATTRIBUTE;
         LdapDN name = new LdapDN( "ou=user,dc=example,dc=com" );
-        Attributes attributes = new BasicAttributes( true );
+        Attributes attributes = new AttributesImpl( true );
         attributes.put( "cn", "does not matter" );
 
         // postive test which should pass
         SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, attributes, registries.getOidRegistry()
);
 
         // test should fail since we are removing the ou attribute
-        attributes.put( new BasicAttribute( "ou" ) );
+        attributes.put( new AttributeImpl( "ou" ) );
         try
         {
             SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, attributes, registries.getOidRegistry()
);
@@ -296,12 +304,12 @@
 
         // test success using more than one attribute for the Rdn but not modifying rdn attribute
         name = new LdapDN( "ou=users+cn=system users,dc=example,dc=com" );
-        attributes = new BasicAttributes( true );
+        attributes = new AttributesImpl( true );
         attributes.put( "sn", "does not matter" );
         SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, attributes, registries.getOidRegistry()
);
 
         // test for failure when modifying Rdn attribute in multi attribute Rdn
-        attributes.put( new BasicAttribute( "cn" ) );
+        attributes.put( new AttributeImpl( "cn" ) );
         try
         {
             SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, attributes, registries.getOidRegistry()
);
@@ -314,13 +322,13 @@
 
         // should succeed since the values being replaced from the rdn attribute is
         // is includes the old Rdn attribute value
-        attributes = new BasicAttributes( true );
+        attributes = new AttributesImpl( true );
         attributes.put( "ou", "container" );
         attributes.put( "ou", "users" );
         SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, attributes, registries.getOidRegistry()
);
 
         // now let's make it fail by not including the old value for ou (users)
-        attributes = new BasicAttributes( true );
+        attributes = new AttributesImpl( true );
         attributes.put( "ou", "container" );
         try
         {
@@ -349,16 +357,16 @@
         // this should pass
         LdapDN name = new LdapDN( "uid=akarasulu,ou=users,dc=example,dc=com" );
         int mod = DirContext.REPLACE_ATTRIBUTE;
-        SchemaChecker.preventStructuralClassRemovalOnModifyReplace( ocRegistry, name, mod,
new BasicAttribute( "cn" ) );
+        SchemaChecker.preventStructuralClassRemovalOnModifyReplace( ocRegistry, name, mod,
new AttributeImpl( "cn" ) );
 
         // this should succeed since person is still in replaced set and is structural
-        BasicAttribute objectClassesReplaced = new BasicAttribute( "objectClass" );
+        Attribute objectClassesReplaced = new AttributeImpl( "objectClass" );
         objectClassesReplaced.add( "top" );
         objectClassesReplaced.add( "person" );
         SchemaChecker.preventStructuralClassRemovalOnModifyReplace( ocRegistry, name, mod,
objectClassesReplaced );
 
         // this should fail since only top is left
-        objectClassesReplaced = new BasicAttribute( "objectClass" );
+        objectClassesReplaced = new AttributeImpl( "objectClass" );
         objectClassesReplaced.add( "top" );
         try
         {
@@ -372,7 +380,7 @@
 
         // this should fail since the modify operation tries to delete all
         // objectClass attribute values
-        objectClassesReplaced = new BasicAttribute( "objectClass" );
+        objectClassesReplaced = new AttributeImpl( "objectClass" );
         try
         {
             SchemaChecker.preventStructuralClassRemovalOnModifyReplace( ocRegistry, name,
mod, objectClassesReplaced );
@@ -393,7 +401,7 @@
     {
         LdapDN name = new LdapDN( "uid=akarasulu,ou=users,dc=example,dc=com" );
         int mod = DirContext.REMOVE_ATTRIBUTE;
-        Attribute entryObjectClasses = new BasicAttribute( "objectClass" );
+        Attribute entryObjectClasses = new AttributeImpl( "objectClass" );
         entryObjectClasses.add( "top" );
         entryObjectClasses.add( "person" );
         entryObjectClasses.add( "organizationalPerson" );
@@ -401,17 +409,17 @@
         ObjectClassRegistry ocRegistry = registries.getObjectClassRegistry();
 
         // this should pass
-        SchemaChecker.preventStructuralClassRemovalOnModifyRemove( ocRegistry, name, mod,
new BasicAttribute( "cn" ),
+        SchemaChecker.preventStructuralClassRemovalOnModifyRemove( ocRegistry, name, mod,
new AttributeImpl( "cn" ),
             entryObjectClasses );
 
         // this should succeed since person is left and is structural
-        BasicAttribute objectClassesRemoved = new BasicAttribute( "objectClass" );
+        Attribute objectClassesRemoved = new AttributeImpl( "objectClass" );
         objectClassesRemoved.add( "person" );
         SchemaChecker.preventStructuralClassRemovalOnModifyRemove( ocRegistry, name, mod,
objectClassesRemoved,
             entryObjectClasses );
 
         // this should fail since only top is left
-        objectClassesRemoved = new BasicAttribute( "objectClass" );
+        objectClassesRemoved = new AttributeImpl( "objectClass" );
         objectClassesRemoved.add( "person" );
         objectClassesRemoved.add( "organizationalPerson" );
         try
@@ -427,7 +435,7 @@
 
         // this should fail since the modify operation tries to delete all
         // objectClass attribute values
-        objectClassesRemoved = new BasicAttribute( "objectClass" );
+        objectClassesRemoved = new AttributeImpl( "objectClass" );
         try
         {
             SchemaChecker.preventStructuralClassRemovalOnModifyRemove( ocRegistry, name,
mod, objectClassesRemoved,
@@ -453,12 +461,12 @@
 
         // postive test which should pass
         SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, 
-            new BasicAttribute( "cn", "does not matter", true ), registry );
+            new AttributeImpl( "cn", "does not matter" ), registry );
 
         // test should fail since we are removing the ou attribute
         try
         {
-            SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, new BasicAttribute(
"ou", true ), registry );
+            SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, new AttributeImpl( "ou"
), registry );
             fail( "should never get here due to a LdapSchemaViolationException being thrown"
);
         }
         catch ( LdapSchemaViolationException e )
@@ -469,12 +477,12 @@
         // test success using more than one attribute for the Rdn but not modifying rdn attribute
         name = new LdapDN( "ou=users+cn=system users,dc=example,dc=com" );
         SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, 
-            new BasicAttribute( "sn", "does not matter" ), registry );
+            new AttributeImpl( "sn", "does not matter" ), registry );
 
         // test for failure when modifying Rdn attribute in multi attribute Rdn
         try
         {
-            SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, new BasicAttribute(
"cn" ), registry );
+            SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, new AttributeImpl( "cn"
), registry );
             fail( "should never get here due to a LdapSchemaViolationException being thrown"
);
         }
         catch ( LdapSchemaViolationException e )
@@ -484,12 +492,12 @@
 
         // should succeed since the value being deleted from the rdn attribute is
         // is not used when composing the Rdn
-        SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, new BasicAttribute( "ou",
"container" ), registry );
+        SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, new AttributeImpl( "ou",
"container" ), registry );
 
         // now let's make it fail again just by providing the right value for ou (users)
         try
         {
-            SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, new BasicAttribute(
"ou", "users" ), registry );
+            SchemaChecker.preventRdnChangeOnModifyRemove( name, mod, new AttributeImpl( "ou",
"users" ), registry );
             fail( "should never get here due to a LdapSchemaViolationException being thrown"
);
         }
         catch ( LdapSchemaViolationException e )
@@ -509,12 +517,12 @@
 //        LdapDN name = new LdapDN( "ou=user,dc=example,dc=com" );
 //
 //        // postive test which should pass
-//        SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, new BasicAttribute( "cn",
"does not matter" ), registries.getOidRegistry() );
+//        SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, new AttributeImpl( "cn",
"does not matter" ), registries.getOidRegistry() );
 //
 //        // test should fail since we are removing the ou attribute
 //        try
 //        {
-//            SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, new BasicAttribute(
"ou" ), registries.getOidRegistry() );
+//            SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, new AttributeImpl(
"ou" ), registries.getOidRegistry() );
 //            fail( "should never get here due to a LdapSchemaViolationException being thrown"
);
 //        }
 //        catch ( LdapSchemaViolationException e )
@@ -524,12 +532,12 @@
 //
 //        // test success using more than one attribute for the Rdn but not modifying rdn
attribute
 //        name = new LdapDN( "ou=users+cn=system users,dc=example,dc=com" );
-//        SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, new BasicAttribute( "sn",
"does not matter" ), registries.getOidRegistry() );
+//        SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, new AttributeImpl( "sn",
"does not matter" ), registries.getOidRegistry() );
 //
 //        // test for failure when modifying Rdn attribute in multi attribute Rdn
 //        try
 //        {
-//            SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, new BasicAttribute(
"cn" ), registries.getOidRegistry() );
+//            SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, new AttributeImpl(
"cn" ), registries.getOidRegistry() );
 //            fail( "should never get here due to a LdapSchemaViolationException being thrown"
);
 //        }
 //        catch ( LdapSchemaViolationException e )
@@ -539,13 +547,13 @@
 //
 //        // should succeed since the values being replaced from the rdn attribute is
 //        // is includes the old Rdn attribute value
-//        Attribute attribute = new BasicAttribute( "ou" );
+//        Attribute attribute = new AttributeImpl( "ou" );
 //        attribute.add( "container" );
 //        attribute.add( "users" );
 //        SchemaChecker.preventRdnChangeOnModifyReplace( name, mod, attribute, registries.getOidRegistry()
);
 //
 //        // now let's make it fail by not including the old value for ou (users)
-//        attribute = new BasicAttribute( "ou" );
+//        attribute = new AttributeImpl( "ou" );
 //        attribute.add( "container" );
 //        try
 //        {

Modified: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/schema/SchemaServiceTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/schema/SchemaServiceTest.java?view=diff&rev=494169&r1=494168&r2=494169
==============================================================================
--- directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/schema/SchemaServiceTest.java
(original)
+++ directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/schema/SchemaServiceTest.java
Mon Jan  8 11:41:45 2007
@@ -26,7 +26,6 @@
 
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
-import javax.naming.directory.BasicAttribute;
 
 import org.apache.directory.server.core.schema.SchemaService;
 import org.apache.directory.server.schema.bootstrap.ApacheSchema;
@@ -36,6 +35,7 @@
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.server.schema.registries.DefaultRegistries;
 import org.apache.directory.shared.ldap.exception.LdapNamingException;
+import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 
@@ -88,7 +88,7 @@
 
     public void testAlterObjectClassesBogusAttr() throws NamingException
     {
-        Attribute attr = new BasicAttribute( "blah", "blah" );
+        Attribute attr = new AttributeImpl( "blah", "blah" );
 
         try
         {
@@ -100,7 +100,7 @@
             assertEquals( ResultCodeEnum.OPERATIONS_ERROR, e.getResultCode() );
         }
 
-        attr = new BasicAttribute( "objectClass" );
+        attr = new AttributeImpl( "objectClass" );
         SchemaService.alterObjectClasses( attr, registries.getObjectClassRegistry() );
         assertEquals( 0, attr.size() );
     }
@@ -108,7 +108,7 @@
 
     public void testAlterObjectClassesNoAttrValue() throws NamingException
     {
-        Attribute attr = new BasicAttribute( "objectClass" );
+        Attribute attr = new AttributeImpl( "objectClass" );
         SchemaService.alterObjectClasses( attr, registries.getObjectClassRegistry() );
         assertEquals( 0, attr.size() );
     }
@@ -116,7 +116,7 @@
 
     public void testAlterObjectClassesTopAttrValue() throws NamingException
     {
-        Attribute attr = new BasicAttribute( "objectClass", "top" );
+        Attribute attr = new AttributeImpl( "objectClass", "top" );
         SchemaService.alterObjectClasses( attr, registries.getObjectClassRegistry() );
         assertEquals( 0, attr.size() );
     }
@@ -124,7 +124,7 @@
 
     public void testAlterObjectClassesInetOrgPersonAttrValue() throws NamingException
     {
-        Attribute attr = new BasicAttribute( "objectClass", "organizationalPerson" );
+        Attribute attr = new AttributeImpl( "objectClass", "organizationalPerson" );
         SchemaService.alterObjectClasses( attr, registries.getObjectClassRegistry() );
         assertEquals( 2, attr.size() );
         assertTrue( attr.contains( "person" ) );
@@ -134,7 +134,7 @@
 
     public void testAlterObjectClassesOverlapping() throws NamingException
     {
-        Attribute attr = new BasicAttribute( "objectClass", "organizationalPerson" );
+        Attribute attr = new AttributeImpl( "objectClass", "organizationalPerson" );
         attr.add( "residentialPerson" );
         SchemaService.alterObjectClasses( attr, registries.getObjectClassRegistry() );
         assertEquals( 3, attr.size() );
@@ -146,7 +146,7 @@
 
     public void testAlterObjectClassesOverlappingAndDsa() throws NamingException
     {
-        Attribute attr = new BasicAttribute( "objectClass", "organizationalPerson" );
+        Attribute attr = new AttributeImpl( "objectClass", "organizationalPerson" );
         attr.add( "residentialPerson" );
         attr.add( "dSA" );
         SchemaService.alterObjectClasses( attr, registries.getObjectClassRegistry() );

Modified: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/subtree/RefinementEvaluatorTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/subtree/RefinementEvaluatorTest.java?view=diff&rev=494169&r1=494168&r2=494169
==============================================================================
--- directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/subtree/RefinementEvaluatorTest.java
(original)
+++ directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/subtree/RefinementEvaluatorTest.java
Mon Jan  8 11:41:45 2007
@@ -23,11 +23,15 @@
 import junit.framework.TestCase;
 
 import javax.naming.NamingException;
-import javax.naming.directory.BasicAttribute;
+import javax.naming.directory.Attribute;
 
 import org.apache.directory.server.core.subtree.RefinementEvaluator;
 import org.apache.directory.server.core.subtree.RefinementLeafEvaluator;
-import org.apache.directory.server.schema.bootstrap.*;
+import org.apache.directory.server.schema.bootstrap.ApacheSchema;
+import org.apache.directory.server.schema.bootstrap.BootstrapSchemaLoader;
+import org.apache.directory.server.schema.bootstrap.CoreSchema;
+import org.apache.directory.server.schema.bootstrap.Schema;
+import org.apache.directory.server.schema.bootstrap.SystemSchema;
 import org.apache.directory.server.schema.registries.DefaultRegistries;
 import org.apache.directory.server.schema.registries.OidRegistry;
 import org.apache.directory.server.schema.registries.Registries;
@@ -37,6 +41,7 @@
 import org.apache.directory.shared.ldap.filter.FilterParserImpl;
 import org.apache.directory.shared.ldap.filter.SimpleNode;
 import org.apache.directory.shared.ldap.filter.AssertionEnum;
+import org.apache.directory.shared.ldap.message.AttributeImpl;
 
 import java.util.Set;
 import java.util.HashSet;
@@ -104,7 +109,7 @@
     {
         try
         {
-            assertFalse( evaluator.evaluate( null, new BasicAttribute( "objectClass" ) )
);
+            assertFalse( evaluator.evaluate( null, new AttributeImpl( "objectClass" ) ) );
             fail( "should never get here due to an IAE" );
         }
         catch ( IllegalArgumentException iae )
@@ -122,7 +127,7 @@
 
         try
         {
-            assertFalse( evaluator.evaluate( new SimpleNode( "", "", AssertionEnum.EQUALITY
), new BasicAttribute( "blah" ) ) );
+            assertFalse( evaluator.evaluate( new SimpleNode( "", "", AssertionEnum.EQUALITY
), new AttributeImpl( "blah" ) ) );
             fail( "should never get here due to an IAE" );
         }
         catch ( IllegalArgumentException iae )
@@ -133,44 +138,44 @@
 
     public void testMatchByName() throws Exception
     {
-        BasicAttribute objectClasses = null;
+        Attribute objectClasses = null;
 
         // positive test
-        objectClasses = new BasicAttribute( "objectClass", "person" );
+        objectClasses = new AttributeImpl( "objectClass", "person" );
         assertTrue( evaluator.evaluate( new SimpleNode( "objectClass", "person", AssertionEnum.EQUALITY
), objectClasses ) );
 
-        objectClasses = new BasicAttribute( "objectClass" );
+        objectClasses = new AttributeImpl( "objectClass" );
         objectClasses.add( "person" );
         objectClasses.add( "blah" );
         assertTrue( evaluator.evaluate( new SimpleNode( "objectClass", "person", AssertionEnum.EQUALITY
), objectClasses ) );
 
         // negative tests
-        objectClasses = new BasicAttribute( "objectClass", "person" );
+        objectClasses = new AttributeImpl( "objectClass", "person" );
         assertFalse( evaluator.evaluate( new SimpleNode( "objectClass", "blah", AssertionEnum.EQUALITY
), objectClasses ) );
 
-        objectClasses = new BasicAttribute( "objectClass", "blah" );
+        objectClasses = new AttributeImpl( "objectClass", "blah" );
         assertFalse( evaluator.evaluate( new SimpleNode( "objectClass", "person", AssertionEnum.EQUALITY
), objectClasses ) );
     }
 
 
     public void testMatchByOID() throws Exception
     {
-        BasicAttribute objectClasses = null;
+        Attribute objectClasses = null;
 
         // positive test
-        objectClasses = new BasicAttribute( "objectClass", "person" );
+        objectClasses = new AttributeImpl( "objectClass", "person" );
         assertTrue( evaluator.evaluate( new SimpleNode( "objectClass", "2.5.6.6", AssertionEnum.EQUALITY
), objectClasses ) );
 
-        objectClasses = new BasicAttribute( "objectClass" );
+        objectClasses = new AttributeImpl( "objectClass" );
         objectClasses.add( "person" );
         objectClasses.add( "blah" );
         assertTrue( evaluator.evaluate( new SimpleNode( "objectClass", "2.5.6.6", AssertionEnum.EQUALITY
), objectClasses ) );
 
         // negative tests
-        objectClasses = new BasicAttribute( "objectClass", "person" );
+        objectClasses = new AttributeImpl( "objectClass", "person" );
         assertFalse( evaluator.evaluate( new SimpleNode( "objectClass", "2.5.6.5", AssertionEnum.EQUALITY
), objectClasses ) );
 
-        objectClasses = new BasicAttribute( "objectClass", "blah" );
+        objectClasses = new AttributeImpl( "objectClass", "blah" );
         assertFalse( evaluator.evaluate( new SimpleNode( "objectClass", "2.5.6.5", AssertionEnum.EQUALITY
), objectClasses ) );
     }
 
@@ -178,15 +183,15 @@
     public void testComplexOrRefinement() throws Exception
     {
         ExprNode refinement = null;
-        BasicAttribute objectClasses = new BasicAttribute( "objectClass", "person" );
+        Attribute objectClasses = new AttributeImpl( "objectClass", "person" );
         FilterParser parser = new FilterParserImpl();
         String refStr = "(| (objectClass=person) (objectClass=organizationalUnit) )";
         refinement = parser.parse( refStr );
 
         assertTrue( evaluator.evaluate( refinement, objectClasses ) );
-        objectClasses = new BasicAttribute( "objectClass", "organizationalUnit" );
+        objectClasses = new AttributeImpl( "objectClass", "organizationalUnit" );
         assertTrue( evaluator.evaluate( refinement, objectClasses ) );
-        objectClasses = new BasicAttribute( "objectClass", "domain" );
+        objectClasses = new AttributeImpl( "objectClass", "domain" );
         assertFalse( evaluator.evaluate( refinement, objectClasses ) );
     }
 
@@ -194,18 +199,18 @@
     public void testComplexAndRefinement() throws Exception
     {
         ExprNode refinement = null;
-        BasicAttribute objectClasses = new BasicAttribute( "objectClass", "person" );
+        Attribute objectClasses = new AttributeImpl( "objectClass", "person" );
         objectClasses.add( "organizationalUnit" );
         FilterParser parser = new FilterParserImpl();
         String refStr = "(& (objectClass=person) (objectClass=organizationalUnit) )";
         refinement = parser.parse( refStr );
 
         assertTrue( evaluator.evaluate( refinement, objectClasses ) );
-        objectClasses = new BasicAttribute( "objectClass", "organizationalUnit" );
+        objectClasses = new AttributeImpl( "objectClass", "organizationalUnit" );
         assertFalse( evaluator.evaluate( refinement, objectClasses ) );
-        objectClasses = new BasicAttribute( "objectClass", "person" );
+        objectClasses = new AttributeImpl( "objectClass", "person" );
         assertFalse( evaluator.evaluate( refinement, objectClasses ) );
-        objectClasses = new BasicAttribute( "objectClass", "domain" );
+        objectClasses = new AttributeImpl( "objectClass", "domain" );
         assertFalse( evaluator.evaluate( refinement, objectClasses ) );
     }
 
@@ -213,20 +218,20 @@
     public void testComplexNotRefinement() throws Exception
     {
         ExprNode refinement = null;
-        BasicAttribute objectClasses = new BasicAttribute( "objectClass", "person" );
+        Attribute objectClasses = new AttributeImpl( "objectClass", "person" );
         FilterParser parser = new FilterParserImpl();
         String refStr = "(! (objectClass=person) )";
         refinement = parser.parse( refStr );
 
         assertFalse( evaluator.evaluate( refinement, objectClasses ) );
-        objectClasses = new BasicAttribute( "objectClass", "organizationalUnit" );
+        objectClasses = new AttributeImpl( "objectClass", "organizationalUnit" );
         assertTrue( evaluator.evaluate( refinement, objectClasses ) );
-        objectClasses = new BasicAttribute( "objectClass", "domain" );
+        objectClasses = new AttributeImpl( "objectClass", "domain" );
         assertTrue( evaluator.evaluate( refinement, objectClasses ) );
 
         try
         {
-            assertFalse( evaluator.evaluate( new BranchNode( AssertionEnum.NOT ), new BasicAttribute(
"objectClass" ) ) );
+            assertFalse( evaluator.evaluate( new BranchNode( AssertionEnum.NOT ), new AttributeImpl(
"objectClass" ) ) );
             fail( "should never get here due to an IAE" );
         }
         catch ( IllegalArgumentException iae )

Modified: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java?view=diff&rev=494169&r1=494168&r2=494169
==============================================================================
--- directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java
(original)
+++ directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java
Mon Jan  8 11:41:45 2007
@@ -23,16 +23,20 @@
 import junit.framework.TestCase;
 
 import javax.naming.NamingException;
-import javax.naming.directory.BasicAttribute;
+import javax.naming.directory.Attribute;
 
 import org.apache.directory.server.core.subtree.RefinementLeafEvaluator;
-import org.apache.directory.server.schema.bootstrap.*;
+import org.apache.directory.server.schema.bootstrap.ApacheSchema;
+import org.apache.directory.server.schema.bootstrap.BootstrapSchemaLoader;
+import org.apache.directory.server.schema.bootstrap.CoreSchema;
+import org.apache.directory.server.schema.bootstrap.Schema;
+import org.apache.directory.server.schema.bootstrap.SystemSchema;
 import org.apache.directory.server.schema.registries.DefaultRegistries;
 import org.apache.directory.server.schema.registries.OidRegistry;
 import org.apache.directory.server.schema.registries.Registries;
-import org.apache.directory.shared.ldap.filter.LeafNode;
 import org.apache.directory.shared.ldap.filter.SimpleNode;
 import org.apache.directory.shared.ldap.filter.AssertionEnum;
+import org.apache.directory.shared.ldap.message.AttributeImpl;
 
 import java.util.Set;
 import java.util.HashSet;
@@ -97,7 +101,7 @@
      */
     public void testForBadArguments() throws Exception
     {
-        BasicAttribute objectClasses = null;
+        Attribute objectClasses = null;
 
         try
         {
@@ -137,7 +141,7 @@
 
         try
         {
-            objectClasses = new BasicAttribute( "incorrectAttrId" );
+            objectClasses = new AttributeImpl( "incorrectAttrId" );
             assertFalse( evaluator.evaluate( new SimpleNode( "objectClass", "", AssertionEnum.EQUALITY
), objectClasses ) );
             fail( "should never get here due to an IAE" );
         }
@@ -149,44 +153,44 @@
 
     public void testMatchByName() throws Exception
     {
-        BasicAttribute objectClasses = null;
+        Attribute objectClasses = null;
 
         // positive test
-        objectClasses = new BasicAttribute( "objectClass", "person" );
+        objectClasses = new AttributeImpl( "objectClass", "person" );
         assertTrue( evaluator.evaluate( new SimpleNode( "objectClass", "person", AssertionEnum.EQUALITY
), objectClasses ) );
 
-        objectClasses = new BasicAttribute( "objectClass" );
+        objectClasses = new AttributeImpl( "objectClass" );
         objectClasses.add( "person" );
         objectClasses.add( "blah" );
         assertTrue( evaluator.evaluate( new SimpleNode( "objectClass", "person", AssertionEnum.EQUALITY
), objectClasses ) );
 
         // negative tests
-        objectClasses = new BasicAttribute( "objectClass", "person" );
+        objectClasses = new AttributeImpl( "objectClass", "person" );
         assertFalse( evaluator.evaluate( new SimpleNode( "objectClass", "blah", AssertionEnum.EQUALITY
), objectClasses ) );
 
-        objectClasses = new BasicAttribute( "objectClass", "blah" );
+        objectClasses = new AttributeImpl( "objectClass", "blah" );
         assertFalse( evaluator.evaluate( new SimpleNode( "objectClass", "person", AssertionEnum.EQUALITY
), objectClasses ) );
     }
 
 
     public void testMatchByOID() throws Exception
     {
-        BasicAttribute objectClasses = null;
+        Attribute objectClasses = null;
 
         // positive test
-        objectClasses = new BasicAttribute( "objectClass", "person" );
+        objectClasses = new AttributeImpl( "objectClass", "person" );
         assertTrue( evaluator.evaluate( new SimpleNode( "objectClass", "2.5.6.6", AssertionEnum.EQUALITY
), objectClasses ) );
 
-        objectClasses = new BasicAttribute( "objectClass" );
+        objectClasses = new AttributeImpl( "objectClass" );
         objectClasses.add( "person" );
         objectClasses.add( "blah" );
         assertTrue( evaluator.evaluate( new SimpleNode( "objectClass", "2.5.6.6", AssertionEnum.EQUALITY
), objectClasses ) );
 
         // negative tests
-        objectClasses = new BasicAttribute( "objectClass", "person" );
+        objectClasses = new AttributeImpl( "objectClass", "person" );
         assertFalse( evaluator.evaluate( new SimpleNode( "objectClass", "2.5.6.5", AssertionEnum.EQUALITY
), objectClasses ) );
 
-        objectClasses = new BasicAttribute( "objectClass", "blah" );
+        objectClasses = new AttributeImpl( "objectClass", "blah" );
         assertFalse( evaluator.evaluate( new SimpleNode( "objectClass", "2.5.6.5", AssertionEnum.EQUALITY
), objectClasses ) );
     }
 }

Modified: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java?view=diff&rev=494169&r1=494168&r2=494169
==============================================================================
--- directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java
(original)
+++ directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java
Mon Jan  8 11:41:45 2007
@@ -27,8 +27,6 @@
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
-import javax.naming.directory.BasicAttribute;
-import javax.naming.directory.BasicAttributes;
 
 import junit.framework.TestCase;
 
@@ -42,6 +40,8 @@
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.filter.FilterParser;
 import org.apache.directory.shared.ldap.filter.FilterParserImpl;
+import org.apache.directory.shared.ldap.message.AttributeImpl;
+import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.subtree.SubtreeSpecification;
 import org.apache.directory.shared.ldap.subtree.SubtreeSpecificationModifier;
@@ -92,8 +92,8 @@
         SubtreeSpecification ss = modifier.getSubtreeSpecification();
         Name apDn = new LdapDN( "ou=system" );
         Name entryDn = new LdapDN( "ou=users,ou=system" );
-        Attribute objectClasses = new BasicAttribute( "objectClass" );
-        Attributes entry = new BasicAttributes();
+        Attribute objectClasses = new AttributeImpl( "objectClass" );
+        Attributes entry = new AttributesImpl();
         entry.put( objectClasses );
 
         assertTrue( evaluator.evaluate( ss, apDn, entryDn, entry ) );
@@ -113,8 +113,8 @@
         SubtreeSpecification ss = modifier.getSubtreeSpecification();
         Name apDn = new LdapDN( "ou=system" );
         Name entryDn = new LdapDN( "ou=users,ou=system" );
-        Attribute objectClasses = new BasicAttribute( "objectClass" );
-        Attributes entry = new BasicAttributes();
+        Attribute objectClasses = new AttributeImpl( "objectClass" );
+        Attributes entry = new AttributesImpl();
         entry.put( objectClasses );
 
         assertTrue( evaluator.evaluate( ss, apDn, entryDn, entry ) );
@@ -136,8 +136,8 @@
         SubtreeSpecification ss = modifier.getSubtreeSpecification();
         Name apDn = new LdapDN( "ou=system" );
         Name entryDn = new LdapDN( "ou=users,ou=system" );
-        Attribute objectClasses = new BasicAttribute( "objectClass" );
-        Attributes entry = new BasicAttributes();
+        Attribute objectClasses = new AttributeImpl( "objectClass" );
+        Attributes entry = new AttributesImpl();
         entry.put( objectClasses );
 
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, entry ) );
@@ -172,8 +172,8 @@
         SubtreeSpecification ss = modifier.getSubtreeSpecification();
         Name apDn = new LdapDN( "ou=system" );
         Name entryDn = new LdapDN( "ou=users,ou=system" );
-        Attribute objectClasses = new BasicAttribute( "objectClass" );
-        Attributes entry = new BasicAttributes();
+        Attribute objectClasses = new AttributeImpl( "objectClass" );
+        Attributes entry = new AttributesImpl();
         entry.put( objectClasses );
 
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, entry ) );
@@ -208,8 +208,8 @@
         SubtreeSpecification ss = modifier.getSubtreeSpecification();
         Name apDn = new LdapDN( "ou=system" );
         Name entryDn = new LdapDN( "ou=users,ou=system" );
-        Attribute objectClasses = new BasicAttribute( "objectClass" );
-        Attributes entry = new BasicAttributes();
+        Attribute objectClasses = new AttributeImpl( "objectClass" );
+        Attributes entry = new AttributesImpl();
         entry.put( objectClasses );
 
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, entry ) );
@@ -244,8 +244,8 @@
         SubtreeSpecification ss = modifier.getSubtreeSpecification();
         Name apDn = new LdapDN( "ou=system" );
         Name entryDn = new LdapDN( "ou=users,ou=system" );
-        Attribute objectClasses = new BasicAttribute( "objectClass", "person" );
-        Attributes entry = new BasicAttributes();
+        Attribute objectClasses = new AttributeImpl( "objectClass", "person" );
+        Attributes entry = new AttributesImpl();
         entry.put( objectClasses );
 
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, entry ) );
@@ -266,8 +266,8 @@
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, entry ) );
 
         // now change the refinement so the entry is rejected
-        objectClasses = new BasicAttribute( "objectClass", "organizationalUnit" );
-        entry = new BasicAttributes();
+        objectClasses = new AttributeImpl( "objectClass", "organizationalUnit" );
+        entry = new AttributesImpl();
         entry.put( objectClasses );
 
         assertFalse( evaluator.evaluate( ss, apDn, entryDn, entry ) );
@@ -303,9 +303,9 @@
         SubtreeSpecification ss = modifier.getSubtreeSpecification();
         Name apDn = new LdapDN( "ou=system" );
         Name entryDn = new LdapDN( "ou=users,ou=system" );
-        Attribute objectClasses = new BasicAttribute( "objectClass", "person" );
-        Attribute cn = new BasicAttribute( "cn", "Ersin" );
-        Attributes entry = new BasicAttributes();
+        Attribute objectClasses = new AttributeImpl( "objectClass", "person" );
+        Attribute cn = new AttributeImpl( "cn", "Ersin" );
+        Attributes entry = new AttributesImpl();
         entry.put( objectClasses );
         entry.put( cn );
 
@@ -315,9 +315,9 @@
         assertTrue( evaluator.evaluate( ss, apDn, entryDn, entry ) );
 
         // now change the filter so the entry is rejected
-        objectClasses = new BasicAttribute( "objectClass", "person" );
-        cn = new BasicAttribute( "cn", "Alex" );
-        entry = new BasicAttributes();
+        objectClasses = new AttributeImpl( "objectClass", "person" );
+        cn = new AttributeImpl( "cn", "Alex" );
+        entry = new AttributesImpl();
         entry.put( objectClasses );
         entry.put( cn );
 



Mime
View raw message