directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oer...@apache.org
Subject svn commit: r550803 [7/10] - in /directory/sandbox/oersoy/das.ldap.parent: ./ das.ldap.constants/ das.ldap.constants/.settings/ das.ldap.constants/src/ das.ldap.constants/src/main/ das.ldap.constants/src/main/java/ das.ldap.constants/src/main/java/org/...
Date Tue, 26 Jun 2007 13:29:26 GMT
Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/DASSchemaContextsSetup.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/DASSchemaContextsSetup.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/DASSchemaContextsSetup.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/DASSchemaContextsSetup.java Tue Jun 26 06:29:06 2007
@@ -0,0 +1,191 @@
+/*
+ *  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.embedded.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 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 DASSchemaContextsSetup 
+extends AbstractTestSetup
+implements DASConstants
+{
+    public void tearDown() throws NamingException, Exception
+    {
+        dasSyntaxesContext.close();
+        
+        dasSchemaSubContext.destroySubcontext(    
+            SYNTAXES_CONTEXT_RDN );
+        
+        dasAttributeTypesContext.close();
+        
+        dasSchemaSubContext.destroySubcontext(
+            ATTRIBUTE_TYPES_CONTEXT_RDN );
+        
+        dasSchemaSubContext.destroySubcontext(
+            OBJECT_CLASSES_CONTEXT_RDN );
+        
+        dasSchemaSubContext.close();
+        
+        schemaPartitionContext.destroySubcontext( 
+            DAS_CONTEXT_RDN );
+        
+        schemaPartitionContext.close();
+        super.tearDown();
+    }
+    
+    public void setUp() throws NamingException, Exception
+    {
+        super.setUp();
+        dasSchemaSubContext       = 
+        	createDasSchemaSubContext();
+        dasSyntaxesContext           = 
+        	createDasSyntaxesContext();
+        dasAttributeTypesContext  = 
+        	createDasAttributeTypesContext();
+        dasObjectClassesContext   = 
+        	createDasObjectClassesContext();
+        
+        mComplexMayRDN              = 
+            SimpleTypeRDNCreator.create( 
+                TUSCANY_SYNTAX_OID_VALUE, 
+                DAS_XSD_NAMESPACE, 
+                M_META_TOP_SDO_OBJECT_CLASS,
+                M_COMPLEX_MAY);
+        
+        mComplexMustRDN            = 
+            SimpleTypeRDNCreator.create( 
+                TUSCANY_SYNTAX_OID_VALUE, 
+                DAS_XSD_NAMESPACE, 
+                M_META_TOP_SDO_OBJECT_CLASS,
+                M_COMPLEX_MUST);
+        
+        idRDN                                   = 
+            SimpleTypeRDNCreator.create( 
+                TUSCANY_SYNTAX_OID_VALUE, 
+                DAS_XSD_NAMESPACE, 
+                M_META_TOP_SDO_OBJECT_CLASS,
+                ID);
+
+        metaTopSDORDN                =
+            ComplexTypeRDNCreator.create( 
+                TUSCANY_SYNTAX_OID_VALUE,
+                DAS_XSD_NAMESPACE,
+                M_META_TOP_SDO_OBJECT_CLASS);
+    }
+    
+    private DirContext createDasSchemaSubContext() 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 schemaPartitionContext.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 dasSchemaSubContext.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 dasSchemaSubContext.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 dasSchemaSubContext.createSubcontext( 
+            OBJECT_CLASSES_CONTEXT_RDN, 
+            contextAttributes );
+    }
+
+    protected DirContext dasSchemaSubContext      = null;
+    protected DirContext dasAttributeTypesContext = null;
+    protected DirContext dasSyntaxesContext          = null;
+    protected DirContext dasObjectClassesContext = null;
+    
+    protected String mComplexMayRDN                     = null;
+    protected String mComplexMustRDN                    = null;
+    protected String idRDN                                           = null;
+    protected String metaTopSDORDN                         = null;
+}
\ No newline at end of file

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/DASSchemaContextsSetupTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/DASSchemaContextsSetupTest.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/DASSchemaContextsSetupTest.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/DASSchemaContextsSetupTest.java Tue Jun 26 06:29:06 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.embedded.setup.test;
+
+import javax.naming.NamingException;
+
+import org.apache.tuscany.das.ldap.constants.DASConstants;
+
+public class DASSchemaContextsSetupTest 
+extends DASSchemaContextsSetup
+implements DASConstants
+{
+    public void tearDown() throws NamingException, Exception
+    {
+        super.tearDown();
+    }
+    
+    public void setUp() throws NamingException, Exception
+    {
+        super.setUp();
+    }
+    
+    public void testCreateDASSchemaSubContext()
+    {
+        assertNotNull(dasSchemaSubContext);
+    }
+    
+    public void testCreateDasAttributeTypesContext()
+    {
+        assertNotNull(dasAttributeTypesContext);
+    }
+    
+    public void testCreateDasSyntaxesContext()
+    {
+        assertNotNull(dasSyntaxesContext);
+    }
+    
+    public void testCreateDasObjectClassesContext()
+    {
+        assertNotNull(dasObjectClassesContext);
+    }
+}
\ No newline at end of file

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/EcoreSchemaAndDASContextsSetup.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/EcoreSchemaAndDASContextsSetup.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/EcoreSchemaAndDASContextsSetup.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/EcoreSchemaAndDASContextsSetup.java Tue Jun 26 06:29:06 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.schema.embedded.setup.test;
+
+import javax.naming.NamingException;
+import javax.naming.ldap.LdapContext;
+
+import org.apache.tuscany.das.ldap.constants.DASConstants;
+import org.apache.tuscany.das.ldap.create.InitialContextCreator;
+import org.apache.tuscany.das.ldap.create.MetaContextCreator;
+import org.apache.tuscany.das.ldap.destroy.InitialContextDestroyer;
+import org.apache.tuscany.das.ldap.destroy.MetaContextDestroyer;
+
+/*
+ * TODO Document that the name of a root object cannot be "meta"
+ * TODO Change "meta" to meta-inf
+ */
+public class EcoreSchemaAndDASContextsSetup 
+extends EcoreSchemaContextsSetup
+implements DASConstants
+{
+    public void tearDown() 
+    throws NamingException, Exception
+    {
+        MetaContextDestroyer.
+        destroy( containerContext );
+        
+        InitialContextDestroyer.
+        destroy(
+            containerContext, 
+            dasPartitionContext );
+        
+        super.tearDown();
+                
+        dasPartitionContext.close();
+    }
+
+    public void setUp() throws NamingException, Exception
+    {
+        super.setUp();
+        
+        containerContext                        = 
+            (LdapContext) 
+            InitialContextCreator.
+            create(
+                xsdNamespace,
+                dasPartitionContext);
+
+        metaContext                               =
+            (LdapContext) 
+            MetaContextCreator.
+            create( containerContext);
+    }
+    
+    protected LdapContext containerContext = null;
+    protected LdapContext metaContext        = null;
+}
\ No newline at end of file

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/EcoreSchemaAndDASContextsSetupTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/EcoreSchemaAndDASContextsSetupTest.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/EcoreSchemaAndDASContextsSetupTest.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/EcoreSchemaAndDASContextsSetupTest.java Tue Jun 26 06:29:06 2007
@@ -0,0 +1,56 @@
+package org.apache.tuscany.das.ldap.schema.embedded.setup.test;
+
+import javax.naming.NamingException;
+
+import org.apache.tuscany.das.ldap.constants.DASConstants;
+
+public class EcoreSchemaAndDASContextsSetupTest 
+extends EcoreSchemaAndDASContextsSetup
+implements DASConstants
+{
+    public void tearDown() throws NamingException, Exception
+    {
+        super.tearDown();
+    }
+    
+    public void setUp() throws NamingException, Exception
+    {
+        super.setUp();
+    }
+
+    public void testConnect()
+    {
+        assertNotNull(schemaPartitionContext);
+    }
+    
+    public void testCreateEcoreSchemaSubContext()
+    {
+        assertNotNull(ecoreSchemaSubContext);
+    }
+    
+    public void testCreateEcoreObjectClassesContext()
+    {
+        assertNotNull(ecoreObjectClassesContext);
+    }
+    
+    public void testCreateEcoreAttributeTypesContext()
+    {
+        assertNotNull(ecoreAttributeTypesContext);
+    }
+    
+    public void testCreateEcoreSyntaxesContext()
+    {
+        assertNotNull(ecoreSyntaxesContext);
+    }
+    
+    public void testCreateDasModelContext()
+    {
+        assertNotNull(containerContext);
+    }
+
+    public void testCreateDasMetaContext()
+    {
+        assertNotNull(metaContext);
+    }
+
+}
\ No newline at end of file

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/EcoreSchemaContextsSetup.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/EcoreSchemaContextsSetup.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/EcoreSchemaContextsSetup.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/EcoreSchemaContextsSetup.java Tue Jun 26 06:29:06 2007
@@ -0,0 +1,200 @@
+/*
+ *  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.embedded.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.ldap.LdapContext;
+
+import org.apache.tuscany.das.ldap.constants.DASConstants;
+
+public class EcoreSchemaContextsSetup 
+extends AbstractTestSetup
+implements DASConstants
+{
+    public void tearDown() 
+    throws NamingException, Exception
+    {
+        ecoreSyntaxesContext.
+        close();
+        
+        ecoreSchemaSubContext.
+        destroySubcontext(
+        		SYNTAXES_CONTEXT_RDN );
+
+        ecoreSyntaxCheckersContext.
+        close();
+        
+        ecoreSchemaSubContext.
+        destroySubcontext(
+        		SYNTAX_CHECKERS_CONTEXT_RDN );
+
+        ecoreAttributeTypesContext.
+        close();
+        ecoreSchemaSubContext.
+        destroySubcontext(
+        		ATTRIBUTE_TYPES_CONTEXT_RDN );
+        
+        ecoreObjectClassesContext.
+        close();
+        
+        ecoreSchemaSubContext.
+        destroySubcontext( 
+        		OBJECT_CLASSES_CONTEXT_RDN );
+        
+        ecoreSchemaSubContext.
+        close();
+        schemaPartitionContext.
+        destroySubcontext( 
+        		ECORE_CONTEXT_RDN );
+        
+        schemaPartitionContext.close();
+        super.tearDown();
+    }
+
+    public void setUp() throws NamingException, Exception
+    {
+        super.setUp();
+        ecoreSchemaSubContext        = createEcoreSchemaSubContext();
+        ecoreSyntaxesContext            = createEcoreSyntaxesContext();
+        ecoreSyntaxCheckersContext = createEcoreSyntaxCheckersContext();
+        ecoreObjectClassesContext    = createEcoreObjectClassesContext();
+        ecoreAttributeTypesContext   = createEcoreAttributeTypesContext();
+    }
+    
+    private LdapContext createEcoreSchemaSubContext() throws NamingException
+    {
+        Attributes contextAttributes   = new BasicAttributes();
+        
+        Attribute objectClassAttribute = new BasicAttribute(
+        OBJECT_CLASS, 
+        TOP);
+        objectClassAttribute.add(META_SCHEMA);
+
+        Attribute ecoreAttribute = new BasicAttribute(
+            CN, 
+            ECORE_CONTEXT_NAME);
+
+        contextAttributes.put( ecoreAttribute );
+        contextAttributes.put( objectClassAttribute );
+        
+        return (LdapContext) 
+        schemaPartitionContext.createSubcontext( 
+            ECORE_CONTEXT_RDN, contextAttributes );
+    }
+    
+
+    private LdapContext createEcoreObjectClassesContext() throws NamingException
+    {
+        Attributes contextAttributes   = new BasicAttributes();
+        
+        Attribute objectClassAttribute = new BasicAttribute(
+        OBJECT_CLASS, 
+        TOP);
+        objectClassAttribute.add(ORGANIZATIONAL_UNIT);
+
+        Attribute ecoreAttribute = new BasicAttribute(
+            OU, 
+            OBJECT_CLASSES_CONTEXT_NAME);
+
+        contextAttributes.put( ecoreAttribute );
+        contextAttributes.put( objectClassAttribute );
+        
+        return (LdapContext) 
+        ecoreSchemaSubContext.createSubcontext( 
+            OBJECT_CLASSES_CONTEXT_RDN, contextAttributes );
+    }
+    
+    
+
+    private LdapContext createEcoreAttributeTypesContext() 
+    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 (LdapContext) 
+        ecoreSchemaSubContext.createSubcontext( 
+            ATTRIBUTE_TYPES_CONTEXT_RDN, contextAttributes );
+    }
+    
+    private LdapContext createEcoreSyntaxesContext() 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 (LdapContext) 
+        ecoreSchemaSubContext.createSubcontext( 
+            SYNTAXES_CONTEXT_RDN, contextAttributes );
+    }
+    
+    private LdapContext createEcoreSyntaxCheckersContext() 
+    throws NamingException
+    {
+        Attributes contextAttributes   = new BasicAttributes();
+        
+        Attribute objectClassAttribute = new BasicAttribute(
+        OBJECT_CLASS, 
+        TOP);
+        objectClassAttribute.add(ORGANIZATIONAL_UNIT);
+
+        Attribute ecoreAttribute = new BasicAttribute(
+            OU, 
+            SYNTAX_CHECKERS_CONTEXT_NAME);
+
+        contextAttributes.put( ecoreAttribute );
+        contextAttributes.put( objectClassAttribute );
+        
+        return (LdapContext) 
+        ecoreSchemaSubContext.createSubcontext( 
+            SYNTAX_CHECKERS_CONTEXT_RDN, contextAttributes );
+    }
+
+    protected LdapContext ecoreSchemaSubContext         = null;
+    protected LdapContext ecoreObjectClassesContext    = null;
+    protected LdapContext ecoreAttributeTypesContext   = null;
+    protected LdapContext ecoreSyntaxesContext            = null;
+    protected LdapContext ecoreSyntaxCheckersContext = null;
+}
\ No newline at end of file

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/EcoreSchemaContextsSetupTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/EcoreSchemaContextsSetupTest.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/EcoreSchemaContextsSetupTest.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/EcoreSchemaContextsSetupTest.java Tue Jun 26 06:29:06 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.embedded.setup.test;
+
+import javax.naming.NamingException;
+
+import org.apache.tuscany.das.ldap.constants.DASConstants;
+
+public class EcoreSchemaContextsSetupTest 
+extends EcoreSchemaContextsSetup
+implements DASConstants
+{
+    public void tearDown() throws NamingException, Exception
+    {
+        super.tearDown();
+    }
+    
+    public void setUp() throws NamingException, Exception
+    {
+        super.setUp();
+    }
+    
+    public void testCreateEcoreSchemaSubContext()
+    {
+        assertNotNull(ecoreSchemaSubContext);
+    }
+    
+    public void testCreateEcoreObjectClassesContext()
+    {
+        assertNotNull(ecoreObjectClassesContext);
+    }
+    
+    public void testCreateEcoreAttributeTypesContext()
+    {
+        assertNotNull(ecoreAttributeTypesContext);
+    }
+    
+    public void testCreateEcoreSyntaxesContext()
+    {
+        assertNotNull(ecoreSyntaxesContext);
+    }
+    
+    public void testCreateEcoreSyntaxCheckersContext()
+    {
+        assertNotNull(ecoreSyntaxCheckersContext);
+    }
+}
\ No newline at end of file

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/XSDSchemaContextsSetup.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/XSDSchemaContextsSetup.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/XSDSchemaContextsSetup.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/XSDSchemaContextsSetup.java Tue Jun 26 06:29:06 2007
@@ -0,0 +1,116 @@
+/*
+ *  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.embedded.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.ldap.LdapContext;
+
+import org.apache.tuscany.das.ldap.constants.DASConstants;
+
+public class XSDSchemaContextsSetup 
+extends AbstractTestSetup
+implements DASConstants
+{
+    public void tearDown() throws NamingException, Exception
+    {
+        xsdSyntaxesContext.
+        close();
+        
+        xsdContext.
+        destroySubcontext( 
+        		SYNTAXES_CONTEXT_RDN );
+        
+        xsdContext.
+        close();
+        
+        schemaPartitionContext.
+        destroySubcontext( 
+        		XSD_CONTEXT_RDN );
+        
+        schemaPartitionContext.
+        close();
+        super.tearDown();
+    }
+    
+    public void setUp() throws NamingException, Exception
+    {
+        super.setUp();
+        xsdContext                                = 
+        	createXsdContext();
+        xsdSyntaxesContext                 = 
+        	createXsdSyntaxesContext();
+    }
+    
+    private LdapContext createXsdContext() throws NamingException
+    {
+        Attributes contextAttributes    = 
+        	new BasicAttributes();
+        
+        Attribute objectClassAttribute = 
+        	new BasicAttribute(
+        		OBJECT_CLASS,
+        		TOP);
+        objectClassAttribute.add(META_SCHEMA);
+
+        Attribute ecoreAttribute           = 
+        	new BasicAttribute(
+            CN, 
+            XSD_CONTEXT_NAME);
+
+        contextAttributes.put( ecoreAttribute );
+        contextAttributes.put( objectClassAttribute );
+        
+        return (LdapContext) schemaPartitionContext.createSubcontext( 
+            XSD_CONTEXT_RDN, contextAttributes );
+    }
+    
+    private LdapContext createXsdSyntaxesContext() 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 (LdapContext) xsdContext.createSubcontext( 
+            SYNTAXES_CONTEXT_RDN, contextAttributes );
+    }
+    protected LdapContext xsdContext                            = 
+    	null;
+    protected LdapContext xsdSyntaxCheckersContext  = 
+    	null;
+    protected LdapContext xsdSyntaxesContext             = 
+    	null;
+}
\ No newline at end of file

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/XSDSchemaContextsSetupTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/XSDSchemaContextsSetupTest.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/XSDSchemaContextsSetupTest.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/XSDSchemaContextsSetupTest.java Tue Jun 26 06:29:06 2007
@@ -0,0 +1,49 @@
+/*
+ *  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.embedded.setup.test;
+
+import javax.naming.NamingException;
+
+import org.apache.tuscany.das.ldap.constants.DASConstants;
+
+public class XSDSchemaContextsSetupTest 
+extends XSDSchemaContextsSetup
+implements DASConstants
+{
+    public void tearDown() throws NamingException, Exception
+    {
+        super.tearDown();
+    }
+    
+    public void setUp() throws NamingException, Exception
+    {
+        super.setUp();
+    }
+    
+    public void testCreateXsdContext()
+    {
+        assertNotNull(xsdContext);
+    }
+    
+    public void testCreateXsdSyntaxesContext()
+    {
+        assertNotNull(xsdSyntaxesContext);
+    }
+}
\ No newline at end of file

Added: directory/sandbox/oersoy/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.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EAttributeTypeCreatorTest.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EAttributeTypeCreatorTest.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EAttributeTypeCreatorTest.java Tue Jun 26 06:29:06 2007
@@ -0,0 +1,140 @@
+/*
+ *  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.embedded.setup.test.EcoreSchemaContextsSetup;
+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 EcoreSchemaContextsSetup
+{
+    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, 
+            ecoreSyntaxCheckersContext,
+            TUSCANY_SYNTAX_OID_VALUE);
+    }
+    
+    public void tearDown() throws NamingException, Exception
+    {
+        EStructuralFeatureTypeDestroyer.
+        destroy(
+            ecoreAttributeTypesContext, 
+            eAttribute, 
+            TUSCANY_SYNTAX_OID_VALUE);
+        
+        EcoreTypeSystemDestroyer.
+        destroy(
+            ecoreSyntaxesContext, 
+            ecoreSyntaxCheckersContext,
+            TUSCANY_SYNTAX_OID_VALUE);
+        
+        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, 
+            TUSCANY_SYNTAX_OID_VALUE );
+
+        String rdn = 
+            SimpleTypeRDNCreator.
+            create(
+                TUSCANY_SYNTAX_OID_VALUE,
+                namespaceURI, 
+                eContainingClassName,
+                eAttributeName);
+  
+        eAttributeEntryContext = 
+        ( DirContext ) 
+        ecoreAttributeTypesContext.
+        lookup( rdn );
+        
+        assertNotNull(eAttributeEntryContext);
+    }
+}
\ No newline at end of file

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EObjectClassCreatorHelperTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EObjectClassCreatorHelperTest.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EObjectClassCreatorHelperTest.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EObjectClassCreatorHelperTest.java Tue Jun 26 06:29:06 2007
@@ -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.tuscany.das.ldap.schema.emf.create.test;
+
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+
+import org.apache.tuscany.das.ldap.schema.emf.create.EObjectClassCreatorHelper;
+import org.apache.tuscany.das.ldap.schema.emf.create.EcoreTypeSystemHelper;
+import org.apache.tuscany.das.ldap.schema.embedded.setup.test.DASContextSetup;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EcoreFactory;
+
+public class EObjectClassCreatorHelperTest
+extends DASContextSetup
+{
+    private static EcoreFactory ecoreFactory = 
+        EcoreFactory.eINSTANCE;
+    
+    private EClass eClassL0                  =
+        null;
+
+    private EClass eClassL1                  =
+        null;
+
+    public void setUp() 
+    throws NamingException, Exception
+    {
+        super.setUp();
+        
+        eClassL0             = 
+            ecoreFactory.
+            createEClass();
+        eClassL0.setName( "L0" );
+
+        eClassL1             = 
+            ecoreFactory.
+            createEClass();
+        eClassL1.setName( "L1" );
+        
+        eClassL1.
+        getESuperTypes().
+        add(eClassL0);
+    }
+
+    public void testCreateInheritanceMetaData() 
+    throws NamingException
+    {
+        EObjectClassCreatorHelper.
+        createInheritanceMetaData( 
+            metaContext, 
+            eClassL1 );
+        
+        DirContext parentContext = 
+            ( DirContext ) 
+            metaContext.
+            lookup( "cn=" + eClassL0.getName() );
+        
+        assertNotNull(parentContext);
+        
+        DirContext childContext = 
+            ( DirContext ) 
+            parentContext.
+            lookup( "cn=" + eClassL1.getName() );
+
+        assertNotNull(childContext);
+
+        parentContext.destroySubcontext( 
+            "cn=" + eClassL1.getName() );
+        
+        metaContext.destroySubcontext( 
+            "cn=" + eClassL0.getName() );
+    }
+
+    public void testGetEClassParent()
+    {
+        EClass eClassParent =
+            null;
+        
+        eClassParent        = 
+            EcoreTypeSystemHelper.
+            getEClassParent(eClassL1);
+        
+        assertSame(eClassL0, eClassParent);
+    }
+}

Added: directory/sandbox/oersoy/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.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EObjectClassCreatorTest.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EObjectClassCreatorTest.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EObjectClassCreatorTest.java Tue Jun 26 06:29:06 2007
@@ -0,0 +1,445 @@
+/*
+ *  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.ArrayList;
+import java.util.List;
+
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.Attributes;
+
+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.embedded.setup.test.EcoreSchemaAndDASContextsSetup;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.emf.ecore.EcorePackage;
+
+public class EObjectClassCreatorTest
+extends EcoreSchemaAndDASContextsSetup
+{
+	boolean isObjectClassL0Created = false;
+	boolean isObjectClassL1Created = false;
+	
+    public void tearDown()
+    throws NamingException, Exception
+    {
+    	if (isObjectClassL1Created)
+    	{
+            EObjectClassDestroyer.
+            destroy(
+                metaContext,
+                ecoreAttributeTypesContext,
+                ecoreObjectClassesContext, 
+                eClassL1, 
+                TUSCANY_SYNTAX_OID_VALUE );
+
+            metaContext.
+            destroySubcontext( 
+                "cn="+eClassL0.getName() );
+    	}
+
+    	if (isObjectClassL0Created)
+    	{
+            EObjectClassDestroyer.
+            destroy(
+                metaContext,
+                ecoreAttributeTypesContext,
+                ecoreObjectClassesContext, 
+                eClassL0, 
+                TUSCANY_SYNTAX_OID_VALUE );
+    	}
+
+        MetaTopSDOObjectClassDestroyer.
+        destroy(
+            ecoreAttributeTypesContext,
+            ecoreObjectClassesContext, 
+            TUSCANY_SYNTAX_OID_VALUE );        
+        
+        EcoreTypeSystemDestroyer.
+        destroy(
+            ecoreSyntaxesContext, 
+            ecoreSyntaxCheckersContext,
+            TUSCANY_SYNTAX_OID_VALUE);
+
+        super.tearDown();
+    }
+
+    public void setUp() 
+    throws NamingException, Exception
+    {
+        super.setUp();
+
+        ecoreFactory                                 =
+            EcoreFactory.eINSTANCE;
+        ecorePackage                                =
+            EcorePackage.eINSTANCE;
+
+        EcoreTypeSystemCreator.
+        create(
+            ecoreSyntaxesContext, 
+            ecoreSyntaxCheckersContext,
+            TUSCANY_SYNTAX_OID_VALUE);
+        
+        MetaTopSDOObjectClassCreator 
+        metaTopSDOObjectClassCreator = 
+            new MetaTopSDOObjectClassCreator();
+        
+        metaTopSDOObjectClassCreator.create(
+            ecoreAttributeTypesContext, 
+            ecoreObjectClassesContext, 
+            TUSCANY_SYNTAX_OID_VALUE );
+        
+        processedEClassifiers                   = 
+            new ArrayList<EClass>();
+        
+        eClassL0                                        =
+            ecoreFactory.createEClass();
+        
+        eClassL1                                        =
+            ecoreFactory.createEClass();
+        
+        eClassL0.setName( "L0" );
+        eClassL1.setName( "L1" );
+        
+    	isObjectClassL0Created = false;
+    	isObjectClassL1Created = false;
+
+    }
+
+    /*
+     * Tests that eClassL0 and eClassL1 are both
+     * created an the corresponding entries exist
+     * in the meta section of the model.
+     */
+    public void testCreate0()
+    throws NamingException, Exception
+    {
+        eClassL1.
+        getESuperTypes().
+        add(eClassL0);
+
+        EPackage ePackage        = 
+            ecoreFactory.
+            createEPackage();
+        
+        ePackage.
+        setNsURI(xsdNamespace);
+
+        ePackage.
+        getEClassifiers().
+        add( eClassL0 );
+        
+        ePackage.
+        getEClassifiers().
+        add( eClassL1 );
+
+        
+        EObjectClassCreator
+        eObjectClassCreator      =
+            new EObjectClassCreator();
+        
+        eObjectClassCreator.
+        create(
+            metaContext,
+            ecoreAttributeTypesContext,
+            ecoreObjectClassesContext,
+            eClassL1, 
+            processedEClassifiers,
+            TUSCANY_SYNTAX_OID_VALUE );
+        
+        String rdnL0 = 
+            ComplexTypeRDNCreator.
+            create(
+                TUSCANY_SYNTAX_OID_VALUE,
+                xsdNamespace, 
+                eClassL0.getName());
+
+        eObjectClassL0EntryContext = 
+            ( DirContext ) 
+            ecoreObjectClassesContext.
+            lookup( rdnL0 );
+
+        assertNotNull(
+            eObjectClassL0EntryContext);
+
+        isObjectClassL0Created = true;
+
+        String rdnL1 = 
+            ComplexTypeRDNCreator.
+            create(
+                TUSCANY_SYNTAX_OID_VALUE,
+                xsdNamespace, 
+                eClassL1.getName());
+
+          eObjectClassL1EntryContext = 
+            ( DirContext ) 
+            ecoreObjectClassesContext.
+            lookup( rdnL1 );
+
+        assertNotNull(
+            eObjectClassL1EntryContext);
+
+        isObjectClassL1Created = true;
+    }
+    
+    /*
+     * Test that eClassL0 is added to the list
+     * of processed eClassifiers and that the 
+     * corresponding ObjectClass is created.
+     * 
+     * Also test the employeeNameEAttribute
+     * and departmentEReferences are added.
+     */
+    public void testCreate1() 
+    throws NamingException, Exception
+    {
+        EPackage ePackage                = 
+            ecoreFactory.
+            createEPackage();
+        
+        ePackage.
+        setNsURI(xsdNamespace);
+
+        ePackage.
+        getEClassifiers().
+        add( eClassL0 );
+
+
+        EAttribute employeeNameEAttribute = 
+            ecoreFactory.createEAttribute();
+        employeeNameEAttribute.setName( 
+            "employeeName" );
+        employeeNameEAttribute.setEType( 
+            ecorePackage.getEString() );
+
+        eClassL0.
+        getEStructuralFeatures().
+        add(employeeNameEAttribute);
+
+        EReference departmentEReference   =
+            ecoreFactory.createEReference();
+        departmentEReference.setName( "department" );
+        departmentEReference.setEType( eClassL0 );
+        
+        eClassL0.
+        getEStructuralFeatures().
+        add(departmentEReference);
+
+        EObjectClassCreator 
+        eObjectClassCreator                 =
+            new EObjectClassCreator();
+
+        eObjectClassCreator.
+        create(
+            metaContext,
+            ecoreAttributeTypesContext,
+            ecoreObjectClassesContext,
+            eClassL0, 
+            processedEClassifiers,
+            TUSCANY_SYNTAX_OID_VALUE );
+
+        assertTrue(processedEClassifiers.contains( eClassL0 ));
+        
+        String rdnL0                        = 
+            ComplexTypeRDNCreator.
+            create(
+                TUSCANY_SYNTAX_OID_VALUE,
+                xsdNamespace, 
+                eClassL0.getName());
+
+        eObjectClassL0EntryContext          = 
+            ( DirContext ) 
+            ecoreObjectClassesContext.
+            lookup( rdnL0 );
+        
+        assertNotNull(
+            eObjectClassL0EntryContext);
+
+        isObjectClassL0Created = true;
+        
+        Attributes attributes               = 
+            eObjectClassL0EntryContext.getAttributes( "" );
+        
+        NamingEnumeration namingEnumeration = 
+            attributes.get( M_MAY ).getAll();
+        
+        boolean hasDepartmentValue          = 
+            false;
+        boolean hasEmployeeNameValue        = 
+            false;
+        
+        String departmentValue              =
+            "example-com-users-accounts-L0-department";
+        
+        String employeeNameValue            =
+            "example-com-users-accounts-L0-employeeName";
+            
+            
+        while (namingEnumeration.hasMore()) 
+        {
+            String attributeValue           =
+                namingEnumeration.next().toString();
+            if (departmentValue.equals(attributeValue))
+            {
+                hasDepartmentValue = true;
+            }
+            if (employeeNameValue.equals(attributeValue))
+            {
+                hasEmployeeNameValue = true;
+            }
+        }
+        assertTrue(hasDepartmentValue);
+        assertTrue(hasEmployeeNameValue);
+    }
+    
+    /*
+     * Test that both ObjectClasses are created
+     * when eClassL1 inherits from eClassL0,
+     * but eClass0's ObjectClass entry 
+     * is already created.
+     */
+    public void testCreate3() 
+    throws NamingException, Exception
+    {
+        EPackage ePackage        = 
+            ecoreFactory.
+            createEPackage();
+        
+        ePackage.
+        setNsURI(xsdNamespace);
+
+        ePackage.
+        getEClassifiers().
+        add( eClassL0 );
+        
+        ePackage.
+        getEClassifiers().
+        add( eClassL1 );
+        
+        EObjectClassCreator
+        eObjectClassCreator      =
+            new EObjectClassCreator();
+
+        eObjectClassCreator.
+        create(
+            metaContext,
+            ecoreAttributeTypesContext,
+            ecoreObjectClassesContext,
+            eClassL0, 
+            processedEClassifiers,
+            TUSCANY_SYNTAX_OID_VALUE );
+
+        isObjectClassL0Created = true;
+        
+        eClassL1.
+        getESuperTypes().
+        add(eClassL0);
+
+        eObjectClassCreator.
+        create(
+            metaContext,
+            ecoreAttributeTypesContext,
+            ecoreObjectClassesContext,
+            eClassL1, 
+            processedEClassifiers,
+            TUSCANY_SYNTAX_OID_VALUE );
+        
+        String rdnL0 = 
+            ComplexTypeRDNCreator.
+            create(
+                TUSCANY_SYNTAX_OID_VALUE,
+                xsdNamespace, 
+                eClassL0.getName());
+
+        eObjectClassL0EntryContext = 
+        ( DirContext ) 
+        ecoreObjectClassesContext.
+        lookup( rdnL0 );
+        
+        assertNotNull(
+            eObjectClassL0EntryContext);
+
+        isObjectClassL0Created = true;
+
+        String rdnL1 = 
+            ComplexTypeRDNCreator.
+            create(
+                TUSCANY_SYNTAX_OID_VALUE,
+                xsdNamespace, 
+                eClassL1.getName());
+
+        eObjectClassL1EntryContext = 
+            ( DirContext ) 
+            ecoreObjectClassesContext.
+            lookup( rdnL1 );
+
+        assertNotNull(
+            eObjectClassL1EntryContext);
+        
+        isObjectClassL1Created = true;
+    }
+
+    
+
+        
+    private static EcoreFactory ecoreFactory    =
+        null;
+
+    private static EcorePackage ecorePackage =
+        null;
+    
+    private static EClass eClassL0                     =
+        null;
+    
+    private static EClass eClassL1                     =
+        null;
+    
+
+    private static List<EClass> 
+    processedEClassifiers                                      =
+        null;
+    
+    private static DirContext 
+    eObjectClassL0EntryContext               = 
+        null;
+
+    private static DirContext 
+    eObjectClassL1EntryContext               = 
+        null;
+    
+    private static DirContext 
+    eClassL0MetaContext                      = 
+        null;
+
+    private static DirContext 
+    eClassL1MetaContext                      = 
+        null;
+ } 
\ No newline at end of file

