You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by er...@apache.org on 2007/05/24 02:27:07 UTC
svn commit: r541123 [3/25] - in
/directory/apacheds/branches/apacheds-sasl-branch: ./ benchmarks/
bootstrap-extract/ bootstrap-extract/src/ bootstrap-extract/src/main/
bootstrap-extract/src/main/java/ bootstrap-extract/src/main/java/org/
bootstrap-extr...
Modified: directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/main/java/org/apache/directory/server/core/unit/AbstractTestCase.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/main/java/org/apache/directory/server/core/unit/AbstractTestCase.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/main/java/org/apache/directory/server/core/unit/AbstractTestCase.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/main/java/org/apache/directory/server/core/unit/AbstractTestCase.java Wed May 23 17:26:40 2007
@@ -43,6 +43,7 @@
import org.apache.directory.server.core.configuration.Configuration;
import org.apache.directory.server.core.configuration.MutableStartupConfiguration;
import org.apache.directory.server.core.configuration.ShutdownConfiguration;
+import org.apache.directory.server.core.configuration.SyncConfiguration;
import org.apache.directory.server.schema.registries.Registries;
import org.apache.directory.shared.ldap.ldif.Entry;
import org.apache.directory.shared.ldap.ldif.LdifReader;
@@ -217,6 +218,17 @@
registries = DirectoryService.getInstance().getConfiguration().getRegistries();
}
+
+ /**
+ * Restarts the server without loading data when it has been shutdown.
+ */
+ protected void restart() throws NamingException
+ {
+ configuration = new MutableStartupConfiguration();
+ configuration.setShutdownHookEnabled( false );
+ setContextRoots( username, password, configuration );
+ }
+
/**
* Deletes the Eve working directory.
@@ -310,14 +322,10 @@
/**
- * Sets the system context root to null.
- *
- * @see junit.framework.TestCase#tearDown()
+ * Issues a shutdown request to the server.
*/
- protected void tearDown() throws Exception
+ protected void shutdown()
{
- super.tearDown();
-
Hashtable<String,Object> env = new Hashtable<String,Object>();
env.put( Context.PROVIDER_URL, "ou=system" );
@@ -333,9 +341,45 @@
}
catch ( Exception e )
{
- }
+ }
sysRoot = null;
Runtime.getRuntime().gc();
+ }
+
+
+ /**
+ * Issues a sync request to the server.
+ */
+ protected void sync()
+ {
+ Hashtable<String,Object> env = new Hashtable<String,Object>();
+
+ env.put( Context.PROVIDER_URL, "ou=system" );
+ env.put( Context.INITIAL_CONTEXT_FACTORY, "org.apache.directory.server.core.jndi.CoreContextFactory" );
+ env.putAll( new SyncConfiguration().toJndiEnvironment() );
+ env.put( Context.SECURITY_PRINCIPAL, "uid=admin,ou=system" );
+ env.put( Context.SECURITY_CREDENTIALS, "secret" );
+ env.put( Context.SECURITY_AUTHENTICATION, "simple" );
+
+ try
+ {
+ new InitialContext( env );
+ }
+ catch ( Exception e )
+ {
+ }
+ }
+
+
+ /**
+ * Sets the system context root to null.
+ *
+ * @see junit.framework.TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ shutdown();
testEntries.clear();
ldifPath = null;
loadClass = null;
Modified: directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticationITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticationITest.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticationITest.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/authn/SimpleAuthenticationITest.java Wed May 23 17:26:40 2007
@@ -389,4 +389,264 @@
assertTrue( attrs.get( "facsimiletelephonenumber" ).contains( "+1 408 555 9751" ) );
assertTrue( attrs.get( "roomnumber" ).contains( "4612" ) );
}
+
+ public void testSHA() throws NamingException
+ {
+ Hashtable<String,Object> env = new Hashtable<String,Object>( configuration.toJndiEnvironment() );
+ env.put( Context.PROVIDER_URL, "ou=system" );
+ env.put( Context.SECURITY_PRINCIPAL, "uid=akarasulu,ou=users,ou=system" );
+ env.put( Context.SECURITY_CREDENTIALS, "test" );
+ env.put( Context.SECURITY_AUTHENTICATION, "simple" );
+ env.put( Context.INITIAL_CONTEXT_FACTORY, "org.apache.directory.server.core.jndi.CoreContextFactory" );
+ InitialDirContext ic = new InitialDirContext( env );
+
+ // Check that we can get the attributes
+ Attributes attrs = ic.getAttributes( "uid=akarasulu,ou=users" );
+ assertNotNull( attrs );
+ assertTrue( attrs.get( "uid" ).contains( "akarasulu" ) );
+
+ // now modify the password for akarasulu : 'secret', encrypted using SHA
+ AttributeImpl userPasswordAttribute = new AttributeImpl( "userPassword", "{SHA}5en6G6MezRroT3XKqkdPOmY/BfQ=" );
+ ic.modifyAttributes( "uid=akarasulu,ou=users", new ModificationItemImpl[] {
+ new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, userPasswordAttribute ) } );
+
+ // close and try with old password (should fail)
+ ic.close();
+ env.put( Context.SECURITY_CREDENTIALS, "test" );
+
+ try
+ {
+ ic = new InitialDirContext( env );
+ fail( "Authentication with old password should fail" );
+ }
+ catch ( NamingException e )
+ {
+ // we should fail
+ }
+
+ // close and try again now with new password (should be successfull)
+ ic.close();
+ env.put( Context.SECURITY_CREDENTIALS, "secret" );
+ ic = new InitialDirContext( env );
+ attrs = ic.getAttributes( "uid=akarasulu,ou=users" );
+ assertNotNull( attrs );
+ assertTrue( attrs.get( "uid" ).contains( "akarasulu" ) );
+
+ // close and try again now with new password, to check that the
+ // cache is updated (should be successfull)
+ ic.close();
+ env.put( Context.SECURITY_CREDENTIALS, "secret" );
+ ic = new InitialDirContext( env );
+ attrs = ic.getAttributes( "uid=akarasulu,ou=users" );
+ assertNotNull( attrs );
+ assertTrue( attrs.get( "uid" ).contains( "akarasulu" ) );
+ }
+
+ public void testSSHA() throws NamingException
+ {
+ Hashtable<String,Object> env = new Hashtable<String,Object>( configuration.toJndiEnvironment() );
+ env.put( Context.PROVIDER_URL, "ou=system" );
+ env.put( Context.SECURITY_PRINCIPAL, "uid=akarasulu,ou=users,ou=system" );
+ env.put( Context.SECURITY_CREDENTIALS, "test" );
+ env.put( Context.SECURITY_AUTHENTICATION, "simple" );
+ env.put( Context.INITIAL_CONTEXT_FACTORY, "org.apache.directory.server.core.jndi.CoreContextFactory" );
+ InitialDirContext ic = new InitialDirContext( env );
+
+ // Check that we can get the attributes
+ Attributes attrs = ic.getAttributes( "uid=akarasulu,ou=users" );
+ assertNotNull( attrs );
+ assertTrue( attrs.get( "uid" ).contains( "akarasulu" ) );
+
+ // now modify the password for akarasulu : 'secret', encrypted using SHA
+ AttributeImpl userPasswordAttribute = new AttributeImpl( "userPassword", "{SSHA}mjVVxasFkk59wMW4L1Ldt+YCblfhULHs03WW7g==" );
+ ic.modifyAttributes( "uid=akarasulu,ou=users", new ModificationItemImpl[] {
+ new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, userPasswordAttribute ) } );
+
+ // close and try with old password (should fail)
+ ic.close();
+ env.put( Context.SECURITY_CREDENTIALS, "test" );
+
+ try
+ {
+ ic = new InitialDirContext( env );
+ fail( "Authentication with old password should fail" );
+ }
+ catch ( NamingException e )
+ {
+ // we should fail
+ }
+
+ // close and try again now with new password (should be successfull)
+ ic.close();
+ env.put( Context.SECURITY_CREDENTIALS, "secret" );
+ ic = new InitialDirContext( env );
+ attrs = ic.getAttributes( "uid=akarasulu,ou=users" );
+ assertNotNull( attrs );
+ assertTrue( attrs.get( "uid" ).contains( "akarasulu" ) );
+
+ // close and try again now with new password, to check that the
+ // cache is updated (should be successfull)
+ ic.close();
+ env.put( Context.SECURITY_CREDENTIALS, "secret" );
+ ic = new InitialDirContext( env );
+ attrs = ic.getAttributes( "uid=akarasulu,ou=users" );
+ assertNotNull( attrs );
+ assertTrue( attrs.get( "uid" ).contains( "akarasulu" ) );
+ }
+
+ public void testMD5() throws NamingException
+ {
+ Hashtable<String,Object> env = new Hashtable<String,Object>( configuration.toJndiEnvironment() );
+ env.put( Context.PROVIDER_URL, "ou=system" );
+ env.put( Context.SECURITY_PRINCIPAL, "uid=akarasulu,ou=users,ou=system" );
+ env.put( Context.SECURITY_CREDENTIALS, "test" );
+ env.put( Context.SECURITY_AUTHENTICATION, "simple" );
+ env.put( Context.INITIAL_CONTEXT_FACTORY, "org.apache.directory.server.core.jndi.CoreContextFactory" );
+ InitialDirContext ic = new InitialDirContext( env );
+
+ // Check that we can get the attributes
+ Attributes attrs = ic.getAttributes( "uid=akarasulu,ou=users" );
+ assertNotNull( attrs );
+ assertTrue( attrs.get( "uid" ).contains( "akarasulu" ) );
+
+ // now modify the password for akarasulu : 'secret', encrypted using MD5
+ AttributeImpl userPasswordAttribute = new AttributeImpl( "userPassword", "{MD5}Xr4ilOzQ4PCOq3aQ0qbuaQ==" );
+ ic.modifyAttributes( "uid=akarasulu,ou=users", new ModificationItemImpl[] {
+ new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, userPasswordAttribute ) } );
+
+ // close and try with old password (should fail)
+ ic.close();
+ env.put( Context.SECURITY_CREDENTIALS, "test" );
+
+ try
+ {
+ ic = new InitialDirContext( env );
+ fail( "Authentication with old password should fail" );
+ }
+ catch ( NamingException e )
+ {
+ // we should fail
+ }
+
+ // close and try again now with new password (should be successfull)
+ ic.close();
+ env.put( Context.SECURITY_CREDENTIALS, "secret" );
+ ic = new InitialDirContext( env );
+ attrs = ic.getAttributes( "uid=akarasulu,ou=users" );
+ assertNotNull( attrs );
+ assertTrue( attrs.get( "uid" ).contains( "akarasulu" ) );
+
+ // close and try again now with new password, to check that the
+ // cache is updated (should be successfull)
+ ic.close();
+ env.put( Context.SECURITY_CREDENTIALS, "secret" );
+ ic = new InitialDirContext( env );
+ attrs = ic.getAttributes( "uid=akarasulu,ou=users" );
+ assertNotNull( attrs );
+ assertTrue( attrs.get( "uid" ).contains( "akarasulu" ) );
+ }
+
+ public void testSMD5() throws NamingException
+ {
+ Hashtable<String,Object> env = new Hashtable<String,Object>( configuration.toJndiEnvironment() );
+ env.put( Context.PROVIDER_URL, "ou=system" );
+ env.put( Context.SECURITY_PRINCIPAL, "uid=akarasulu,ou=users,ou=system" );
+ env.put( Context.SECURITY_CREDENTIALS, "test" );
+ env.put( Context.SECURITY_AUTHENTICATION, "simple" );
+ env.put( Context.INITIAL_CONTEXT_FACTORY, "org.apache.directory.server.core.jndi.CoreContextFactory" );
+ InitialDirContext ic = new InitialDirContext( env );
+
+ // Check that we can get the attributes
+ Attributes attrs = ic.getAttributes( "uid=akarasulu,ou=users" );
+ assertNotNull( attrs );
+ assertTrue( attrs.get( "uid" ).contains( "akarasulu" ) );
+
+ // now modify the password for akarasulu : 'secret', encrypted using SHA
+ AttributeImpl userPasswordAttribute = new AttributeImpl( "userPassword", "{SMD5}tQ9wo/VBuKsqBtylMMCcORbnYOJFMyDJ" );
+ ic.modifyAttributes( "uid=akarasulu,ou=users", new ModificationItemImpl[] {
+ new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, userPasswordAttribute ) } );
+
+ // close and try with old password (should fail)
+ ic.close();
+ env.put( Context.SECURITY_CREDENTIALS, "test" );
+
+ try
+ {
+ ic = new InitialDirContext( env );
+ fail( "Authentication with old password should fail" );
+ }
+ catch ( NamingException e )
+ {
+ // we should fail
+ }
+
+ // close and try again now with new password (should be successfull)
+ ic.close();
+ env.put( Context.SECURITY_CREDENTIALS, "secret" );
+ ic = new InitialDirContext( env );
+ attrs = ic.getAttributes( "uid=akarasulu,ou=users" );
+ assertNotNull( attrs );
+ assertTrue( attrs.get( "uid" ).contains( "akarasulu" ) );
+
+ // close and try again now with new password, to check that the
+ // cache is updated (should be successfull)
+ ic.close();
+ env.put( Context.SECURITY_CREDENTIALS, "secret" );
+ ic = new InitialDirContext( env );
+ attrs = ic.getAttributes( "uid=akarasulu,ou=users" );
+ assertNotNull( attrs );
+ assertTrue( attrs.get( "uid" ).contains( "akarasulu" ) );
+ }
+
+ public void testCRYPT() throws NamingException
+ {
+ Hashtable<String,Object> env = new Hashtable<String,Object>( configuration.toJndiEnvironment() );
+ env.put( Context.PROVIDER_URL, "ou=system" );
+ env.put( Context.SECURITY_PRINCIPAL, "uid=akarasulu,ou=users,ou=system" );
+ env.put( Context.SECURITY_CREDENTIALS, "test" );
+ env.put( Context.SECURITY_AUTHENTICATION, "simple" );
+ env.put( Context.INITIAL_CONTEXT_FACTORY, "org.apache.directory.server.core.jndi.CoreContextFactory" );
+ InitialDirContext ic = new InitialDirContext( env );
+
+ // Check that we can get the attributes
+ Attributes attrs = ic.getAttributes( "uid=akarasulu,ou=users" );
+ assertNotNull( attrs );
+ assertTrue( attrs.get( "uid" ).contains( "akarasulu" ) );
+
+ // now modify the password for akarasulu : 'secret', encrypted using CRYPT
+ AttributeImpl userPasswordAttribute = new AttributeImpl( "userPassword", "{crypt}qFkH8Z1woBlXw" );
+ ic.modifyAttributes( "uid=akarasulu,ou=users", new ModificationItemImpl[] {
+ new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, userPasswordAttribute ) } );
+
+ // close and try with old password (should fail)
+ ic.close();
+ env.put( Context.SECURITY_CREDENTIALS, "test" );
+
+ try
+ {
+ ic = new InitialDirContext( env );
+ fail( "Authentication with old password should fail" );
+ }
+ catch ( NamingException e )
+ {
+ // we should fail
+ }
+
+ // close and try again now with new password (should be successfull)
+ ic.close();
+ env.put( Context.SECURITY_CREDENTIALS, "secret" );
+ ic = new InitialDirContext( env );
+ attrs = ic.getAttributes( "uid=akarasulu,ou=users" );
+ assertNotNull( attrs );
+ assertTrue( attrs.get( "uid" ).contains( "akarasulu" ) );
+
+ // close and try again now with new password, to check that the
+ // cache is updated (should be successfull)
+ ic.close();
+ env.put( Context.SECURITY_CREDENTIALS, "secret" );
+ ic = new InitialDirContext( env );
+ attrs = ic.getAttributes( "uid=akarasulu,ou=users" );
+ assertNotNull( attrs );
+ assertTrue( attrs.get( "uid" ).contains( "akarasulu" ) );
+ }
}
Modified: directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/authz/AbstractAuthorizationITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/authz/AbstractAuthorizationITest.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/authz/AbstractAuthorizationITest.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/authz/AbstractAuthorizationITest.java Wed May 23 17:26:40 2007
@@ -23,6 +23,7 @@
import org.apache.directory.server.core.partition.PartitionNexus;
import org.apache.directory.server.core.subtree.SubentryService;
import org.apache.directory.server.core.unit.AbstractTestCase;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.message.AttributeImpl;
import org.apache.directory.shared.ldap.message.AttributesImpl;
import org.apache.directory.shared.ldap.name.LdapDN;
@@ -298,7 +299,7 @@
Attribute objectClass = new AttributeImpl( "objectClass" );
subentry.put( objectClass );
objectClass.add( "top" );
- objectClass.add( "subentry" );
+ objectClass.add( SchemaConstants.SUBENTRY_OC );
objectClass.add( "accessControlSubentry" );
subentry.put( "subtreeSpecification", subtree );
subentry.put( "prescriptiveACI", aciItem );
Modified: directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceITest.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceITest.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/collective/CollectiveAttributeServiceITest.java Wed May 23 17:26:40 2007
@@ -32,6 +32,7 @@
import javax.naming.directory.SearchResult;
import org.apache.directory.server.core.unit.AbstractAdminTestCase;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.message.AttributeImpl;
import org.apache.directory.shared.ldap.message.AttributesImpl;
import org.apache.directory.shared.ldap.message.ModificationItemImpl;
@@ -63,7 +64,7 @@
Attributes subentry = new AttributesImpl();
Attribute objectClass = new AttributeImpl( "objectClass" );
objectClass.add( "top" );
- objectClass.add( "subentry" );
+ objectClass.add( SchemaConstants.SUBENTRY_OC );
objectClass.add( "collectiveAttributeSubentry" );
subentry.put( objectClass );
subentry.put( "c-ou", "configuration" );
@@ -78,7 +79,7 @@
Attributes subentry = new AttributesImpl();
Attribute objectClass = new AttributeImpl( "objectClass" );
objectClass.add( "top" );
- objectClass.add( "subentry" );
+ objectClass.add( SchemaConstants.SUBENTRY_OC );
objectClass.add( "collectiveAttributeSubentry" );
subentry.put( objectClass );
subentry.put( "c-ou", "configuration2" );
@@ -93,7 +94,7 @@
Attributes subentry = new AttributesImpl();
Attribute objectClass = new AttributeImpl( "objectClass" );
objectClass.add( "top" );
- objectClass.add( "subentry" );
+ objectClass.add( SchemaConstants.SUBENTRY_OC );
objectClass.add( "collectiveAttributeSubentry" );
subentry.put( objectClass );
subentry.put( "c-st", "FL" );
Modified: directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/jndi/AddITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/jndi/AddITest.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/jndi/AddITest.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/jndi/AddITest.java Wed May 23 17:26:40 2007
@@ -21,6 +21,7 @@
import org.apache.directory.server.core.unit.AbstractAdminTestCase;
+import org.apache.directory.shared.ldap.exception.LdapInvalidAttributeValueException;
import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
import org.apache.directory.shared.ldap.message.AttributeImpl;
import org.apache.directory.shared.ldap.message.AttributesImpl;
@@ -114,6 +115,36 @@
fail( "Should not reach this state" );
}
catch ( LdapSchemaViolationException e )
+ {
+ assertTrue( true );
+ }
+ }
+
+ /**
+ * Test that we can't add an entry with an attribute with a bad syntax
+ */
+ public void testAddAttributesBadSyntax() throws Exception
+ {
+ Attributes attrs = new AttributesImpl( true );
+ Attribute oc = new AttributeImpl( "ObjectClass", "top" );
+ oc.add( "person" );
+ Attribute cn = new AttributeImpl( "cn", "kevin Spacey" );
+ Attribute sn = new AttributeImpl( "sn", "ke" );
+ Attribute telephone = new AttributeImpl( "telephoneNumber", "0123456abc" );
+ attrs.put( oc );
+ attrs.put( cn );
+ attrs.put( sn );
+ attrs.put( telephone );
+
+ String base = "sn=kevin";
+
+ //create subcontext
+ try
+ {
+ sysRoot.createSubcontext( base, attrs );
+ fail( "Should not reach this state" );
+ }
+ catch ( LdapInvalidAttributeValueException e )
{
assertTrue( true );
}
Modified: directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/jndi/DIRSERVER169ITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/jndi/DIRSERVER169ITest.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/jndi/DIRSERVER169ITest.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/jndi/DIRSERVER169ITest.java Wed May 23 17:26:40 2007
@@ -57,7 +57,7 @@
Attributes user = new AttributesImpl( "uid", "bob" );
user.put( "cn", "Bob Hamilton" );
- user.put( "userPassword", "bobspassword".getBytes( "UTF-8" ) );
+ user.put( "userPassword", "bobspassword" );
Attribute objectClass = new AttributeImpl( "objectClass" );
user.put( objectClass );
@@ -122,7 +122,7 @@
String filter = "(userPassword={0})";
NamingEnumeration results = ctx.search( "uid=bob,ou=people", filter, new Object[]
- { "bobspassword".getBytes( "UTF-8" ) }, ctls );
+ { "bobspassword" }, ctls );
// We should have a match
assertTrue( results.hasMore() );
Modified: directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/jndi/DIRSERVER759ITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/jndi/DIRSERVER759ITest.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/jndi/DIRSERVER759ITest.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/jndi/DIRSERVER759ITest.java Wed May 23 17:26:40 2007
@@ -29,6 +29,7 @@
import javax.naming.directory.SearchControls;
import org.apache.directory.server.core.unit.AbstractAdminTestCase;
+import org.apache.directory.shared.ldap.constants.JndiPropertyConstants;
import org.apache.directory.shared.ldap.message.AttributeImpl;
import org.apache.directory.shared.ldap.message.AttributesImpl;
import org.apache.directory.shared.ldap.message.DerefAliasesEnum;
@@ -155,7 +156,7 @@
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
controls.setDerefLinkFlag( false );
- sysRoot.addToEnvironment( DerefAliasesEnum.JNDI_DEREF_ALIAS_PROP, DerefAliasesEnum.NEVER_DEREF_ALIASES );
+ sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, DerefAliasesEnum.NEVER_DEREF_ALIASES );
try
{
Modified: directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/jndi/ObjStateFactoryITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/jndi/ObjStateFactoryITest.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/jndi/ObjStateFactoryITest.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/jndi/ObjStateFactoryITest.java Wed May 23 17:26:40 2007
@@ -64,14 +64,14 @@
public void testStateFactory() throws NamingException
{
super.sysRoot.addToEnvironment( Context.STATE_FACTORIES, PersonStateFactory.class.getName() );
- Person p = new Person( "Rodriguez", "Mr. Kerberos", "noices", "555-1212", "erodriguez", "committer" );
+ Person p = new Person( "Rodriguez", "Mr. Kerberos", "noices", "555-1212", "sn=erodriguez", "committer" );
super.sysRoot.bind( "uid=erodriguez, ou=users", p );
Attributes attrs = super.sysRoot.getAttributes( "uid=erodriguez, ou=users" );
assertEquals( "Rodriguez", attrs.get( "sn" ).get() );
assertEquals( "Mr. Kerberos", attrs.get( "cn" ).get() );
assertTrue( ArrayUtils.isEquals( attrs.get( "userPassword" ).get(), "noices".getBytes() ) );
assertEquals( "555-1212", attrs.get( "telephonenumber" ).get() );
- assertEquals( "erodriguez", attrs.get( "seealso" ).get() );
+ assertEquals( "sn=erodriguez", attrs.get( "seealso" ).get() );
assertEquals( "committer", attrs.get( "description" ).get() );
}
Modified: directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/jndi/ReferralITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/jndi/ReferralITest.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/jndi/ReferralITest.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/jndi/ReferralITest.java Wed May 23 17:26:40 2007
@@ -42,6 +42,7 @@
import org.apache.directory.server.core.jndi.ServerLdapContext;
import org.apache.directory.server.core.unit.AbstractAdminTestCase;
+import org.apache.directory.shared.ldap.constants.JndiPropertyConstants;
import org.apache.directory.shared.ldap.exception.LdapNamingException;
import org.apache.directory.shared.ldap.message.AttributeImpl;
import org.apache.directory.shared.ldap.message.AttributesImpl;
@@ -118,7 +119,7 @@
}
Hashtable<String,Object> env = new Hashtable<String,Object>();
- env.put( "java.naming.factory.initial", "com.sun.jndi.ldap.LdapCtxFactory" );
+ env.put( JndiPropertyConstants.JNDI_FACTORY_INITIAL, "com.sun.jndi.ldap.LdapCtxFactory" );
env.put( "java.naming.provider.url", "ldap://hertz.karasulu.homeip.net:10390/ou=system" );
env.put( "java.naming.security.principal", "uid=admin,ou=system" );
env.put( "java.naming.security.credentials", "longsecret" );
Modified: directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/jndi/SearchContextITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/jndi/SearchContextITest.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/jndi/SearchContextITest.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/jndi/SearchContextITest.java Wed May 23 17:26:40 2007
@@ -34,6 +34,7 @@
import org.apache.directory.server.core.enumeration.SearchResultFilteringEnumeration;
import org.apache.directory.server.core.invocation.Invocation;
import org.apache.directory.server.core.unit.AbstractAdminTestCase;
+import org.apache.directory.shared.ldap.constants.JndiPropertyConstants;
import org.apache.directory.shared.ldap.exception.LdapSizeLimitExceededException;
import org.apache.directory.shared.ldap.exception.LdapTimeLimitExceededException;
import org.apache.directory.shared.ldap.message.AttributeImpl;
@@ -162,7 +163,7 @@
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
controls.setDerefLinkFlag( false );
- sysRoot.addToEnvironment( DerefAliasesEnum.JNDI_DEREF_ALIAS_PROP, DerefAliasesEnum.NEVER_DEREF_ALIASES );
+ sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, DerefAliasesEnum.NEVER_DEREF_ALIASES );
HashMap<String,Attributes> map = new HashMap<String,Attributes>();
NamingEnumeration list = sysRoot.search( "", "(ou=*)", controls );
@@ -184,7 +185,7 @@
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
controls.setDerefLinkFlag( false );
- sysRoot.addToEnvironment( DerefAliasesEnum.JNDI_DEREF_ALIAS_PROP, DerefAliasesEnum.NEVER_DEREF_ALIASES );
+ sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, DerefAliasesEnum.NEVER_DEREF_ALIASES );
HashMap<String, Attributes> map = new HashMap<String, Attributes>();
NamingEnumeration list = sysRoot.search( "", "(ou=*)", controls );
@@ -209,7 +210,7 @@
controls.setDerefLinkFlag( false );
controls.setReturningAttributes( new String[]{ "1.1" } );
- sysRoot.addToEnvironment( DerefAliasesEnum.JNDI_DEREF_ALIAS_PROP, DerefAliasesEnum.NEVER_DEREF_ALIASES );
+ sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, DerefAliasesEnum.NEVER_DEREF_ALIASES );
HashMap<String, Attributes> map = new HashMap<String, Attributes>();
NamingEnumeration list = sysRoot.search( "", "(ou=testing02)", controls );
@@ -232,7 +233,7 @@
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
controls.setDerefLinkFlag( false );
- sysRoot.addToEnvironment( DerefAliasesEnum.JNDI_DEREF_ALIAS_PROP, DerefAliasesEnum.NEVER_DEREF_ALIASES );
+ sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, DerefAliasesEnum.NEVER_DEREF_ALIASES );
HashMap<String, Attributes> map = new HashMap<String, Attributes>();
NamingEnumeration list = sysRoot.search( "", "(objectClass=organ*)", controls );
@@ -257,7 +258,7 @@
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
controls.setDerefLinkFlag( false );
- sysRoot.addToEnvironment( DerefAliasesEnum.JNDI_DEREF_ALIAS_PROP, DerefAliasesEnum.NEVER_DEREF_ALIASES );
+ sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, DerefAliasesEnum.NEVER_DEREF_ALIASES );
HashMap<String, Attributes> map = new HashMap<String, Attributes>();
NamingEnumeration list = sysRoot.search( "", "(| (ou={0}) (ou={1}))", new Object[]
@@ -280,7 +281,7 @@
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
controls.setDerefLinkFlag( false );
controls.setCountLimit( 7 );
- sysRoot.addToEnvironment( DerefAliasesEnum.JNDI_DEREF_ALIAS_PROP, DerefAliasesEnum.NEVER_DEREF_ALIASES );
+ sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, DerefAliasesEnum.NEVER_DEREF_ALIASES );
HashMap<String, Attributes> map = new HashMap<String, Attributes>();
NamingEnumeration list = sysRoot.search( "", "(ou=*)", controls );
@@ -307,7 +308,7 @@
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
controls.setDerefLinkFlag( false );
controls.setTimeLimit( 200 );
- sysRoot.addToEnvironment( DerefAliasesEnum.JNDI_DEREF_ALIAS_PROP, DerefAliasesEnum.NEVER_DEREF_ALIASES );
+ sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, DerefAliasesEnum.NEVER_DEREF_ALIASES );
HashMap<String, Attributes> map = new HashMap<String, Attributes>();
NamingEnumeration list = sysRoot.search( "", "(ou=*)", controls );
@@ -350,7 +351,7 @@
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
controls.setDerefLinkFlag( false );
- sysRoot.addToEnvironment( DerefAliasesEnum.JNDI_DEREF_ALIAS_PROP, DerefAliasesEnum.NEVER_DEREF_ALIASES );
+ sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, DerefAliasesEnum.NEVER_DEREF_ALIASES );
HashMap<String, Attributes> map = new HashMap<String, Attributes>();
NamingEnumeration list = sysRoot.search( "", "(name=testing00)", controls );
@@ -369,7 +370,7 @@
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
controls.setDerefLinkFlag( false );
- sysRoot.addToEnvironment( DerefAliasesEnum.JNDI_DEREF_ALIAS_PROP, DerefAliasesEnum.NEVER_DEREF_ALIASES );
+ sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, DerefAliasesEnum.NEVER_DEREF_ALIASES );
HashMap<String, Attributes> map = new HashMap<String, Attributes>();
NamingEnumeration list = sysRoot.search( "", "(name=*)", controls );
@@ -392,7 +393,7 @@
assertTrue( "contains ou=system", map.containsKey( "ou=system" ) );
assertTrue( "contains ou=users,ou=system", map.containsKey( "ou=users,ou=system" ) );
assertTrue( "contains uid=admin,ou=system", map.containsKey( "uid=admin,ou=system" ) );
- assertTrue( "contains cn=administrators,ou=groups,ou=system", map.containsKey( "cn=administrators,ou=groups,ou=system" ) );
+ assertTrue( "contains cn=administrators,ou=groups,ou=system", map.containsKey( "cn=Administrators,ou=groups,ou=system" ) );
}
@@ -401,7 +402,7 @@
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
controls.setDerefLinkFlag( false );
- sysRoot.addToEnvironment( DerefAliasesEnum.JNDI_DEREF_ALIAS_PROP, DerefAliasesEnum.NEVER_DEREF_ALIASES );
+ sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, DerefAliasesEnum.NEVER_DEREF_ALIASES );
HashMap<String, Attributes> map = new HashMap<String, Attributes>();
NamingEnumeration list = sysRoot.search( "", "(| (name=testing00)(name=testing01))", controls );
@@ -421,7 +422,7 @@
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
controls.setDerefLinkFlag( false );
- sysRoot.addToEnvironment( DerefAliasesEnum.JNDI_DEREF_ALIAS_PROP, DerefAliasesEnum.NEVER_DEREF_ALIASES );
+ sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, DerefAliasesEnum.NEVER_DEREF_ALIASES );
HashMap<String, Attributes> map = new HashMap<String, Attributes>();
NamingEnumeration list = sysRoot.search( "", "(name=testing*)", controls );
@@ -442,7 +443,7 @@
SearchControls controls = new SearchControls();
controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
controls.setDerefLinkFlag( false );
- sysRoot.addToEnvironment( DerefAliasesEnum.JNDI_DEREF_ALIAS_PROP, DerefAliasesEnum.NEVER_DEREF_ALIASES );
+ sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, DerefAliasesEnum.NEVER_DEREF_ALIASES );
HashMap<String, Attributes> map = new HashMap<String, Attributes>();
String filter = "(|(2.5.4.11.1=testing*)(2.5.4.54=testing*)(2.5.4.10=testing*)" +
@@ -469,7 +470,7 @@
controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
controls.setDerefLinkFlag( false );
controls.setReturningAttributes( new String[] { "creatorsName" } );
- sysRoot.addToEnvironment( DerefAliasesEnum.JNDI_DEREF_ALIAS_PROP, DerefAliasesEnum.NEVER_DEREF_ALIASES );
+ sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, DerefAliasesEnum.NEVER_DEREF_ALIASES );
HashMap<String, Attributes> map = new HashMap<String, Attributes>();
NamingEnumeration list = sysRoot.search( "", "(ou=testing00)", controls );
@@ -493,7 +494,7 @@
controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
controls.setDerefLinkFlag( false );
controls.setReturningAttributes( new String[] { "creatorsName" } );
- sysRoot.addToEnvironment( DerefAliasesEnum.JNDI_DEREF_ALIAS_PROP, DerefAliasesEnum.NEVER_DEREF_ALIASES );
+ sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, DerefAliasesEnum.NEVER_DEREF_ALIASES );
HashMap<String, Attributes> map = new HashMap<String, Attributes>();
NamingEnumeration list = sysRoot.search( "", "(ou=testing00)", controls );
@@ -565,7 +566,7 @@
// SearchControls controls = new SearchControls();
// controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
// controls.setDerefLinkFlag( false );
-// sysRoot.addToEnvironment( DerefAliasesEnum.JNDI_DEREF_ALIAS_PROP, DerefAliasesEnum.NEVER_DEREF_ALIASES );
+// sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, DerefAliasesEnum.NEVER_DEREF_ALIASES );
//
// List map = new ArrayList();
// NamingEnumeration list = sysRoot.search( "", "(name=*)", controls );
Modified: directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/jndi/SearchITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/jndi/SearchITest.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/jndi/SearchITest.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/jndi/SearchITest.java Wed May 23 17:26:40 2007
@@ -31,6 +31,7 @@
import javax.naming.directory.SearchResult;
import org.apache.directory.server.core.unit.AbstractAdminTestCase;
+import org.apache.directory.shared.ldap.constants.JndiPropertyConstants;
import org.apache.directory.shared.ldap.message.AttributeImpl;
import org.apache.directory.shared.ldap.message.AttributesImpl;
import org.apache.directory.shared.ldap.message.DerefAliasesEnum;
@@ -175,7 +176,7 @@
controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
controls.setDerefLinkFlag( false );
controls.setReturningAttributes( new String[] { "+" } );
- sysRoot.addToEnvironment( DerefAliasesEnum.JNDI_DEREF_ALIAS_PROP, DerefAliasesEnum.NEVER_DEREF_ALIASES );
+ sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, DerefAliasesEnum.NEVER_DEREF_ALIASES );
HashMap<String, Attributes> map = new HashMap<String, Attributes>();
NamingEnumeration list = sysRoot.search( "", "(ou=testing01)", controls );
@@ -201,7 +202,7 @@
controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
controls.setDerefLinkFlag( false );
controls.setReturningAttributes( new String[] { "*" } );
- sysRoot.addToEnvironment( DerefAliasesEnum.JNDI_DEREF_ALIAS_PROP, DerefAliasesEnum.NEVER_DEREF_ALIASES );
+ sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, DerefAliasesEnum.NEVER_DEREF_ALIASES );
HashMap<String, Attributes> map = new HashMap<String, Attributes>();
NamingEnumeration list = sysRoot.search( "", "(ou=testing01)", controls );
@@ -228,7 +229,7 @@
controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
controls.setDerefLinkFlag( false );
controls.setReturningAttributes( new String[] { "+", "*" } );
- sysRoot.addToEnvironment( DerefAliasesEnum.JNDI_DEREF_ALIAS_PROP, DerefAliasesEnum.NEVER_DEREF_ALIASES );
+ sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, DerefAliasesEnum.NEVER_DEREF_ALIASES );
HashMap<String, Attributes> map = new HashMap<String, Attributes>();
NamingEnumeration list = sysRoot.search( "", "(ou=testing01)", controls );
Modified: directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/operational/BinaryAttributeFilterITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/operational/BinaryAttributeFilterITest.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/operational/BinaryAttributeFilterITest.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/operational/BinaryAttributeFilterITest.java Wed May 23 17:26:40 2007
@@ -65,9 +65,9 @@
value = ou.get();
assertEquals( "test", value );
- // try krb5Key which should be binary automatically - use ou as control
+ // try jpegPhoto which should be binary automatically - use ou as control
byte[] keyValue = new byte[]
- { 0x45, 0x23, 0x7d, 0x7f };
+ { (byte)0xFF, (byte)0xD8, (byte)0xFF, (byte)0xE0, 0x01, 0x02, 'J', 'F', 'I', 'F', 0x00, 0x45, 0x23, 0x7d, 0x7f };
attributes.put( "jpegPhoto", keyValue );
sysRoot.createSubcontext( "ou=anothertest", attributes );
ctx = ( DirContext ) sysRoot.lookup( "ou=anothertest" );
@@ -77,11 +77,11 @@
Attribute jpegPhoto = ctx.getAttributes( "" ).get( "jpegPhoto" );
value = jpegPhoto.get();
assertTrue( value instanceof byte[] );
- assertEquals( "0x45 0x23 0x7D 0x7F ", StringTools.dumpBytes( ( byte[] ) value ) );
+ assertEquals( "0xFF 0xD8 0xFF 0xE0 0x01 0x02 0x4A 0x46 0x49 0x46 0x00 0x45 0x23 0x7D 0x7F ", StringTools.dumpBytes( ( byte[] ) value ) );
// try jpegPhoto which should be binary automatically but use String to
// create so we should still get back a byte[] - use ou as control
- attributes.remove( "jpegPhoto" );
+ /*attributes.remove( "jpegPhoto" );
attributes.put( "jpegPhoto", "testing a string" );
sysRoot.createSubcontext( "ou=yetanothertest", attributes );
ctx = ( DirContext ) sysRoot.lookup( "ou=yetanothertest" );
@@ -90,6 +90,6 @@
assertEquals( "yetanothertest", value );
jpegPhoto = ctx.getAttributes( "" ).get( "jpegPhoto" );
value = jpegPhoto.get();
- assertTrue( value instanceof byte[] );
+ assertTrue( value instanceof byte[] );*/
}
}
Modified: directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceITest.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceITest.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/operational/OperationalAttributeServiceITest.java Wed May 23 17:26:40 2007
@@ -34,6 +34,7 @@
import javax.naming.directory.SearchResult;
import org.apache.directory.server.core.unit.AbstractAdminTestCase;
+import org.apache.directory.shared.ldap.constants.JndiPropertyConstants;
import org.apache.directory.shared.ldap.message.AttributeImpl;
import org.apache.directory.shared.ldap.message.AttributesImpl;
import org.apache.directory.shared.ldap.message.DerefAliasesEnum;
@@ -115,7 +116,7 @@
ctls.setReturningAttributes( new String[]
{ "ou", "createTimestamp", "creatorsName" } );
- sysRoot.addToEnvironment( DerefAliasesEnum.JNDI_DEREF_ALIAS_PROP, DerefAliasesEnum.NEVER_DEREF_ALIASES );
+ sysRoot.addToEnvironment( JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES, DerefAliasesEnum.NEVER_DEREF_ALIASES );
NamingEnumeration list;
list = sysRoot.search( "", "(ou=testing00)", ctls );
SearchResult result = ( SearchResult ) list.next();
Modified: directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/prefs/ServerSystemPreferencesITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/prefs/ServerSystemPreferencesITest.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/prefs/ServerSystemPreferencesITest.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/prefs/ServerSystemPreferencesITest.java Wed May 23 17:26:40 2007
@@ -88,13 +88,17 @@
*
* @throws BackingStoreException if there are failures with the store
*/
+ /* TODO: Temporarily commented until we get a clear status about this package
public void testCreateAndSetByteArray() throws BackingStoreException
{
+ byte[] jpegValue = new byte[]
+ { (byte)0xFF, (byte)0xD8, (byte)0xFF, (byte)0xE0, 0x01, 0x02, 'J', 'F', 'I', 'F', 0x00, 0x45, 0x23, 0x7d, 0x7f };
Preferences testNode = prefs.node( "testNode" );
- testNode.put( "jpegPhoto", "testNodeValue" );
+ testNode.putByteArray( "jpegPhoto", jpegValue );
testNode.sync();
testNode = prefs.node( "testNode" );
}
+ */
/**
Modified: directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/schema/MetaAttributeTypeHandlerITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/schema/MetaAttributeTypeHandlerITest.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/schema/MetaAttributeTypeHandlerITest.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/schema/MetaAttributeTypeHandlerITest.java Wed May 23 17:26:40 2007
@@ -26,8 +26,8 @@
import javax.naming.directory.DirContext;
import org.apache.directory.server.constants.MetaSchemaConstants;
-import org.apache.directory.server.constants.SystemSchemaConstants;
import org.apache.directory.server.core.unit.AbstractAdminTestCase;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.exception.LdapInvalidNameException;
import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
import org.apache.directory.shared.ldap.message.AttributeImpl;
@@ -75,7 +75,7 @@
public void testAddAttributeType() throws NamingException
{
Attributes attrs = new AttributesImpl();
- Attribute oc = new AttributeImpl( SystemSchemaConstants.OBJECT_CLASS_AT, "top" );
+ Attribute oc = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT, "top" );
oc.add( MetaSchemaConstants.META_TOP_OC );
oc.add( MetaSchemaConstants.META_ATTRIBUTE_TYPE_OC );
attrs.put( oc );
@@ -252,7 +252,7 @@
private void addDependeeAttributeType() throws NamingException
{
Attributes attrs = new AttributesImpl();
- Attribute oc = new AttributeImpl( SystemSchemaConstants.OBJECT_CLASS_AT, "top" );
+ Attribute oc = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT, "top" );
oc.add( MetaSchemaConstants.META_TOP_OC );
oc.add( MetaSchemaConstants.META_ATTRIBUTE_TYPE_OC );
attrs.put( oc );
@@ -430,7 +430,7 @@
public void testAddAttributeTypeToDisabledSchema() throws NamingException
{
Attributes attrs = new AttributesImpl();
- Attribute oc = new AttributeImpl( SystemSchemaConstants.OBJECT_CLASS_AT, "top" );
+ Attribute oc = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT, "top" );
oc.add( MetaSchemaConstants.META_TOP_OC );
oc.add( MetaSchemaConstants.META_ATTRIBUTE_TYPE_OC );
attrs.put( oc );
Modified: directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/schema/MetaComparatorHandlerITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/schema/MetaComparatorHandlerITest.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/schema/MetaComparatorHandlerITest.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/schema/MetaComparatorHandlerITest.java Wed May 23 17:26:40 2007
@@ -33,8 +33,8 @@
import jdbm.helper.StringComparator;
import org.apache.directory.server.constants.MetaSchemaConstants;
-import org.apache.directory.server.constants.SystemSchemaConstants;
import org.apache.directory.server.core.unit.AbstractAdminTestCase;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.exception.LdapInvalidNameException;
import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
import org.apache.directory.shared.ldap.message.AttributeImpl;
@@ -77,7 +77,7 @@
public void testAddComparator() throws NamingException
{
Attributes attrs = new AttributesImpl();
- Attribute oc = new AttributeImpl( SystemSchemaConstants.OBJECT_CLASS_AT, "top" );
+ Attribute oc = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT, "top" );
oc.add( MetaSchemaConstants.META_TOP_OC );
oc.add( MetaSchemaConstants.META_COMPARATOR_OC );
attrs.put( oc );
@@ -106,7 +106,7 @@
}
Attributes attrs = new AttributesImpl();
- Attribute oc = new AttributeImpl( SystemSchemaConstants.OBJECT_CLASS_AT, "top" );
+ Attribute oc = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT, "top" );
oc.add( MetaSchemaConstants.META_TOP_OC );
oc.add( MetaSchemaConstants.META_COMPARATOR_OC );
attrs.put( oc );
@@ -432,7 +432,7 @@
public void testAddComparatorToDisabledSchema() throws NamingException
{
Attributes attrs = new AttributesImpl();
- Attribute oc = new AttributeImpl( SystemSchemaConstants.OBJECT_CLASS_AT, "top" );
+ Attribute oc = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT, "top" );
oc.add( MetaSchemaConstants.META_TOP_OC );
oc.add( MetaSchemaConstants.META_COMPARATOR_OC );
attrs.put( oc );
Modified: directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/schema/MetaMatchingRuleHandlerITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/schema/MetaMatchingRuleHandlerITest.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/schema/MetaMatchingRuleHandlerITest.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/schema/MetaMatchingRuleHandlerITest.java Wed May 23 17:26:40 2007
@@ -26,8 +26,8 @@
import javax.naming.directory.DirContext;
import org.apache.directory.server.constants.MetaSchemaConstants;
-import org.apache.directory.server.constants.SystemSchemaConstants;
import org.apache.directory.server.core.unit.AbstractAdminTestCase;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.exception.LdapInvalidNameException;
import org.apache.directory.shared.ldap.message.AttributeImpl;
import org.apache.directory.shared.ldap.message.AttributesImpl;
@@ -73,7 +73,7 @@
public void testAddMatchingRule() throws NamingException
{
Attributes attrs = new AttributesImpl();
- Attribute oc = new AttributeImpl( SystemSchemaConstants.OBJECT_CLASS_AT, "top" );
+ Attribute oc = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT, "top" );
oc.add( MetaSchemaConstants.META_TOP_OC );
oc.add( MetaSchemaConstants.META_MATCHING_RULE_OC );
attrs.put( oc );
@@ -410,7 +410,7 @@
public void testAddMatchingRuleToDisabledSchema() throws NamingException
{
Attributes attrs = new AttributesImpl();
- Attribute oc = new AttributeImpl( SystemSchemaConstants.OBJECT_CLASS_AT, "top" );
+ Attribute oc = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT, "top" );
oc.add( MetaSchemaConstants.META_TOP_OC );
oc.add( MetaSchemaConstants.META_MATCHING_RULE_OC );
attrs.put( oc );
Modified: directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/schema/MetaNormalizerHandlerITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/schema/MetaNormalizerHandlerITest.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/schema/MetaNormalizerHandlerITest.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/schema/MetaNormalizerHandlerITest.java Wed May 23 17:26:40 2007
@@ -30,8 +30,8 @@
import javax.naming.directory.DirContext;
import org.apache.directory.server.constants.MetaSchemaConstants;
-import org.apache.directory.server.constants.SystemSchemaConstants;
import org.apache.directory.server.core.unit.AbstractAdminTestCase;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.exception.LdapInvalidNameException;
import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
import org.apache.directory.shared.ldap.message.AttributeImpl;
@@ -76,7 +76,7 @@
public void testAddNormalizer() throws NamingException
{
Attributes attrs = new AttributesImpl();
- Attribute oc = new AttributeImpl( SystemSchemaConstants.OBJECT_CLASS_AT, "top" );
+ Attribute oc = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT, "top" );
oc.add( MetaSchemaConstants.META_TOP_OC );
oc.add( MetaSchemaConstants.META_NORMALIZER_OC );
attrs.put( oc );
@@ -105,7 +105,7 @@
}
Attributes attrs = new AttributesImpl();
- Attribute oc = new AttributeImpl( SystemSchemaConstants.OBJECT_CLASS_AT, "top" );
+ Attribute oc = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT, "top" );
oc.add( MetaSchemaConstants.META_TOP_OC );
oc.add( MetaSchemaConstants.META_NORMALIZER_OC );
attrs.put( oc );
@@ -431,7 +431,7 @@
public void testAddNormalizerToDisabledSchema() throws NamingException
{
Attributes attrs = new AttributesImpl();
- Attribute oc = new AttributeImpl( SystemSchemaConstants.OBJECT_CLASS_AT, "top" );
+ Attribute oc = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT, "top" );
oc.add( MetaSchemaConstants.META_TOP_OC );
oc.add( MetaSchemaConstants.META_NORMALIZER_OC );
attrs.put( oc );
Modified: directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/schema/MetaObjectClassHandlerITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/schema/MetaObjectClassHandlerITest.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/schema/MetaObjectClassHandlerITest.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/schema/MetaObjectClassHandlerITest.java Wed May 23 17:26:40 2007
@@ -26,8 +26,8 @@
import javax.naming.directory.DirContext;
import org.apache.directory.server.constants.MetaSchemaConstants;
-import org.apache.directory.server.constants.SystemSchemaConstants;
import org.apache.directory.server.core.unit.AbstractAdminTestCase;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.exception.LdapInvalidNameException;
import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
import org.apache.directory.shared.ldap.message.AttributeImpl;
@@ -76,7 +76,7 @@
public void testAddObjectClass() throws NamingException
{
Attributes attrs = new AttributesImpl();
- Attribute oc = new AttributeImpl( SystemSchemaConstants.OBJECT_CLASS_AT, "top" );
+ Attribute oc = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT, "top" );
oc.add( MetaSchemaConstants.META_TOP_OC );
oc.add( MetaSchemaConstants.META_OBJECT_CLASS_OC );
attrs.put( oc );
@@ -253,7 +253,7 @@
private void addDependeeObjectClass() throws NamingException
{
Attributes attrs = new AttributesImpl();
- Attribute oc = new AttributeImpl( SystemSchemaConstants.OBJECT_CLASS_AT, "top" );
+ Attribute oc = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT, "top" );
oc.add( MetaSchemaConstants.META_TOP_OC );
oc.add( MetaSchemaConstants.META_OBJECT_CLASS_OC );
attrs.put( oc );
@@ -431,7 +431,7 @@
public void testAddObjectClassToDisabledSchema() throws NamingException
{
Attributes attrs = new AttributesImpl();
- Attribute oc = new AttributeImpl( SystemSchemaConstants.OBJECT_CLASS_AT, "top" );
+ Attribute oc = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT, "top" );
oc.add( MetaSchemaConstants.META_TOP_OC );
oc.add( MetaSchemaConstants.META_OBJECT_CLASS_OC );
attrs.put( oc );
Modified: directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/schema/MetaSyntaxCheckerHandlerITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/schema/MetaSyntaxCheckerHandlerITest.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/schema/MetaSyntaxCheckerHandlerITest.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/schema/MetaSyntaxCheckerHandlerITest.java Wed May 23 17:26:40 2007
@@ -29,8 +29,8 @@
import javax.naming.directory.DirContext;
import org.apache.directory.server.constants.MetaSchemaConstants;
-import org.apache.directory.server.constants.SystemSchemaConstants;
import org.apache.directory.server.core.unit.AbstractAdminTestCase;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.exception.LdapInvalidNameException;
import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
import org.apache.directory.shared.ldap.message.AttributeImpl;
@@ -73,7 +73,7 @@
public void testAddSyntaxChecker() throws NamingException
{
Attributes attrs = new AttributesImpl();
- Attribute oc = new AttributeImpl( SystemSchemaConstants.OBJECT_CLASS_AT, "top" );
+ Attribute oc = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT, "top" );
oc.add( MetaSchemaConstants.META_TOP_OC );
oc.add( MetaSchemaConstants.META_SYNTAX_CHECKER_OC );
attrs.put( oc );
@@ -102,7 +102,7 @@
}
Attributes attrs = new AttributesImpl();
- Attribute oc = new AttributeImpl( SystemSchemaConstants.OBJECT_CLASS_AT, "top" );
+ Attribute oc = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT, "top" );
oc.add( MetaSchemaConstants.META_TOP_OC );
oc.add( MetaSchemaConstants.META_SYNTAX_CHECKER_OC );
attrs.put( oc );
@@ -428,7 +428,7 @@
public void testAddSyntaxCheckerToDisabledSchema() throws NamingException
{
Attributes attrs = new AttributesImpl();
- Attribute oc = new AttributeImpl( SystemSchemaConstants.OBJECT_CLASS_AT, "top" );
+ Attribute oc = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT, "top" );
oc.add( MetaSchemaConstants.META_TOP_OC );
oc.add( MetaSchemaConstants.META_SYNTAX_CHECKER_OC );
attrs.put( oc );
Modified: directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/schema/MetaSyntaxHandlerITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/schema/MetaSyntaxHandlerITest.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/schema/MetaSyntaxHandlerITest.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/schema/MetaSyntaxHandlerITest.java Wed May 23 17:26:40 2007
@@ -32,8 +32,8 @@
import javax.naming.directory.SearchResult;
import org.apache.directory.server.constants.MetaSchemaConstants;
-import org.apache.directory.server.constants.SystemSchemaConstants;
import org.apache.directory.server.core.unit.AbstractAdminTestCase;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.exception.LdapInvalidNameException;
import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
import org.apache.directory.shared.ldap.message.AttributeImpl;
@@ -82,7 +82,7 @@
public void testAddSyntax() throws NamingException
{
Attributes attrs = new AttributesImpl();
- Attribute oc = new AttributeImpl( SystemSchemaConstants.OBJECT_CLASS_AT, "top" );
+ Attribute oc = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT, "top" );
oc.add( MetaSchemaConstants.META_TOP_OC );
oc.add( MetaSchemaConstants.META_SYNTAX_OC );
attrs.put( oc );
@@ -332,7 +332,7 @@
private void addDependeeMatchingRule( String oid ) throws NamingException
{
Attributes attrs = new AttributesImpl();
- Attribute oc = new AttributeImpl( SystemSchemaConstants.OBJECT_CLASS_AT, "top" );
+ Attribute oc = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT, "top" );
oc.add( MetaSchemaConstants.META_TOP_OC );
oc.add( MetaSchemaConstants.META_MATCHING_RULE_OC );
attrs.put( oc );
@@ -432,7 +432,7 @@
public void testAddSyntaxToDisabledSchema() throws NamingException
{
Attributes attrs = new AttributesImpl();
- Attribute oc = new AttributeImpl( SystemSchemaConstants.OBJECT_CLASS_AT, "top" );
+ Attribute oc = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT, "top" );
oc.add( MetaSchemaConstants.META_TOP_OC );
oc.add( MetaSchemaConstants.META_SYNTAX_OC );
attrs.put( oc );
Modified: directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/schema/SchemaServiceITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/schema/SchemaServiceITest.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/schema/SchemaServiceITest.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/schema/SchemaServiceITest.java Wed May 23 17:26:40 2007
@@ -507,4 +507,137 @@
assertTrue( seeAlso.contains( "cn=Bad E\u00e9k\u00e0,ou=people,o=sevenSeas" ) );
}
+ /**
+ * Doing a search with filtering attributes should work even if the attribute
+ * is not valid
+ *
+ */
+ public void testSearchForUnknownAttributes() throws NamingException
+ {
+ SearchControls controls = new SearchControls();
+ controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
+ Map<String, Attributes> persons = new HashMap<String, Attributes>();
+ controls.setReturningAttributes( new String[] { "9.9.9" } );
+
+ NamingEnumeration results = sysRoot.search( "", "(objectClass=person)", controls );
+
+ while ( results.hasMore() )
+ {
+ SearchResult result = ( SearchResult ) results.next();
+ persons.put( result.getName(), result.getAttributes() );
+ }
+
+ // admin is extra
+ assertEquals( 4, persons.size() );
+
+ Attributes person = null;
+ Attribute ocs = null;
+
+ person = persons.get( "cn=person0,ou=system" );
+ assertNotNull( person );
+ ocs = person.get( "objectClass" );
+ assertNull( ocs );
+
+ ocs = person.get( "9.9.9" );
+ assertNull( ocs );
+
+ person = persons.get( "cn=person1,ou=system" );
+ assertNotNull( person );
+ ocs = person.get( "objectClass" );
+ assertNull( ocs );
+
+ person = persons.get( "cn=person2,ou=system" );
+ assertNotNull( person );
+ ocs = person.get( "objectClass" );
+ assertNull( ocs );
+ }
+
+ /**
+ * Check that if we request a Attribute which is not an AttributeType,
+ * we still get a result
+ */
+ public void testSearchAttributesOIDObjectClass() throws NamingException
+ {
+ SearchControls controls = new SearchControls();
+ controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
+ Map<String, Attributes> persons = new HashMap<String, Attributes>();
+ controls.setReturningAttributes( new String[] { "2.5.6.6" } );
+
+ NamingEnumeration results = sysRoot.search( "", "(objectClass=person)", controls );
+
+ while ( results.hasMore() )
+ {
+ SearchResult result = ( SearchResult ) results.next();
+ persons.put( result.getName(), result.getAttributes() );
+ }
+
+ // admin is extra
+ assertEquals( 4, persons.size() );
+
+ Attributes person = null;
+ Attribute ocs = null;
+
+ person = persons.get( "cn=person0,ou=system" );
+ assertNotNull( person );
+ ocs = person.get( "objectClass" );
+ assertNull( ocs );
+
+ // We should not get this attribute (it's an ObjectClass)
+ ocs = person.get( "2.5.6.6" );
+ assertNull( ocs );
+
+ person = persons.get( "cn=person1,ou=system" );
+ assertNotNull( person );
+ ocs = person.get( "objectClass" );
+ assertNull( ocs );
+
+ person = persons.get( "cn=person2,ou=system" );
+ assertNotNull( person );
+ ocs = person.get( "objectClass" );
+ assertNull( ocs );
+ }
+
+ /**
+ * Check that if we request a Attribute which is an ObjectClass.
+ */
+ public void testSearchAttributesOIDObjectClassName() throws NamingException
+ {
+ SearchControls controls = new SearchControls();
+ controls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
+ Map<String, Attributes> persons = new HashMap<String, Attributes>();
+ controls.setReturningAttributes( new String[] { "person" } );
+
+ NamingEnumeration results = sysRoot.search( "", "(objectClass=person)", controls );
+
+ while ( results.hasMore() )
+ {
+ SearchResult result = ( SearchResult ) results.next();
+ persons.put( result.getName(), result.getAttributes() );
+ }
+
+ // admin is extra
+ assertEquals( 4, persons.size() );
+
+ Attributes person = null;
+ Attribute ocs = null;
+
+ person = persons.get( "cn=person0,ou=system" );
+ assertNotNull( person );
+ ocs = person.get( "objectClass" );
+ assertNull( ocs );
+
+ // We should not get this attrinute (it's an ObjectClass)
+ ocs = person.get( "2.5.4.46" );
+ assertNull( ocs );
+
+ person = persons.get( "cn=person1,ou=system" );
+ assertNotNull( person );
+ ocs = person.get( "objectClass" );
+ assertNull( ocs );
+
+ person = persons.get( "cn=person2,ou=system" );
+ assertNotNull( person );
+ ocs = person.get( "objectClass" );
+ assertNull( ocs );
+ }
}
Modified: directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryITest.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryITest.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/schema/SubschemaSubentryITest.java Wed May 23 17:26:40 2007
@@ -24,18 +24,25 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Hashtable;
import java.util.List;
+import java.util.TimeZone;
+import javax.naming.Context;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;
import javax.naming.directory.DirContext;
+import javax.naming.directory.InitialDirContext;
import javax.naming.directory.SearchControls;
import javax.naming.directory.SearchResult;
import jdbm.helper.IntegerComparator;
+import org.apache.directory.server.core.configuration.Configuration;
+import org.apache.directory.server.core.configuration.StartupConfiguration;
import org.apache.directory.server.core.unit.AbstractAdminTestCase;
import org.apache.directory.shared.ldap.exception.LdapNameAlreadyBoundException;
import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
@@ -63,6 +70,7 @@
import org.apache.directory.shared.ldap.schema.syntax.parser.ObjectClassDescriptionSchemaParser;
import org.apache.directory.shared.ldap.schema.syntax.parser.SyntaxCheckerDescriptionSchemaParser;
import org.apache.directory.shared.ldap.util.Base64;
+import org.apache.directory.shared.ldap.util.DateUtils;
/**
@@ -1723,6 +1731,141 @@
checkObjectClassPresent( "1.3.6.1.4.1.18060.0.4.1.3.10001", "other", true );
}
+
+ // -----------------------------------------------------------------------
+ // Test Modifier and Timestamp Updates
+ // -----------------------------------------------------------------------
+
+
+ /**
+ * This method checks the modifiersName, and the modifyTimestamp on the schema
+ * subentry then modifies a schema. It then checks it again to make sure these
+ * values have been updated properly to reflect the modification time and the
+ * modifier.
+ */
+ public void testTimestampAndModifierUpdates() throws NamingException, InterruptedException
+ {
+ TimeZone tz = TimeZone.getTimeZone( "GMT" );
+
+ Attributes subentry = this.getSubschemaSubentryAttributes();
+
+ // check first that everything that is required is present
+
+ Attribute creatorsNameAttr = subentry.get( "creatorsName" );
+ Attribute createTimestampAttr = subentry.get( "createTimestamp" );
+ assertNotNull( creatorsNameAttr );
+ assertNotNull( createTimestampAttr );
+
+ Attribute modifiersNameAttr = subentry.get( "modifiersName" );
+ Attribute modifiersTimestampAttr = subentry.get( "modifyTimestamp" );
+ assertNotNull( modifiersNameAttr );
+ LdapDN expectedDN = new LdapDN( "uid=admin,ou=system" );
+ expectedDN.normalize( super.registries.getAttributeTypeRegistry().getNormalizerMapping() );
+ assertEquals( expectedDN.getNormName(), modifiersNameAttr.get() );
+ assertNotNull( modifiersTimestampAttr );
+
+ Calendar cal = Calendar.getInstance( tz );
+ assertTrue( DateUtils.getDate( ( String ) modifiersTimestampAttr.get() ) .before( cal.getTime() ) );
+
+ // now update the schema information: add a new attribute type
+
+ enableSchema( "nis" );
+ LdapDN dn = new LdapDN( getSubschemaSubentryDN() );
+ String substrate = "( 1.3.6.1.4.1.18060.0.4.0.2.10000 NAME ( 'bogus' 'bogusName' ) " +
+ "DESC 'bogus description' SUP name SINGLE-VALUE X-SCHEMA 'nis' )";
+ ModificationItemImpl[] mods = new ModificationItemImpl[1];
+ mods[0] = new ModificationItemImpl( DirContext.ADD_ATTRIBUTE,
+ new AttributeImpl( "attributeTypes", substrate ) );
+
+ rootDSE.modifyAttributes( dn, mods );
+
+ // now check the modification timestamp and the modifiers name
+
+ subentry = this.getSubschemaSubentryAttributes();
+
+ // check first that everything that is required is present
+
+ Attribute creatorsNameAttrAfter = subentry.get( "creatorsName" );
+ Attribute createTimestampAttrAfter = subentry.get( "createTimestamp" );
+ assertNotNull( creatorsNameAttrAfter );
+ assertNotNull( createTimestampAttrAfter );
+
+ Attribute modifiersNameAttrAfter = subentry.get( "modifiersName" );
+ Attribute modifiersTimestampAttrAfter = subentry.get( "modifyTimestamp" );
+ assertNotNull( modifiersNameAttrAfter );
+ expectedDN = new LdapDN( "uid=admin,ou=system" );
+ expectedDN.normalize( super.registries.getAttributeTypeRegistry().getNormalizerMapping() );
+ assertEquals( expectedDN.getNormName(), modifiersNameAttrAfter.get() );
+ assertNotNull( modifiersTimestampAttrAfter );
+
+ // generalized time is correct up to the last second so we should
+ // wait a second just to avoid rounding errors that may show sys
+ // time to be around same time as generalized time for after modify
+ Thread.sleep( 1000 );
+
+ cal = Calendar.getInstance( tz );
+ assertTrue( DateUtils.getDate( ( String ) modifiersTimestampAttrAfter.get() ).before( cal.getTime() ) );
+ assertTrue( DateUtils.getDate( ( String ) modifiersTimestampAttrAfter.get() )
+ .after( DateUtils.getDate( ( String ) modifiersTimestampAttr.get() ) ) );
+
+ // now let's test the modifiersName update with another user besides
+ // the administrator - we'll create a dummy user for that ...
+
+ AttributesImpl user = new AttributesImpl( "objectClass", "person", true );
+ user.put( "sn", "bogus" );
+ user.put( "cn", "bogus user" );
+ user.put( "userPassword", "secret" );
+ sysRoot.createSubcontext( "cn=bogus user", user );
+
+ // now let's get a context for this user
+
+ Hashtable<String,Object> env = new Hashtable<String,Object>();
+ env.put( Context.INITIAL_CONTEXT_FACTORY, "org.apache.directory.server.core.jndi.CoreContextFactory" );
+ env.put( Context.PROVIDER_URL, "" );
+ env.put( Context.SECURITY_AUTHENTICATION, "simple" );
+ env.put( Context.SECURITY_CREDENTIALS, "secret" );
+ env.put( Context.SECURITY_PRINCIPAL, "cn=bogus user,ou=system" );
+ env.put( Configuration.JNDI_KEY, new StartupConfiguration() );
+ InitialDirContext ctx = new InitialDirContext( env );
+
+ // now let's add another attribute type definition to the schema but
+ // with this newly created user and check that the modifiers name is his
+
+ substrate = "( 1.3.6.1.4.1.18060.0.4.0.2.10001 NAME ( 'bogus2' 'bogusName2' ) " +
+ "DESC 'bogus description' SUP name SINGLE-VALUE X-SCHEMA 'nis' )";
+ mods[0] = new ModificationItemImpl( DirContext.ADD_ATTRIBUTE,
+ new AttributeImpl( "attributeTypes", substrate ) );
+ ctx.modifyAttributes( dn, mods );
+
+ // now let's verify the new values for the modification attributes
+
+ subentry = this.getSubschemaSubentryAttributes();
+
+ creatorsNameAttrAfter = subentry.get( "creatorsName" );
+ createTimestampAttrAfter = subentry.get( "createTimestamp" );
+ assertNotNull( creatorsNameAttrAfter );
+ assertNotNull( createTimestampAttrAfter );
+
+ modifiersNameAttrAfter = subentry.get( "modifiersName" );
+ modifiersTimestampAttrAfter = subentry.get( "modifyTimestamp" );
+ assertNotNull( modifiersNameAttrAfter );
+ expectedDN = new LdapDN( "cn=bogus user,ou=system" );
+ expectedDN.normalize( super.registries.getAttributeTypeRegistry().getNormalizerMapping() );
+ assertEquals( expectedDN.getNormName(), modifiersNameAttrAfter.get() );
+ assertNotNull( modifiersTimestampAttrAfter );
+
+ // generalized time is correct up to the last second so we should
+ // wait a second just to avoid rounding errors that may show sys
+ // time to be around same time as generalized time for after modify
+ Thread.sleep( 1000 );
+
+ cal = Calendar.getInstance( tz );
+ assertTrue( DateUtils.getDate( ( String ) modifiersTimestampAttrAfter.get() ).before( cal.getTime() ) );
+ assertTrue( DateUtils.getDate( ( String ) modifiersTimestampAttrAfter.get() )
+ .after( DateUtils.getDate( ( String ) modifiersTimestampAttr.get() ) ) );
+
+ }
+
// -----------------------------------------------------------------------
// Private Utility Methods
Modified: directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/subtree/BadSubentryServiceITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/subtree/BadSubentryServiceITest.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/subtree/BadSubentryServiceITest.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/subtree/BadSubentryServiceITest.java Wed May 23 17:26:40 2007
@@ -33,6 +33,7 @@
import javax.naming.directory.SearchResult;
import org.apache.directory.server.core.unit.AbstractAdminTestCase;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.message.AttributeImpl;
import org.apache.directory.shared.ldap.message.AttributesImpl;
import org.apache.directory.shared.ldap.message.ModificationItemImpl;
@@ -64,7 +65,7 @@
Attributes subentry = new AttributesImpl();
Attribute objectClass = new AttributeImpl( "objectClass" );
objectClass.add( "top" );
- objectClass.add( "subentry" );
+ objectClass.add( SchemaConstants.SUBENTRY_OC );
objectClass.add( "collectiveAttributeSubentry" );
subentry.put( objectClass );
subentry.put( "subtreeSpecification", "{ }" );
@@ -79,7 +80,7 @@
Attributes subentry = new AttributesImpl();
Attribute objectClass = new AttributeImpl( "objectClass" );
objectClass.add( "top" );
- objectClass.add( "subentry" );
+ objectClass.add( SchemaConstants.SUBENTRY_OC );
objectClass.add( "accessControlSubentry" );
subentry.put( objectClass );
subentry.put( "subtreeSpecification", "{ }" );
Modified: directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceEntryModificationHandlingITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceEntryModificationHandlingITest.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceEntryModificationHandlingITest.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceEntryModificationHandlingITest.java Wed May 23 17:26:40 2007
@@ -33,6 +33,7 @@
import javax.naming.directory.SearchResult;
import org.apache.directory.server.core.unit.AbstractAdminTestCase;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.message.AttributeImpl;
import org.apache.directory.shared.ldap.message.AttributesImpl;
import org.apache.directory.shared.ldap.message.ModificationItemImpl;
@@ -66,7 +67,7 @@
Attributes subentry = new AttributesImpl();
Attribute objectClass = new AttributeImpl( "objectClass" );
objectClass.add( "top" );
- objectClass.add( "subentry" );
+ objectClass.add( SchemaConstants.SUBENTRY_OC );
objectClass.add( "collectiveAttributeSubentry" );
subentry.put( objectClass );
subentry.put( "subtreeSpecification", "{ specificationFilter (sn=" + sn + ") }" );
Modified: directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceITest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceITest.java?view=diff&rev=541123&r1=541122&r2=541123
==============================================================================
--- directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceITest.java (original)
+++ directory/apacheds/branches/apacheds-sasl-branch/core-unit/src/test/java/org/apache/directory/server/core/subtree/SubentryServiceITest.java Wed May 23 17:26:40 2007
@@ -19,9 +19,9 @@
*/
package org.apache.directory.server.core.subtree;
-
import org.apache.directory.server.core.subtree.SubentryService;
import org.apache.directory.server.core.unit.AbstractAdminTestCase;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
import org.apache.directory.shared.ldap.exception.LdapNoSuchAttributeException;
import org.apache.directory.shared.ldap.message.AttributeImpl;
import org.apache.directory.shared.ldap.message.AttributesImpl;
@@ -67,7 +67,7 @@
Attributes subentry = new AttributesImpl();
Attribute objectClass = new AttributeImpl( "objectClass" );
objectClass.add( "top" );
- objectClass.add( "subentry" );
+ objectClass.add( SchemaConstants.SUBENTRY_OC );
objectClass.add( "collectiveAttributeSubentry" );
subentry.put( objectClass );
subentry.put( "subtreeSpecification", "{ base \"ou=configuration\" }" );
@@ -82,7 +82,7 @@
Attributes subentry = new AttributesImpl();
Attribute objectClass = new AttributeImpl( "objectClass" );
objectClass.add( "top" );
- objectClass.add( "subentry" );
+ objectClass.add( SchemaConstants.SUBENTRY_OC );
objectClass.add( "collectiveAttributeSubentry" );
subentry.put( objectClass );
String spec = "{ base \"ou=configuration\", specificExclusions { chopBefore:\"cn=unmarked\" } }";