directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oer...@apache.org
Subject svn commit: r550803 [6/10] - in /directory/sandbox/oersoy/das.ldap.parent: ./ das.ldap.constants/ das.ldap.constants/.settings/ das.ldap.constants/src/ das.ldap.constants/src/main/ das.ldap.constants/src/main/java/ das.ldap.constants/src/main/java/org/...
Date Tue, 26 Jun 2007 13:29:26 GMT
Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/create/test/EDataObjectCreatorTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/create/test/EDataObjectCreatorTest.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/create/test/EDataObjectCreatorTest.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/create/test/EDataObjectCreatorTest.java Tue Jun 26 06:29:06 2007
@@ -0,0 +1,171 @@
+/*
+ *  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.emf.create.test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.naming.NamingException;
+import javax.naming.directory.Attributes;
+import javax.naming.ldap.LdapContext;
+
+import org.apache.tuscany.das.ldap.emf.create.EDataObjectCreator;
+import org.apache.tuscany.das.ldap.emf.read.EDataObjectReader;
+import org.apache.tuscany.das.ldap.prototype.setup.Prototype;
+import org.apache.tuscany.das.ldap.schema.embedded.setup.test.EcoreSchemaAndDASContextsSetup;
+import org.apache.tuscany.das.ldap.schema.emf.create.EObjectClassCreator;
+import org.apache.tuscany.das.ldap.schema.emf.destroy.EObjectClassDestroyer;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.sdo.EDataObject;
+
+public class EDataObjectCreatorTest 
+extends EcoreSchemaAndDASContextsSetup
+implements Prototype
+{
+    protected static List<EClass> 
+    processedEClassifiers                                                  = null;
+    
+	protected static EDataObject userDataObject      = null;
+	
+	protected String eDataObjectRDN                          = null;
+	protected LdapContext namedContainerContext  = null;
+	
+	public void tearDown() throws NamingException, Exception
+	{
+		containerContext.destroySubcontext(eDataObjectRDN);
+		
+        EObjectClassDestroyer.
+            destroy(
+                metaContext,
+                ecoreAttributeTypesContext,
+                ecoreObjectClassesContext, 
+                userEClass, 
+                TUSCANY_SYNTAX_OID_VALUE );
+
+        super.tearDown();
+	}
+	
+	public void setUp() throws Exception
+	{
+		super.setUp();
+		
+        userEClass.
+        getEStructuralFeatures().
+        add( userNameEAttribute );
+        userEClass.
+        getEStructuralFeatures().
+        add( userPasswordEAttribute );
+        userEClass.
+        getEStructuralFeatures().
+        add( userAgeEAttribute );
+        userEClass.
+        getEStructuralFeatures().
+        add( userHeightEAttribute );
+        userEClass.
+        getEStructuralFeatures().
+        add( userIsMaleEAttribute );
+        userEClass.
+        getEStructuralFeatures().
+        add( authorizationEReference );
+        
+
+        userEClass.
+        getEStructuralFeatures().
+        add( userIDEAttribute );
+
+		userEPackage.
+		getEClassifiers().
+		add(userEClass);
+		
+    	userDataObject =
+    		(EDataObject) 
+    		userEFactory.create(userEClass);
+    	
+    	userDataObject.eSet(userNameEAttribute,"ole");
+    	userDataObject.eSet(userPasswordEAttribute,"secret");
+    	userDataObject.eSet(userIDEAttribute, "1");
+    	userDataObject.eSet(userAgeEAttribute, 33);
+    	userDataObject.eSet(userHeightEAttribute, 6.11);
+    	userDataObject.eSet(userIsMaleEAttribute, true);
+    	
+
+        processedEClassifiers                   = 
+            new ArrayList<EClass>();
+        
+        EObjectClassCreator
+        eObjectClassCreator      =
+            new EObjectClassCreator();
+        
+        eObjectClassCreator.
+        create(
+            metaContext,
+            ecoreAttributeTypesContext,
+            ecoreObjectClassesContext,
+            userEClass, 
+            processedEClassifiers,
+            TUSCANY_SYNTAX_OID_VALUE );
+        
+    	eDataObjectRDN                             = 
+    		EDataObjectCreator.create(
+    				userDataObject,
+    				containerContext);
+    	
+    	EDataObject eDataObject               =
+    		EDataObjectReader.read(
+    				userEClass,  
+    				"1", 
+    				containerContext);
+    }
+	
+    public void testCreate() throws NamingException
+    {
+    	LdapContext eDataObjectContext = 
+    		(LdapContext) 
+    		containerContext.lookup(eDataObjectRDN);
+    	
+    	assertEquals(
+    			"example-com-users-accounts-User-id=1,cn=accounts,cn=users,cn=example,cn=com,ou=das",
+    			eDataObjectContext.getNameInNamespace());
+    	
+    	Attributes attributes = 
+    		eDataObjectContext.getAttributes("");
+    	
+    	assertEquals(
+    			attributes.get("example-com-users-accounts-User-userPassword").get(),
+    			"secret");
+    	
+    	assertEquals(
+    			attributes.get("example-com-users-accounts-User-userName").get(),
+    			"ole");
+    	assertEquals(
+    			attributes.get("example-com-users-accounts-User-userPassword").get(),
+    			"secret");
+    	assertEquals(
+    			attributes.get("example-com-users-accounts-User-userAge").get(),
+    			"33");
+    	assertEquals(
+    			attributes.get("example-com-users-accounts-User-userHeight").get(),
+    			"6.11");
+    
+    	assertEquals(
+    			attributes.get("example-com-users-accounts-User-authorizationList").size(),
+    			0);
+    }
+}
\ No newline at end of file

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/read/test/EDataGraphReaderTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/read/test/EDataGraphReaderTest.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/read/test/EDataGraphReaderTest.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/read/test/EDataGraphReaderTest.java Tue Jun 26 06:29:06 2007
@@ -0,0 +1,285 @@
+/*
+ *  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.emf.read.test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.naming.NamingException;
+import javax.naming.ldap.LdapContext;
+
+import org.apache.tuscany.das.ldap.emf.create.EDataGraphCreator;
+import org.apache.tuscany.das.ldap.emf.read.EDataGraphReader;
+import org.apache.tuscany.das.ldap.prototype.setup.Prototype;
+import org.apache.tuscany.das.ldap.schema.embedded.setup.test.EcoreSchemaAndDASContextsSetup;
+import org.apache.tuscany.das.ldap.schema.emf.create.EObjectClassCreator;
+import org.apache.tuscany.das.ldap.schema.emf.destroy.EObjectClassDestroyer;
+import org.eclipse.emf.common.util.BasicEList;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.sdo.EDataGraph;
+import org.eclipse.emf.ecore.sdo.EDataObject;
+import org.eclipse.emf.ecore.sdo.SDOFactory;
+
+public class EDataGraphReaderTest 
+extends EcoreSchemaAndDASContextsSetup
+implements Prototype
+{
+	private EDataObject authorizationDataObject0 = null;
+	private EDataObject authorizationDataObject1 = null;
+	private EDataGraph eDataGraph                          = null;
+	
+	private static List<EClass> 
+    processedEClassifiers                                              = null;
+    
+	private EDataObject userDataObject                  = null;
+	
+
+	String eDataObjectRDN                                     = 
+		"example-com-users-accounts-User-id=1";
+	String eContainingFeatureRDN                         = 
+		"cn=authorizationList";
+	String authorizationDataObject1RDN              = 
+		"example-com-users-accounts-Authorization-id=2";
+	String authorizationDataObject2RDN              = 
+		"example-com-users-accounts-Authorization-id=3";
+	
+	LdapContext authorizationContainerContext  = null;
+	LdapContext eDataObjectContext                   = null;
+	
+	public void tearDown() throws NamingException, Exception
+	{
+		authorizationContainerContext.destroySubcontext(authorizationDataObject1RDN);
+		authorizationContainerContext.destroySubcontext(authorizationDataObject2RDN);
+		eDataObjectContext.destroySubcontext(eContainingFeatureRDN);
+		containerContext.destroySubcontext(eDataObjectRDN);
+
+        EObjectClassDestroyer.
+        destroy(
+            metaContext,
+            ecoreAttributeTypesContext,
+            ecoreObjectClassesContext, 
+            authorizationEClass, 
+            TUSCANY_SYNTAX_OID_VALUE );
+
+        EObjectClassDestroyer.
+            destroy(
+                metaContext,
+                ecoreAttributeTypesContext,
+                ecoreObjectClassesContext, 
+                userEClass, 
+                TUSCANY_SYNTAX_OID_VALUE );
+           
+        super.tearDown();
+	}
+	
+	public void setUp() throws Exception
+	{
+		super.setUp();
+
+        userEClass.
+        getEStructuralFeatures().
+        add( userNameEAttribute );
+        userEClass.
+        getEStructuralFeatures().
+        add( userPasswordEAttribute );
+        userEClass.
+        getEStructuralFeatures().
+        add( userAgeEAttribute );
+        userEClass.
+        getEStructuralFeatures().
+        add( userHeightEAttribute );
+        userEClass.
+        getEStructuralFeatures().
+        add( userIsMaleEAttribute );
+        userEClass.
+        getEStructuralFeatures().
+        add( userIDEAttribute );
+        userEClass.
+        getEStructuralFeatures().
+        add( authorizationEReference );
+
+		userEPackage.getEClassifiers().add(userEClass);
+		
+    	userDataObject =
+    		(EDataObject) 
+    		userEFactory.create(userEClass);
+    	
+    	userDataObject.eSet(userNameEAttribute,"ole");
+    	userDataObject.eSet(userPasswordEAttribute,"secret");
+    	userDataObject.eSet(userIDEAttribute, "1");
+    	userDataObject.eSet(userAgeEAttribute, 33);
+    	userDataObject.eSet(userHeightEAttribute, 6.11);
+    	userDataObject.eSet(userIsMaleEAttribute, true);
+    	
+        
+		userEPackage.getEClassifiers().
+		add(authorizationEClass);
+		
+		authorizationEClass.
+		getEStructuralFeatures().
+		add(fileEAttribute);
+
+		authorizationEClass.
+		getEStructuralFeatures().
+		add(writeEAttribute);
+
+		authorizationEClass.
+		getEStructuralFeatures().
+		add(readEAttribute);
+		
+		authorizationEClass.
+		getEStructuralFeatures().
+		add(executeEAttribute);
+
+		authorizationEClass.
+		getEStructuralFeatures().
+		add(authorizationIDEAttribute);
+		
+		authorizationEReference.
+		setEType(authorizationEClass);
+		
+    	authorizationDataObject0  =
+    		(EDataObject) 
+    		userEFactory.create(authorizationEClass);
+    	
+    	authorizationDataObject1  =
+    		(EDataObject) 
+    		userEFactory.create(authorizationEClass);
+    	
+    	authorizationDataObject0.eSet(fileEAttribute,"somefile.text");
+    	authorizationDataObject0.eSet(writeEAttribute, true);
+    	authorizationDataObject0.eSet(readEAttribute,true);
+    	authorizationDataObject0.eSet(executeEAttribute,true);
+    	authorizationDataObject0.eSet(authorizationIDEAttribute, "2");
+
+    	authorizationDataObject1.eSet(fileEAttribute,"someOtherfile.text");
+    	authorizationDataObject1.eSet(writeEAttribute,Boolean.TRUE);
+    	authorizationDataObject1.eSet(readEAttribute,true);
+    	authorizationDataObject1.eSet(executeEAttribute,true);
+    	authorizationDataObject1.eSet(authorizationIDEAttribute, "3");
+    	
+    	EList userDataObjectAuthorizationList =
+    		new BasicEList();
+    	
+    	userDataObjectAuthorizationList.add(authorizationDataObject0);
+    	userDataObjectAuthorizationList.add(authorizationDataObject1);
+    	
+		userDataObject.eSet(
+				authorizationEReference, 
+				userDataObjectAuthorizationList);
+            
+        processedEClassifiers                   = 
+            new ArrayList<EClass>();
+        
+        EObjectClassCreator
+        eObjectClassCreator      =
+            new EObjectClassCreator();
+        
+        eObjectClassCreator.
+        create(
+            metaContext,
+            ecoreAttributeTypesContext,
+            ecoreObjectClassesContext,
+            userEClass, 
+            processedEClassifiers,
+            TUSCANY_SYNTAX_OID_VALUE );
+
+        eObjectClassCreator.
+        create(
+            metaContext,
+            ecoreAttributeTypesContext,
+            ecoreObjectClassesContext,
+            authorizationEClass, 
+            processedEClassifiers,
+            TUSCANY_SYNTAX_OID_VALUE );
+
+    	eDataGraph             =
+    		SDOFactory.eINSTANCE.createEDataGraph();
+    	   		
+    	eDataGraph.setERootObject(userDataObject);
+
+    	EDataGraphCreator.create(
+				eDataGraph,
+				containerContext);
+	}
+	    
+    public void testRead() throws NamingException
+    {
+    	eDataObjectContext                  = 
+    		(LdapContext) 
+    		containerContext.
+    		lookup(eDataObjectRDN);
+    	
+    	authorizationContainerContext =
+    		(LdapContext) 
+    		eDataObjectContext.
+    		lookup(eContainingFeatureRDN);
+
+
+    	EDataGraph eDataGraph            =
+    		(EDataGraph) 
+    		EDataGraphReader.read(
+				userEClass,  
+				"1", 
+				containerContext);
+    		
+    	EDataObject eDataObject          =
+    		(EDataObject) eDataGraph.getRootObject();
+
+    	assertEquals(eDataObject.eGet(userNameEAttribute), "ole");
+    	assertEquals(eDataObject.eGet(userPasswordEAttribute), "secret");
+    	assertEquals(eDataObject.eGet(userAgeEAttribute), 33);
+    	assertEquals(eDataObject.eGet(userHeightEAttribute), 6.11);
+    	assertEquals(eDataObject.eGet(userIsMaleEAttribute), true);
+    	
+    	EList<EDataObject> containmentList                 =
+    		(EList<EDataObject>) 
+    		eDataObject.eGet(authorizationEReference);
+    	
+    	assertEquals(containmentList.size(), 2);
+    	
+    	EDataObject containedEDataObject1                     =
+    		containmentList.get(0);
+    	
+    	assertEquals(
+    			containedEDataObject1.
+    			eGet(authorizationIDEAttribute), "2");
+    	assertEquals(
+    			containedEDataObject1.
+    			eGet(fileEAttribute), "somefile.text");
+    	assertEquals(
+    			containedEDataObject1.
+    			eGet(writeEAttribute), true);
+    	assertEquals(
+    			containedEDataObject1.
+    			eGet(readEAttribute), true);
+    	assertEquals(
+    			containedEDataObject1.
+    			eGet(executeEAttribute), true);
+
+    	EDataObject containedEDataObject2                     =
+    		containmentList.get(1);
+
+    	assertEquals(
+    			containedEDataObject2.
+    			eGet(authorizationIDEAttribute), "3");
+  }
+}
\ No newline at end of file

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/read/test/EDataObjectReaderTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/read/test/EDataObjectReaderTest.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/read/test/EDataObjectReaderTest.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/read/test/EDataObjectReaderTest.java Tue Jun 26 06:29:06 2007
@@ -0,0 +1,140 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.tuscany.das.ldap.emf.read.test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.naming.NamingException;
+import javax.naming.directory.Attributes;
+import javax.naming.ldap.LdapContext;
+
+import org.apache.tuscany.das.ldap.emf.create.EDataObjectCreator;
+import org.apache.tuscany.das.ldap.emf.read.EDataObjectReader;
+import org.apache.tuscany.das.ldap.prototype.setup.Prototype;
+import org.apache.tuscany.das.ldap.schema.embedded.setup.test.EcoreSchemaAndDASContextsSetup;
+import org.apache.tuscany.das.ldap.schema.emf.create.EObjectClassCreator;
+import org.apache.tuscany.das.ldap.schema.emf.destroy.EObjectClassDestroyer;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.sdo.EDataObject;
+
+public class EDataObjectReaderTest 
+extends EcoreSchemaAndDASContextsSetup
+implements Prototype
+{
+    protected static List<EClass> 
+    processedEClassifiers                                                  = null;
+    
+	protected static EDataObject userDataObject      = null;
+	
+	protected String eDataObjectRDN                          = null;
+	protected LdapContext namedContainerContext  = null;
+	
+	public void tearDown() throws NamingException, Exception
+	{
+		containerContext.destroySubcontext(eDataObjectRDN);
+		
+        EObjectClassDestroyer.
+            destroy(
+                metaContext,
+                ecoreAttributeTypesContext,
+                ecoreObjectClassesContext, 
+                userEClass, 
+                TUSCANY_SYNTAX_OID_VALUE );
+
+        super.tearDown();
+	}
+	
+	public void setUp() throws Exception
+	{
+		super.setUp();
+		
+        userEClass.
+        getEStructuralFeatures().
+        add( userNameEAttribute );
+        userEClass.
+        getEStructuralFeatures().
+        add( userPasswordEAttribute );
+        userEClass.
+        getEStructuralFeatures().
+        add( userAgeEAttribute );
+        userEClass.
+        getEStructuralFeatures().
+        add( userHeightEAttribute );
+        userEClass.
+        getEStructuralFeatures().
+        add( userIsMaleEAttribute );
+        userEClass.
+        getEStructuralFeatures().
+        add( userIDEAttribute );
+
+		userEPackage.
+		getEClassifiers().
+		add(userEClass);
+		
+    	userDataObject =
+    		(EDataObject) 
+    		userEFactory.create(userEClass);
+    	
+    	userDataObject.eSet(userNameEAttribute,"ole");
+    	userDataObject.eSet(userPasswordEAttribute,"secret");
+    	userDataObject.eSet(userIDEAttribute, "1");
+    	userDataObject.eSet(userAgeEAttribute, 33);
+    	userDataObject.eSet(userHeightEAttribute, 6.11);
+    	userDataObject.eSet(userIsMaleEAttribute, true);
+    	
+
+        processedEClassifiers                   = 
+            new ArrayList<EClass>();
+        
+        EObjectClassCreator
+        eObjectClassCreator      =
+            new EObjectClassCreator();
+        
+        eObjectClassCreator.
+        create(
+            metaContext,
+            ecoreAttributeTypesContext,
+            ecoreObjectClassesContext,
+            userEClass, 
+            processedEClassifiers,
+            TUSCANY_SYNTAX_OID_VALUE );
+        
+    	eDataObjectRDN                             = 
+    		EDataObjectCreator.create(
+    				userDataObject,
+    				containerContext);
+    }
+	
+    public void testRead() throws NamingException
+    {
+    	EDataObject eDataObject               =
+    		EDataObjectReader.read(
+    				userEClass,  
+    				"1", 
+    				containerContext);
+    	
+    	assertEquals(eDataObject.eGet(userNameEAttribute), "ole");
+    	assertEquals(eDataObject.eGet(userPasswordEAttribute), "secret");
+    	assertEquals(eDataObject.eGet(userAgeEAttribute), 33);
+    	assertEquals(eDataObject.eGet(userHeightEAttribute), 6.11);
+    	assertEquals(eDataObject.eGet(userIsMaleEAttribute), true);
+    }
+}
\ No newline at end of file

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/read/test/LearningTestTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/read/test/LearningTestTest.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/read/test/LearningTestTest.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/emf/read/test/LearningTestTest.java Tue Jun 26 06:29:06 2007
@@ -0,0 +1,109 @@
+/*
+ *  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.emf.read.test;
+
+import java.util.List;
+
+import javax.naming.NamingException;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.das.ldap.prototype.setup.Prototype;
+import org.eclipse.emf.common.util.BasicEList;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.sdo.EDataObject;
+
+public class LearningTestTest
+extends TestCase
+implements Prototype
+{
+	private EDataObject authorizationDataObject0 = null;
+	private EDataObject authorizationDataObject1 = null;
+	
+	private EDataObject userDataObject                  = null;
+		
+	public void setUp() throws Exception
+	{
+	    userEClass.
+        getEStructuralFeatures().
+        add( userNameEAttribute );
+        userEClass.
+        getEStructuralFeatures().
+        add( userIDEAttribute );
+        userEClass.
+        getEStructuralFeatures().
+        add( authorizationEReference );
+
+		userEPackage.getEClassifiers().add(userEClass);
+		
+    	userDataObject =
+    		(EDataObject) 
+    		userEFactory.create(userEClass);
+    	
+    	userDataObject.eSet(userIDEAttribute, "1");
+        
+		userEPackage.getEClassifiers().
+		add(authorizationEClass);
+
+		authorizationEClass.
+		getEStructuralFeatures().
+		add(authorizationIDEAttribute);
+		
+		authorizationEReference.setEType(authorizationEClass);
+		
+    	authorizationDataObject0  =
+    		(EDataObject) 
+    		userEFactory.create(authorizationEClass);
+    	
+    	authorizationDataObject1  =
+    		(EDataObject) 
+    		userEFactory.create(authorizationEClass);
+    	
+    	authorizationDataObject0.eSet(authorizationIDEAttribute, "2");
+
+    	authorizationDataObject1.eSet(authorizationIDEAttribute, "3");
+    	
+    	EList userDataObjectAuthorizationList =
+    		new BasicEList();
+    	
+    	userDataObjectAuthorizationList.add(authorizationDataObject0);
+    	userDataObjectAuthorizationList.add(authorizationDataObject1);
+    	
+		userDataObject.eSet(
+				authorizationEReference, 
+				userDataObjectAuthorizationList);
+	}
+	    
+    public void testLearning() throws NamingException
+    {
+    	List<EReference> eReferences = userEClass.getEAllContainments();
+    	for (EReference eReference : eReferences)
+    	{
+    		System.out.println(eReference);
+    		EClass type = (EClass) eReference.getEType();
+    		assertSame(type, authorizationEClass);
+    		System.out.println(type);
+    		System.out.println(type.getEIDAttribute());
+    	}
+
+    }
+}
\ No newline at end of file

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/learning/test/DASPartitionCleanerTest.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/DASPartitionCleanerTest.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/learning/test/DASPartitionCleanerTest.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/learning/test/DASPartitionCleanerTest.java Tue Jun 26 06:29:06 2007
@@ -0,0 +1,139 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.tuscany.das.ldap.learning.test;
+
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+
+import org.apache.tuscany.das.ldap.schema.embedded.setup.test.AbstractTestSetup;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EcoreFactory;
+
+public class DASPartitionCleanerTest
+extends AbstractTestSetup
+{
+    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 tearDown() 
+    throws NamingException, Exception
+    {
+        super.tearDown();
+    }
+    
+    public void testTemporaryCleanupMethod() throws NamingException
+    {
+        DirContext comContext      = null;
+        DirContext exampleContext  = null;
+        DirContext usersContext    = null;
+        DirContext accountsContext = null;
+        DirContext metaContext     = null;
+        DirContext parentContext   = null;
+        DirContext childContext    = null;
+
+        
+        comContext      = 
+            ( DirContext ) 
+            dasPartitionContext.lookup( "cn=com" );
+        assertNotNull(comContext);
+        
+        exampleContext  = 
+            ( DirContext )
+            comContext.lookup( "cn=example" );
+        assertNotNull(exampleContext);
+        
+        usersContext    = 
+            ( DirContext ) 
+            exampleContext.lookup( "cn=users" );
+        assertNotNull(usersContext);
+        
+        accountsContext = 
+            ( DirContext ) 
+            usersContext.lookup( "cn=accounts" );
+        assertNotNull(accountsContext);
+        
+        metaContext     = 
+            ( DirContext ) 
+            accountsContext.lookup( "cn=meta" );
+        assertNotNull(metaContext);
+        
+        
+       /*
+        parentContext              =
+            ( DirContext ) 
+            metaContext.
+            lookup( "cn=" + eClassL0.getName() );
+        assertNotNull(parentContext);
+        
+        
+        childContext               =  
+            ( DirContext ) 
+            parentContext.
+            lookup( "cn=" + eClassL1.getName() );
+        assertNotNull(childContext);
+        
+        
+
+        parentContext.
+        destroySubcontext( "cn=" + eClassL1.getName() );
+
+        metaContext.
+        destroySubcontext( "cn=" + eClassL0.getName() );
+*/
+        
+        
+        accountsContext.
+        destroySubcontext( "cn=meta" );
+               
+        usersContext.
+        destroySubcontext( "cn=accounts" );
+        
+        exampleContext.
+        destroySubcontext( "cn=users" );
+
+        comContext.
+        destroySubcontext( "cn=example" );
+
+        dasPartitionContext.
+        destroySubcontext( "cn=com" );
+    }
+}

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/learning/test/LearningTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/learning/test/LearningTest.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/learning/test/LearningTest.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/learning/test/LearningTest.java Tue Jun 26 06:29:06 2007
@@ -0,0 +1,54 @@
+package org.apache.tuscany.das.ldap.learning.test;
+
+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.SearchResult;
+import javax.naming.ldap.LdapContext;
+
+import org.apache.tuscany.das.ldap.schema.embedded.setup.test.AbstractTestSetup;
+
+public class LearningTest extends AbstractTestSetup {
+	
+	public void testSearch() throws NamingException
+	{
+		LdapContext contextL0 = 
+			(LdapContext) 
+			dasPartitionContext.createSubcontext("cn=L0");
+		
+		contextL0.createSubcontext("cn=L1");
+		
+		Attributes searchAttributes = 
+			new BasicAttributes(true); 
+		
+		searchAttributes.put(new BasicAttribute("cn"));
+		
+		NamingEnumeration answer = contextL0.search("", searchAttributes);
+		while (answer.hasMore()) {
+			
+		    SearchResult result = (SearchResult)answer.next();
+		    Attributes attributes = result.getAttributes();
+		    assertEquals("L1", attributes.get("cn").get().toString());
+		}
+		dasPartitionContext.destroySubcontext("cn=L1, cn=L0");
+		dasPartitionContext.destroySubcontext("cn=L0");
+	}
+
+	/*
+	public void testBoolean() throws NamingException
+	{
+		Attributes attributes = new BasicAttributes();
+		Attribute objectClassAttribute = new BasicAttribute("objectClass"); 
+		objectClassAttribute.add("top");
+		objectClassAttribute.add("metaTop");
+		objectClassAttribute.add("metaObjectClass");
+		attributes.put("m-oid", "0.9.2342.19200300.100.4.19.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1");
+		String rdn = "m-oid=0.9.2342.19200300.100.4.19.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1";
+		dasPartitionContext.createSubcontext(rdn, attributes);
+		dasPartitionContext.destroySubcontext(rdn);
+	}
+	*/
+}

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=550803
==============================================================================
--- 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 Tue Jun 26 06:29:06 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=550803
==============================================================================
--- 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 Tue Jun 26 06:29:06 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/prototype/setup/Prototype.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/prototype/setup/Prototype.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/prototype/setup/Prototype.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/prototype/setup/Prototype.java Tue Jun 26 06:29:06 2007
@@ -0,0 +1,54 @@
+package org.apache.tuscany.das.ldap.prototype.setup;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EFactory;
+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 interface Prototype {
+	EClass userEClass                               = 
+		PrototypeUtilities.createUserEClass();
+	EClass authorizationEClass                 = 
+		PrototypeUtilities.createAuthorizationEClass();
+	
+	EAttribute userNameEAttribute          = 
+		PrototypeUtilities.createUserNameEAttribute(); 
+	EAttribute userPasswordEAttribute    = 
+		PrototypeUtilities.createUserPasswordEAttribute();
+	EAttribute userIDEAttribute                =
+		PrototypeUtilities.createUserIDEAttribute();
+	EAttribute userAgeEAttribute                =
+		PrototypeUtilities.createUserAgeEAttribute();
+	EAttribute userHeightEAttribute                =
+		PrototypeUtilities.createUserHeightEAttribute();
+	EAttribute userIsMaleEAttribute                =
+		PrototypeUtilities.createUserIsMaleEAttribute();
+	
+	EAttribute fileEAttribute                     = 
+		PrototypeUtilities.createFileEAttribute();
+	EAttribute readEAttribute                   = 
+		PrototypeUtilities.createReadAuthorizationEAttribute();
+	EAttribute writeEAttribute                  = 
+		PrototypeUtilities.createWriteAuthorizationEAttribute();
+	EAttribute executeEAttribute             = 
+		PrototypeUtilities.createExecuteAuthorizationEAttribute();
+	EAttribute authorizationIDEAttribute = 
+		PrototypeUtilities.createAuthorizationIDEAttribute();
+	
+	EReference authorizationEReference = 
+		PrototypeUtilities.createAuthorizationEReference();
+	
+	EPackage  userEPackage                     = 
+		PrototypeUtilities.createUserEPackage();
+	
+	EFactory userEFactory                        =
+		userEPackage.getEFactoryInstance();
+	
+    EcoreFactory ecoreFactory                 = 
+    	EcoreFactory.eINSTANCE;
+    EcorePackage ecorePackage               = 
+    	EcorePackage.eINSTANCE;
+}