Added: directory/sandbox/oersoy/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.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EReferenceTypeCreatorTest.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EReferenceTypeCreatorTest.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EReferenceTypeCreatorTest.java Tue Jun 26 06:29:06 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.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.embedded.setup.test.EcoreSchemaContextsSetup;
+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 EcoreSchemaContextsSetup
+{
+    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, 
+            ecoreSyntaxCheckersContext,
+            TUSCANY_SYNTAX_OID_VALUE);
+    }
+    
+    public void tearDown() 
+    throws NamingException, Exception
+    {
+        EStructuralFeatureTypeDestroyer.
+        destroy(
+            ecoreAttributeTypesContext, 
+            eReference, 
+            TUSCANY_SYNTAX_OID_VALUE);
+        
+        EcoreTypeSystemDestroyer.
+        destroy(
+            ecoreSyntaxesContext, 
+            ecoreSyntaxCheckersContext,
+            TUSCANY_SYNTAX_OID_VALUE);
+        
+        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, 
+            TUSCANY_SYNTAX_OID_VALUE );
+
+        String rdn = 
+            SimpleTypeRDNCreator.
+            create(
+                TUSCANY_SYNTAX_OID_VALUE,
+                namespaceURI, 
+                eContainingClassName,
+                eReferenceName);
+  
+        eReferenceEntryContext = 
+        ( DirContext ) 
+        ecoreAttributeTypesContext.
+        lookup( rdn );
+        
+        assertNotNull(eReferenceEntryContext);
+    }
+}
\ No newline at end of file

