directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oer...@apache.org
Subject svn commit: r549870 [7/9] - 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 Fri, 22 Jun 2007 16:39:54 GMT
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=549870
==============================================================================
--- 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 Fri Jun 22 09:39:30 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=549870
==============================================================================
--- 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 Fri Jun 22 09:39:30 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=549870
==============================================================================
--- 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 Fri Jun 22 09:39:30 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=549870
==============================================================================
--- 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 Fri Jun 22 09:39:30 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=549870
==============================================================================
--- 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 Fri Jun 22 09:39:30 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

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/destroy/test/EObjectClassDestroyerTest.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/EObjectClassDestroyerTest.java?view=auto&rev=549870
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/destroy/test/EObjectClassDestroyerTest.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/destroy/test/EObjectClassDestroyerTest.java Fri Jun 22 09:39:30 2007
@@ -0,0 +1,492 @@
+/*
+ *  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.List;
+
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+
+import org.apache.tuscany.das.ldap.emf.create.test.Prototype;
+import org.apache.tuscany.das.ldap.emf.create.test.PrototypeUtilities;
+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.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 EObjectClassDestroyerTest
+extends EcoreSchemaAndDASContextsSetup
+implements Prototype
+{
+    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" );
+    }
+    
+    /*
+     * Test the deletion of two
+     * single level hierarchy ObjectClasses
+     */
+    public void testDestroy0() 
+    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);
+        
+        EObjectClassDestroyer.
+        destroy( 
+            metaContext,
+            ecoreAttributeTypesContext, 
+            ecoreObjectClassesContext, 
+            eClassL0, 
+            TUSCANY_SYNTAX_OID_VALUE );
+
+        EObjectClassDestroyer.
+        destroy(
+            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);
+    }
+
+    /*
+     * Testt the deletion of two
+     * ObjectClasses where L1 inherits from
+     * L0
+     */
+
+    public void testDestroy1() 
+    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 );
+
+        EObjectClassDestroyer.
+        destroy(
+            metaContext,
+            ecoreAttributeTypesContext, 
+            ecoreObjectClassesContext, 
+            eClassL1, 
+            TUSCANY_SYNTAX_OID_VALUE );
+
+        EObjectClassDestroyer.
+        destroy( 
+            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);
+
+        
+        eClassL0MetaContext            =
+            ( DirContext ) 
+            metaContext.
+            lookup( 
+                "cn=" + eClassL0.getName() );
+
+        assertNotNull(
+            eClassL0MetaContext );
+
+        try
+        {
+            eClassL1MetaContext            =
+                ( DirContext ) 
+                eClassL0MetaContext.
+                lookup( 
+                    "cn=" + eClassL1.getName() );
+
+        }
+        catch (Exception e)
+        {
+            eClassL1MetaContext = 
+                null;
+        }
+        
+        assertNull(
+            eClassL1MetaContext);
+
+        metaContext.
+        destroySubcontext( 
+            "cn=" + eClassL0.getName() );
+    }
+    
+    /*
+     * Test the deletion of an ObjectClass that has 
+     * has attributes.
+     */
+    public void testDestroy2() throws NamingException, Exception
+    {
+    	userEClass.getEStructuralFeatures().add(userIDEAttribute);
+    	userEClass.getEStructuralFeatures().add(userNameEAttribute);
+    	userEClass.getEStructuralFeatures().add(userPasswordEAttribute);
+    	userEClass.getEStructuralFeatures().add(authorizationEReference);
+    	
+        EPackage ePackage        = 
+            ecoreFactory.
+            createEPackage();
+        
+        ePackage.
+        setNsURI(xsdNamespace);
+
+        ePackage.
+        getEClassifiers().
+        add( userEClass );
+
+        EObjectClassCreator
+        eObjectClassCreator           =
+            new EObjectClassCreator();
+        
+        eObjectClassCreator.
+        create(
+            metaContext,
+            ecoreAttributeTypesContext,
+            ecoreObjectClassesContext,
+            userEClass, 
+            processedEClassifiers,
+            TUSCANY_SYNTAX_OID_VALUE );
+    	
+        String rdnL0                          = 
+            ComplexTypeRDNCreator.
+            create(
+                TUSCANY_SYNTAX_OID_VALUE,
+                xsdNamespace, 
+                userEClass.getName());
+        
+        EObjectClassDestroyer.
+        destroy(
+            metaContext,
+            ecoreAttributeTypesContext, 
+            ecoreObjectClassesContext, 
+            userEClass, 
+            TUSCANY_SYNTAX_OID_VALUE );
+    }
+
+    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/destroy/test/EcoreTypeSystemDestroyerTest.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/EcoreTypeSystemDestroyerTest.java?view=auto&rev=549870
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/destroy/test/EcoreTypeSystemDestroyerTest.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/emf/destroy/test/EcoreTypeSystemDestroyerTest.java Fri Jun 22 09:39:30 2007
@@ -0,0 +1,55 @@
+/*
+ *  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.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 EcoreTypeSystemDestroyerTest 
+extends EcoreSchemaContextsSetup
+{
+    public EcorePackage ecorePackage = EcorePackage.eINSTANCE;
+
+    public void setUp() throws NamingException, Exception
+    {
+        super.setUp();
+     }
+    
+    public void tearDown() throws NamingException, Exception
+    {
+        super.tearDown();
+    }
+    
+    public void testDestroy() throws Exception
+    {
+        EcoreTypeSystemCreator.create(
+        		ecoreSyntaxesContext,
+        		ecoreSyntaxCheckersContext,
+        		TUSCANY_SYNTAX_OID_VALUE);
+        EcoreTypeSystemDestroyer.destroy(
+        		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/setup/test/AbstractTestSetup.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/AbstractTestSetup.java?view=auto&rev=549870
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/AbstractTestSetup.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/AbstractTestSetup.java Fri Jun 22 09:39:30 2007
@@ -0,0 +1,57 @@
+
+package org.apache.tuscany.das.ldap.schema.setup.test;
+
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+
+import org.apache.directory.apacheds.testing.setup.JNDIConnectionTemplate;
+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;
+
+public abstract class AbstractTestSetup 
+extends JNDIConnectionTemplate
+implements 
+EnumeratedSchemaAttributeTypeValues,
+SchemaAttributeTypeConstants,
+AttributeTypeConstants,
+SchemaObjectClassConstants,
+ObjectClassConstants,
+DASConstants
+{
+    public void setUp() throws NamingException, Exception
+    {
+
+    }
+
+    protected DirContext schemaContext                         = 
+        null;
+
+    protected static String PROVIDER_URL_VALUE                 =
+        "ldap://localhost:10389/ou=schema";
+    
+    protected static final String SYNTAXES_CONTEXT_RDN         = 
+        OU + "=" + SYNTAXES_CONTEXT_NAME;
+
+    protected static final String ATTRIBUTE_TYPES_CONTEXT_RDN  = 
+        OU + "=" + ATTRIBUTE_TYPES_CONTEXT_NAME;
+    
+    protected static final String OBJECT_CLASSES_CONTEXT_RDN   = 
+        OU + "=" + OBJECT_CLASSES_CONTEXT_NAME;
+    
+    
+    
+    protected static final String XSD_CONTEXT_RDN              = 
+        CN + "=" + XSD_CONTEXT_NAME;
+    protected static final String DAS_CONTEXT_RDN              = 
+        CN + "=" + DAS_CONTEXT_NAME;
+    protected static final String ECORE_CONTEXT_RDN            = 
+        CN + "=" + ECORE_CONTEXT_NAME;
+    
+    protected String xsdNamespace                   = 
+        "http://example.com/users/accounts";
+
+}
\ No newline at end of file

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/DASContextSetup.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/DASContextSetup.java?view=auto&rev=549870
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/DASContextSetup.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/DASContextSetup.java Fri Jun 22 09:39:30 2007
@@ -0,0 +1,55 @@
+package org.apache.tuscany.das.ldap.schema.setup.test;
+
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+import javax.naming.ldap.LdapContext;
+
+import org.apache.directory.apacheds.testing.setup.JNDIHotPartitionConnectionTemplate;
+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;
+
+public class DASContextSetup 
+extends JNDIHotPartitionConnectionTemplate
+implements DASConstants
+{
+    public void tearDown() throws NamingException, Exception
+    {
+        MetaContextDestroyer.
+        destroy( modelContext );
+        
+        InitialContextDestroyer.
+        destroy(
+            modelContext, 
+            dasPartitionContext );
+                super.tearDown();
+                
+        dasPartitionContext.close();
+    }
+    
+    public void setUp() throws NamingException, Exception
+    {
+        super.setUp();
+        dasPartitionContext                     =
+        	connect("das");
+
+        modelContext                               = 
+            (LdapContext) 
+            InitialContextCreator.
+            create(
+                xsdNamespace,
+                dasPartitionContext);
+
+        //Meta Context
+        //----------------------------------------------
+        metaContext                               =
+            (LdapContext) MetaContextCreator.
+            create( 
+            modelContext);
+    }
+    protected LdapContext dasPartitionContext      = null;
+    protected LdapContext modelContext                = 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/setup/test/DASContextSetupTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/DASContextSetupTest.java?view=auto&rev=549870
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/DASContextSetupTest.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/DASContextSetupTest.java Fri Jun 22 09:39:30 2007
@@ -0,0 +1,34 @@
+package org.apache.tuscany.das.ldap.schema.setup.test;
+
+import javax.naming.NamingException;
+
+import org.apache.tuscany.das.ldap.constants.DASConstants;
+
+public class DASContextSetupTest 
+extends DASContextSetup
+implements DASConstants
+{
+    public void tearDown() throws NamingException, Exception
+    {
+        super.tearDown();
+    }
+    
+    public void setUp() throws NamingException, Exception
+    {
+        super.setUp();
+    }
+    
+    public void testCreateDASPartitionContext()
+    {
+        assertNotNull(dasPartitionContext);
+    }
+    
+    public void testModelContext()
+    {
+        assertNotNull(modelContext);
+    }
+    public void testMetaContext()
+    {
+        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/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/setup/test/DASSchemaContextsSetup.java?view=auto&rev=549870
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/DASSchemaContextsSetup.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/DASSchemaContextsSetup.java Fri Jun 22 09:39:30 2007
@@ -0,0 +1,189 @@
+/*
+ *  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.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();
+        
+        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( 
+                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 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 );
+    }
+
+    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 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/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/setup/test/DASSchemaContextsSetupTest.java?view=auto&rev=549870
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/DASSchemaContextsSetupTest.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/DASSchemaContextsSetupTest.java Fri Jun 22 09:39:30 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 DASSchemaContextsSetupTest 
+extends DASSchemaContextsSetup
+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

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/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/setup/test/EcoreSchemaAndDASContextsSetup.java?view=auto&rev=549870
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/EcoreSchemaAndDASContextsSetup.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/EcoreSchemaAndDASContextsSetup.java Fri Jun 22 09:39:30 2007
@@ -0,0 +1,136 @@
+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 org.apache.tuscany.das.ldap.constants.DASConstants;
+
+public class EcoreSchemaAndDASContextsSetup 
+extends DASContextSetup
+implements DASConstants
+{
+    public void tearDown() 
+    throws NamingException, Exception
+    {
+        ecoreSyntaxesContext.close();
+        ecoreContext.destroySubcontext( SYNTAXES_CONTEXT_RDN );
+        
+        ecoreAttributeTypesContext.close();
+        ecoreContext.destroySubcontext( ATTRIBUTE_TYPES_CONTEXT_RDN );
+        
+        ecoreObjectClassesContext.close();
+        ecoreContext.destroySubcontext( OBJECT_CLASSES_CONTEXT_RDN );
+        
+        ecoreContext.close();
+        schemaContext.destroySubcontext( ECORE_CONTEXT_RDN );
+        
+        schemaContext.close();
+        super.tearDown();
+    }
+    
+    public void setUp() throws NamingException, Exception
+    {
+        super.setUp();
+        providerURL                = PROVIDER_URL_VALUE;
+        schemaContext              = connect();
+        ecoreContext               = createEcoreContext();
+        ecoreSyntaxesContext       = createEcoreSyntaxesContext();
+        ecoreObjectClassesContext  = createEcoreObjectClassesContext();
+        ecoreAttributeTypesContext = createEcoreAttributeTypesContext();
+    }
+    
+    private DirContext createEcoreContext() 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 schemaContext.createSubcontext( 
+            ECORE_CONTEXT_RDN, contextAttributes );
+    }
+    
+
+    private DirContext 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 ecoreContext.createSubcontext( 
+            OBJECT_CLASSES_CONTEXT_RDN, contextAttributes );
+    }
+    
+    
+
+    private DirContext 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 ecoreContext.createSubcontext( 
+            ATTRIBUTE_TYPES_CONTEXT_RDN, contextAttributes );
+    }
+    
+    
+    private DirContext 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 ecoreContext.createSubcontext( 
+            SYNTAXES_CONTEXT_RDN, contextAttributes );
+    }
+    
+    private static String PROVIDER_URL_VALUE =
+        "ldap://localhost:10389/ou=schema";
+    
+    protected DirContext ecoreContext               = null;
+    protected DirContext ecoreObjectClassesContext  = null;
+    protected DirContext ecoreAttributeTypesContext = null;
+    protected DirContext ecoreSyntaxesContext       = 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/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/setup/test/EcoreSchemaAndDASContextsSetupTest.java?view=auto&rev=549870
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/EcoreSchemaAndDASContextsSetupTest.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/EcoreSchemaAndDASContextsSetupTest.java Fri Jun 22 09:39:30 2007
@@ -0,0 +1,56 @@
+package org.apache.tuscany.das.ldap.schema.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(schemaContext);
+    }
+    
+    public void testCreateEcoreContext()
+    {
+        assertNotNull(ecoreContext);
+    }
+    
+    public void testCreateEcoreObjectClassesContext()
+    {
+        assertNotNull(ecoreObjectClassesContext);
+    }
+    
+    public void testCreateEcoreAttributeTypesContext()
+    {
+        assertNotNull(ecoreAttributeTypesContext);
+    }
+    
+    public void testCreateEcoreSyntaxesContext()
+    {
+        assertNotNull(ecoreSyntaxesContext);
+    }
+    
+    public void testCreateDasModelContext()
+    {
+        assertNotNull(modelContext);
+    }
+
+    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/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/setup/test/EcoreSchemaContextsSetup.java?view=auto&rev=549870
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/EcoreSchemaContextsSetup.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/EcoreSchemaContextsSetup.java Fri Jun 22 09:39:30 2007
@@ -0,0 +1,136 @@
+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 org.apache.tuscany.das.ldap.constants.DASConstants;
+
+public class EcoreSchemaContextsSetup 
+extends AbstractTestSetup
+implements DASConstants
+{
+    public void tearDown() 
+    throws NamingException, Exception
+    {
+        ecoreSyntaxesContext.close();
+        ecoreContext.destroySubcontext( SYNTAXES_CONTEXT_RDN );
+        
+        ecoreAttributeTypesContext.close();
+        ecoreContext.destroySubcontext( ATTRIBUTE_TYPES_CONTEXT_RDN );
+        
+        ecoreObjectClassesContext.close();
+        ecoreContext.destroySubcontext( OBJECT_CLASSES_CONTEXT_RDN );
+        
+        ecoreContext.close();
+        schemaContext.destroySubcontext( ECORE_CONTEXT_RDN );
+        
+        schemaContext.close();
+        super.tearDown();
+    }
+    
+    public void setUp() throws NamingException, Exception
+    {
+        super.setUp();
+        providerURL                = PROVIDER_URL_VALUE;
+        schemaContext              = connect();
+        ecoreContext               = createEcoreContext();
+        ecoreSyntaxesContext       = createEcoreSyntaxesContext();
+        ecoreObjectClassesContext  = createEcoreObjectClassesContext();
+        ecoreAttributeTypesContext = createEcoreAttributeTypesContext();
+    }
+    
+    private DirContext createEcoreContext() 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 schemaContext.createSubcontext( 
+            ECORE_CONTEXT_RDN, contextAttributes );
+    }
+    
+
+    private DirContext 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 ecoreContext.createSubcontext( 
+            OBJECT_CLASSES_CONTEXT_RDN, contextAttributes );
+    }
+    
+    
+
+    private DirContext 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 ecoreContext.createSubcontext( 
+            ATTRIBUTE_TYPES_CONTEXT_RDN, contextAttributes );
+    }
+    
+    
+    private DirContext 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 ecoreContext.createSubcontext( 
+            SYNTAXES_CONTEXT_RDN, contextAttributes );
+    }
+    
+    private static String PROVIDER_URL_VALUE =
+        "ldap://localhost:10389/ou=schema";
+    
+    protected DirContext ecoreContext               = null;
+    protected DirContext ecoreObjectClassesContext  = null;
+    protected DirContext ecoreAttributeTypesContext = null;
+    protected DirContext ecoreSyntaxesContext       = 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/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/setup/test/EcoreSchemaContextsSetupTest.java?view=auto&rev=549870
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/EcoreSchemaContextsSetupTest.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/EcoreSchemaContextsSetupTest.java Fri Jun 22 09:39:30 2007
@@ -0,0 +1,59 @@
+package org.apache.tuscany.das.ldap.schema.setup.test;
+
+import javax.naming.NamingException;
+
+import org.apache.tuscany.das.ldap.constants.DASConstants;
+
+public class EcoreSchemaContextsSetupTest 
+extends EcoreSchemaAndDASContextsSetup
+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(ecoreContext);
+    }
+    
+    public void testCreateEcoreObjectClassesContext()
+    {
+        assertNotNull(ecoreObjectClassesContext);
+    }
+    
+    public void testCreateEcoreAttributeTypesContext()
+    {
+        assertNotNull(ecoreAttributeTypesContext);
+    }
+    
+    public void testCreateEcoreSyntaxesContext()
+    {
+        assertNotNull(ecoreSyntaxesContext);
+    }
+    
+    public void testCreateDASPartitionContext()
+    {
+        assertNotNull(dasPartitionContext);
+    }
+    
+    public void testModelContext()
+    {
+        assertNotNull(modelContext);
+    }
+    public void testMetaContext()
+    {
+        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/setup/test/SchemaContextSetup.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/SchemaContextSetup.java?view=auto&rev=549870
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/SchemaContextSetup.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/SchemaContextSetup.java Fri Jun 22 09:39:30 2007
@@ -0,0 +1,22 @@
+package org.apache.tuscany.das.ldap.schema.setup.test;
+
+import javax.naming.NamingException;
+import org.apache.tuscany.das.ldap.constants.DASConstants;
+
+public class SchemaContextSetup 
+extends AbstractTestSetup
+implements DASConstants
+{
+    public void tearDown() throws NamingException, Exception
+    {
+        schemaContext.close();
+        super.tearDown();
+    }
+    
+    public void setUp() throws NamingException, Exception
+    {
+        super.setUp();
+        providerURL              = PROVIDER_URL_VALUE;
+        schemaContext            = connect();
+    }
+}
\ No newline at end of file

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/SchemaContextSetupTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/SchemaContextSetupTest.java?view=auto&rev=549870
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/SchemaContextSetupTest.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/setup/test/SchemaContextSetupTest.java Fri Jun 22 09:39:30 2007
@@ -0,0 +1,25 @@
+package org.apache.tuscany.das.ldap.schema.setup.test;
+
+import javax.naming.NamingException;
+
+import org.apache.tuscany.das.ldap.constants.DASConstants;
+
+public class SchemaContextSetupTest 
+extends SchemaContextSetup
+implements DASConstants
+{
+    public void tearDown() throws NamingException, Exception
+    {
+        super.tearDown();
+    }
+    
+    public void setUp() throws NamingException, Exception
+    {
+        super.setUp();
+    }
+    
+    public void testConnect()
+    {
+        assertNotNull(schemaContext);
+    }
+}
\ No newline at end of file



Mime
View raw message