directory-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yiannis Mavroukakis <imavrouka...@gameaccount.com>
Subject Re: Embedded apacheds for junit
Date Tue, 05 May 2009 08:21:54 GMT
Hi Paul,

I haven't done any unit testing with apacheds before, but if this is the 
embedded version, I believe you need to create your partition initially 
before applying your changes, unless that's what @ApplyLdifs is meant to 
do. I may be wrong here though so take my advice with the proverbial 
pinch..:)

Y.
Paul Edwards wrote:
> Guys,
>
> I have followed the instructions for using apacheds within a junit test.
>
> The issue I have is I cannot seem to modify the schema. I have by default an ou=system
which I can add/remove stuff from. I cannot seem to create a new partition in any way shape
or form. Obviously for unit testing I want a different partition. Ideally dc=hyro,dc=com.
I have this ldif:
>
> dn: dc=hyro,dc=com
> objectclass: dcObject
> objectclass: organization
> o: hyro
> dc: hyro
>
> dn: cn=Manager,dc=hyro,dc=com
> objectclass: organizationalRole
> cn: Manager
>
> dn: ou=People,dc=hyro,dc=com
> ou: People
> objectClass: top
> objectClass: organizationalUnit
>
> dn: cn=pedwards,ou=People,dc=hyro,dc=com
> cn: pedwards
> objectClass: inetOrgPerson
> sn: Edwards
> uid: pedwards
> userPassword: password
>
>
> I have used this successfully with openldap many time. I have tried changing everything
under the sun and no joy. It just throws:
>
> hyro_common: 2009-05-05 18:03:48 DEBUG [DefaultOperationManager] >> AddOperation
: AddContext for DN 'dc=hyro,dc=com', added entry: ServerEntry
>     dn[n]: 0.9.2342.19200300.100.1.25=hyro,0.9.2342.19200300.100.1.25=com
>     objectclass: organization
>     dc: hyro
>     o: hyro
>
> hyro_common: 2009-05-05 18:03:48 DEBUG [AuthenticationInterceptor] Operation Context:
AddContext for DN 'dc=hyro,dc=com', added entry: ServerEntry
>     dn[n]: 0.9.2342.19200300.100.1.25=hyro,0.9.2342.19200300.100.1.25=com
>     objectclass: organization
>     dc: hyro
>     o: hyro
>
> hyro_common: 2009-05-05 18:03:48 DEBUG [DefaultOidRegistry] looked up OID '2.5.4.0' with
id 'objectClass'
> hyro_common: 2009-05-05 18:03:48 DEBUG [DefaultAttributeTypeRegistry] lookup with id2.5.4.0'
of attributeType: <2.5.4.0, objectClass>
> hyro_common: 2009-05-05 18:03:48 DEBUG [DefaultNormalizerRegistry] registered normalizer
with oid: 2.5.13.0
> hyro_common: 2009-05-05 18:03:48 DEBUG [DefaultPartitionNexus] Check if DN '0.9.2342.19200300.100.1.25=hyro,0.9.2342.19200300.100.1.25=com'
exists.
> java.lang.NoSuchMethodError: org.junit.runner.notification.RunNotifier.testAborted(Lorg/junit/runner/Description;Ljava/lang/Throwable;)V
> 	at org.apache.directory.server.integ.state.StartedPristineState.test(StartedPristineState.java:199)
> 	at org.apache.directory.server.integ.state.NonExistentState.test(NonExistentState.java:213)
> 	at org.apache.directory.server.integ.state.TestServerContext.test(TestServerContext.java:187)
> 	at org.apache.directory.server.integ.SiRunner.invokeTestMethod(SiRunner.java:103)
> 	at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:59)
> 	at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:52)
> 	at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:34)
> 	at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:44)
> 	at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:50)
> 	at org.apache.directory.server.integ.SiRunner.run(SiRunner.java:77)
> 	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
> 	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
>
> The top of the code looks like:
>
> import static org.apache.directory.server.integ.ServerIntegrationUtils.getWiredContext;
> import static org.junit.Assert.assertNotNull;
> import static org.junit.Assert.assertNull;
> import static org.junit.Assert.assertEquals;
> import static org.junit.Assert.assertTrue;
> import static org.junit.Assert.fail;
>
> import java.util.Hashtable;
>
> import javax.naming.Context;
> import javax.naming.InitialContext;
> import javax.naming.NamingEnumeration;
> import javax.naming.directory.Attribute;
> import javax.naming.directory.Attributes;
> import javax.naming.directory.DirContext;
> import javax.naming.directory.SearchControls;
> import javax.naming.directory.SearchResult;
> import javax.naming.ldap.LdapContext;
>
> import org.apache.directory.server.core.integ.Level;
> import org.apache.directory.server.core.integ.annotations.ApplyLdifs;
> import org.apache.directory.server.core.integ.annotations.CleanupLevel;
> import org.apache.directory.server.integ.SiRunner;
> import org.apache.directory.server.ldap.LdapService;
> import org.apache.tools.ant.taskdefs.Sleep;
> import org.junit.runner.RunWith;
> import org.junit.Test;
>
> @RunWith(SiRunner.class)
> @CleanupLevel(Level.CLASS)
> @ApplyLdifs( {
> 	
> 	"dn: dc=hyro,dc=com\n" +
> 	//"objectclass: dcObject\n" +
> 	"objectclass: organization\n" +
> 	"o: hyro\n" +
> 	"dc: hyro\n\n" +
>
> 	"dn: cn=Manager,dc=hyro,dc=com\n" +
> 	"objectclass: organizationalRole\n" +
> 	"cn: Manager\n\n" +
>
> 	"dn: ou=People,dc=hyro,dc=com\n" +
> 	"ou: People\n" +
> 	"objectClass: top\n" +
> 	"objectClass: organizationalUnit\n\n" +
>
> 	"dn: cn=pedwards,ou=People,dc=hyro,dc=com\n" +
> 	"cn: pedwards\n" +
> 	"objectClass: inetOrgPerson\n" +
> 	"sn: Edwards\n" +
> 	"uid: pedwards\n" +
> 	"userPassword: password\n\n"
> 	
>
> } )	
>
>
> Help gratefully received.
> Thanks
> --
> Paul Edwards
> Solutions Engineer
> Identity Solutions Practice
> ---------------------------------------------------------
> hyro
> W www.hyro.com
>   

Mime
View raw message