diff options
Diffstat (limited to 'das-java/contrib/ldap/das.ldap/src/main/java/org/apache/directory')
8 files changed, 754 insertions, 0 deletions
diff --git a/das-java/contrib/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/ADSEmbeddedConnectionTemplate.java b/das-java/contrib/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/ADSEmbeddedConnectionTemplate.java new file mode 100644 index 0000000000..7977f60545 --- /dev/null +++ b/das-java/contrib/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/ADSEmbeddedConnectionTemplate.java @@ -0,0 +1,129 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.directory.apacheds.testing.setup; + +import java.util.Hashtable; + +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; +import javax.naming.ldap.InitialLdapContext; +import javax.naming.ldap.LdapContext; + +import org.apache.directory.server.core.configuration.MutableStartupConfiguration; +import org.apache.directory.server.core.configuration.ShutdownConfiguration; +import org.apache.log4j.PropertyConfigurator; + +/** + * The Class JNDIEmbeddedConnectionTemplate. + */ +public abstract class ADSEmbeddedConnectionTemplate +extends JNDIConnectionTemplate +{ + public void tearDown() throws NamingException, Exception + { + Hashtable<String,Object> env = + new Hashtable<String,Object>(); + + env = createEnvironment(env); + + env.put( + Context.PROVIDER_URL, + SYSTEM_PROVIDER_PATH); + env.put( + Context.INITIAL_CONTEXT_FACTORY, + "org.apache.directory.server.core.jndi.CoreContextFactory" ); + env.putAll( + new ShutdownConfiguration().toJndiEnvironment() ); + + new InitialContext( env ); + Runtime.getRuntime().gc(); + super.tearDown(); + } + + + + public void setUp() throws Exception + { + PropertyConfigurator. + configure(NLOG4J_CONFIGURATION_FILEPATH); + super.setUp(); + } + + /** + * Connect to an embedded ApacheDS server. + * + * @param providerPath the provider path ("ou=schema", ou="system", etc.) + * + * @return the ldap context + * + * @throws NamingException the naming exception + */ + public LdapContext connect( String providerPath ) throws NamingException + { + MutableStartupConfiguration mutableStartupConfiguration = + new MutableStartupConfiguration(); + + Hashtable<String,Object> adminEnv = + new Hashtable<String,Object>( ); + + adminEnv.putAll( + mutableStartupConfiguration. + toJndiEnvironment()); + + adminEnv.put( + Context.PROVIDER_URL, + SYSTEM_PROVIDER_PATH); + adminEnv.put( + Context.SECURITY_PRINCIPAL, + DEFAULT_SECURITY_PRINCIPAL_VALUE); + adminEnv.put( + Context.SECURITY_CREDENTIALS, + DEFAULT_SECURITY_CREDENTIALS_VALUE); + adminEnv.put( + Context.SECURITY_AUTHENTICATION, + SIMPLE_SECURITY_AUTHENTICATION_VALUE ); + new InitialLdapContext( adminEnv, null ); + + + + Hashtable<String,Object> env = + new Hashtable<String,Object>(); + + env.put( + Context.INITIAL_CONTEXT_FACTORY, + "org.apache.directory.server.core.jndi.CoreContextFactory" ); + env.put( + Context.SECURITY_PRINCIPAL, + DEFAULT_SECURITY_PRINCIPAL_VALUE); + env.put( + Context.SECURITY_CREDENTIALS, + DEFAULT_SECURITY_CREDENTIALS_VALUE); + env.put( + Context.SECURITY_AUTHENTICATION, + SIMPLE_SECURITY_AUTHENTICATION_VALUE ); + env.put( Context.PROVIDER_URL, providerPath ); + + env.put( Context.PROVIDER_URL, providerPath ); + + return new InitialLdapContext( env, null ); + + } +}
\ No newline at end of file diff --git a/das-java/contrib/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/ADSEmbeddedConnectionTemplateTest.java b/das-java/contrib/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/ADSEmbeddedConnectionTemplateTest.java new file mode 100644 index 0000000000..f5426b3424 --- /dev/null +++ b/das-java/contrib/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/ADSEmbeddedConnectionTemplateTest.java @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.directory.apacheds.testing.setup; + +import javax.naming.NamingException; +import javax.naming.ldap.LdapContext; + +public class ADSEmbeddedConnectionTemplateTest +extends ADSEmbeddedConnectionTemplate +{ + public void tearDown() throws NamingException, Exception + { + super.tearDown(); + } + + public void setUp() throws Exception + { + super.setUp(); + } + + public void testSchemaConnect() throws NamingException + { + LdapContext ldapContext =null; + + ldapContext =connect("ou=schema"); + + assertEquals( + "ou=schema", + ldapContext.getNameInNamespace()); + } + + public void testRootDSEConnect() throws NamingException + { + LdapContext ldapContext =null; + + ldapContext =connect(""); + + assertEquals( + "", + ldapContext.getNameInNamespace()); + } +}
\ No newline at end of file diff --git a/das-java/contrib/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/ADSEmbeddedHotPartitionTemplate.java b/das-java/contrib/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/ADSEmbeddedHotPartitionTemplate.java new file mode 100644 index 0000000000..fae915a0a2 --- /dev/null +++ b/das-java/contrib/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/ADSEmbeddedHotPartitionTemplate.java @@ -0,0 +1,157 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.directory.apacheds.testing.setup; + +import java.util.HashSet; +import java.util.Hashtable; +import java.util.Set; + +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; +import javax.naming.directory.Attributes; +import javax.naming.directory.BasicAttributes; +import javax.naming.ldap.InitialLdapContext; +import javax.naming.ldap.LdapContext; + +import org.apache.directory.server.core.configuration.Configuration; +import org.apache.directory.server.core.configuration.MutablePartitionConfiguration; +import org.apache.directory.server.core.configuration.MutableStartupConfiguration; +import org.apache.directory.server.core.configuration.ShutdownConfiguration; +import org.apache.log4j.PropertyConfigurator; + +/** + * The Class JNDIEmbeddedConnectionTemplate. + */ +public abstract class ADSEmbeddedHotPartitionTemplate +extends JNDIConnectionTemplate +{ + public void tearDown() throws NamingException, Exception + { + Hashtable<String,Object> env = + new Hashtable<String,Object>(); + + env = createEnvironment(env); + + env.put( + Context.PROVIDER_URL, + SYSTEM_PROVIDER_PATH); + env.put( + Context.INITIAL_CONTEXT_FACTORY, + "org.apache.directory.server.core.jndi.CoreContextFactory" ); + env.putAll( + new ShutdownConfiguration().toJndiEnvironment() ); + + new InitialContext( env ); + Runtime.getRuntime().gc(); + super.tearDown(); + } + + + + public void setUp() throws Exception + { + PropertyConfigurator. + configure(NLOG4J_CONFIGURATION_FILEPATH); + super.setUp(); + } + + /** + * Connect to an embedded ApacheDS server. + * + * @param partitionName the provider path ("ou=schema", ou="system", etc.) + * + * @return the ldap context + * + * @throws NamingException the naming exception + */ + public LdapContext connect( String partitionName ) throws NamingException + { + MutableStartupConfiguration mutableStartupConfiguration = + new MutableStartupConfiguration(); + + Hashtable<String,Object> adminEnv = + new Hashtable<String,Object>( ); + + adminEnv.putAll( + mutableStartupConfiguration. + toJndiEnvironment()); + + adminEnv.put( + Context.PROVIDER_URL, + SYSTEM_PROVIDER_PATH); + adminEnv.put( + Context.SECURITY_PRINCIPAL, + DEFAULT_SECURITY_PRINCIPAL_VALUE); + adminEnv.put( + Context.SECURITY_CREDENTIALS, + DEFAULT_SECURITY_CREDENTIALS_VALUE); + adminEnv.put( + Context.SECURITY_AUTHENTICATION, + SIMPLE_SECURITY_AUTHENTICATION_VALUE ); + new InitialLdapContext( adminEnv, null ); + + + MutablePartitionConfiguration dasPartition = + new MutablePartitionConfiguration(); + + Attributes suffixAttributes = new BasicAttributes(); + suffixAttributes.put( "objectClass", "top"); + suffixAttributes.get( "objectClass" ).add( "organizationalUnit" ); + suffixAttributes.put( "ou", partitionName ); + + dasPartition.setId( partitionName); + dasPartition.setSuffix( "ou=" +partitionName ); + dasPartition.setContextEntry( suffixAttributes ); + + Set<MutablePartitionConfiguration> partitions = + new HashSet<MutablePartitionConfiguration> (); + + partitions.add( dasPartition ); + + mutableStartupConfiguration. + setPartitionConfigurations( partitions ); + + Hashtable<String,Object> env = + new Hashtable<String,Object>(); + + env.put( + Context.INITIAL_CONTEXT_FACTORY, + "org.apache.directory.server.core.jndi.CoreContextFactory" ); + env.put( + Context.SECURITY_PRINCIPAL, + DEFAULT_SECURITY_PRINCIPAL_VALUE); + env.put( + Context.SECURITY_CREDENTIALS, + DEFAULT_SECURITY_CREDENTIALS_VALUE); + env.put( + Context.SECURITY_AUTHENTICATION, + SIMPLE_SECURITY_AUTHENTICATION_VALUE ); + env.put( + Context.PROVIDER_URL, + "ou=" + partitionName ); + + env.put( + Configuration.JNDI_KEY, + mutableStartupConfiguration ); + + return new InitialLdapContext( env, null ); + } +}
\ No newline at end of file diff --git a/das-java/contrib/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/ADSEmbeddedHotPartitionTemplateTest.java b/das-java/contrib/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/ADSEmbeddedHotPartitionTemplateTest.java new file mode 100644 index 0000000000..aba1ff7940 --- /dev/null +++ b/das-java/contrib/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/ADSEmbeddedHotPartitionTemplateTest.java @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.directory.apacheds.testing.setup; + +import javax.naming.NamingException; +import javax.naming.ldap.LdapContext; + +public class ADSEmbeddedHotPartitionTemplateTest +extends ADSEmbeddedHotPartitionTemplate +{ + public void tearDown() throws NamingException, Exception + { + super.tearDown(); + } + + public void setUp() throws Exception + { + super.setUp(); + } + + public void testCreateHotPartition() throws NamingException + { + LdapContext ldapContext = + null; + + ldapContext = + connect("test"); + + assertEquals( + "ou=test", + ldapContext.getNameInNamespace()); + } +}
\ No newline at end of file diff --git a/das-java/contrib/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/JNDIConnectionTemplate.java b/das-java/contrib/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/JNDIConnectionTemplate.java new file mode 100644 index 0000000000..ae267144eb --- /dev/null +++ b/das-java/contrib/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/JNDIConnectionTemplate.java @@ -0,0 +1,103 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.directory.apacheds.testing.setup; + +import java.util.Hashtable; + +import javax.naming.Context; +import javax.naming.NamingException; +import javax.naming.ldap.InitialLdapContext; +import javax.naming.ldap.LdapContext; + +import org.apache.tuscany.das.ldap.constants.ApacheDSConnectionConstants; + +import junit.framework.TestCase; + +/* + * Just a class template class + */ +public abstract class JNDIConnectionTemplate +extends TestCase +implements ApacheDSConnectionConstants +{ + protected String providerHost = + "ldap://localhost:10389/"; + + protected String providerPath = + SYSTEM_PROVIDER_PATH; + + private String providerURL = + providerHost + providerPath; + + protected String initialContextFactory = + SUN_CONTEXT_FACTORY; + + protected String securityAuthentication = + SIMPLE_SECURITY_AUTHENTICATION_VALUE; + + protected String securityPrincipal = + DEFAULT_SECURITY_PRINCIPAL_VALUE; + + protected String credentials = + DEFAULT_SECURITY_CREDENTIALS_VALUE; + + public Hashtable<String,Object> createEnvironment( + Hashtable<String, Object> env) + { + providerURL = + providerHost + providerPath; + + env.put( + Context.PROVIDER_URL, + providerURL); + + env.put( + Context.INITIAL_CONTEXT_FACTORY, + initialContextFactory ); + + env.put( + Context.SECURITY_AUTHENTICATION, + securityAuthentication); + + env.put( + Context.SECURITY_PRINCIPAL, + securityPrincipal ); + + env.put( + Context.SECURITY_CREDENTIALS, + credentials ); + + return env; + } + + public LdapContext connect() throws NamingException + { + Hashtable<String, Object> env = + new Hashtable<String, Object>(); + + return new InitialLdapContext( + createEnvironment(env), null); + } + + public void setUp() throws Exception + { + super.setUp(); + } +}
\ No newline at end of file diff --git a/das-java/contrib/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/JNDIConnectionTemplateTest.java b/das-java/contrib/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/JNDIConnectionTemplateTest.java new file mode 100644 index 0000000000..883a556167 --- /dev/null +++ b/das-java/contrib/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/JNDIConnectionTemplateTest.java @@ -0,0 +1,66 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.directory.apacheds.testing.setup; + +import javax.naming.NamingException; +import javax.naming.ldap.LdapContext; + +/* + * These tests require a running server. + */ +public class JNDIConnectionTemplateTest extends JNDIConnectionTemplate +{ + private static LdapContext systemContext = null; + private static LdapContext schemaContext = null; + + public void tearDown() throws NamingException, Exception + { + super.tearDown(); + } + + public void setUp() throws NamingException, Exception + { + super.setUp(); + } + + public void testSystemContextConnection() + throws NamingException + { + systemContext = connect(); + assertNotNull( systemContext ); + assertNotNull( connect() ); + assertEquals( + systemContext. + getNameInNamespace(), + "ou=system"); + } + + public void testSchemaContextConnection() + throws NamingException + { + providerPath = SCHEMA_PROVIDER_PATH; + schemaContext = connect(); + assertNotNull (schemaContext); + assertNotNull(connect()); + assertEquals( + schemaContext.getNameInNamespace(), + "ou=schema"); + } +}
\ No newline at end of file diff --git a/das-java/contrib/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/JNDIHotPartitionConnectionTemplate.java b/das-java/contrib/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/JNDIHotPartitionConnectionTemplate.java new file mode 100644 index 0000000000..546ccea0d5 --- /dev/null +++ b/das-java/contrib/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/JNDIHotPartitionConnectionTemplate.java @@ -0,0 +1,117 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.directory.apacheds.testing.setup; + +import java.util.HashSet; +import java.util.Hashtable; +import java.util.Set; + +import javax.naming.Context; +import javax.naming.NamingException; +import javax.naming.directory.Attributes; +import javax.naming.directory.BasicAttributes; +import javax.naming.ldap.InitialLdapContext; +import javax.naming.ldap.LdapContext; + +import org.apache.directory.server.core.configuration.Configuration; +import org.apache.directory.server.core.configuration.MutablePartitionConfiguration; +import org.apache.directory.server.core.configuration.MutableStartupConfiguration; +import org.apache.tuscany.das.ldap.constants.ApacheDSConnectionConstants; +import org.apache.tuscany.das.ldap.schema.embedded.setup.test.AbstractTestSetup; + +import junit.framework.TestCase; + +/* + * Just a class template class + */ +public abstract class JNDIHotPartitionConnectionTemplate +extends AbstractTestSetup +implements ApacheDSConnectionConstants +{ + + public Hashtable<String,Object> createEnvironment( + Hashtable<String, Object> env, + String partitionName) throws NamingException + { + MutableStartupConfiguration mutableStartupConfiguration = + new MutableStartupConfiguration(); + + MutablePartitionConfiguration dasPartition = + new MutablePartitionConfiguration(); + + Attributes suffixAttributes = new BasicAttributes(); + suffixAttributes.put( "objectClass", "top"); + suffixAttributes.get( "objectClass" ).add( "organizationalUnit" ); + suffixAttributes.put( "ou", partitionName ); + + dasPartition.setId( partitionName); + dasPartition.setSuffix( "ou=" +partitionName ); + dasPartition.setContextEntry( suffixAttributes ); + + Set<MutablePartitionConfiguration> partitions = + new HashSet<MutablePartitionConfiguration> (); + + partitions.add( dasPartition ); + + mutableStartupConfiguration. + setPartitionConfigurations( partitions ); + + env.put( + Context.INITIAL_CONTEXT_FACTORY, + "org.apache.directory.server.core.jndi.CoreContextFactory" ); + + env.put( + Context.SECURITY_PRINCIPAL, + DEFAULT_SECURITY_PRINCIPAL_VALUE); + + env.put( + Context.SECURITY_CREDENTIALS, + DEFAULT_SECURITY_CREDENTIALS_VALUE); + + env.put( + Context.SECURITY_AUTHENTICATION, + SIMPLE_SECURITY_AUTHENTICATION_VALUE ); + + env.put( + Context.PROVIDER_URL, + "ou=" + partitionName ); + + env.put( + Configuration.JNDI_KEY, + mutableStartupConfiguration ); + + return env; + } + + public LdapContext connect( String partitionName ) + throws NamingException + { + Hashtable<String, Object> env = + new Hashtable<String, Object>(); + + return new InitialLdapContext( + createEnvironment(env, partitionName), null); + } + + public void setUp() throws Exception + { + super.setUp(); + } +}
\ No newline at end of file diff --git a/das-java/contrib/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/JNDIHotPartitionConnectionTemplateTest.java b/das-java/contrib/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/JNDIHotPartitionConnectionTemplateTest.java new file mode 100644 index 0000000000..85b9f5eb10 --- /dev/null +++ b/das-java/contrib/ldap/das.ldap/src/main/java/org/apache/directory/apacheds/testing/setup/JNDIHotPartitionConnectionTemplateTest.java @@ -0,0 +1,73 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.directory.apacheds.testing.setup; + +import javax.naming.NamingException; +import javax.naming.ldap.LdapContext; + +/* + * These tests require a running server. + */ +public class JNDIHotPartitionConnectionTemplateTest +extends JNDIHotPartitionConnectionTemplate +{ + private static LdapContext testContext = null; + private static LdapContext systemContext = null; + private static LdapContext schemaContext = null; + + public void tearDown() throws NamingException, Exception + { + super.tearDown(); + } + + public void setUp() throws NamingException, Exception + { + super.setUp(); + } + + public void testTestContextConnection() + throws NamingException + { + testContext = connect("test"); + assertNotNull(testContext ); + assertEquals( + testContext.getNameInNamespace(), "ou=test"); + } + + + public void testSystemContextConnection() + throws NamingException + { + systemContext = connect("system"); + assertNotNull( systemContext ); + assertEquals( + systemContext.getNameInNamespace(), "ou=system"); + } + + public void testSchemaContextConnection() + throws NamingException + { + schemaContext = connect("schema"); + assertNotNull( schemaContext ); + assertEquals( + schemaContext.getNameInNamespace(), + "ou=schema"); + } +}
\ No newline at end of file |