Added: directory/sandbox/oersoy/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.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EcoreTypeSystemCreatorHelperTest.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EcoreTypeSystemCreatorHelperTest.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EcoreTypeSystemCreatorHelperTest.java Tue Jun 26 06:29:06 2007
@@ -0,0 +1,58 @@
+/*
+ *  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);
+    }
+}

Added: directory/sandbox/oersoy/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.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EcoreTypeSystemCreatorTest.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EcoreTypeSystemCreatorTest.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/create/test/EcoreTypeSystemCreatorTest.java Tue Jun 26 06:29:06 2007
@@ -0,0 +1,58 @@
+/*
+ *  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.schema.emf.create.EcoreTypeSystemCreator;
+import org.apache.tuscany.das.ldap.schema.emf.destroy.EcoreTypeSystemDestroyer;
+import org.apache.tuscany.das.ldap.schema.embedded.setup.test.EcoreSchemaContextsSetup;
+import org.eclipse.emf.ecore.EcorePackage;
+
+public class EcoreTypeSystemCreatorTest 
+extends EcoreSchemaContextsSetup
+{
+    public EcorePackage ecorePackage = 
+        EcorePackage.eINSTANCE;
+
+    public void setUp() 
+    throws NamingException, Exception
+    {
+        super.setUp();
+    }
+    
+    public void tearDown() throws NamingException, Exception
+    {
+        EcoreTypeSystemDestroyer.destroy(
+            ecoreSyntaxesContext, 
+            ecoreSyntaxCheckersContext,
+            TUSCANY_SYNTAX_OID_VALUE);
+        super.tearDown();
+    }
+    
+    public void testCreate() throws Exception
+    {
+        EcoreTypeSystemCreator.
+        create(
+            ecoreSyntaxesContext, 
+            ecoreSyntaxCheckersContext,
+            TUSCANY_SYNTAX_OID_VALUE);
+    }
+}
\ No newline at end of file

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/destroy/test/ECascadingObjectClassDestroyerTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/destroy/test/ECascadingObjectClassDestroyerTest.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/destroy/test/ECascadingObjectClassDestroyerTest.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/destroy/test/ECascadingObjectClassDestroyerTest.java Tue Jun 26 06:29:06 2007
@@ -0,0 +1,432 @@
+/*
+ *  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 java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+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.ECascadingObjectClassDestroyer;
+import org.apache.tuscany.das.ldap.schema.emf.destroy.EcoreTypeSystemDestroyer;
+import org.apache.tuscany.das.ldap.schema.embedded.setup.test.EcoreSchemaAndDASContextsSetup;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.emf.ecore.EcorePackage;
+
+/*
+ * TODO Make sure that we test EAttribute deletion as well.
+ */
+public class ECascadingObjectClassDestroyerTest
+extends EcoreSchemaAndDASContextsSetup
+{
+    public void tearDown() 
+    throws NamingException, Exception
+    {
+        MetaTopSDOObjectClassDestroyer.
+        destroy(
+            ecoreAttributeTypesContext,
+            ecoreObjectClassesContext, 
+            TUSCANY_SYNTAX_OID_VALUE );        
+        
+        EcoreTypeSystemDestroyer.
+        destroy(
+            ecoreSyntaxesContext, 
+            ecoreSyntaxCheckersContext,
+            TUSCANY_SYNTAX_OID_VALUE);
+
+        super.tearDown();
+    }
+
+    public void setUp() 
+    throws NamingException, Exception
+    {
+        super.setUp();
+
+        ecoreFactory                 =
+            EcoreFactory.eINSTANCE;
+        ecorePackage                 =
+            EcorePackage.eINSTANCE;
+
+
+        EcoreTypeSystemCreator.
+        create(
+            ecoreSyntaxesContext, 
+            ecoreSyntaxCheckersContext,
+            TUSCANY_SYNTAX_OID_VALUE);
+        
+        
+        MetaTopSDOObjectClassCreator 
+        metaTopSDOObjectClassCreator = 
+            new MetaTopSDOObjectClassCreator();
+        
+        metaTopSDOObjectClassCreator.
+        create(
+            ecoreAttributeTypesContext, 
+            ecoreObjectClassesContext, 
+            TUSCANY_SYNTAX_OID_VALUE );
+        
+
+        processedEClassifiers        = 
+            new ArrayList<EClass>();
+        
+        eClassL0                     =
+            ecoreFactory.
+            createEClass();
+        
+        eClassL1                     =
+            ecoreFactory.
+            createEClass();
+        
+        eClassL0.setName( "L0" );
+        eClassL1.setName( "L1" );
+        
+        eClassNameToEClassMap        = 
+            new HashMap<String, EClass>();
+        
+        eClassNameToEClassMap.put( 
+            eClassL0.getName(), 
+            eClassL0 );
+        
+        eClassNameToEClassMap.put( 
+            eClassL1.getName(), 
+            eClassL1 );
+
+    }
+    
+    /*
+     * Test the deletion of two
+     * single level hierarchy ObjectClasses
+     */
+    public void testCreate1() 
+    throws NamingException, Exception
+    {
+        eClassL1.
+        getESuperTypes().
+        add(eClassL0);
+
+        EPackage ePackage        = 
+            ecoreFactory.
+            createEPackage();
+        
+        ePackage.
+        setNsURI(xsdNamespace);
+
+        ePackage.
+        getEClassifiers().
+        add( eClassL0 );
+        
+        ePackage.
+        getEClassifiers().
+        add( eClassL1 );
+        
+
+        EObjectClassCreator
+        eObjectClassCreator       =
+            new EObjectClassCreator();
+        
+        eObjectClassCreator.
+        create(
+            metaContext,
+            ecoreAttributeTypesContext,
+            ecoreObjectClassesContext,
+            eClassL1, 
+            processedEClassifiers,
+            TUSCANY_SYNTAX_OID_VALUE );
+        
+        String rdnL0                 = 
+            ComplexTypeRDNCreator.
+            create(
+                TUSCANY_SYNTAX_OID_VALUE,
+                xsdNamespace, 
+                eClassL0.getName());
+
+        String rdnL1                 = 
+            ComplexTypeRDNCreator.
+            create(
+                TUSCANY_SYNTAX_OID_VALUE,
+                xsdNamespace, 
+                eClassL1.getName());
+
+        eObjectClassL0EntryContext = 
+            ( DirContext ) 
+            ecoreObjectClassesContext.
+            lookup( rdnL0 );
+
+        eObjectClassL1EntryContext = 
+        ( DirContext ) 
+        ecoreObjectClassesContext.
+        lookup( rdnL1 );
+        
+        assertNotNull(
+            eObjectClassL0EntryContext);
+        
+        assertNotNull(
+            eObjectClassL1EntryContext);
+
+        eClassL0MetaContext            =
+            ( DirContext ) 
+            metaContext.
+            lookup( 
+                "cn=" + eClassL0.getName() );
+
+        assertNotNull(
+            eClassL0MetaContext );
+        
+        eClassL1MetaContext            =
+            ( DirContext ) 
+            eClassL0MetaContext.
+            lookup( 
+                "cn=" + eClassL1.getName() );
+
+        assertNotNull(
+            eClassL0MetaContext );
+        
+        assertNotNull(
+            eClassL1MetaContext );
+
+
+        ECascadingObjectClassDestroyer.
+        destroy(
+            eClassNameToEClassMap, 
+            metaContext,
+            ecoreAttributeTypesContext, 
+            ecoreObjectClassesContext, 
+            eClassL0, 
+            TUSCANY_SYNTAX_OID_VALUE );
+        
+        try
+        {
+            eObjectClassL0EntryContext = 
+                ( DirContext ) 
+                ecoreObjectClassesContext.
+                lookup( rdnL0 );
+        }
+        catch (Exception e)
+        {
+            eObjectClassL0EntryContext = 
+                null;
+        }
+
+        try
+        {
+            eObjectClassL1EntryContext = 
+                ( DirContext ) 
+                ecoreObjectClassesContext.
+                lookup( rdnL1 );
+        }
+        catch (Exception e)
+        {
+            eObjectClassL1EntryContext = 
+                null;
+        }
+        
+        assertNull(
+            eObjectClassL0EntryContext);
+        
+        assertNull(
+            eObjectClassL1EntryContext);
+
+        try
+        {
+            eClassL0MetaContext            =
+                ( DirContext ) 
+                metaContext.
+                lookup( 
+                    "cn=" + eClassL0.getName() );
+
+        }
+        catch (Exception e)
+        {
+            assertNotNull(
+                eClassL0MetaContext );
+        }
+    }
+
+    
+    private static EcoreFactory ecoreFactory =
+        null;
+
+    private static EcorePackage ecorePackage =
+        null;
+    
+    private static EClass eClassL0           =
+        null;
+    
+    private static EClass eClassL1           =
+        null;
+
+    private static List<EClass> 
+    processedEClassifiers                    =
+        null;
+    
+    private static DirContext 
+    eObjectClassL0EntryContext               = 
+        null;
+
+    private static DirContext 
+    eObjectClassL1EntryContext               = 
+        null;
+    
+    private static DirContext 
+    eClassL0MetaContext                = 
+        null;
+
+    private static DirContext 
+    eClassL1MetaContext                = 
+        null;
+    
+    private Map<String, EClass> eClassNameToEClassMap   =
+        null;
+
+    /*
+     * Test the deletion of two
+     * single level hierarchy ObjectClasses
+     */
+    public void testCreate0() 
+    throws NamingException, Exception
+    {
+        EPackage ePackage        = 
+            ecoreFactory.
+            createEPackage();
+        
+        ePackage.
+        setNsURI(xsdNamespace);
+
+        ePackage.
+        getEClassifiers().
+        add( eClassL0 );
+        
+        ePackage.
+        getEClassifiers().
+        add( eClassL1 );
+        
+
+        EObjectClassCreator
+        eObjectClassCreator       =
+            new EObjectClassCreator();
+        
+        eObjectClassCreator.
+        create(
+            metaContext,
+            ecoreAttributeTypesContext,
+            ecoreObjectClassesContext,
+            eClassL0, 
+            processedEClassifiers,
+            TUSCANY_SYNTAX_OID_VALUE );
+        
+        eObjectClassCreator.
+        create(
+            metaContext,
+            ecoreAttributeTypesContext,
+            ecoreObjectClassesContext,
+            eClassL1, 
+            processedEClassifiers,
+            TUSCANY_SYNTAX_OID_VALUE );
+        
+        String rdnL0                 = 
+            ComplexTypeRDNCreator.
+            create(
+                TUSCANY_SYNTAX_OID_VALUE,
+                xsdNamespace, 
+                eClassL0.getName());
+
+        String rdnL1                 = 
+            ComplexTypeRDNCreator.
+            create(
+                TUSCANY_SYNTAX_OID_VALUE,
+                xsdNamespace, 
+                eClassL1.getName());
+
+        eObjectClassL0EntryContext = 
+            ( DirContext ) 
+            ecoreObjectClassesContext.
+            lookup( rdnL0 );
+
+        eObjectClassL1EntryContext = 
+        ( DirContext ) 
+        ecoreObjectClassesContext.
+        lookup( rdnL1 );
+        
+        assertNotNull(
+            eObjectClassL0EntryContext);
+        
+        assertNotNull(
+            eObjectClassL1EntryContext);
+        
+        ECascadingObjectClassDestroyer.
+        destroy(
+            eClassNameToEClassMap,
+            metaContext,
+            ecoreAttributeTypesContext, 
+            ecoreObjectClassesContext, 
+            eClassL0, 
+            TUSCANY_SYNTAX_OID_VALUE );
+
+        ECascadingObjectClassDestroyer.
+        destroy(
+            eClassNameToEClassMap,
+            metaContext,
+            ecoreAttributeTypesContext, 
+            ecoreObjectClassesContext, 
+            eClassL1, 
+            TUSCANY_SYNTAX_OID_VALUE );
+        try
+        {
+            eObjectClassL0EntryContext = 
+                ( DirContext ) 
+                ecoreObjectClassesContext.
+                lookup( rdnL0 );
+        }
+        catch (Exception e)
+        {
+            eObjectClassL0EntryContext = 
+                null;
+        }
+
+        try
+        {
+            eObjectClassL1EntryContext = 
+                ( DirContext ) 
+                ecoreObjectClassesContext.
+                lookup( rdnL1 );
+        }
+        catch (Exception e)
+        {
+            eObjectClassL1EntryContext = 
+                null;
+        }
+        
+        assertNull(
+            eObjectClassL0EntryContext);
+        
+        assertNull(
+            eObjectClassL1EntryContext);
+    }
+}
\ No newline at end of file



Mime
View raw message