You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by oe...@apache.org on 2007/05/31 21:58:38 UTC
svn commit: r543239 [9/37] - in
/directory/sandbox/oersoy/das.testing/das.ldap.parent: ./
das.ldap.configuration.model.ecore.v100/
das.ldap.configuration.model.ecore.v100/.settings/
das.ldap.configuration.model.ecore.v100/model/ das.ldap.configuration....
Added: directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/create/test/CreateSyntaxEntrySelfContainedTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/create/test/CreateSyntaxEntrySelfContainedTest.java?view=auto&rev=543239
==============================================================================
--- directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/create/test/CreateSyntaxEntrySelfContainedTest.java (added)
+++ directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/create/test/CreateSyntaxEntrySelfContainedTest.java Thu May 31 12:58:13 2007
@@ -0,0 +1,155 @@
+/*
+ * 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.tuscany.das.ldap.create.test;
+
+import java.util.Hashtable;
+
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttribute;
+import javax.naming.directory.BasicAttributes;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.InitialDirContext;
+
+import junit.framework.TestCase;
+
+public class CreateSyntaxEntrySelfContainedTest
+extends TestCase
+{
+ private static final String XSD_CONTEXT_RDN = "cn=xsd";
+ private static final String XSD_SYNTAX_RDN = "ou=syntaxes";
+ private static final String OID =
+ "1.3.6.1.4.1.18060.0.4.0.0.100000.233.1233";
+
+ private DirContext directoryContext = null;
+ private DirContext xsdContext = null;
+ private DirContext syntaxContext = null;
+ private String xsdSyntaxStringRDN = "m-oid" + "=" + OID;
+
+ public void setUp() throws NamingException
+ {
+ directoryContext = connect();
+ xsdContext = createXSDSchemaContext();
+ syntaxContext = createSyntaxContext();
+ }
+
+ public void tearDown() throws NamingException
+ {
+ syntaxContext.destroySubcontext( xsdSyntaxStringRDN );
+ syntaxContext.close();
+ xsdContext.destroySubcontext( XSD_SYNTAX_RDN );
+ xsdContext.close();
+ directoryContext.destroySubcontext( XSD_CONTEXT_RDN );
+ directoryContext.close();
+ }
+
+ public DirContext connect() throws NamingException
+ {
+ Hashtable<String,String> env = new Hashtable<String, String>();
+
+ env.put(
+ DirContext.INITIAL_CONTEXT_FACTORY,
+ "com.sun.jndi.ldap.LdapCtxFactory" );
+ env.put(
+ DirContext.PROVIDER_URL,
+ "ldap://localhost:10389/ou=schema");
+ env.put(
+ DirContext.SECURITY_AUTHENTICATION,
+ "simple");
+ env.put(
+ DirContext.SECURITY_PRINCIPAL,
+ "uid=admin,ou=system" );
+ env.put(
+ DirContext.SECURITY_CREDENTIALS,
+ "secret" );
+ return new InitialDirContext(env);
+ }
+
+ public DirContext createXSDSchemaContext() throws NamingException
+ {
+ Attributes xsdAttributes = new BasicAttributes();
+
+ Attribute objectClassAttribute = new BasicAttribute(
+ "objectClass",
+ "top");
+ objectClassAttribute.add("metaSchema");
+
+ Attribute xsdAttribute = new BasicAttribute(
+ "cn",
+ "xsd");
+
+ Attribute mDependenciesAttribute = new BasicAttribute(
+ "m-dependencies", "system");
+
+ xsdAttributes.put( objectClassAttribute );
+ xsdAttributes.put( xsdAttribute );
+ xsdAttributes.put( mDependenciesAttribute );
+
+ return directoryContext.createSubcontext(
+ XSD_CONTEXT_RDN, xsdAttributes );
+ }
+
+ public DirContext createSyntaxContext() throws NamingException
+ {
+ Attribute objectClassAttribute = new BasicAttribute(
+ "objectClass",
+ "top");
+ objectClassAttribute.add( "organizationalUnit" );
+
+ Attribute syntaxesAttribute = new BasicAttribute(
+ "ou",
+ "syntaxes");
+
+ Attributes syntaxAttributes = new BasicAttributes();
+ syntaxAttributes.put( syntaxesAttribute );
+ syntaxAttributes.put( objectClassAttribute);
+
+ return ( DirContext ) xsdContext.createSubcontext( XSD_SYNTAX_RDN, syntaxAttributes );
+ }
+
+ public void testCreateSyntaxSchemaEntry() throws NamingException
+ {
+ Attribute objectClassAttribute = new BasicAttribute(
+ "objectClass",
+ "metaSyntax" );
+ objectClassAttribute.add( "metaTop" );
+ objectClassAttribute.add( "top" );
+
+ Attribute oidAttribute = new BasicAttribute(
+ "m-oid",
+ OID);
+
+ Attribute descriptionAttribute = new BasicAttribute(
+ "m-description",
+ "xsd:String");
+
+ Attributes attributes = new BasicAttributes();
+
+ attributes.put( objectClassAttribute );
+ attributes.put( oidAttribute );
+ attributes.put( descriptionAttribute );
+// attributes.put( "m-name", ",monkey" );
+
+ syntaxContext.createSubcontext( xsdSyntaxStringRDN, attributes );
+ syntaxContext.lookup(xsdSyntaxStringRDN);
+// syntaxContext.lookup("monkeywrench");
+ }
+}
Added: directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/create/test/InitialContextCreatorHelperTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/create/test/InitialContextCreatorHelperTest.java?view=auto&rev=543239
==============================================================================
--- directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/create/test/InitialContextCreatorHelperTest.java (added)
+++ directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/create/test/InitialContextCreatorHelperTest.java Thu May 31 12:58:13 2007
@@ -0,0 +1,203 @@
+/*
+ * 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.tuscany.das.ldap.create.test;
+
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.das.ldap.create.InitialContextCreatorHelper;
+
+import org.apache.tuscany.das.ldap.configuration.model.v100.ConnectionManager;
+import org.apache.tuscany.das.ldap.configuration.model.v100.DASLdapModelV100Factory;
+import org.apache.tuscany.das.ldap.util.XSDNamespaceURITokenizer;
+import org.eclipse.emf.common.util.URI;
+
+/*
+ * Note these tests require a running instance of ApacheDS
+ */
+
+public class InitialContextCreatorHelperTest
+extends TestCase
+{
+ protected String xsdNamespace = "http://example.com/users/accounts";
+ protected URI xsdNamespaceURI = URI.createURI( xsdNamespace );
+
+ DirContext comContext = null;
+ DirContext exampleContext = null;
+ DirContext usersContext = null;
+
+
+ protected DirContext dasPartitionContext = null;
+ protected ConnectionManager connectionManager = null;
+
+ public void setUp() throws NamingException
+ {
+ DASLdapModelV100Factory dasLdapV100Factory =
+ DASLdapModelV100Factory.eINSTANCE;
+ connectionManager =
+ dasLdapV100Factory.createConnectionManager();
+ dasPartitionContext = connectionManager.createDASPartition();
+ }
+
+ public void tearDown() throws NamingException
+ {
+ if (dasPartitionContext != null)
+ {
+ connectionManager.disconnect( dasPartitionContext );
+ }
+ }
+
+ public void testCreateSystemSubContext() throws NamingException
+ {
+ String testContextRDN = "cn=newContext";
+
+ Object testContext = null;
+
+ try {
+ testContext = dasPartitionContext.lookup( testContextRDN );
+ }
+ catch (Exception e)
+ {
+ //good
+ }
+
+ assertNull(testContext);
+
+ InitialContextCreatorHelper.createSubContext(
+ dasPartitionContext,
+ testContextRDN,
+ null);
+
+ testContext = dasPartitionContext.lookup( testContextRDN );
+
+ assertNotNull(testContext);
+ dasPartitionContext.destroySubcontext( testContextRDN );
+ }
+
+ public void testCreateExistingSystemSubContext() throws NamingException
+ {
+ String testContextRDN = "cn=newContext";
+ Object testContext = null;
+
+ try {
+ testContext = dasPartitionContext.lookup( testContextRDN );
+ }
+ catch (Exception e)
+ {
+ //good
+ }
+
+ assertNull(testContext);
+
+ InitialContextCreatorHelper.createSubContext(
+ dasPartitionContext,
+ testContextRDN,
+ null);
+
+ //Run the same code again.
+ InitialContextCreatorHelper.createSubContext(
+ dasPartitionContext,
+ testContextRDN,
+ null);
+
+ testContext = dasPartitionContext.lookup( testContextRDN );
+
+ assertNotNull(testContext);
+ dasPartitionContext.destroySubcontext( testContextRDN );
+ }
+
+
+ public void testCreateAuthorityContext()
+ throws NamingException
+ {
+ try
+ {
+ comContext =
+ ( DirContext )
+ dasPartitionContext.lookup("cn=com");
+ }
+ catch ( NamingException e )
+ {
+ //Good - the subcontext does not exist
+ }
+ assertTrue(comContext==null);
+
+ String[] authorityTokens =
+ XSDNamespaceURITokenizer.createAuthorityTokens(xsdNamespaceURI);
+
+ InitialContextCreatorHelper.createAuthorityContext(
+ dasPartitionContext,
+ authorityTokens );
+
+ comContext =
+ ( DirContext ) dasPartitionContext.lookup("cn=com");
+
+ assertNotNull(comContext);
+
+ exampleContext =
+ ( DirContext ) comContext.lookup("cn=example");
+
+ assertNotNull(exampleContext);
+
+ comContext.destroySubcontext( "cn=example" );
+ dasPartitionContext.destroySubcontext( "cn=com" );
+ }
+
+ public void testCreatePathContext() throws NamingException
+ {
+ String[] authorityTokens =
+ XSDNamespaceURITokenizer.
+ createAuthorityTokens(xsdNamespaceURI);
+
+ exampleContext =
+ InitialContextCreatorHelper.
+ createAuthorityContext(
+ dasPartitionContext,
+ authorityTokens );
+
+ String[] pathTokens =
+ XSDNamespaceURITokenizer.
+ createPathTokens(xsdNamespaceURI);
+
+ InitialContextCreatorHelper.
+ createPathContext(
+ exampleContext,
+ pathTokens );
+
+ comContext =
+ ( DirContext )
+ dasPartitionContext.
+ lookup("cn=com");
+
+ exampleContext =
+ ( DirContext )
+ comContext.
+ lookup("cn=example");
+
+ usersContext = ( DirContext ) exampleContext.lookup("cn=users");
+
+ usersContext.destroySubcontext( "cn=accounts" );
+ exampleContext.destroySubcontext( "cn=users" );
+ comContext.destroySubcontext( "cn=example" );
+ dasPartitionContext.destroySubcontext( "cn=com" );
+ }
+}
\ No newline at end of file
Added: directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/create/test/InitialContextCreatorTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/create/test/InitialContextCreatorTest.java?view=auto&rev=543239
==============================================================================
--- directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/create/test/InitialContextCreatorTest.java (added)
+++ directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/create/test/InitialContextCreatorTest.java Thu May 31 12:58:13 2007
@@ -0,0 +1,67 @@
+/*
+ * 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.tuscany.das.ldap.create.test;
+
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+
+import org.apache.tuscany.das.ldap.create.InitialContextCreator;
+import org.apache.tuscany.das.ldap.test.TestSetup;
+
+public class InitialContextCreatorTest
+extends TestSetup
+{
+ public void testCreate() throws NamingException
+ {
+ DirContext comContext = null;
+ DirContext exampleContext = null;
+ DirContext usersContext = null;
+ DirContext accountsContext = null;
+
+ InitialContextCreator.
+ create(
+ xsdNamespace,
+ dasPartitionContext );
+
+ comContext =
+ ( DirContext )
+ dasPartitionContext.lookup( "cn=com" );
+ exampleContext = ( DirContext )comContext.lookup( "cn=example" );
+ usersContext = ( DirContext ) exampleContext.lookup( "cn=users" );
+ accountsContext = ( DirContext ) usersContext.lookup( "cn=accounts" );
+
+ assertNotNull(exampleContext);
+ assertNotNull(exampleContext);
+ assertNotNull(usersContext);
+ assertNotNull(accountsContext);
+
+ usersContext.
+ destroySubcontext( "cn=accounts" );
+
+ exampleContext.
+ destroySubcontext( "cn=users" );
+
+ comContext.
+ destroySubcontext( "cn=example" );
+
+ dasPartitionContext.
+ destroySubcontext( "cn=com" );
+ }
+}
Added: directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/create/test/SyntaxEntryCreatorTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/create/test/SyntaxEntryCreatorTest.java?view=auto&rev=543239
==============================================================================
--- directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/create/test/SyntaxEntryCreatorTest.java (added)
+++ directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/create/test/SyntaxEntryCreatorTest.java Thu May 31 12:58:13 2007
@@ -0,0 +1,74 @@
+/*
+ * 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.tuscany.das.ldap.create.test;
+
+import javax.naming.directory.DirContext;
+
+import org.apache.tuscany.das.ldap.schema.create.ComplexTypeRDNCreator;
+import org.apache.tuscany.das.ldap.schema.create.SyntaxEntryCreator;
+import org.apache.tuscany.das.ldap.schema.destroy.SyntaxEntryDestroyer;
+import org.apache.tuscany.das.ldap.schema.setup.test.XSDContextsSetup;
+
+public class SyntaxEntryCreatorTest
+extends XSDContextsSetup
+{
+ DirContext syntaxEntryContext =
+ null;
+ String dataTypeName =
+ "string";
+ String namespaceURI =
+ "http://org.apache.tuscany/sdo/datatypes";
+
+ public void testCreate()
+ throws Exception
+ {
+ SyntaxEntryCreator.create(
+ oidPrefix,
+ dataTypeName,
+ namespaceURI,
+ xsdSyntaxesContext );
+
+ String rdn =
+ ComplexTypeRDNCreator.
+ create(
+ oidPrefix,
+ dataTypeName,
+ namespaceURI);
+
+ syntaxEntryContext =
+ ( DirContext )
+ xsdSyntaxesContext.
+ lookup(rdn);
+
+ assertNotNull(syntaxEntryContext);
+
+ SyntaxEntryDestroyer.
+ destroy(
+ oidPrefix,
+ dataTypeName,
+ namespaceURI,
+ xsdSyntaxesContext );
+ }
+
+ public void tearDown() throws Exception
+ {
+ super.tearDown();
+ }
+}
Added: directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/create/test/UniqueOIDCreatorHelperTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/create/test/UniqueOIDCreatorHelperTest.java?view=auto&rev=543239
==============================================================================
--- directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/create/test/UniqueOIDCreatorHelperTest.java (added)
+++ directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/create/test/UniqueOIDCreatorHelperTest.java Thu May 31 12:58:13 2007
@@ -0,0 +1,53 @@
+/*
+ * 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.tuscany.das.ldap.create.test;
+
+import org.apache.tuscany.das.ldap.oid.create.OIDCreatorHelper;
+
+import junit.framework.TestCase;
+
+public class UniqueOIDCreatorHelperTest
+extends TestCase
+{
+ public void testCalculateSegmentedOID() throws Exception
+ {
+ String input1 = "56102578";
+ String input2 = "5610257834";
+
+ String result =
+ "will not pass if exception not caught";
+ try {
+ result =
+ OIDCreatorHelper.
+ calculateSegmentedOID( input1 );
+ }
+ catch (Exception e)
+ {
+ result = "passed";
+ }
+ assertEquals(result, "passed");
+
+ result =
+ OIDCreatorHelper.
+ calculateSegmentedOID( input2 );
+
+ assertEquals(result, "56102578.4");
+ }
+}
\ No newline at end of file
Added: directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/destroy/test/InitialContextDestroyerTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/destroy/test/InitialContextDestroyerTest.java?view=auto&rev=543239
==============================================================================
--- directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/destroy/test/InitialContextDestroyerTest.java (added)
+++ directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/destroy/test/InitialContextDestroyerTest.java Thu May 31 12:58:13 2007
@@ -0,0 +1,78 @@
+/*
+ * 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.tuscany.das.ldap.destroy.test;
+
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+
+import org.apache.tuscany.das.ldap.destroy.InitialContextDestroyer;
+import org.apache.tuscany.das.ldap.test.TestSetup;
+
+public class InitialContextDestroyerTest extends TestSetup
+{
+ DirContext test1Context = null;
+ DirContext test2Context = null;
+ DirContext test3Context = null;
+
+ /*
+ * Tests that the initial context destroyer
+ * destroys child projects before parent projects.
+ */
+ public void testDestroy() throws NamingException
+ {
+ test1Context =
+ ( DirContext )
+ dasPartitionContext.
+ createSubcontext( "cn=test1" );
+
+ test2Context =
+ ( DirContext )
+ test1Context.
+ createSubcontext( "cn=test2" );
+
+ test3Context =
+ ( DirContext )
+ test2Context.
+ createSubcontext( "cn=test3" );
+
+ Object test = null;
+ test =
+ dasPartitionContext.
+ lookup( "cn=test1" );
+
+ assertNotNull(test);
+
+ InitialContextDestroyer.
+ destroy(
+ test3Context,
+ dasPartitionContext);
+
+ try
+ {
+ test = dasPartitionContext.lookup( "cn=test1" );
+ }
+ catch (Exception e)
+ {
+ test = "caught";
+ }
+
+ assertSame("caught", test);
+ }
+}
\ No newline at end of file
Added: directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/learning/test/DualHotPartitionTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/learning/test/DualHotPartitionTest.java?view=auto&rev=543239
==============================================================================
--- directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/learning/test/DualHotPartitionTest.java (added)
+++ directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/learning/test/DualHotPartitionTest.java Thu May 31 12:58:13 2007
@@ -0,0 +1,71 @@
+/*
+ * 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.tuscany.das.ldap.learning.test;
+
+import javax.naming.NamingException;
+
+import org.apache.tuscany.das.ldap.configuration.model.v100.DASLdapModelV100Factory;
+import org.apache.tuscany.das.ldap.test.TestSetup;
+
+public class DualHotPartitionTest
+extends TestSetup
+{
+ public void setUp() throws NamingException
+ {
+ DASLdapModelV100Factory dasLdapV100Factory =
+ DASLdapModelV100Factory.eINSTANCE;
+ connectionManager =
+ dasLdapV100Factory.createConnectionManager();
+ }
+
+ /*
+ * Create the ou=das partition and the cn=newContext
+ * under it. See whether cn=newContext shows up
+ * programmatically and in LS visually.
+ *
+ * The context is there, but remains invisible to LS
+ */
+
+ public void testCreateDualHotPartitions()
+ throws NamingException
+ {
+ connectionManager.
+ setDasPartitionName( "system" );
+ dasPartitionContext =
+ connectionManager.
+ createDASPartition();
+
+ boolean hasFailed = false;
+
+ try
+ {
+ connectionManager.
+ setDasPartitionName( "das" );
+ dasPartitionContext =
+ connectionManager.
+ createDASPartition();
+ }
+ catch(Exception e)
+ {
+ hasFailed = true;
+ }
+ assertTrue(hasFailed);
+ }
+}
Added: directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/learning/test/HotPartitionTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/learning/test/HotPartitionTest.java?view=auto&rev=543239
==============================================================================
--- directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/learning/test/HotPartitionTest.java (added)
+++ directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/learning/test/HotPartitionTest.java Thu May 31 12:58:13 2007
@@ -0,0 +1,82 @@
+/*
+ * 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.tuscany.das.ldap.learning.test;
+
+import javax.naming.NamingException;
+
+import org.apache.tuscany.das.ldap.configuration.model.v100.DASLdapModelV100Factory;
+import org.apache.tuscany.das.ldap.test.TestSetup;
+
+public class HotPartitionTest extends TestSetup
+{
+ public void setUp() throws NamingException
+ {
+ DASLdapModelV100Factory
+ dasLdapV100Factory =
+ DASLdapModelV100Factory.eINSTANCE;
+
+ connectionManager =
+ dasLdapV100Factory.
+ createConnectionManager();
+ }
+
+ /*
+ * Create the ou=das partition and the cn=newContext
+ * under it. See whether cn=newContext shows up
+ * programmatically and in LS visually.
+ *
+ * The context is there, but remains invisible to LS
+ */
+
+ public void testCreateDASSubContext() throws NamingException
+ {
+ dasPartitionContext =
+ connectionManager.
+ createDASPartition();
+
+ String testContextRDN =
+ "cn=newContext";
+
+ boolean isCreated =
+ true;
+
+ try
+ {
+ dasPartitionContext.
+ lookup( testContextRDN );
+ }
+ catch (Exception e)
+ {
+ isCreated = false;
+ }
+
+ assertFalse( isCreated );
+
+ dasPartitionContext.
+ createSubcontext( testContextRDN );
+
+ assertNotNull(
+ dasPartitionContext.
+ lookup( testContextRDN ) );
+
+ dasPartitionContext.
+ destroySubcontext( testContextRDN );
+ }
+}
\ No newline at end of file
Added: directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/learning/test/LearningTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/learning/test/LearningTest.java?view=auto&rev=543239
==============================================================================
--- directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/learning/test/LearningTest.java (added)
+++ directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/learning/test/LearningTest.java Thu May 31 12:58:13 2007
@@ -0,0 +1,74 @@
+/*
+ * 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.tuscany.das.ldap.learning.test;
+
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttribute;
+import javax.naming.directory.BasicAttributes;
+
+import org.apache.tuscany.das.ldap.schema.create.SimpleTypeRDNCreator;
+import org.apache.tuscany.das.ldap.schema.setup.test.DASContextsSetupTest;
+
+public class LearningTest
+extends DASContextsSetupTest
+{
+ protected static Attribute objectClassAttribute;
+
+ public void tearDown() throws NamingException, Exception
+ {
+ dasAttributeTypesContext.destroySubcontext(
+ mComplexMustRDN);
+ super.tearDown();
+ }
+
+ public void testCreateMComplexMayAttributeType() throws Exception
+ {
+ Attributes basicAttributes = new BasicAttributes();
+
+ objectClassAttribute =
+ new BasicAttribute( OBJECT_CLASS, TOP );
+ objectClassAttribute.add( META_TOP );
+ basicAttributes.put(objectClassAttribute);
+
+ objectClassAttribute.add( META_ATTRIBUTE_TYPE );
+
+ basicAttributes.put( M_OBSOLETE, LDAP_FALSE );
+ basicAttributes.put( M_DESCRIPTION, M_COMPLEX_MUST_DESCRIPTION);
+ basicAttributes.put( M_SYNTAX, OID_SYNTAX_OID_VALUE );
+ basicAttributes.put( M_NAME, M_COMPLEX_MUST);
+ basicAttributes.put( M_COLLECTIVE, LDAP_FALSE );
+ basicAttributes.put( M_EQUALITY, M_EQUALITY__NAME_OR_NUMERIC_ID_MATCH );
+ basicAttributes.put( M_NO_USER_MODIFICATION, LDAP_FALSE);
+ basicAttributes.put( M_SINGLE_VALUE, LDAP_FALSE );
+ basicAttributes.put( M_USAGE, LDAP_USER_APPLICATIONS);
+
+ String rdn =
+ SimpleTypeRDNCreator.create(
+ oidPrefix,
+ DAS_XSD_NAMESPACE,
+ M_META_TOP_SDO_OBJECT_CLASS,
+ M_COMPLEX_MUST);
+
+ dasAttributeTypesContext.createSubcontext(
+ rdn, basicAttributes );
+ }
+}
\ No newline at end of file
Added: directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/modify/test/DataObjectModififierTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/modify/test/DataObjectModififierTest.java?view=auto&rev=543239
==============================================================================
--- directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/modify/test/DataObjectModififierTest.java (added)
+++ directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/modify/test/DataObjectModififierTest.java Thu May 31 12:58:13 2007
@@ -0,0 +1,146 @@
+/*
+ * 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.tuscany.das.ldap.modify.test;
+
+import javax.naming.directory.Attribute;
+import javax.naming.directory.BasicAttribute;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.ModificationItem;
+
+import org.apache.tuscany.das.ldap.schema.create.ComplexTypeRDNCreator;
+import org.apache.tuscany.das.ldap.schema.create.SyntaxEntryCreator;
+import org.apache.tuscany.das.ldap.schema.destroy.SyntaxEntryDestroyer;
+import org.apache.tuscany.das.ldap.schema.setup.test.XSDContextsSetupTest;
+
+public class DataObjectModififierTest
+extends XSDContextsSetupTest
+{
+
+/*
+ * TODO Remember to integrate...
+ public void updateModificationTemp()
+ {
+ Attribute objectClassAttribute = new BasicAttribute(
+ OBJECT_CLASS,
+ "top" );
+
+ objectClassAttribute.add( META_TOP );
+ objectClassAttribute.add( META_SYNTAX );
+
+ Attribute oidAttribute = new BasicAttribute(
+ M_OID,
+ OID);
+
+ Attribute descriptionAttribute = new BasicAttribute(
+ M_DESCRIPTION,
+ "xsd:String");
+
+ ModificationItem[] modificationItems = new ModificationItem[3];
+
+ modificationItems[0] =
+ new ModificationItem(DirContext.ADD_ATTRIBUTE, objectClassAttribute);
+
+ modificationItems[1] =
+ new ModificationItem(
+ DirContext.ADD_ATTRIBUTE, oidAttribute );
+
+ modificationItems[2] =
+ new ModificationItem(
+ DirContext.ADD_ATTRIBUTE, descriptionAttribute );
+ }
+
+ //TAKEN FROM THE ATTRIBYTPETYPEENTRYCREATORTEST - WAS DELETED
+ //Attributes ldapAttributes = new AttributesImpl();
+ ModificationItem[] modificationItems = new ModificationItem[7];
+
+ Attribute objectClassAttribute = new BasicAttribute(
+ OBJECT_CLASS,
+ "top" );
+
+ objectClassAttribute.add( META_TOP );
+ objectClassAttribute.add( META_SYNTAX );
+
+ Attribute oidAttribute = new BasicAttribute(
+ M_OID,
+ OID);
+
+ Attribute nameAttribute = new BasicAttribute(
+ M_NAME,
+ "org.tuscany.das.ldap.config.DASConfig");
+
+ //TODO Check what this is
+ Attribute objectClassMetaTypeAttribute = new BasicAttribute(
+ M_DESCRIPTION,
+ "SyntaxAddTest");
+
+
+ *
+ */
+
+
+ /*
+ modificationItems[0] =
+ new ModificationItem(DirContext.ADD_ATTRIBUTE, objectClassAttribute);
+
+ modificationItems[1] =
+ new ModificationItem(
+ DirContext.ADD_ATTRIBUTE,
+ new BasicAttribute(
+ MetaSchemaConstants.M_ObjectClassConstants,
+ "org.tuscany.das.ldap.config.DASConfig") );
+
+
+ modificationItems[2] =
+ new ModificationItem(
+ DirContext.ADD_ATTRIBUTE,
+ new BasicAttribute(
+ MetaSchemaConstants.M_TYPE_OBJECT_CObjectClassConstants,
+ "STRUCTURAL" ) );
+
+ modificationItems[3] =
+ new ModificationItem(
+ DirContext.ADD_ATTRIBUTE,
+ new BasicAttribute(
+ MetaSchemaConstants.M_ObjectClassConstants,
+ "org.tuscany.das.ldap.config.DASConfig") );
+
+ modificationItems[4] =
+ new ModificationItem(
+ DirContext.ADD_ATTRIBUTE,
+ new BasicAttribute(
+ MetaSchemaConstants.M_ObjectClassConstants,
+ "org.tuscany.das.ldap.config.DASConfig") );
+
+ modificationItems[5] =
+ new ModificationItem(
+ DirContext.ADD_ATTRIBUTE,
+ new BasicAttribute(
+ MetaSchemaConstants.M_ObjectClassConstants,
+ "baseDN" ) );
+
+ modificationItems[6] =
+ new ModificationItem(
+ DirContext.ADD_ATTRIBUTE,
+ new BasicAttribute(
+ M_OID,
+ "optionalOPP" ) );
+
+ */
+}
Added: directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/create/test/MComplexMayAttributeTypeCreatorTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/create/test/MComplexMayAttributeTypeCreatorTest.java?view=auto&rev=543239
==============================================================================
--- directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/create/test/MComplexMayAttributeTypeCreatorTest.java (added)
+++ directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/create/test/MComplexMayAttributeTypeCreatorTest.java Thu May 31 12:58:13 2007
@@ -0,0 +1,57 @@
+/*
+ * 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.tuscany.das.ldap.schema.create.test;
+
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+
+import org.apache.tuscany.das.ldap.schema.create.MComplexMayAttributeTypeCreator;
+import org.apache.tuscany.das.ldap.schema.setup.test.DASContextsSetupTest;
+
+public class MComplexMayAttributeTypeCreatorTest
+extends DASContextsSetupTest
+{
+ public void tearDown() throws NamingException, Exception
+ {
+ dasAttributeTypesContext.destroySubcontext(
+ mComplexMayRDN);
+ super.tearDown();
+ }
+
+ public void testCreate() throws NamingException, Exception
+ {
+ MComplexMayAttributeTypeCreator
+ mComplexMayAttributeTypeCreator =
+ new MComplexMayAttributeTypeCreator();
+
+ mComplexMayAttributeTypeCreator.create(
+ dasAttributeTypesContext,
+ oidPrefix );
+
+ DirContext mComplexMayContext = null;
+
+ mComplexMayContext =
+ ( DirContext )
+ dasAttributeTypesContext.
+ lookup(mComplexMayRDN);
+
+ assertNotNull(mComplexMayContext);
+ }
+}
Added: directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/create/test/MComplexMustAttributeTypeCreatorTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/create/test/MComplexMustAttributeTypeCreatorTest.java?view=auto&rev=543239
==============================================================================
--- directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/create/test/MComplexMustAttributeTypeCreatorTest.java (added)
+++ directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/create/test/MComplexMustAttributeTypeCreatorTest.java Thu May 31 12:58:13 2007
@@ -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.tuscany.das.ldap.schema.create.test;
+
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+
+import org.apache.tuscany.das.ldap.schema.create.MComplexMustAttributeTypeCreator;
+import org.apache.tuscany.das.ldap.schema.setup.test.DASContextsSetupTest;
+
+public class MComplexMustAttributeTypeCreatorTest
+extends DASContextsSetupTest
+{
+ public void tearDown()
+ throws NamingException, Exception
+ {
+ dasAttributeTypesContext.destroySubcontext(
+ mComplexMustRDN );
+ super.tearDown();
+ }
+
+ public void testCreate()
+ throws NamingException, Exception
+ {
+ MComplexMustAttributeTypeCreator
+ mComplexMustAttributeTypeCreator =
+ new MComplexMustAttributeTypeCreator();
+
+ mComplexMustAttributeTypeCreator.
+ create(
+ dasAttributeTypesContext,
+ oidPrefix);
+ DirContext mComplexMustContext = null;
+
+ mComplexMustContext =
+ ( DirContext ) dasAttributeTypesContext.lookup(mComplexMustRDN);
+
+ assertNotNull(mComplexMustContext);
+
+ assertTrue(true);
+ }
+}
\ No newline at end of file
Added: directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/create/test/MetaTopSDOObjectClassCreatorTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/create/test/MetaTopSDOObjectClassCreatorTest.java?view=auto&rev=543239
==============================================================================
--- directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/create/test/MetaTopSDOObjectClassCreatorTest.java (added)
+++ directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/create/test/MetaTopSDOObjectClassCreatorTest.java Thu May 31 12:58:13 2007
@@ -0,0 +1,64 @@
+/*
+ * 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.tuscany.das.ldap.schema.create.test;
+
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+
+import org.apache.tuscany.das.ldap.schema.create.MetaTopSDOObjectClassCreator;
+import org.apache.tuscany.das.ldap.schema.destroy.MetaTopSDOObjectClassDestroyer;
+import org.apache.tuscany.das.ldap.schema.setup.test.DASContextsSetupTest;
+
+public class MetaTopSDOObjectClassCreatorTest
+extends DASContextsSetupTest
+{
+ public void tearDown()
+ throws NamingException, Exception
+ {
+ MetaTopSDOObjectClassDestroyer.destroy(
+ dasAttributeTypesContext,
+ dasObjectClassesContext,
+ oidPrefix );
+
+ super.tearDown();
+ }
+
+ public void testCreate()
+ throws NamingException, Exception
+ {
+ MetaTopSDOObjectClassCreator
+ metaTopSDOObjectClassCreator =
+ new MetaTopSDOObjectClassCreator();
+
+ metaTopSDOObjectClassCreator.
+ create(
+ dasAttributeTypesContext,
+ dasObjectClassesContext,
+ oidPrefix );
+ DirContext metaTopSDOContext = null;
+
+ metaTopSDOContext =
+ ( DirContext ) dasObjectClassesContext.lookup(
+ metaTopSDORDN);
+
+ assertNotNull(metaTopSDOContext);
+ }
+}
+
Added: directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EAttributeTypeCreatorTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EAttributeTypeCreatorTest.java?view=auto&rev=543239
==============================================================================
--- directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EAttributeTypeCreatorTest.java (added)
+++ directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EAttributeTypeCreatorTest.java Thu May 31 12:58:13 2007
@@ -0,0 +1,138 @@
+/*
+ * 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.tuscany.das.ldap.schema.emf.create.test;
+
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+
+import org.apache.tuscany.das.ldap.schema.create.SimpleTypeRDNCreator;
+import org.apache.tuscany.das.ldap.schema.emf.create.EAttributeTypeCreator;
+import org.apache.tuscany.das.ldap.schema.emf.create.EcoreTypeSystemCreator;
+import org.apache.tuscany.das.ldap.schema.emf.destroy.EStructuralFeatureTypeDestroyer;
+import org.apache.tuscany.das.ldap.schema.emf.destroy.EcoreTypeSystemDestroyer;
+import org.apache.tuscany.das.ldap.schema.setup.test.EcoreContextsSetup;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.emf.ecore.EcorePackage;
+
+public class EAttributeTypeCreatorTest
+extends EcoreContextsSetup
+{
+ private static final String namespaceURI =
+ "http://org.apache.tuscany/datatypes";
+
+ private static EcoreFactory ecoreFactory =
+ EcoreFactory.eINSTANCE;
+
+ private static EcorePackage ecorePackage =
+ EcorePackage.eINSTANCE;
+
+ private static EAttribute eAttribute =
+ ecoreFactory.createEAttribute();
+
+ private static String eAttributeName =
+ "ole";
+
+ private static DirContext eAttributeEntryContext =
+ null;
+
+ public void setUp() throws NamingException, Exception
+ {
+ super.setUp();
+ EcoreTypeSystemCreator.
+ create(
+ ecoreSyntaxesContext,
+ oidPrefix);
+ }
+
+ public void tearDown() throws NamingException, Exception
+ {
+ EStructuralFeatureTypeDestroyer.
+ destroy(
+ ecoreAttributeTypesContext,
+ eAttribute,
+ oidPrefix);
+
+ EcoreTypeSystemDestroyer.
+ destroy(
+ ecoreSyntaxesContext,
+ oidPrefix);
+
+ super.tearDown();
+ }
+
+ public void testCreate() throws NamingException, Exception
+ {
+ EPackage ePackage =
+ ecoreFactory.
+ createEPackage();
+
+ ePackage.
+ setNsURI(namespaceURI);
+
+ EClass eContainingClass =
+ ecoreFactory.
+ createEClass();
+
+ String eContainingClassName =
+ eContainingClass.getName();
+
+ ePackage.
+ getEClassifiers().
+ add( eContainingClass );
+
+ eContainingClass.
+ getEStructuralFeatures().
+ add(eAttribute);
+
+ eAttribute.
+ setName(eAttributeName);
+
+ eAttribute.
+ setEType(ecorePackage.getEString());
+
+ EAttributeTypeCreator
+ eAttributeTypeCreator =
+ new EAttributeTypeCreator();
+
+ eAttributeTypeCreator.
+ create(
+ ecoreAttributeTypesContext,
+ eAttribute,
+ oidPrefix );
+
+ String rdn =
+ SimpleTypeRDNCreator.
+ create(
+ oidPrefix,
+ namespaceURI,
+ eContainingClassName,
+ eAttributeName);
+
+ eAttributeEntryContext =
+ ( DirContext )
+ ecoreAttributeTypesContext.
+ lookup( rdn );
+
+ assertNotNull(eAttributeEntryContext);
+ }
+}
\ No newline at end of file
Added: directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EObjectClassCreatorTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EObjectClassCreatorTest.java?view=auto&rev=543239
==============================================================================
--- directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EObjectClassCreatorTest.java (added)
+++ directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EObjectClassCreatorTest.java Thu May 31 12:58:13 2007
@@ -0,0 +1,145 @@
+/*
+ * 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.tuscany.das.ldap.schema.emf.create.test;
+
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+
+import org.apache.tuscany.das.ldap.schema.create.ComplexTypeRDNCreator;
+import org.apache.tuscany.das.ldap.schema.create.MetaTopSDOObjectClassCreator;
+import org.apache.tuscany.das.ldap.schema.destroy.MetaTopSDOObjectClassDestroyer;
+import org.apache.tuscany.das.ldap.schema.emf.create.EObjectClassCreator;
+import org.apache.tuscany.das.ldap.schema.emf.create.EcoreTypeSystemCreator;
+import org.apache.tuscany.das.ldap.schema.emf.destroy.EObjectClassDestroyer;
+import org.apache.tuscany.das.ldap.schema.emf.destroy.EcoreTypeSystemDestroyer;
+import org.apache.tuscany.das.ldap.schema.setup.test.EcoreContextsSetup;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EcoreFactory;
+
+public class EObjectClassCreatorTest
+extends EcoreContextsSetup
+{
+ private static final String namespaceURI =
+ "http://org.apache.tuscany/datatypes";
+
+ private static EcoreFactory ecoreFactory =
+ EcoreFactory.eINSTANCE;
+
+ private static EClass eClass =
+ ecoreFactory.createEClass();
+
+ private static String eClassName =
+ "ole";
+
+ private static DirContext eObjectClassEntryContext =
+ null;
+
+ public void setUp()
+ throws NamingException, Exception
+ {
+ super.setUp();
+ EcoreTypeSystemCreator.
+ create(
+ ecoreSyntaxesContext,
+ oidPrefix);
+
+ MetaTopSDOObjectClassCreator
+ metaTopSDOObjectClassCreator =
+ new MetaTopSDOObjectClassCreator();
+
+ metaTopSDOObjectClassCreator.create(
+ ecoreAttributeTypesContext,
+ ecoreObjectClassesContext,
+ oidPrefix );
+ }
+
+ public void tearDown()
+ throws NamingException, Exception
+ {
+ EObjectClassDestroyer.
+ destroy(
+ ecoreAttributeTypesContext,
+ ecoreObjectClassesContext,
+ eClass,
+ oidPrefix );
+
+ MetaTopSDOObjectClassDestroyer.
+ destroy(
+ ecoreAttributeTypesContext,
+ ecoreObjectClassesContext,
+ oidPrefix );
+
+ EcoreTypeSystemDestroyer.
+ destroy(
+ ecoreSyntaxesContext,
+ oidPrefix);
+
+ super.tearDown();
+ }
+
+ public void testCreate()
+ throws NamingException, Exception
+ {
+ EPackage ePackage =
+ ecoreFactory.
+ createEPackage();
+
+ ePackage.
+ setNsURI(namespaceURI);
+
+ eClass =
+ ecoreFactory.
+ createEClass();
+
+ eClass.setName(eClassName);
+
+ ePackage.
+ getEClassifiers().
+ add( eClass );
+
+ EObjectClassCreator
+ eObjectClassCreator =
+ new EObjectClassCreator();
+
+ eObjectClassCreator.
+ create(
+ ecoreAttributeTypesContext,
+ ecoreObjectClassesContext,
+ eClass,
+ oidPrefix );
+
+ String rdn =
+ ComplexTypeRDNCreator.
+ create(
+ oidPrefix,
+ namespaceURI,
+ eClass.getName());
+
+ eObjectClassEntryContext =
+ ( DirContext )
+ ecoreObjectClassesContext.
+
+ lookup( rdn );
+
+ assertNotNull(
+ eObjectClassEntryContext);
+ }
+}
\ No newline at end of file
Added: directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EReferenceTypeCreatorTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EReferenceTypeCreatorTest.java?view=auto&rev=543239
==============================================================================
--- directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EReferenceTypeCreatorTest.java (added)
+++ directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EReferenceTypeCreatorTest.java Thu May 31 12:58:13 2007
@@ -0,0 +1,136 @@
+/*
+ * 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.tuscany.das.ldap.schema.emf.create.test;
+
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+
+import org.apache.tuscany.das.ldap.schema.create.SimpleTypeRDNCreator;
+import org.apache.tuscany.das.ldap.schema.emf.create.EReferenceTypeCreator;
+import org.apache.tuscany.das.ldap.schema.emf.create.EcoreTypeSystemCreator;
+import org.apache.tuscany.das.ldap.schema.emf.destroy.EStructuralFeatureTypeDestroyer;
+import org.apache.tuscany.das.ldap.schema.emf.destroy.EcoreTypeSystemDestroyer;
+import org.apache.tuscany.das.ldap.schema.setup.test.EcoreContextsSetup;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EcoreFactory;
+
+public class EReferenceTypeCreatorTest
+extends EcoreContextsSetup
+{
+ private static final String namespaceURI =
+ "http://org.apache.tuscany/datatypes";
+
+ private static EcoreFactory ecoreFactory =
+ EcoreFactory.eINSTANCE;
+
+ private static EReference eReference =
+ ecoreFactory.createEReference();
+
+ private static String eReferenceName =
+ "ole";
+
+ private static DirContext eReferenceEntryContext =
+ null;
+
+ public void setUp()
+ throws NamingException, Exception
+ {
+ super.setUp();
+ EcoreTypeSystemCreator.
+ create(
+ ecoreSyntaxesContext,
+ oidPrefix);
+ }
+
+ public void tearDown()
+ throws NamingException, Exception
+ {
+ EStructuralFeatureTypeDestroyer.
+ destroy(
+ ecoreAttributeTypesContext,
+ eReference,
+ oidPrefix);
+
+ EcoreTypeSystemDestroyer.
+ destroy(
+ ecoreSyntaxesContext,
+ oidPrefix);
+
+ super.tearDown();
+ }
+
+ public void testCreate() throws NamingException, Exception
+ {
+ EPackage ePackage =
+ ecoreFactory.
+ createEPackage();
+
+ ePackage.
+ setNsURI(namespaceURI);
+
+ EClass eContainingClass =
+ ecoreFactory.
+ createEClass();
+
+ String eContainingClassName =
+ eContainingClass.getName();
+
+ ePackage.
+ getEClassifiers().
+ add( eContainingClass );
+
+ eContainingClass.
+ getEStructuralFeatures().
+ add(eReference);
+
+ eReference.
+ setName(eReferenceName);
+
+ eReference.
+ setEType(eContainingClass);
+
+ EReferenceTypeCreator
+ eReferenceTypeCreator =
+ new EReferenceTypeCreator();
+
+ eReferenceTypeCreator.
+ create(
+ ecoreAttributeTypesContext,
+ eReference,
+ oidPrefix );
+
+ String rdn =
+ SimpleTypeRDNCreator.
+ create(
+ oidPrefix,
+ namespaceURI,
+ eContainingClassName,
+ eReferenceName);
+
+ eReferenceEntryContext =
+ ( DirContext )
+ ecoreAttributeTypesContext.
+ lookup( rdn );
+
+ assertNotNull(eReferenceEntryContext);
+ }
+}
\ No newline at end of file
Added: directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EcoreTypeSystemCreatorHelperTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EcoreTypeSystemCreatorHelperTest.java?view=auto&rev=543239
==============================================================================
--- directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EcoreTypeSystemCreatorHelperTest.java (added)
+++ directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EcoreTypeSystemCreatorHelperTest.java Thu May 31 12:58:13 2007
@@ -0,0 +1,79 @@
+/*
+ * 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.tuscany.das.ldap.schema.emf.create.test;
+
+import java.util.Stack;
+
+import org.apache.tuscany.das.ldap.schema.emf.create.EcoreTypeSystemHelper;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EcoreFactory;
+
+import junit.framework.TestCase;
+
+public class EcoreTypeSystemCreatorHelperTest
+extends TestCase
+{
+ EcoreFactory ecoreFactory =
+ EcoreFactory.eINSTANCE;
+
+ public void testLoadParentEClassifierStack()
+ {
+ EClass eClassL0 =
+ ecoreFactory.createEClass();
+
+ EClass eClassL1 =
+ ecoreFactory.createEClass();
+
+ EClass eClassL2 =
+ ecoreFactory.createEClass();
+
+ eClassL2.getESuperTypes().add(eClassL1);
+
+ eClassL1.getESuperTypes().add(eClassL0);
+
+ Stack<EClass> testStack =
+ EcoreTypeSystemHelper.
+ loadParentEClassifierStack(
+ eClassL2,
+ null);
+
+ assertEquals(testStack.size(), 2);
+ }
+
+ public void testGetEClassParent()
+ {
+ EClass eClassL0 =
+ ecoreFactory.createEClass();
+
+ EClass eClassL1 =
+ ecoreFactory.createEClass();
+
+ eClassL1.getESuperTypes().add(eClassL0);
+
+ EClass eClassParent =
+ null;
+
+ eClassParent =
+ EcoreTypeSystemHelper.
+ getEClassParent(eClassL1);
+
+ assertSame(eClassL0, eClassParent);
+
+ }
+}
Added: directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EcoreTypeSystemCreatorTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EcoreTypeSystemCreatorTest.java?view=auto&rev=543239
==============================================================================
--- directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EcoreTypeSystemCreatorTest.java (added)
+++ directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EcoreTypeSystemCreatorTest.java Thu May 31 12:58:13 2007
@@ -0,0 +1,69 @@
+/*
+ * 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.tuscany.das.ldap.schema.emf.create.test;
+
+import javax.naming.NamingException;
+
+import org.apache.tuscany.das.ldap.configuration.model.v100.DASConfiguration;
+import org.apache.tuscany.das.ldap.configuration.model.v100.DASLdapModelV100Factory;
+import org.apache.tuscany.das.ldap.schema.emf.create.EcoreTypeSystemCreator;
+import org.apache.tuscany.das.ldap.schema.emf.destroy.EcoreTypeSystemDestroyer;
+import org.apache.tuscany.das.ldap.schema.setup.test.EcoreContextsSetup;
+import org.eclipse.emf.ecore.EcorePackage;
+
+public class EcoreTypeSystemCreatorTest
+extends EcoreContextsSetup
+{
+ public EcorePackage ecorePackage =
+ EcorePackage.eINSTANCE;
+
+ private String oidPrefix =
+ null;
+
+ public void setUp()
+ throws NamingException, Exception
+ {
+ super.setUp();
+
+ DASConfiguration
+ dasConfiguration =
+ DASLdapModelV100Factory.
+ eINSTANCE.
+ createDASConfiguration();
+ oidPrefix = dasConfiguration.getOidPrefix();
+ }
+
+ public void tearDown() throws NamingException, Exception
+ {
+ EcoreTypeSystemDestroyer.destroy(
+ ecoreSyntaxesContext,
+ oidPrefix);
+ super.tearDown();
+
+ }
+
+ public void testCreate() throws Exception
+ {
+ EcoreTypeSystemCreator.
+ create(
+ ecoreSyntaxesContext,
+ oidPrefix);
+ }
+}
\ No newline at end of file
Added: directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/destroy/test/EcoreTypeSystemDestroyerTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/destroy/test/EcoreTypeSystemDestroyerTest.java?view=auto&rev=543239
==============================================================================
--- directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/destroy/test/EcoreTypeSystemDestroyerTest.java (added)
+++ directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/destroy/test/EcoreTypeSystemDestroyerTest.java Thu May 31 12:58:13 2007
@@ -0,0 +1,57 @@
+/*
+ * 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.tuscany.das.ldap.schema.emf.destroy.test;
+
+import javax.naming.NamingException;
+
+import org.apache.tuscany.das.ldap.configuration.model.v100.DASConfiguration;
+import org.apache.tuscany.das.ldap.configuration.model.v100.DASLdapModelV100Factory;
+import org.apache.tuscany.das.ldap.schema.emf.create.EcoreTypeSystemCreator;
+import org.apache.tuscany.das.ldap.schema.emf.destroy.EcoreTypeSystemDestroyer;
+import org.apache.tuscany.das.ldap.schema.setup.test.EcoreContextsSetup;
+import org.eclipse.emf.ecore.EcorePackage;
+
+public class EcoreTypeSystemDestroyerTest
+extends EcoreContextsSetup
+{
+ public EcorePackage ecorePackage = EcorePackage.eINSTANCE;
+
+ private String oidPrefix = null;
+
+ public void setUp() throws NamingException, Exception
+ {
+ super.setUp();
+
+ DASConfiguration dasConfiguration =
+ DASLdapModelV100Factory.eINSTANCE.createDASConfiguration();
+ oidPrefix = dasConfiguration.getOidPrefix();
+ }
+
+ public void tearDown() throws NamingException, Exception
+ {
+ super.tearDown();
+ }
+
+ public void testDestroy() throws Exception
+ {
+ EcoreTypeSystemCreator.create(ecoreSyntaxesContext,oidPrefix);
+ EcoreTypeSystemDestroyer.destroy(ecoreSyntaxesContext, oidPrefix);
+ }
+}
\ No newline at end of file
Added: directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/AbstractTestSetup.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/AbstractTestSetup.java?view=auto&rev=543239
==============================================================================
--- directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/AbstractTestSetup.java (added)
+++ directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/AbstractTestSetup.java Thu May 31 12:58:13 2007
@@ -0,0 +1,83 @@
+
+package org.apache.tuscany.das.ldap.schema.setup.test;
+
+import java.util.Hashtable;
+
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+
+import org.apache.tuscany.das.ldap.configuration.model.v100.DASConfiguration;
+import org.apache.tuscany.das.ldap.configuration.model.v100.DASLdapModelV100Factory;
+import org.apache.tuscany.das.ldap.constants.DASConstants;
+import org.apache.tuscany.das.ldap.schema.constants.AttributeTypeConstants;
+import org.apache.tuscany.das.ldap.schema.constants.EnumeratedSchemaAttributeTypeValues;
+import org.apache.tuscany.das.ldap.schema.constants.ObjectClassConstants;
+import org.apache.tuscany.das.ldap.schema.constants.SchemaAttributeTypeConstants;
+import org.apache.tuscany.das.ldap.schema.constants.SchemaObjectClassConstants;
+
+import junit.framework.TestCase;
+
+public abstract class AbstractTestSetup extends TestCase
+implements
+EnumeratedSchemaAttributeTypeValues,
+SchemaAttributeTypeConstants,
+AttributeTypeConstants,
+SchemaObjectClassConstants,
+ObjectClassConstants,
+DASConstants
+{
+ public void setUp() throws NamingException, Exception
+ {
+ DASConfiguration dasConfiguration =
+ DASLdapModelV100Factory.
+ eINSTANCE.createDASConfiguration();
+
+ oidPrefix = dasConfiguration.getOidPrefix();
+
+ env = new Hashtable<String, String>();
+
+ env.put(
+ DirContext.INITIAL_CONTEXT_FACTORY,
+ INITIAL_CONTEXT_FACTORY_VALUE );
+ env.put(
+ DirContext.SECURITY_AUTHENTICATION,
+ SECURITY_AUTHENTICATION_VALUE);
+ env.put(
+ DirContext.SECURITY_PRINCIPAL,
+ SECURITY_PRINCIPAL_VALUE);
+ env.put(
+ DirContext.SECURITY_CREDENTIALS,
+ SECURITY_CREDENTIALS_VALUE );
+ }
+
+ protected static final String SYNTAXES_CONTEXT_NAME = "syntaxes";
+ protected static final String SYNTAXES_CONTEXT_RDN =
+ OU + "=" + SYNTAXES_CONTEXT_NAME;
+
+ protected static final String ATTRIBUTE_TYPES_CONTEXT_NAME =
+ "attributeTypes";
+ protected static final String ATTRIBUTE_TYPES_CONTEXT_RDN =
+ OU + "=" + ATTRIBUTE_TYPES_CONTEXT_NAME;
+
+ protected static final String OBJECT_CLASSES_CONTEXT_NAME =
+ "objectClasses";
+ protected static final String OBJECT_CLASSES_CONTEXT_RDN =
+ OU + "=" + OBJECT_CLASSES_CONTEXT_NAME;
+
+
+
+
+ private static String INITIAL_CONTEXT_FACTORY_VALUE =
+ "com.sun.jndi.ldap.LdapCtxFactory";
+ private static String SECURITY_AUTHENTICATION_VALUE =
+ "simple";
+ private static String SECURITY_PRINCIPAL_VALUE =
+ "uid=admin,ou=system";
+ private static String SECURITY_CREDENTIALS_VALUE =
+ "secret";
+
+ protected String oidPrefix =
+ null;
+
+ protected Hashtable<String,String> env;
+}
Added: directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/DASContextsSetup.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/DASContextsSetup.java?view=auto&rev=543239
==============================================================================
--- directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/DASContextsSetup.java (added)
+++ directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/DASContextsSetup.java Thu May 31 12:58:13 2007
@@ -0,0 +1,182 @@
+package org.apache.tuscany.das.ldap.schema.setup.test;
+
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttribute;
+import javax.naming.directory.BasicAttributes;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.InitialDirContext;
+
+import org.apache.tuscany.das.ldap.constants.DASConstants;
+import org.apache.tuscany.das.ldap.schema.create.ComplexTypeRDNCreator;
+import org.apache.tuscany.das.ldap.schema.create.SimpleTypeRDNCreator;
+
+public class DASContextsSetup
+extends AbstractTestSetup
+implements DASConstants
+{
+ public void tearDown() throws NamingException, Exception
+ {
+ dasSyntaxesContext.close();
+
+ dasContext.destroySubcontext(
+ SYNTAXES_CONTEXT_RDN );
+
+ dasAttributeTypesContext.close();
+
+ dasContext.destroySubcontext(
+ ATTRIBUTE_TYPES_CONTEXT_RDN );
+
+ dasContext.destroySubcontext(
+ OBJECT_CLASSES_CONTEXT_RDN );
+
+ dasContext.close();
+
+ schemaContext.destroySubcontext(
+ DAS_CONTEXT_RDN );
+
+ schemaContext.close();
+ super.tearDown();
+ }
+
+ public void setUp() throws NamingException, Exception
+ {
+ super.setUp();
+
+ schemaContext = connect();
+ dasContext = createDasContext();
+ dasSyntaxesContext = createDasSyntaxesContext();
+ dasAttributeTypesContext = createDasAttributeTypesContext();
+ dasObjectClassesContext = createDasObjectClassesContext();
+
+ mComplexMayRDN =
+ SimpleTypeRDNCreator.create(
+ oidPrefix,
+ DAS_XSD_NAMESPACE,
+ M_META_TOP_SDO_OBJECT_CLASS,
+ M_COMPLEX_MAY);
+
+ mComplexMustRDN =
+ SimpleTypeRDNCreator.create(
+ oidPrefix,
+ DAS_XSD_NAMESPACE,
+ M_META_TOP_SDO_OBJECT_CLASS,
+ M_COMPLEX_MUST);
+
+ metaTopSDORDN =
+ ComplexTypeRDNCreator.create(
+ oidPrefix,
+ DAS_XSD_NAMESPACE,
+ M_META_TOP_SDO_OBJECT_CLASS);
+ }
+
+
+ private DirContext connect() throws NamingException
+ {
+ env.put(
+ DirContext.PROVIDER_URL,
+ PROVIDER_URL_VALUE);
+ return new InitialDirContext(env);
+ }
+
+ private DirContext createDasContext() throws NamingException
+ {
+ Attributes contextAttributes = new BasicAttributes();
+
+ Attribute objectClassAttribute = new BasicAttribute(
+ OBJECT_CLASS,
+ TOP);
+ objectClassAttribute.add(META_SCHEMA);
+
+ Attribute ecoreAttribute = new BasicAttribute(
+ CN,
+ DAS_CONTEXT_NAME);
+
+ contextAttributes.put( ecoreAttribute );
+ contextAttributes.put( objectClassAttribute );
+
+ return schemaContext.createSubcontext(
+ DAS_CONTEXT_RDN, contextAttributes );
+ }
+
+ private DirContext createDasAttributeTypesContext() throws NamingException
+ {
+ Attributes contextAttributes = new BasicAttributes();
+
+ Attribute objectClassAttribute = new BasicAttribute(
+ OBJECT_CLASS,
+ TOP);
+ objectClassAttribute.add(ORGANIZATIONAL_UNIT);
+
+ Attribute ecoreAttribute = new BasicAttribute(
+ OU,
+ ATTRIBUTE_TYPES_CONTEXT_NAME);
+
+ contextAttributes.put( ecoreAttribute );
+ contextAttributes.put( objectClassAttribute );
+
+ return dasContext.createSubcontext(
+ ATTRIBUTE_TYPES_CONTEXT_RDN, contextAttributes );
+ }
+
+ private DirContext createDasSyntaxesContext() throws NamingException
+ {
+ Attributes contextAttributes = new BasicAttributes();
+
+ Attribute objectClassAttribute = new BasicAttribute(
+ OBJECT_CLASS,
+ TOP);
+ objectClassAttribute.add(ORGANIZATIONAL_UNIT);
+
+ Attribute ecoreAttribute = new BasicAttribute(
+ OU,
+ SYNTAXES_CONTEXT_NAME);
+
+ contextAttributes.put( ecoreAttribute );
+ contextAttributes.put( objectClassAttribute );
+
+ return dasContext.createSubcontext(
+ SYNTAXES_CONTEXT_RDN, contextAttributes );
+ }
+
+ private DirContext createDasObjectClassesContext() throws NamingException
+ {
+ Attributes contextAttributes = new BasicAttributes();
+
+ Attribute objectClassAttribute = new BasicAttribute(
+ OBJECT_CLASS,
+ TOP);
+
+ objectClassAttribute.add(ORGANIZATIONAL_UNIT);
+
+ Attribute attributeTypes = new BasicAttribute(
+ OU,
+ OBJECT_CLASSES_CONTEXT_NAME);
+
+ contextAttributes.put( attributeTypes );
+ contextAttributes.put( objectClassAttribute );
+
+ return dasContext.createSubcontext(
+ OBJECT_CLASSES_CONTEXT_RDN,
+ contextAttributes );
+ }
+
+ private static String PROVIDER_URL_VALUE =
+ "ldap://localhost:10389/ou=schema";
+
+ private static final String DAS_CONTEXT_NAME = "das";
+ private static final String DAS_CONTEXT_RDN =
+ CN + "=" + DAS_CONTEXT_NAME;
+
+ protected DirContext schemaContext = null;
+ protected DirContext dasContext = null;
+ protected DirContext dasAttributeTypesContext = null;
+ protected DirContext dasSyntaxesContext = null;
+ protected DirContext dasObjectClassesContext = null;
+
+ protected String mComplexMayRDN = null;
+ protected String mComplexMustRDN = null;
+ protected String metaTopSDORDN = null;
+
+}
\ No newline at end of file
Added: directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/DASContextsSetupTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/DASContextsSetupTest.java?view=auto&rev=543239
==============================================================================
--- directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/DASContextsSetupTest.java (added)
+++ directory/sandbox/oersoy/das.testing/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/DASContextsSetupTest.java Thu May 31 12:58:13 2007
@@ -0,0 +1,48 @@
+package org.apache.tuscany.das.ldap.schema.setup.test;
+
+import javax.naming.NamingException;
+
+import org.apache.tuscany.das.ldap.constants.DASConstants;
+
+public class DASContextsSetupTest
+extends DASContextsSetup
+implements DASConstants
+{
+ public void tearDown() throws NamingException, Exception
+ {
+ super.tearDown();
+ }
+
+ public void setUp() throws NamingException, Exception
+ {
+ super.setUp();
+ }
+
+
+ public void testConnect()
+ {
+ assertNotNull(schemaContext);
+ }
+
+ public void testCreateEcoreContext()
+ {
+ assertNotNull(dasContext);
+ }
+
+
+ public void testCreateDasAttributeTypesContext()
+ {
+ assertNotNull(dasAttributeTypesContext);
+ }
+
+ public void testCreateDasSyntaxesContext()
+ {
+ assertNotNull(dasSyntaxesContext);
+ }
+
+ public void testCreateDasObjectClassesContext()
+ {
+ assertNotNull(dasObjectClassesContext);
+ }
+
+}
\ No newline at end of file