Added: directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/prototype/setup/PrototypeUtilities.java
URL: http://svn.apache.org/viewvc/directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/prototype/setup/PrototypeUtilities.java?view=auto&rev=550803
==============================================================================
--- directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/prototype/setup/PrototypeUtilities.java (added)
+++ directory/sandbox/oersoy/das.ldap.parent/das.ldap/src/test/java/org/apache/tuscany/das/ldap/prototype/setup/PrototypeUtilities.java Tue Jun 26 06:29:06 2007
@@ -0,0 +1,165 @@
+package org.apache.tuscany.das.ldap.prototype.setup;
+
+import org.apache.tuscany.das.ldap.testing.constants.DASTestingConstants;
+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.ETypedElement;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.sdo.impl.DynamicEDataObjectImpl;
+
+public class PrototypeUtilities 
+implements DASTestingConstants {
+	
+
+    public static EClass createUserEClass()
+    {
+        EClass userEClass                                     = 
+        	EcoreFactory.eINSTANCE.createEClass();
+        
+        userEClass.setName("User");
+        
+        return userEClass;
+    }
+    
+    public static EAttribute createUserIDEAttribute()
+    {
+        EAttribute id                         = 
+        	EcoreFactory.eINSTANCE.createEAttribute();
+        id.setName( "id" );
+        id.setEType( EcorePackage.eINSTANCE.getEString() );
+        id.setID(true);
+        return id;
+    }
+
+    public static EAttribute createAuthorizationIDEAttribute()
+    {
+        EAttribute id                         = 
+        	EcoreFactory.eINSTANCE.createEAttribute();
+        id.setName( "id" );
+        id.setEType( EcorePackage.eINSTANCE.getEString() );
+        id.setID(true);
+        return id;
+    }
+
+    public static EAttribute createUserNameEAttribute()
+    {
+        EAttribute userName                         = 
+        	EcoreFactory.eINSTANCE.createEAttribute();
+        userName.setName( "userName" );
+        userName.setEType( EcorePackage.eINSTANCE.getEString() );
+        return userName;
+    }
+
+    public static EAttribute createUserPasswordEAttribute()
+    {
+        EAttribute userPassword                    = 
+        	EcoreFactory.eINSTANCE.createEAttribute();
+        userPassword.setName( "userPassword" );
+        userPassword.setEType( EcorePackage.eINSTANCE.getEString() );
+        return userPassword;
+    }
+    
+    public static EAttribute createUserAgeEAttribute()
+    {
+        EAttribute userAge                         = 
+        	EcoreFactory.eINSTANCE.createEAttribute();
+        userAge.setName( "userAge" );
+        userAge.setEType( EcorePackage.eINSTANCE.getEInt() );
+        return userAge;
+    }
+
+    public static EAttribute createUserHeightEAttribute()
+    {
+        EAttribute userHeight                         = 
+        	EcoreFactory.eINSTANCE.createEAttribute();
+        userHeight.setName( "userHeight" );
+        userHeight.setEType( EcorePackage.eINSTANCE.getEDouble() );
+        return userHeight;
+    }
+
+    public static EAttribute createUserIsMaleEAttribute()
+    {
+        EAttribute isMale                         = 
+        	EcoreFactory.eINSTANCE.createEAttribute();
+        isMale.setName( "isMale" );
+        isMale.setEType( EcorePackage.eINSTANCE.getEBoolean() );
+        return isMale;
+    }
+
+    public static EPackage createUserEPackage()
+    {
+        EPackage userEPackage                     = 
+        	EcoreFactory.eINSTANCE.createEPackage();
+        userEPackage.setName( "userPackage" );
+        userEPackage.setNsPrefix( "user" );
+        userEPackage.setNsURI( xsdNamespace );
+        
+        userEPackage.setEFactoryInstance(
+            new DynamicEDataObjectImpl.FactoryImpl());
+        
+        return userEPackage;
+    }
+    
+    public static EClass createAuthorizationEClass()
+    {
+        EClass authorizationEClass         = 
+        	EcoreFactory.eINSTANCE.createEClass();
+        
+        authorizationEClass.setName("Authorization");
+
+        return authorizationEClass;
+    }
+    
+    public static EAttribute createFileEAttribute()
+    {
+        EAttribute fileNameEAttribute     = 
+        	EcoreFactory.eINSTANCE.createEAttribute();
+        fileNameEAttribute.setName( "fileName" );
+        fileNameEAttribute.setEType( EcorePackage.eINSTANCE.getEString() );
+        return fileNameEAttribute;
+        
+    }
+    
+    public static EAttribute createWriteAuthorizationEAttribute()
+    {
+        EAttribute writeAuthorizationEAttribute  = 
+        	EcoreFactory.eINSTANCE.createEAttribute();
+        writeAuthorizationEAttribute.setName( "writeAuthorization" );
+        writeAuthorizationEAttribute.setEType( EcorePackage.eINSTANCE.getEBoolean() );
+        return writeAuthorizationEAttribute;
+    }
+
+    public static EAttribute createReadAuthorizationEAttribute()
+    {
+        EAttribute readAuthorizationEAttribute  = 
+        	EcoreFactory.eINSTANCE.createEAttribute();
+        readAuthorizationEAttribute.setName( "readAuthorization" );
+        readAuthorizationEAttribute.setEType( EcorePackage.eINSTANCE.getEBoolean() );
+        return readAuthorizationEAttribute;
+    }
+
+    public static EAttribute createExecuteAuthorizationEAttribute()
+    {
+        EAttribute readExecuteEAttribute  = 
+        	EcoreFactory.eINSTANCE.createEAttribute();
+        readExecuteEAttribute.setName( "executeAuthorization" );
+        readExecuteEAttribute.setEType( EcorePackage.eINSTANCE.getEBoolean() );
+        return readExecuteEAttribute;
+    }
+
+    public static EReference createAuthorizationEReference()
+    {
+    	EReference authorizationEReference =
+    		EcoreFactory.eINSTANCE.createEReference();
+    	authorizationEReference.setLowerBound(0);
+    	authorizationEReference.setUpperBound(ETypedElement.UNBOUNDED_MULTIPLICITY);
+    	authorizationEReference.setContainment(true);
+    	authorizationEReference.setEType(createAuthorizationEClass());
+    	authorizationEReference.setName("authorizationList");
+    	
+    	return authorizationEReference;
+    }
+}

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=550803
==============================================================================
--- 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 Tue Jun 26 06:29:06 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=550803
==============================================================================
--- 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 Tue Jun 26 06:29:06 2007
@@ -0,0 +1,59 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.tuscany.das.ldap.schema.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=550803
==============================================================================
--- 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 Tue Jun 26 06:29:06 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=550803
==============================================================================
--- 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 Tue Jun 26 06:29:06 2007
@@ -0,0 +1,64 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.tuscany.das.ldap.schema.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=550803
==============================================================================
--- 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 Tue Jun 26 06:29:06 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=550803
==============================================================================
--- 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 Tue Jun 26 06:29:06 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=550803
==============================================================================
--- 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 Tue Jun 26 06:29:06 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=550803
==============================================================================
--- 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 Tue Jun 26 06:29:06 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



Mime
View raw message