directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oer...@apache.org
Subject svn commit: r549870 [6/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/learning/test/SelfContainedBindingTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/learning/test/SelfContainedBindingTest.java?view=auto&rev=549870
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/learning/test/SelfContainedBindingTest.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/learning/test/SelfContainedBindingTest.java Fri Jun 22 09:39:30 2007
@@ -0,0 +1,348 @@
+
+package org.apache.tuscany.das.ldap.learning.test;
+
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Set;
+
+import javax.naming.Binding;
+import javax.naming.Context;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttribute;
+import javax.naming.directory.BasicAttributes;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.InitialDirContext;
+
+import org.apache.directory.server.core.configuration.Configuration;
+import org.apache.directory.server.core.configuration.MutablePartitionConfiguration;
+import org.apache.directory.server.core.configuration.MutableStartupConfiguration;
+
+import junit.framework.TestCase;
+
+public class SelfContainedBindingTest extends TestCase
+{
+    DirContext hotPartitionContext       =
+        null;
+
+    DirContext schemaContext             =
+        null;
+
+    public void setUp() throws NamingException
+    {
+        hotPartitionContext              =
+        createDASPartition();
+        
+        schemaContext                    =
+            connect();
+    }
+    
+    String APACHE_CONTEXT_FACTORY        =
+        "org.apache.directory.server.core.jndi.CoreContextFactory";
+
+    String SUN_CONTEXT_FACTORY        =
+        "com.sun.jndi.ldap.LdapCtxFactory";
+    
+    String SIMPLE_SECURITY_AUTHENTICATION_VALUE = 
+        "simple";
+    
+    String DEFAULT_SECURITY_PRINCIPAL_VALUE      = 
+        "uid=admin,ou=system";
+    
+    String DEFAULT_SECURITY_CREDENTIALS_VALUE    = 
+        "secret";
+
+    protected String providerHost            =
+        "ldap://localhost:10389/";
+
+    protected String providerPath            =
+        "ou=schema";
+
+    protected String  providerURL            =
+        providerHost + providerPath;
+
+    protected String initialContextFactory   = 
+        SUN_CONTEXT_FACTORY;
+    
+    protected String  securityAuthentication = 
+        SIMPLE_SECURITY_AUTHENTICATION_VALUE;
+    
+    protected String  securityPrincipal      = 
+        DEFAULT_SECURITY_PRINCIPAL_VALUE;
+    
+    protected String credentials             =
+        DEFAULT_SECURITY_CREDENTIALS_VALUE;
+    
+    private Hashtable<String,Object> createEnvironment()
+    {
+        providerURL                          =
+            providerHost + providerPath;
+
+        Hashtable<String,Object> env = 
+            new Hashtable<String, Object>();
+
+        env.put( 
+            DirContext.PROVIDER_URL,
+            providerURL);
+
+        env.put( 
+            DirContext.INITIAL_CONTEXT_FACTORY, 
+            initialContextFactory );
+
+        env.put( 
+            DirContext.SECURITY_AUTHENTICATION, 
+            securityAuthentication);
+        
+        env.put( 
+            DirContext.SECURITY_PRINCIPAL, 
+            securityPrincipal );
+        
+        env.put( 
+            DirContext.SECURITY_CREDENTIALS, 
+            credentials );
+        
+        return env;
+    }
+    
+    public DirContext connect() throws NamingException
+    {
+        return new InitialDirContext(createEnvironment());
+    }
+    
+    public void testNullBinding() throws NamingException
+    {
+    	 String l0RDN = "cn=L0";
+    	 String l1RDN = "cn=L1";
+    	 
+    	 DirContext testPartitionContext = 
+    		  createDASPartition();
+    	  
+    	 DirContext directoryContextL0  =
+    		 null;
+
+    	 DirContext directoryContextL1  =
+    		 null;
+
+    	 directoryContextL0                      =
+    		  (DirContext) 
+    		  testPartitionContext.
+    		  createSubcontext(l0RDN);
+
+    	 directoryContextL1                      = 
+    		  (DirContext) 
+    		  directoryContextL0.
+    		  createSubcontext(l1RDN);
+    	  
+    	 //Just making double sure we can look these contexts up
+    	 //=================================
+          directoryContextL0                     =
+              ( DirContext ) 
+              testPartitionContext.
+              lookup(l0RDN);
+
+          assertNotNull(
+              directoryContextL0 );
+          
+          directoryContextL1                      =
+              ( DirContext ) 
+              directoryContextL0.
+              lookup( l1RDN );
+          
+          assertNotNull(
+        		  directoryContextL1 );
+     	 //=================================
+          
+          NamingEnumeration<Binding> childEntryContexts = 
+          	directoryContextL0.listBindings("");
+
+          assertTrue(childEntryContexts.hasMore());
+          
+          Binding binding                                                             =
+        	  (Binding) 
+        	  childEntryContexts.next();
+          
+          assertFalse(binding instanceof DirContext);
+          assertNull(binding.getObject());
+          
+          assertEquals("cn=L1,cn=L0,ou=test", binding.getName());
+          assertFalse(binding.isRelative());
+          
+          directoryContextL0.destroySubcontext(l1RDN);
+          testPartitionContext.destroySubcontext(l0RDN);
+    }
+
+    public void testNullBindingFix() throws NamingException
+    {
+    	 String l0RDN = "cn=L0";
+    	 String l1RDN = "cn=L1";
+    	 
+    	 DirContext testPartitionContext = 
+    		  createDASPartition();
+    	  
+    	 DirContext directoryContextL0   =
+    		 null;
+
+    	 DirContext directoryContextL1   =
+    		 null;
+    	 
+    	 Attributes attributes                    = 
+    		 new BasicAttributes();
+    	 Attribute objectClassAttribute    = 
+    		 new BasicAttribute(
+    				 "objectClass", 
+    				 "top");
+    	 objectClassAttribute.add("subentry");
+    	 attributes.put(objectClassAttribute);
+    	 
+
+    	 directoryContextL0                       =
+    		  (DirContext) 
+    		  testPartitionContext.
+    		  createSubcontext(l0RDN, attributes);
+
+    	 directoryContextL1                       = 
+    		  (DirContext) 
+    		  directoryContextL0.
+    		  createSubcontext(l1RDN, attributes);
+    	  
+    	 //Just making double sure we can look these contexts up
+    	 //=================================
+          directoryContextL0                     =
+              ( DirContext ) 
+              testPartitionContext.
+              lookup(l0RDN);
+
+          assertNotNull(
+              directoryContextL0 );
+          
+          directoryContextL1                      =
+              ( DirContext ) 
+              directoryContextL0.
+              lookup( l1RDN );
+
+          assertNotNull(
+        		  directoryContextL1 );
+     	 //=================================
+          
+          
+          
+          NamingEnumeration<Binding> childEntryContexts = 
+          	directoryContextL0.listBindings("");
+
+          assertTrue(childEntryContexts.hasMore());
+          
+          Binding binding                                                             =
+        	  (Binding) 
+        	  childEntryContexts.next();
+          //assertFalse(binding instanceof DirContext);
+          //assertNull(binding.getObject());
+          
+          //assertEquals("cn=L1,cn=L0,ou=test", binding.getName());
+          //assertFalse(binding.isRelative());
+          
+          directoryContextL0.destroySubcontext(l1RDN);
+          testPartitionContext.destroySubcontext(l0RDN);
+    }
+
+    
+    public void testExperimental() throws NamingException
+    {
+
+        {
+            String l0RDN = "cn=L0";
+            String l1RDN = "cn=L1";
+
+            DirContext testPartitionContext = createDASPartition();
+
+            DirContext directoryContextL0 = null;
+
+            DirContext directoryContextL1 = null;
+            
+            Attributes attrsL0 = new BasicAttributes( true );
+            attrsL0.put( "ObjectClass", "person" );
+            attrsL0.put( "cn", "L0");
+            attrsL0.put( "sn", "l0");
+
+            Attributes attrsL1 = new BasicAttributes( true );
+            attrsL1.put( "ObjectClass", "person" );
+            attrsL1.put( "cn", "L1");
+            attrsL1.put( "sn", "l1");
+
+            directoryContextL0 = ( DirContext ) testPartitionContext.createSubcontext( l0RDN, attrsL0 );
+
+            directoryContextL1 = ( DirContext ) directoryContextL0.createSubcontext( l1RDN, attrsL1 );
+
+            //Just making double sure we can look these contexts up
+            //=================================
+            directoryContextL0 = ( DirContext ) testPartitionContext.lookup( l0RDN );
+
+            assertNotNull( directoryContextL0 );
+
+            directoryContextL1 = ( DirContext ) directoryContextL0.lookup( l1RDN );
+
+            assertNotNull( directoryContextL1 );
+            //=================================
+
+            NamingEnumeration<Binding> childEntryContexts = directoryContextL0.listBindings( "" );
+
+            assertTrue( childEntryContexts.hasMore() );
+
+            Binding binding = ( Binding ) childEntryContexts.next();
+
+            System.out.println( binding instanceof Context );
+            System.out.println( childEntryContexts.hasMore());
+
+            assertNull( binding.getObject() );
+
+            assertEquals( "cn=L1,cn=L0,ou=test", binding.getName() );
+
+            directoryContextL0.destroySubcontext( l1RDN );
+            testPartitionContext.destroySubcontext( l0RDN );
+     }
+
+    	
+    	
+    }
+    public void tearDown()
+    {
+    	
+    }
+
+    public DirContext createDASPartition() throws NamingException
+    {
+        MutableStartupConfiguration configuration        = 
+        new MutableStartupConfiguration();
+                
+        MutablePartitionConfiguration dasPartition        = 
+         new MutablePartitionConfiguration();
+                
+        dasPartition.setName( "test" );
+        dasPartition.setSuffix( "ou=test" );
+        
+        Set<MutablePartitionConfiguration> partitions = 
+        new HashSet<MutablePartitionConfiguration> ();
+        partitions.add( dasPartition );
+        configuration.setPartitionConfigurations( partitions );
+
+        Attributes suffixAttributes = new BasicAttributes();
+        suffixAttributes.put( "objectClass", "top");
+        suffixAttributes.get( "objectClass" ).add( "organizationalUnit" );
+        suffixAttributes.put( "ou", "test" );
+        
+        dasPartition.setContextEntry( suffixAttributes );
+                
+        Hashtable<String,Object> env                            = 
+        	createEnvironment();
+        
+        env.put(Context.INITIAL_CONTEXT_FACTORY, 
+            APACHE_CONTEXT_FACTORY);
+                
+        env.put( Context.PROVIDER_URL, "ou=test"  );
+        
+        env.put( Configuration.JNDI_KEY, configuration );
+                
+        return new InitialDirContext( env );
+    }
+ }
\ No newline at end of file

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/modify/test/DataObjectModififierTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/modify/test/DataObjectModififierTest.java?view=auto&rev=549870
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/modify/test/DataObjectModififierTest.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/modify/test/DataObjectModififierTest.java Fri Jun 22 09:39:30 2007
@@ -0,0 +1,147 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.tuscany.das.ldap.modify.test;
+
+import javax.naming.directory.Attribute;
+import javax.naming.directory.BasicAttribute;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.ModificationItem;
+
+import org.apache.tuscany.das.ldap.schema.create.ComplexTypeRDNCreator;
+import org.apache.tuscany.das.ldap.schema.create.SyntaxEntryCreator;
+import org.apache.tuscany.das.ldap.schema.destroy.SyntaxEntryDestroyer;
+import org.apache.tuscany.das.ldap.schema.embedded.setup.test.XSDSchemaContextsSetup;
+import org.apache.tuscany.das.ldap.schema.setup.test.XSDSchemaContextsSetupTest;
+
+public class DataObjectModififierTest 
+extends XSDSchemaContextsSetup
+{
+
+/*
+ * TODO Remember to integrate...
+    public void updateModificationTemp()
+    {
+        Attribute objectClassAttribute = new BasicAttribute(
+            OBJECT_CLASS, 
+            "top" );
+        
+        objectClassAttribute.add( META_TOP );
+        objectClassAttribute.add( META_SYNTAX );
+        
+        Attribute oidAttribute = new BasicAttribute(
+            M_OID, 
+            OID);
+        
+        Attribute descriptionAttribute = new BasicAttribute(
+            M_DESCRIPTION, 
+            "xsd:String");
+
+        ModificationItem[] modificationItems = new ModificationItem[3];
+        
+        modificationItems[0] = 
+            new ModificationItem(DirContext.ADD_ATTRIBUTE, objectClassAttribute);
+
+        modificationItems[1] = 
+            new ModificationItem(
+                DirContext.ADD_ATTRIBUTE, oidAttribute );
+
+        modificationItems[2] = 
+            new ModificationItem(
+                DirContext.ADD_ATTRIBUTE, descriptionAttribute );
+    }
+
+    //TAKEN FROM THE ATTRIBYTPETYPEENTRYCREATORTEST - WAS DELETED
+    //Attributes ldapAttributes = new AttributesImpl();
+    ModificationItem[] modificationItems = new ModificationItem[7];
+    
+    Attribute objectClassAttribute = new BasicAttribute(
+        OBJECT_CLASS, 
+        "top" );
+    
+    objectClassAttribute.add( META_TOP );
+    objectClassAttribute.add( META_SYNTAX );
+    
+    Attribute oidAttribute = new BasicAttribute(
+        M_OID, 
+        OID);
+    
+    Attribute nameAttribute = new BasicAttribute(
+        M_NAME,
+        "org.tuscany.das.ldap.config.DASConfig");
+    
+    //TODO Check what this is
+    Attribute objectClassMetaTypeAttribute = new BasicAttribute(
+        M_DESCRIPTION, 
+        "SyntaxAddTest");
+    
+
+    *
+    */
+    
+    
+    /*
+    modificationItems[0] = 
+        new ModificationItem(DirContext.ADD_ATTRIBUTE, objectClassAttribute);
+    
+    modificationItems[1] = 
+        new ModificationItem(
+            DirContext.ADD_ATTRIBUTE,
+            new BasicAttribute( 
+                MetaSchemaConstants.M_ObjectClassConstants, 
+                "org.tuscany.das.ldap.config.DASConfig") );
+
+    
+    modificationItems[2] = 
+        new ModificationItem(
+            DirContext.ADD_ATTRIBUTE, 
+            new BasicAttribute( 
+                MetaSchemaConstants.M_TYPE_OBJECT_CObjectClassConstants, 
+                "STRUCTURAL" ) );
+
+    modificationItems[3] = 
+        new ModificationItem(
+            DirContext.ADD_ATTRIBUTE, 
+            new BasicAttribute( 
+                MetaSchemaConstants.M_ObjectClassConstants, 
+                "org.tuscany.das.ldap.config.DASConfig") );
+
+    modificationItems[4] = 
+        new ModificationItem(
+            DirContext.ADD_ATTRIBUTE, 
+            new BasicAttribute( 
+                MetaSchemaConstants.M_ObjectClassConstants, 
+                "org.tuscany.das.ldap.config.DASConfig") );
+
+    modificationItems[5] = 
+        new ModificationItem(
+            DirContext.ADD_ATTRIBUTE, 
+            new BasicAttribute( 
+                MetaSchemaConstants.M_ObjectClassConstants, 
+                "baseDN" ) );
+
+    modificationItems[6] = 
+        new ModificationItem(
+            DirContext.ADD_ATTRIBUTE, 
+            new BasicAttribute( 
+                M_OID, 
+                "optionalOPP" ) );
+                
+                */
+}

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/create/test/MComplexMayAttributeTypeCreatorTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/create/test/MComplexMayAttributeTypeCreatorTest.java?view=auto&rev=549870
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/create/test/MComplexMayAttributeTypeCreatorTest.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/create/test/MComplexMayAttributeTypeCreatorTest.java Fri Jun 22 09:39:30 2007
@@ -0,0 +1,57 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.tuscany.das.ldap.schema.create.test;
+
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+
+import org.apache.tuscany.das.ldap.schema.create.MComplexMayAttributeTypeCreator;
+import org.apache.tuscany.das.ldap.schema.embedded.setup.test.DASSchemaContextsSetup;
+
+public class MComplexMayAttributeTypeCreatorTest 
+extends DASSchemaContextsSetup
+{
+    public void tearDown() throws NamingException, Exception
+    {
+        dasAttributeTypesContext.destroySubcontext( 
+            mComplexMayRDN);
+        super.tearDown();
+    }
+    
+    public void testCreate() throws NamingException, Exception
+    {
+        MComplexMayAttributeTypeCreator 
+        mComplexMayAttributeTypeCreator = 
+            new MComplexMayAttributeTypeCreator();
+        
+        mComplexMayAttributeTypeCreator.create( 
+            dasAttributeTypesContext, 
+            TUSCANY_SYNTAX_OID_VALUE );
+        
+        DirContext mComplexMayContext = null;
+        
+        mComplexMayContext = 
+            ( DirContext ) 
+            dasAttributeTypesContext.
+            lookup(mComplexMayRDN);
+        
+        assertNotNull(mComplexMayContext);
+    }
+}

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/create/test/MComplexMustAttributeTypeCreatorTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/create/test/MComplexMustAttributeTypeCreatorTest.java?view=auto&rev=549870
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/create/test/MComplexMustAttributeTypeCreatorTest.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/create/test/MComplexMustAttributeTypeCreatorTest.java Fri Jun 22 09:39:30 2007
@@ -0,0 +1,59 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.tuscany.das.ldap.schema.create.test;
+
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+
+import org.apache.tuscany.das.ldap.schema.create.MComplexMustAttributeTypeCreator;
+import org.apache.tuscany.das.ldap.schema.embedded.setup.test.DASSchemaContextsSetup;
+
+public class MComplexMustAttributeTypeCreatorTest 
+extends DASSchemaContextsSetup
+{
+    public void tearDown() 
+    throws NamingException, Exception
+    {
+        dasAttributeTypesContext.destroySubcontext(
+            mComplexMustRDN );
+        super.tearDown();
+    }
+
+    public void testCreate() 
+    throws NamingException, Exception
+    {
+        MComplexMustAttributeTypeCreator 
+        mComplexMustAttributeTypeCreator = 
+            new MComplexMustAttributeTypeCreator();
+
+        mComplexMustAttributeTypeCreator.
+        create(
+            dasAttributeTypesContext, 
+            TUSCANY_SYNTAX_OID_VALUE);
+        DirContext mComplexMustContext = null;
+
+        mComplexMustContext = 
+            ( DirContext ) dasAttributeTypesContext.lookup(mComplexMustRDN);
+
+        assertNotNull(mComplexMustContext);
+        
+        assertTrue(true);
+    }
+}
\ No newline at end of file

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/create/test/MIDAttributeTypeCreatorTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/create/test/MIDAttributeTypeCreatorTest.java?view=auto&rev=549870
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/create/test/MIDAttributeTypeCreatorTest.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/create/test/MIDAttributeTypeCreatorTest.java Fri Jun 22 09:39:30 2007
@@ -0,0 +1,60 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.tuscany.das.ldap.schema.create.test;
+
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+
+import org.apache.tuscany.das.ldap.schema.create.MIDAttributeTypeCreator;
+import org.apache.tuscany.das.ldap.schema.embedded.setup.test.DASSchemaContextsSetup;
+
+public class MIDAttributeTypeCreatorTest 
+extends DASSchemaContextsSetup
+{
+    public void tearDown() 
+    throws NamingException, Exception
+    {
+        dasAttributeTypesContext.
+        destroySubcontext( 
+            idRDN);
+        super.tearDown();
+    }
+    
+    public void testCreate() 
+    throws NamingException, Exception
+    {
+        MIDAttributeTypeCreator 
+        mIDAttributeTypeCreator = 
+            new MIDAttributeTypeCreator();
+        
+        mIDAttributeTypeCreator.create( 
+            dasAttributeTypesContext, 
+            TUSCANY_SYNTAX_OID_VALUE );
+        
+        DirContext idContext = null;
+        
+        idContext = 
+            ( DirContext ) 
+            dasAttributeTypesContext.
+            lookup(idRDN);
+        
+        assertNotNull(idContext);
+    }
+}

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/create/test/MetaTopSDOObjectClassCreatorTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/create/test/MetaTopSDOObjectClassCreatorTest.java?view=auto&rev=549870
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/create/test/MetaTopSDOObjectClassCreatorTest.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/create/test/MetaTopSDOObjectClassCreatorTest.java Fri Jun 22 09:39:30 2007
@@ -0,0 +1,64 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.tuscany.das.ldap.schema.create.test;
+
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+
+import org.apache.tuscany.das.ldap.schema.create.MetaTopSDOObjectClassCreator;
+import org.apache.tuscany.das.ldap.schema.destroy.MetaTopSDOObjectClassDestroyer;
+import org.apache.tuscany.das.ldap.schema.embedded.setup.test.DASSchemaContextsSetup;
+
+public class MetaTopSDOObjectClassCreatorTest 
+extends DASSchemaContextsSetup
+{
+    public void tearDown() 
+    throws NamingException, Exception
+    {
+        MetaTopSDOObjectClassDestroyer.destroy( 
+            dasAttributeTypesContext, 
+            dasObjectClassesContext, 
+            TUSCANY_SYNTAX_OID_VALUE );
+
+        super.tearDown();
+    }
+    
+    public void testCreate() 
+    throws NamingException, Exception
+    {
+        MetaTopSDOObjectClassCreator 
+        metaTopSDOObjectClassCreator = 
+            new MetaTopSDOObjectClassCreator();
+        
+        metaTopSDOObjectClassCreator.
+        create(
+            dasAttributeTypesContext,
+            dasObjectClassesContext, 
+            TUSCANY_SYNTAX_OID_VALUE );
+        DirContext metaTopSDOContext = null;
+        
+        metaTopSDOContext = 
+            ( DirContext ) dasObjectClassesContext.lookup( 
+                metaTopSDORDN);
+        
+        assertNotNull(metaTopSDOContext);
+    }
+}
+

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/embedded/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/embedded/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/embedded/setup/test/AbstractTestSetup.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/AbstractTestSetup.java Fri Jun 22 09:39:30 2007
@@ -0,0 +1,87 @@
+/*
+ *  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.directory.apacheds.testing.setup.ADSEmbeddedHotPartitionTemplate;
+import org.apache.tuscany.das.ldap.constants.DASConstants;
+import org.apache.tuscany.das.ldap.schema.constants.AttributeTypeConstants;
+import org.apache.tuscany.das.ldap.schema.constants.EnumeratedSchemaAttributeTypeValues;
+import org.apache.tuscany.das.ldap.schema.constants.ObjectClassConstants;
+import org.apache.tuscany.das.ldap.schema.constants.SchemaAttributeTypeConstants;
+import org.apache.tuscany.das.ldap.schema.constants.SchemaObjectClassConstants;
+import org.apache.tuscany.das.ldap.testing.constants.DASTestingConstants;
+
+public abstract class AbstractTestSetup 
+extends ADSEmbeddedHotPartitionTemplate
+implements 
+EnumeratedSchemaAttributeTypeValues,
+SchemaAttributeTypeConstants,
+AttributeTypeConstants,
+SchemaObjectClassConstants,
+ObjectClassConstants,
+DASConstants,
+DASTestingConstants
+{
+    public void tearDown() throws NamingException, Exception
+    {
+        super.tearDown();
+    }
+    
+    public void setUp() throws Exception
+    {
+        super.setUp();
+        
+        dasPartitionContext = 
+        	connect("das");
+        
+        schemaPartitionContext = 
+        	connect("schema");
+    }
+    
+    protected LdapContext schemaPartitionContext                          =
+    	null;
+    
+    protected LdapContext dasPartitionContext                                 =
+    	null;
+    
+    protected static final String SYNTAXES_CONTEXT_RDN               = 
+        OU + "=" + SYNTAXES_CONTEXT_NAME;
+
+    protected static final String SYNTAX_CHECKERS_CONTEXT_RDN               = 
+        OU + "=" + SYNTAX_CHECKERS_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;
+}
\ 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/AbstractTestSetupTest.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/AbstractTestSetupTest.java?view=auto&rev=549870
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/AbstractTestSetupTest.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/AbstractTestSetupTest.java Fri Jun 22 09:39:30 2007
@@ -0,0 +1,46 @@
+/*
+ *  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;
+
+public class AbstractTestSetupTest 
+extends AbstractTestSetup
+{
+    public void tearDown() throws NamingException, Exception
+    {
+        super.tearDown();
+    }
+    
+    public void setUp() throws Exception
+    {
+    	super.setUp();
+        dasPartitionContext        = 
+        	connect("das");
+        schemaPartitionContext = 
+        	connect("schema");
+    }
+    
+    public void testConnect() throws NamingException
+    {
+	    assertNotNull(dasPartitionContext);
+	    assertNotNull(schemaPartitionContext);
+    }
+}
\ 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/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/embedded/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/embedded/setup/test/DASContextSetup.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/DASContextSetup.java Fri Jun 22 09:39:30 2007
@@ -0,0 +1,46 @@
+package org.apache.tuscany.das.ldap.schema.embedded.setup.test;
+
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+
+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 AbstractTestSetup
+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();
+        modelContext                               = 
+            InitialContextCreator.
+            create(
+                xsdNamespace,
+                dasPartitionContext);
+
+        metaContext                               =
+            MetaContextCreator.
+            create( modelContext);
+    }
+    
+    protected DirContext modelContext             = null;
+    protected DirContext 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/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/embedded/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/embedded/setup/test/DASContextSetupTest.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/schema/embedded/setup/test/DASContextSetupTest.java Fri Jun 22 09:39:30 2007
@@ -0,0 +1,54 @@
+/*
+ *  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 DASContextSetupTest 
+extends DASContextSetup
+implements DASConstants
+{
+    public void tearDown() throws NamingException, Exception
+    {
+        super.tearDown();
+    }
+    
+    public void setUp() throws NamingException, Exception
+    {
+        super.setUp();
+    }
+    
+    public void testModelContext() throws NamingException
+    {
+        assertNotNull(modelContext);
+        assertEquals(
+        		"cn=accounts,cn=users,cn=example,cn=com,ou=das",
+        		modelContext.getNameInNamespace());
+    }
+
+    public void testMetaContext() throws NamingException
+    {
+        assertNotNull(metaContext);
+        assertEquals("cn=meta,cn=accounts,cn=users,cn=example,cn=com,ou=das",
+        		metaContext.getNameInNamespace());
+    }
+}
\ 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/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=549870
==============================================================================
--- 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 Fri Jun 22 09:39:30 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=549870
==============================================================================
--- 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 Fri Jun 22 09:39:30 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=549870
==============================================================================
--- 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 Fri Jun 22 09:39:30 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=549870
==============================================================================
--- 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 Fri Jun 22 09:39:30 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=549870
==============================================================================
--- 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 Fri Jun 22 09:39:30 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=549870
==============================================================================
--- 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 Fri Jun 22 09:39:30 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=549870
==============================================================================
--- 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 Fri Jun 22 09:39:30 2007
@@ -0,0 +1,114 @@
+/*
+ *  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 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=549870
==============================================================================
--- 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 Fri Jun 22 09:39:30 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=549870
==============================================================================
--- 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 Fri Jun 22 09:39:30 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=549870
==============================================================================
--- 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 Fri Jun 22 09:39:30 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);
+    }
+}



Mime
View raw message