You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ke...@apache.org on 2007/05/09 16:04:51 UTC

svn commit: r536535 [3/4] - in /incubator/tuscany/java/cts: sdo2.1-tuscany/src/main/java/test/sdo21/vendor/tuscany/dataObjectFactory/ sdo2.1-tuscany/src/main/java/test/sdo21/vendor/tuscany/testHelper/ sdo2.1/src/main/java/test/sdo21/ sdo2.1/src/main/ja...

Added: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/general/ContainmentCyclePreventionTest.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/general/ContainmentCyclePreventionTest.java?view=auto&rev=536535
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/general/ContainmentCyclePreventionTest.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/general/ContainmentCyclePreventionTest.java Wed May  9 07:04:49 2007
@@ -0,0 +1,439 @@
+/*
+ *  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 test.sdo21.paramatizedTests.general;
+
+import static org.junit.Assert.fail;
+import static org.junit.Assert.assertTrue;
+import commonj.sdo.DataObject;
+import commonj.sdo.Sequence;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import test.sdo21.framework.DataObjectFactory;
+import test.sdo21.paramatizedTests.BaseSDOParamatizedTest;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Tests prevdention of containment cycles.  Each test passes if the method call that
+ * would result in a containment cycle throws an IllegalArgumentException and does
+ * not allow the formation of containment cycle.  There is a test case for 
+ * each of the various mechanisms through which a containment cycle may be created.  
+ * 
+ * The same test is run for a static model (Type created using XSD2JavaGenerator), a
+ * dynamic model (Type created using TypeHelper), and a 'mixed' model (Type created
+ * using XSDHelper - dynamic Type creation using static resources).  
+ */
+@RunWith(Parameterized.class)
+public class ContainmentCyclePreventionTest extends BaseSDOParamatizedTest {    
+    
+    public ContainmentCyclePreventionTest(DataObjectFactory factory, String description) 
+    {
+        super(factory, description);
+    }
+    
+    /**
+     * Attempt to create a 1-Member Containment Cycle using set____ on a single valued property
+     * and verify the behavior of the method.  
+     */
+	@Test
+    public void oneMemberSingleValueSetDataObject() {        
+        DataObject dataObj1 = factory.createTestAPIObject();     
+        
+        setSingleValueOneMember(dataObj1);
+    }
+    
+    /**
+     * Attempt to create an n-Member Containment Cycle using set____ on a single valued property
+     * and verify the behavior of the method.  
+     */
+	@Test
+    public void nMemberSingleValueSetDataObject() {
+        DataObject dataObj1 = factory.createTestAPIObject();
+        DataObject dataObj2 = factory.createTestAPIObject();
+        DataObject dataObj3 = factory.createTestAPIObject();
+        
+        setSingleValueNMember(dataObj1, dataObj2, dataObj3);
+    }
+    
+    /**
+     * Attempt to create a 1-Member Containment Cycle using set____ on a multi valued property
+     * and verify the behavior of the method.  
+     */
+	@Test
+    public void oneMemberMultiValueSetDataObject() {
+        DataObject dataObj1 = factory.createTestAPIObject();
+        DataObject dataObj2 = factory.createTestAPIObject();
+        DataObject dataObj3 = factory.createTestAPIObject();
+        
+        setMultiValueOneMember(dataObj1, dataObj2, dataObj3);
+    }
+    
+    /**
+     * Attempt to create an n-Member Containment Cycle using set____ on a multi valued property
+     * and verify the behavior of the method.  
+     */
+	@Test
+    public void nMemberMultiValueSetDataObject() {
+        DataObject dataObj1 = factory.createTestAPIObject();
+        DataObject dataObj2 = factory.createTestAPIObject();
+        DataObject dataObj3 = factory.createTestAPIObject();
+        
+        setManyValueNMember(dataObj1, dataObj2, dataObj3);
+    }
+    
+    /**
+     * Attempt to create a 1-Member Containment Cycle by making updates to a List returned
+     * from the DataObject and verify the behavior of the method.  This is the static version 
+     * of this test case.
+     */
+	@Test
+    public void oneMemberReturnedList() {
+        DataObject dataObj1 = factory.createTestAPIObject();
+        
+        returnedListOneMember(dataObj1);
+    }
+    
+    /**
+     * Attempt to create an n-Member Containment Cycle by making updates to a List returned
+     * from the DataObject and verify the behavior of the method.  This is the static version 
+     * of this test case.
+     */
+	@Test
+    public void nMemberReturnedList() {
+        DataObject dataObj1 = factory.createTestAPIObject();
+        DataObject dataObj2 = factory.createTestAPIObject();
+        DataObject dataObj3 = factory.createTestAPIObject();
+        
+        returnedListNMember(dataObj1, dataObj2, dataObj3);
+    }
+    
+    /**
+     * Attempt to create a 1-Member Containment Cycle using by using a Sequence to make updates
+     * to the DataObject, affecting a single valued property, and verify the behavior of 
+     * the method.  
+     */
+	@Test
+    public void oneMemberSingleValueSequence() {
+        DataObject dataObj1 = factory.createSequencedObject();
+        
+        sequenceSingleValueOneMember(dataObj1);
+    }
+    
+    /**
+     * Attempt to create an n-Member Containment Cycle using by using a Sequence to make updates
+     * to the DataObject, affecting a single valued property, and verify the behavior of 
+     * the method.  
+     */
+	@Test
+    public void nMemberSingleValueSequence() {
+        DataObject dataObj1 = factory.createSequencedObject();
+        DataObject dataObj2 = factory.createSequencedObject();
+        DataObject dataObj3 = factory.createSequencedObject();
+        
+        sequenceSingleValueNMember(dataObj1, dataObj2, dataObj3);
+    }
+    
+    /**
+     * Attempt to create a 1-Member Containment Cycle using by using a Sequence to make updates
+     * to the DataObject, affecting a multi valued property, and verify the behavior of 
+     * the method.  
+     */
+	@Test
+    public void oneMemberMultiValueSequence() {
+        DataObject dataObj1 = factory.createSequencedObject();
+        DataObject dataObj2 = factory.createSequencedObject();
+        DataObject dataObj3 = factory.createSequencedObject();
+        
+        sequenceMultiValueOneMember(dataObj1, dataObj2, dataObj3);
+    }
+    
+    /**
+     * Attempt to create an n-Member Containment Cycle using by using a Sequence to make updates
+     * to the DataObject, affecting a multi valued property, and verify the behavior of 
+     * the method.  
+     */
+	@Test
+    public void nMemberMultiValueSequence() {
+        DataObject dataObj1 = factory.createSequencedObject();
+        DataObject dataObj2 = factory.createSequencedObject();
+        DataObject dataObj3 = factory.createSequencedObject();
+        
+        sequenceManyValueNMember(dataObj1, dataObj2, dataObj3);
+    }
+
+    /**
+     * Returns true if input DataObject root is part of a containment cycle, 
+     * false otherwise.
+     * @param root
+     * @return
+     */
+    private static boolean containmentCycleExists (DataObject root)
+    {
+        DataObject curr = root.getContainer();
+        
+        while (curr != null)
+        {
+            if (curr == root)
+                return true;
+            
+            curr = curr.getContainer();
+        }
+        return false;
+    }
+
+    /**
+     * Use setDataObject to create a one member containment cycle.  
+     * @param dataObj1
+     */
+    private void setSingleValueOneMember(DataObject dataObj1) {
+    	try {
+            dataObj1.setDataObject("contain", dataObj1);
+
+            if (containmentCycleExists(dataObj1))
+            	fail("Attempting to create a containment cycle should result in an Exception.");
+            else
+            	fail("Containment cycle was neither created nor prevented.");
+    	} catch (Exception e) {
+    		// do nothing - success
+    	}
+    }
+    
+    /**
+     * Use setDataObject to create an N-member containment cycle.
+     * @param dataObj1
+     * @param dataObj2
+     * @param dataobj3
+     */
+    private void setSingleValueNMember(DataObject dataObj1, DataObject dataObj2, DataObject dataObj3) {
+        dataObj1.setDataObject("contain", dataObj2);
+        dataObj2.setDataObject("contain", dataObj3);
+        
+    	try {
+    		dataObj3.setDataObject("contain", dataObj1);
+            if (containmentCycleExists(dataObj1))
+            	fail("Attempting to create a containment cycle should result in an Exception.");
+            else
+            	fail("Containment cycle was neither created nor prevented.");
+    	} catch (Exception e) {
+    		// do nothing - success
+    	}
+    }
+
+    /**
+     * Use setList to create a one member containment cycle. 
+     * @param dataObj1
+     * @param dataObj2
+     * @param dataObj3
+     */
+    private void setMultiValueOneMember(DataObject dataObj1, DataObject dataObj2, DataObject dataObj3) {
+        List addList = new ArrayList();
+        addList.add(dataObj2);
+        addList.add(dataObj1);
+        addList.add(dataObj3);
+        
+    	try {
+    		dataObj1.setList("containMany", addList);
+            if (containmentCycleExists(dataObj1))
+            	fail("Attempting to create a containment cycle should result in an Exception.");
+            else
+            	fail("Containment cycle was neither created nor prevented.");
+    	} catch (Exception e) {
+    		// do nothing - success
+    	}
+    }
+
+    /**
+     * Use setList to create an N-member containment cycle. 
+     * @param dataObj1
+     * @param dataObj2
+     * @param dataObj3
+     */
+    private void setManyValueNMember(DataObject dataObj1, DataObject dataObj2, DataObject dataObj3) {
+        List addList = new ArrayList();
+        
+        dataObj1.setDataObject("contain", dataObj2);
+        dataObj2.setDataObject("contain", dataObj3);
+        addList.add(dataObj1);
+        
+    	try {
+    		dataObj3.setList("containMany", addList);
+            if (containmentCycleExists(dataObj1))
+            	fail("Attempting to create a containment cycle should result in an Exception.");
+            else
+            	fail("Containment cycle was neither created nor prevented.");
+    	} catch (Exception e) {
+    		// do nothing - success
+    	}
+    }
+
+    /**
+     * Create a 1-member containment cycle by making updates to a returned List.  
+     * @param dataObj1
+     */
+    private void returnedListOneMember(DataObject dataObj1) {
+        List returnedList = dataObj1.getList("containMany");
+
+    	try {
+            returnedList.add(dataObj1);
+            if (containmentCycleExists(dataObj1))
+            	fail("Attempting to create a containment cycle should result in an Exception.");
+            else
+            	fail("Containment cycle was neither created nor prevented.");
+    	} catch (Exception e) {
+    		// do nothing - success
+    	}
+    }
+    
+    /**
+     * Create an n-member containment cycle by making updates to a returned List.  
+     * @param dataObj1
+     * @param dataObj2
+     * @param dataobj3
+     */
+    private void returnedListNMember(DataObject dataObj1, DataObject dataObj2, DataObject dataObj3) {
+        dataObj1.setDataObject("contain", dataObj2);
+        dataObj2.setDataObject("contain", dataObj3);
+        
+        List returnedList = dataObj3.getList("containMany");
+     
+    	try {
+    		   returnedList.add(dataObj1);
+            if (containmentCycleExists(dataObj1))
+            	fail("Attempting to create a containment cycle should result in an Exception.");
+            else
+            	fail("Containment cycle was neither created nor prevented.");
+    	} catch (Exception e) {
+    		// do nothing - success
+    	}
+    }
+
+    /**
+     * Create a 1-member containment cycle by making updates to a Sequence.  
+     * The data member in this case is single valued.
+     * @param dataObj1
+     * @param dataObj2
+     * @param dataObj3
+     */
+    private void sequenceSingleValueOneMember(DataObject dataObj1) {
+        assertTrue("DataObject is not Sequenced.  Test case may not proceed.", dataObj1.getType().isSequenced());
+        
+        Sequence sequence = dataObj1.getSequence();
+
+    	try {
+    		sequence.add("contain", dataObj1);
+           if (containmentCycleExists(dataObj1))
+            	fail("Attempting to create a containment cycle should result in an Exception.");
+           else
+            	fail("Containment cycle was neither created nor prevented.");
+ 	    } catch (Exception e) {
+ 		    // do nothing - success
+ 	    }
+        
+    }
+    
+    /**
+     * Create an n-member containment cycle by making updates to a Sequence.  
+     * The data member in this case is single valued.
+     * @param dataObj1
+     * @param dataObj2
+     * @param dataObj3
+     */
+    private void sequenceSingleValueNMember(DataObject dataObj1, DataObject dataObj2, DataObject dataObj3) {
+        assertTrue("DataObject is not Sequenced.  Test case may not proceed.", dataObj1.getType().isSequenced());
+
+        Sequence sequence1 = dataObj1.getSequence();
+        Sequence sequence2 = dataObj2.getSequence();
+        Sequence sequence3 = dataObj3.getSequence();
+
+        sequence1.add("contain", (Object) dataObj2);
+        sequence2.add("contain", (Object) dataObj3);
+
+       
+    	try {
+    	   sequence3.add("contain", (Object) dataObj1);
+           if (containmentCycleExists(dataObj1))
+            	fail("Attempting to create a containment cycle should result in an Exception.");
+           else
+            	fail("Containment cycle was neither created nor prevented.");
+ 	    } catch (Exception e) {
+ 		    // do nothing - success
+ 	    }
+    }
+
+    /**
+     * Create a 1-member containment cycle by making updates to a Sequence.  
+     * The data member in this case is many valued.
+     * @param dataObj1
+     * @param dataObj2
+     * @param dataObj3
+     */
+    private void sequenceMultiValueOneMember(DataObject dataObj1, DataObject dataObj2, DataObject dataObj3) {
+        assertTrue("DataObject is not Sequenced.  Test case may not proceed.", dataObj1.getType().isSequenced());
+
+        Sequence sequence = dataObj1.getSequence();
+        
+        sequence.add("containMany", dataObj2);
+        sequence.add("containMany", dataObj3);
+        
+    	try {
+    		sequence.add("containMany", dataObj1);
+            if (containmentCycleExists(dataObj1))
+             	fail("Attempting to create a containment cycle should result in an Exception.");
+            else
+             	fail("Containment cycle was neither created nor prevented.");
+  	    } catch (Exception e) {
+  		    // do nothing - success
+  	    }
+    }
+    
+    /**
+     * Create an n-member containment cycle by making updates to a Sequence.  
+     * The data member in this case is many valued.
+     * @param dataObj1
+     * @param dataObj2
+     * @param dataObj3
+     */
+    private void sequenceManyValueNMember(DataObject dataObj1, DataObject dataObj2, DataObject dataObj3) {
+        assertTrue("DataObject is not Sequenced.  Test case may not proceed.", dataObj1.getType().isSequenced());
+
+        List addList = new ArrayList();
+        
+        addList.add(dataObj2);
+        dataObj1.setList("containMany", addList);
+        
+        addList.clear();
+        addList.add(dataObj3);
+        dataObj2.setList("containMany", addList);
+
+        Sequence sequence = dataObj3.getSequence();
+
+    	try {
+    		sequence.add("containMany", dataObj1);
+            if (containmentCycleExists(dataObj1))
+             	fail("Attempting to create a containment cycle should result in an Exception.");
+            else
+             	fail("Containment cycle was neither created nor prevented.");
+  	    } catch (Exception e) {
+  		    // do nothing - success
+  	    }
+    }
+}

Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/general/ContainmentCyclePreventionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/general/ContainmentCyclePreventionTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/general/ContainmentCycleSerializationTest.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/general/ContainmentCycleSerializationTest.java?view=auto&rev=536535
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/general/ContainmentCycleSerializationTest.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/general/ContainmentCycleSerializationTest.java Wed May  9 07:04:49 2007
@@ -0,0 +1,458 @@
+/*
+ *  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 test.sdo21.paramatizedTests.general;
+
+import static org.junit.Assert.fail;
+import static org.junit.Assert.assertTrue;
+import commonj.sdo.DataObject;
+import commonj.sdo.Sequence;
+import commonj.sdo.helper.HelperContext;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import test.sdo21.framework.DataObjectFactory;
+import test.sdo21.paramatizedTests.BaseSDOParamatizedTest;
+import test.sdo21.paramatizedTests.util.ParamatizedTestUtil;
+
+import java.io.ByteArrayOutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Tests serialization of containment cycles.  Each test passes if the serialization does
+ * not generate output representing the containment cycle.  There is a test case for 
+ * each of the various mechanisms through which a containment cycle may be created and serialized.  
+ * 
+ * The same test is run for a static model (Type created using XSD2JavaGenerator), a
+ * dynamic model (Type created using TypeHelper), and a 'mixed' model (Type created
+ * using XSDHelper - dynamic Type creation using static resources).  
+ * 
+ * Note also that Java serialization of a containment cycle should result in an IllegalStateException, 
+ * while XMLHelper and XMLStreamHelper serialization should successfully serialize the DataObject
+ * absent the containment cycle.
+ */
+@RunWith(Parameterized.class)
+public class ContainmentCycleSerializationTest extends BaseSDOParamatizedTest {    
+
+    private static HelperContext helperContext;
+    
+    public ContainmentCycleSerializationTest(DataObjectFactory factory, String description) 
+    {
+        super(factory, description);
+        helperContext = factory.getHelperContext();
+    }
+    
+    /**
+     * Attempt to create a 1-Member Containment Cycle using set____ on a single valued property
+     * and verify the behavior of serialization.  
+     */
+    @Test
+    public void oneMemberSingleValueSetDataObject() {        
+        DataObject dataObj1 = factory.createTestAPIObject();           
+        setSingleValueOneMember(dataObj1);
+        attemptSerialization(dataObj1, helperContext);
+    }
+    
+    /**
+     * Attempt to create an n-Member Containment Cycle using set____ on a single valued property
+     * and verify the behavior of serialization.  
+     */
+    @Test
+    public void nMemberSingleValueSetDataObject() {
+        DataObject dataObj1 = factory.createTestAPIObject();
+        DataObject dataObj2 = factory.createTestAPIObject();
+        DataObject dataObj3 = factory.createTestAPIObject();
+        
+        setSingleValueNMember(dataObj1, dataObj2, dataObj3);
+        attemptSerialization(dataObj1, helperContext);
+    }
+    
+    /**
+     * Attempt to create a 1-Member Containment Cycle using set____ on a multi valued property
+     * and verify the behavior of serialization.  
+     */
+    @Test
+    public void oneMemberMultiValueSetDataObject() {
+        DataObject dataObj1 = factory.createTestAPIObject();
+        DataObject dataObj2 = factory.createTestAPIObject();
+        DataObject dataObj3 = factory.createTestAPIObject();
+        
+        setMultiValueOneMember(dataObj1, dataObj2, dataObj3);
+        attemptSerialization(dataObj1, helperContext);
+    }
+    
+    /**
+     * Attempt to create an n-Member Containment Cycle using set____ on a multi valued property
+     * and verify the behavior of serialization.  
+     */
+    @Test
+    public void nMemberMultiValueSetDataObject() {
+        DataObject dataObj1 = factory.createTestAPIObject();
+        DataObject dataObj2 = factory.createTestAPIObject();
+        DataObject dataObj3 = factory.createTestAPIObject();
+        
+        setManyValueNMember(dataObj1, dataObj2, dataObj3);
+        attemptSerialization(dataObj1, helperContext);
+    }
+    
+    /**
+     * Attempt to create a 1-Member Containment Cycle by making updates to a List returned
+     * from the DataObject and verify the behavior of serialization.  This is the static version 
+     * of this test case.
+     */
+    @Test
+    public void oneMemberReturnedList() {
+        DataObject dataObj1 = factory.createTestAPIObject();
+        
+        returnedListOneMember(dataObj1);
+        attemptSerialization(dataObj1, helperContext);
+    }
+    
+    /**
+     * Attempt to create an n-Member Containment Cycle by making updates to a List returned
+     * from the DataObject and verify the behavior of serialization.  This is the static version 
+     * of this test case.
+     */
+    @Test
+    public void nMemberReturnedList() {
+        DataObject dataObj1 = factory.createTestAPIObject();
+        DataObject dataObj2 = factory.createTestAPIObject();
+        DataObject dataObj3 = factory.createTestAPIObject();
+        
+        returnedListNMember(dataObj1, dataObj2, dataObj3);
+        attemptSerialization(dataObj1, helperContext);
+    }
+    
+    /**
+     * Attempt to create a 1-Member Containment Cycle using by using a Sequence to make updates
+     * to the DataObject, affecting a single valued property, and verify the behavior of 
+     * serialization.  
+     */
+    @Test
+    public void oneMemberSingleValueSequence() {
+        DataObject dataObj1 = factory.createSequencedObject();
+        
+        sequenceSingleValueOneMember(dataObj1);
+        attemptSerialization(dataObj1, helperContext);
+    }
+    
+    /**
+     * Attempt to create an n-Member Containment Cycle using by using a Sequence to make updates
+     * to the DataObject, affecting a single valued property, and verify the behavior of 
+     * serialization.  
+     */
+     @Test
+    public void nMemberSingleValueSequence() {
+        DataObject dataObj1 = factory.createSequencedObject();
+        DataObject dataObj2 = factory.createSequencedObject();
+        DataObject dataObj3 = factory.createSequencedObject();
+        
+        sequenceSingleValueNMember(dataObj1, dataObj2, dataObj3);
+        attemptSerialization(dataObj1, helperContext);
+    }
+    
+    /**
+     * Attempt to create a 1-Member Containment Cycle using by using a Sequence to make updates
+     * to the DataObject, affecting a multi valued property, and verify the behavior of 
+     * serialization.  
+     */
+    @Test
+    public void oneMemberMultiValueSequence() {
+        DataObject dataObj1 = factory.createSequencedObject();
+        DataObject dataObj2 = factory.createSequencedObject();
+        DataObject dataObj3 = factory.createSequencedObject();
+        
+        sequenceMultiValueOneMember(dataObj1, dataObj2, dataObj3);
+        attemptSerialization(dataObj1, helperContext);
+    }
+    
+    /**
+     * Attempt to create an n-Member Containment Cycle using by using a Sequence to make updates
+     * to the DataObject, affecting a multi valued property, and verify the behavior of 
+     * serialization.  
+     */
+     @Test
+    public void nMemberMultiValueSequence() {
+        DataObject dataObj1 = factory.createSequencedObject();
+        DataObject dataObj2 = factory.createSequencedObject();
+        DataObject dataObj3 = factory.createSequencedObject();
+        
+        sequenceManyValueNMember(dataObj1, dataObj2, dataObj3);
+        attemptSerialization(dataObj1, helperContext);
+    }
+
+    /** 
+     * Attempt to serialize the DataObject in via XML, XMLStreamHelper,
+     * and Java serialization.
+     * @param dataObj
+     */
+    private void attemptSerialization(DataObject dataObj, HelperContext scope) {    
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        
+        assertTrue("Containment cycle was not established.", 
+                containmentCycleExists(dataObj));   
+        try {
+            ParamatizedTestUtil.serializeDataObjectXML(dataObj, baos, scope);
+        } catch (Exception e) {
+            fail("XML serialization of a containment cycle resulted in a(n) " + e.getClass().getName() + ".");
+            e.printStackTrace();
+        }
+         
+        assertTrue("Containment cycle was affected by XMLHelper serialization.", 
+                containmentCycleExists(dataObj));
+  
+        try {
+             ParamatizedTestUtil.serializeDataObjectJava(dataObj, baos, scope); 
+             fail("Java serialization of a containment cycle should result in an IllegalStateException."); 
+        } catch (Exception e) {
+            // Do nothing.  An Exception is expected in this case.
+        }
+ 
+        assertTrue("Containment cycle was affected by Java serialization.", 
+                containmentCycleExists(dataObj));
+
+        // try {
+        //     ParamatizedTestUtil.serializeDataObjectStream(dataObj, baos, scope);    
+       //  } catch (Exception e) {
+       //        fail("XMLStreamHelper serialization of a containment cycle resulted in a(n) " + e.getClass().getName() + ".");
+       //     e.printStackTrace();
+       // }
+
+       // assertTrue("Containment cycle was affected by XMLStreamHelper serialization.", 
+       //         containmentCycleExists(dataObj));  
+    }
+
+    /**
+     * Returns true if input DataObject root is part of a containment cycle, 
+     * false otherwise.
+     * @param root
+     * @return
+     */
+    private static boolean containmentCycleExists (DataObject root)
+    {
+        DataObject curr = root.getContainer();
+        
+        while (curr != null)
+        {
+            if (curr == root)
+                return true;
+            
+            curr = curr.getContainer();
+        }
+        return false;
+    }
+
+    /**
+     * Use setDataObject to create a one member containment cycle.  
+     * @param dataObj1
+     */
+    private void setSingleValueOneMember(DataObject dataObj1) {
+        try {
+            dataObj1.setDataObject("contain", dataObj1);
+        } catch (Exception e) {
+            // do nothing - success
+        }
+    }
+    
+    /**
+     * Use setDataObject to create an N-member containment cycle.
+     * @param dataObj1
+     * @param dataObj2
+     * @param dataobj3
+     */
+    private void setSingleValueNMember(DataObject dataObj1, DataObject dataObj2, DataObject dataObj3) {
+        dataObj1.setDataObject("contain", dataObj2);
+        dataObj2.setDataObject("contain", dataObj3);
+        
+        try {
+            dataObj3.setDataObject("contain", dataObj1);
+        } catch (Exception e) {
+            // do nothing - success
+        }
+    }
+
+    /**
+     * Use setList to create a one member containment cycle. 
+     * @param dataObj1
+     * @param dataObj2
+     * @param dataObj3
+     */
+    private void setMultiValueOneMember(DataObject dataObj1, DataObject dataObj2, DataObject dataObj3) {
+        List addList = new ArrayList();
+        addList.add(dataObj2);
+        addList.add(dataObj1);
+        addList.add(dataObj3);
+        
+        try {
+            dataObj1.setList("containMany", addList);
+        } catch (Exception e) {
+            // do nothing - success
+        }
+    }
+
+    /**
+     * Use setList to create an N-member containment cycle. 
+     * @param dataObj1
+     * @param dataObj2
+     * @param dataObj3
+     */
+    private void setManyValueNMember(DataObject dataObj1, DataObject dataObj2, DataObject dataObj3) {
+        List addList = new ArrayList();
+        
+        dataObj1.setDataObject("contain", dataObj2);
+        dataObj2.setDataObject("contain", dataObj3);
+        addList.add(dataObj1);
+        
+        try {
+            dataObj3.setList("containMany", addList);
+        } catch (Exception e) {
+            // do nothing - success
+        }
+    }
+
+    /**
+     * Create a 1-member containment cycle by making updates to a returned List.  
+     * @param dataObj1
+     */
+    private void returnedListOneMember(DataObject dataObj1) {
+        List returnedList = dataObj1.getList("containMany");
+
+        try {
+            returnedList.add(dataObj1);
+        } catch (Exception e) {
+            // do nothing - success
+        }
+    }
+    
+    /**
+     * Create an n-member containment cycle by making updates to a returned List.  
+     * @param dataObj1
+     * @param dataObj2
+     * @param dataobj3
+     */
+    private void returnedListNMember(DataObject dataObj1, DataObject dataObj2, DataObject dataObj3) {
+        dataObj1.setDataObject("contain", dataObj2);
+        dataObj2.setDataObject("contain", dataObj3);
+        
+        List returnedList = dataObj3.getList("containMany");
+     
+        try {
+               returnedList.add(dataObj1);
+         } catch (Exception e) {
+            // do nothing - success
+        }
+    }
+
+    /**
+     * Create a 1-member containment cycle by making updates to a Sequence.  
+     * The data member in this case is single valued.
+     * @param dataObj1
+     * @param dataObj2
+     * @param dataObj3
+     */
+    private void sequenceSingleValueOneMember(DataObject dataObj1) {
+        assertTrue("DataObject is not Sequenced.  Test case may not proceed.", dataObj1.getType().isSequenced());
+        
+        Sequence sequence = dataObj1.getSequence();
+
+        try {
+            sequence.add("contain", dataObj1);
+         } catch (Exception e) {
+             // do nothing - success
+         }
+        
+    }
+    
+    /**
+     * Create an n-member containment cycle by making updates to a Sequence.  
+     * The data member in this case is single valued.
+     * @param dataObj1
+     * @param dataObj2
+     * @param dataObj3
+     */
+    private void sequenceSingleValueNMember(DataObject dataObj1, DataObject dataObj2, DataObject dataObj3) {
+        assertTrue("DataObject is not Sequenced.  Test case may not proceed.", dataObj1.getType().isSequenced());
+
+        Sequence sequence1 = dataObj1.getSequence();
+        Sequence sequence2 = dataObj2.getSequence();
+        Sequence sequence3 = dataObj3.getSequence();
+
+        sequence1.add("contain", (Object) dataObj2);
+        sequence2.add("contain", (Object) dataObj3);
+
+       
+        try {
+           sequence3.add("contain", (Object) dataObj1);
+         } catch (Exception e) {
+             // do nothing - success
+         }
+    }
+
+    /**
+     * Create a 1-member containment cycle by making updates to a Sequence.  
+     * The data member in this case is many valued.
+     * @param dataObj1
+     * @param dataObj2
+     * @param dataObj3
+     */
+    private void sequenceMultiValueOneMember(DataObject dataObj1, DataObject dataObj2, DataObject dataObj3) {
+        assertTrue("DataObject is not Sequenced.  Test case may not proceed.", dataObj1.getType().isSequenced());
+
+        Sequence sequence = dataObj1.getSequence();
+        
+        sequence.add("containMany", dataObj2);
+        sequence.add("containMany", dataObj3);
+        
+        try {
+            sequence.add("containMany", dataObj1);
+          } catch (Exception e) {
+              // do nothing - success
+          }
+    }
+    
+    /**
+     * Create an n-member containment cycle by making updates to a Sequence.  
+     * The data member in this case is many valued.
+     * @param dataObj1
+     * @param dataObj2
+     * @param dataObj3
+     */
+    private void sequenceManyValueNMember(DataObject dataObj1, DataObject dataObj2, DataObject dataObj3) {
+        assertTrue("DataObject is not Sequenced.  Test case may not proceed.", dataObj1.getType().isSequenced());
+
+        List addList = new ArrayList();
+        
+        addList.add(dataObj2);
+        dataObj1.setList("containMany", addList);
+        
+        addList.clear();
+        addList.add(dataObj3);
+        dataObj2.setList("containMany", addList);
+
+        Sequence sequence = dataObj3.getSequence();
+
+        try {
+            sequence.add("containMany", dataObj1);
+          } catch (Exception e) {
+              // do nothing - success
+          }
+    }
+}

Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/general/ContainmentCycleSerializationTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/general/ContainmentCycleSerializationTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/general/ContainmentTest.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/general/ContainmentTest.java?view=diff&rev=536535&r1=536534&r2=536535
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/general/ContainmentTest.java (original)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/general/ContainmentTest.java Wed May  9 07:04:49 2007
@@ -28,17 +28,18 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import org.junit.Before;
 import org.junit.Test;
+import org.junit.Before;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 
-import test.sdo21.framework.ParamaterizedTestBase;
-import test.sdo21.framework.ParameterFactory;
+import test.sdo21.framework.DataObjectFactory;
+import test.sdo21.paramatizedTests.BaseSDOParamatizedTest;
 
 import commonj.sdo.DataObject;
 import commonj.sdo.Property;
 import commonj.sdo.Type;
+import commonj.sdo.helper.HelperContext;
 
 /**
  * Junit 4.1 test case. ContainmentTest insures that containment alterations are
@@ -47,16 +48,18 @@
  * 
  */
 @RunWith(Parameterized.class)
-public class ContainmentTest extends ParamaterizedTestBase {
-    public ContainmentTest(ParameterFactory pf) {
-        super(pf);
+public class ContainmentTest extends BaseSDOParamatizedTest {
+	private DataObject testDO;
+	private HelperContext helperContext;
+	
+    public ContainmentTest(DataObjectFactory factory, String description) {
+        super(factory, description);
     }
-    
+
     @Before
-    public void setUp() throws Exception {
-      super.setUp();
-      List addList = new ArrayList();
-      testDO.setList("children", addList);
+    public void setUp () {
+    	testDO = factory.createTestAPIObject();
+    	helperContext = factory.getHelperContext();
     }
 
     /**
@@ -65,7 +68,7 @@
      */
     @Test
     public void verifyIsContainment() {
-        Property containmentProp = testDO.getInstanceProperty("children");
+        Property containmentProp = testDO.getInstanceProperty("containMany");
         assertTrue("Property.isContainment() returned an unexpected value.", containmentProp.isContainment());
     }
 
@@ -95,10 +98,17 @@
     public void verifyGetContainer() {
         List addList = new ArrayList();
         Type type = testDO.getType();
-        Property containmentProp = testDO.getInstanceProperty("children");
+        Property containmentProp = testDO.getInstanceProperty("containMany");
+
+        DataObject dataObj1 = helperContext.getDataFactory().create(type);
+        DataObject dataObj2 = helperContext.getDataFactory().create(type);
 
-        DataObject dataObj1 = getScope().getDataFactory().create(type);
-        DataObject dataObj2 = getScope().getDataFactory().create(type);
+        // Ensure that any previous containment relationships are broken.
+
+        addList.clear();
+        testDO.setList("containMany", addList);
+        testDO.detach();
+        addList.clear();
 
         addList.add(dataObj1);
         addList.add(dataObj2);
@@ -119,11 +129,11 @@
      */
     @Test
     public void verifyGetContainmentProperty() {
-        Property containmentProp = testDO.getInstanceProperty("children");
+        Property containmentProp = testDO.getInstanceProperty("containMany");
         List addList = new ArrayList();
         Type type = testDO.getType();
-        DataObject dataObj1 = getScope().getDataFactory().create(type);
-        DataObject dataObj2 = getScope().getDataFactory().create(type);
+        DataObject dataObj1 = helperContext.getDataFactory().create(type);
+        DataObject dataObj2 = helperContext.getDataFactory().create(type);
 
         addList.add(dataObj1);
         addList.add(dataObj2);
@@ -145,13 +155,13 @@
     @Test
     public void verifyContainmentContents() {
         assertNull("testDO container !=  null", testDO.getContainer());
-        assertEquals("testDO.children != 0", 0, testDO.getList("children").size());
+        assertEquals("testDO.containMany != 0", 0, testDO.getList("containMany").size());
 
-        Property containmentProp = testDO.getInstanceProperty("children");
+        Property containmentProp = testDO.getInstanceProperty("containMany");
         List addList = new ArrayList();
         Type type = testDO.getType();
-        DataObject dataObj1 = getScope().getDataFactory().create(type);
-        DataObject dataObj2 = getScope().getDataFactory().create(type);
+        DataObject dataObj1 = helperContext.getDataFactory().create(type);
+        DataObject dataObj2 = helperContext.getDataFactory().create(type);
 
         addList.add(dataObj1);
         addList.add(dataObj2);
@@ -175,11 +185,11 @@
      */
     @Test
     public void verifyAutomaticRemoval() {
-        Property containmentProp = testDO.getInstanceProperty("children");
+        Property containmentProp = testDO.getInstanceProperty("containMany");
         List addList = new ArrayList();
         Type type = testDO.getType();
-        DataObject dataObj1 = getScope().getDataFactory().create(type);
-        DataObject dataObj2 = getScope().getDataFactory().create(type);
+        DataObject dataObj1 = helperContext.getDataFactory().create(type);
+        DataObject dataObj2 = helperContext.getDataFactory().create(type);
 
         addList.add(dataObj1);
         addList.add(dataObj2);
@@ -217,11 +227,11 @@
      */
     @Test
     public void verifyNewContainer() {
-        Property containmentProp = testDO.getInstanceProperty("children");
+        Property containmentProp = testDO.getInstanceProperty("containMany");
         List addList = new ArrayList();
         Type type = testDO.getType();
-        DataObject dataObj1 = getScope().getDataFactory().create(type);
-        DataObject dataObj2 = getScope().getDataFactory().create(type);
+        DataObject dataObj1 = helperContext.getDataFactory().create(type);
+        DataObject dataObj2 = helperContext.getDataFactory().create(type);
 
         addList.add(dataObj1);
         addList.add(dataObj2);
@@ -252,11 +262,11 @@
      */
     @Test
     public void verifyDetachRemoval() {
-        Property containmentProp = testDO.getInstanceProperty("children");
+        Property containmentProp = testDO.getInstanceProperty("containMany");
         List addList = new ArrayList();
         Type type = testDO.getType();
-        DataObject dataObj1 = getScope().getDataFactory().create(type);
-        DataObject dataObj2 = getScope().getDataFactory().create(type);
+        DataObject dataObj1 = helperContext.getDataFactory().create(type);
+        DataObject dataObj2 = helperContext.getDataFactory().create(type);
 
         // After the following section, it should be true that: dataObj1
         // contains testDO contains dataObj2
@@ -282,11 +292,11 @@
      */
     @Test
     public void verifyDetachContainer() {
-        Property containmentProp = testDO.getInstanceProperty("children");
+        Property containmentProp = testDO.getInstanceProperty("containMany");
         List addList = new ArrayList();
         Type type = testDO.getType();
-        DataObject dataObj1 = getScope().getDataFactory().create(type);
-        DataObject dataObj2 = getScope().getDataFactory().create(type);
+        DataObject dataObj1 = helperContext.getDataFactory().create(type);
+        DataObject dataObj2 = helperContext.getDataFactory().create(type);
 
         // After the following section, it should be true that: dataObj1
         // contains testDO contains dataObj2
@@ -311,11 +321,11 @@
      */
     @Test
     public void verifyDetachContainedDOs() {
-        Property containmentProp = testDO.getInstanceProperty("children");
+        Property containmentProp = testDO.getInstanceProperty("containMany");
         List addList = new ArrayList();
         Type type = testDO.getType();
-        DataObject dataObj1 = getScope().getDataFactory().create(type);
-        DataObject dataObj2 = getScope().getDataFactory().create(type);
+        DataObject dataObj1 = helperContext.getDataFactory().create(type);
+        DataObject dataObj2 = helperContext.getDataFactory().create(type);
 
         // After the following section, it should be true that: dataObj1
         // contains testDO contains dataObj2
@@ -336,11 +346,11 @@
      */
     @Test
     public void verifyDeleteRemoval() {
-        Property containmentProp = testDO.getInstanceProperty("children");
+        Property containmentProp = testDO.getInstanceProperty("containMany");
         List addList = new ArrayList();
         Type type = testDO.getType();
-        DataObject dataObj1 = getScope().getDataFactory().create(type);
-        DataObject dataObj2 = getScope().getDataFactory().create(type);
+        DataObject dataObj1 = helperContext.getDataFactory().create(type);
+        DataObject dataObj2 = helperContext.getDataFactory().create(type);
 
         // After the following section, it should be true that: dataObj1
         // contains testDO contains dataObj2
@@ -363,11 +373,11 @@
      */
     @Test
     public void verifyDeleteResultsOnDeleted() {
-        Property containmentProp = testDO.getInstanceProperty("children");
+        Property containmentProp = testDO.getInstanceProperty("containMany");
         List addList = new ArrayList();
         Type type = testDO.getType();
-        DataObject dataObj1 = getScope().getDataFactory().create(type);
-        DataObject dataObj2 = getScope().getDataFactory().create(type);
+        DataObject dataObj1 = helperContext.getDataFactory().create(type);
+        DataObject dataObj2 = helperContext.getDataFactory().create(type);
 
         // After the following section, it should be true that: dataObj1
         // contains testDO contains dataObj2
@@ -389,11 +399,11 @@
      */
     @Test
     public void verifyDeleteAsContainer() {
-        Property containmentProp = testDO.getInstanceProperty("children");
+        Property containmentProp = testDO.getInstanceProperty("containMany");
         List addList = new ArrayList();
         Type type = testDO.getType();
-        DataObject dataObj1 = getScope().getDataFactory().create(type);
-        DataObject dataObj2 = getScope().getDataFactory().create(type);
+        DataObject dataObj1 = helperContext.getDataFactory().create(type);
+        DataObject dataObj2 = helperContext.getDataFactory().create(type);
 
         // After the following section, it should be true that: dataObj1
         // contains testDO contains dataObj2
@@ -416,11 +426,11 @@
      */
     @Test
     public void verifyDeleteAffectOnContained() {
-        Property containmentProp = testDO.getInstanceProperty("children");
+        Property containmentProp = testDO.getInstanceProperty("containMany");
         List addList = new ArrayList();
         Type type = testDO.getType();
-        DataObject dataObj1 = getScope().getDataFactory().create(type);
-        DataObject dataObj2 = getScope().getDataFactory().create(type);
+        DataObject dataObj1 = helperContext.getDataFactory().create(type);
+        DataObject dataObj2 = helperContext.getDataFactory().create(type);
 
         // After the following section, it should be true that: dataObj1
         // contains testDO contains dataObj2

Modified: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/general/DeleteTest.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/general/DeleteTest.java?view=diff&rev=536535&r1=536534&r2=536535
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/general/DeleteTest.java (original)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/general/DeleteTest.java Wed May  9 07:04:49 2007
@@ -27,17 +27,19 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 
-import test.sdo21.CTSSuite;
+import test.sdo21.framework.DataObjectFactory;
 import test.sdo21.paramatizedTests.BaseSDOParamatizedTest;
 
 import commonj.sdo.DataObject;
 import commonj.sdo.Property;
 import commonj.sdo.Type;
 import commonj.sdo.helper.DataFactory;
+import commonj.sdo.helper.HelperContext;
 
 /**
  * Junit 4.1 test case. Tests containment alterations:
@@ -47,11 +49,20 @@
  */
 @RunWith(Parameterized.class)
 public class DeleteTest extends BaseSDOParamatizedTest {
-
-    public DeleteTest(DataObject testDO, String description) {
-        super(testDO, description);
+	private DataObject testDO;
+	private HelperContext helperContext;
+	
+    public DeleteTest(DataObjectFactory factory, String description) {
+        super(factory, description);
     }
 
+    
+    @Before
+    public void setUp () {
+    	testDO = factory.createTestAPIObject();
+    	helperContext = factory.getHelperContext();
+    }
+    
     /**
      * testRecursiveDeletion verifies that when a DataObject is deleted, all
      * (recursively) contained DataObjects are also deleted.
@@ -59,12 +70,12 @@
     @Test
     public void testRecursiveDeletion() {
         Type type = testDO.getType();
-        Property containmentProp = type.getProperty("children");
+        Property containmentProp = type.getProperty("containMany");
 
         assertTrue("Cannot continue with test because Property.isContainment() is false.", containmentProp
             .isContainment());
 
-        DataFactory df = CTSSuite.getTestHelper().getDataFactory();
+        DataFactory df = helperContext.getDataFactory();
         DataObject child1 = df.create(type);
         DataObject child2 = df.create(type);
         DataObject child3 = df.create(type);

Modified: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/util/ParamatizedTestUtil.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/util/ParamatizedTestUtil.java?view=diff&rev=536535&r1=536534&r2=536535
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/util/ParamatizedTestUtil.java (original)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/util/ParamatizedTestUtil.java Wed May  9 07:04:49 2007
@@ -20,6 +20,10 @@
  */
 package test.sdo21.paramatizedTests.util;
 
+import static org.junit.Assert.fail;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
@@ -30,11 +34,17 @@
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
-import test.sdo21.CTSSuite;
+
+//import javax.xml.stream.XMLOutputFactory;
+//import javax.xml.stream.XMLStreamException;
+//import javax.xml.stream.XMLStreamWriter;
+
+import test.sdo21.framework.DataObjectFactory;
 
 import commonj.sdo.DataObject;
 import commonj.sdo.Property;
 import commonj.sdo.Type;
+import commonj.sdo.helper.HelperContext;
 
 /**
  * Utility methods for SDO Tests. Provides methods to populate fields of
@@ -42,9 +52,11 @@
  */
 public class ParamatizedTestUtil {
     public final static String TEST_TYPE = "APITest";
+    public final static String SEQ_TYPE = "Sequenced";
+    public final static String EXT_TYPE = "Extended";
     public final static String TEST_MODEL = "/api_test.xsd";
     public final static String TEST_NAMESPACE = "http://www.example.com/api_test";
-    public final static String DATA_XML = "/api_test_full.xml";
+    public final static String DATA_XML = "/apiTestValues.xml";
 
     /**
      * populateFields uses set<Type> to set each of the fields in the
@@ -52,9 +64,10 @@
      * not other than the default values for the various fields.
      * 
      * @param testDO
+     * @param helperContext
      * @throws ExpectedConditionError
      */
-    public static void populateFields(DataObject testDO) throws Exception {
+    public static void populateFields(DataObject testDO, DataObjectFactory factory) throws Exception {
         testDO.setString("stringVal", "String 1");
         testDO.setBoolean("booleanVal", true);
         testDO.setBoolean("booleanVal2", false);
@@ -68,21 +81,15 @@
         testDO.setDate("dateVal", new Date(System.currentTimeMillis()));
         testDO.setShort("shortVal", (short)-800);
         testDO.setLong("longVal", (long)88881113);
-        List children = new ArrayList();
-        children.add(CTSSuite.getTestHelper().getDataFactory().create(testDO.getType()));
-        testDO.setList("children", children);
         testDO.setBytes("bytesVal", new byte[] {120, 80, -40});
         testDO.setBigInteger("integerVal", new BigInteger("88819313"));
         testDO.setChar("charVal", '*');
-        if (testDO.getType().getInstanceClass() != null) {
-            // TODO: need to create a static sequence here.
-            // Sequenced createStatic =
-            // StaticSdoFactory.INSTANCE.createSequenced();
-            // testDO.setDataObject("sequencedElem", (DataObject)createStatic);
-        } else {
-            testDO.setDataObject("sequencedElem", CTSSuite.getTestHelper().getDataFactory().create(CTSSuite
-                .getTestHelper().getTypeHelper().getType(TEST_NAMESPACE, "Sequenced")));
-        }
+        testDO.setDataObject("sequencedElem", factory.createSequencedObject());
+        testDO.setDataObject("extendedElem", factory.createExtendedObject());
+        testDO.setDataObject("contain", factory.createTestAPIObject());
+        List containMany = new ArrayList();
+        containMany.add(factory.createTestAPIObject());
+        testDO.setList("containMany", containMany);
     }
 
     /**
@@ -183,39 +190,38 @@
      * Uses the XMLHelper to serialize the input DataObject
      * 
      * @param dataObject
-     * @param fileName
+     * @param baos
+     * @param helperContexgt
      * @throws IOException
      */
-    public static void serializeDataObjectXML(DataObject dataObject, String fileName) throws IOException {
-        FileOutputStream fos = new FileOutputStream(fileName);
+    public static void serializeDataObjectXML(DataObject dataObject, ByteArrayOutputStream baos, HelperContext helperContext) throws IOException {
         Type type = dataObject.getType();
-        CTSSuite.getTestHelper().getXMLHelper().save(dataObject, type.getURI(), type.getName(), fos);
+        helperContext.getXMLHelper().save(dataObject, type.getURI(), type.getName(), baos);
     }
 
     /**
      * Uses the XMLHelper to deserialize the input XML file
      * 
-     * @param fileName
+     * @param bais
+     * @param helperContext
      * @return
      * @throws IOException
      * @throws ClassNotFoundException
      */
-    public static DataObject deserializeDataObjectXML(String fileName) throws IOException, ClassNotFoundException {
-        FileInputStream fis = new FileInputStream(fileName);
-
-        return CTSSuite.getTestHelper().getXMLHelper().load(fis).getRootObject();
+    public static DataObject deserializeDataObjectXML(ByteArrayInputStream bais, HelperContext helperContext) throws IOException, ClassNotFoundException {
+        return helperContext.getXMLHelper().load(bais).getRootObject();
     }
 
     /**
      * Uses Java serialization to serialize the input DataObject
      * 
      * @param dataObject
-     * @param fileName
+     * @param baos
+     * @param helperContext
      * @throws IOException
      */
-    public static void serializeDataObjectJava(DataObject dataObject, String fileName) throws IOException {
-        FileOutputStream fos = new FileOutputStream(fileName);
-        ObjectOutputStream out = new ObjectOutputStream(fos);
+    public static void serializeDataObjectJava(DataObject dataObject, ByteArrayOutputStream baos, HelperContext helperContext) throws IOException {
+        ObjectOutputStream out = test.sdo21.CTSSuite.getTestHelper().createObjectOutputStream(baos, helperContext);
         out.writeObject(dataObject);
         out.close();
     }
@@ -223,19 +229,42 @@
     /**
      * Uses Java deserialization to deserialize the input XML file
      * 
-     * @param fileName
+     * @param bais
+     * @param helperContext
      * @return
      * @throws IOException
      * @throws ClassNotFoundException
      */
-    public static DataObject deserializeDataObjectJava(String fileName) throws IOException, ClassNotFoundException {
-        FileInputStream fis = new FileInputStream(fileName);
-        ObjectInputStream input = new ObjectInputStream(fis);
+    public static DataObject deserializeDataObjectJava(ByteArrayInputStream bais, HelperContext helperContext) throws IOException, ClassNotFoundException {
+        ObjectInputStream input = test.sdo21.CTSSuite.getTestHelper().createObjectInputStream(bais, helperContext);
         DataObject dataObject = (DataObject)input.readObject();
         input.close();
         return dataObject;
     }
 
+//    /**
+//     * Uses Java serialization to serialize the input DataObject
+//     * 
+//     * @param dataObject
+//     * @param baos
+//     * @param helperContext
+//     * @throws IOException
+//     */
+//    public static void serializeDataObjectStream(DataObject dataObject, ByteArrayOutputStream baos, HelperContext helperContext) {
+//       XMLOutputFactory factory = XMLOutputFactory.newInstance();
+//        XMLStreamWriter serializer;
+//        try {
+//            serializer = factory.createXMLStreamWriter(baos);
+//           test.sdo21.CTSSuite.getTestHelper().serializeViaXMLStreamHelper(helperContext.getTypeHelper(), dataObject, serializer);
+//            serializer.flush();
+//        }
+//        catch (XMLStreamException e) {
+//            fail("Exception encountered during XMLStreamHelper serialization.");
+//            e.printStackTrace();
+//        }
+//    }
+    
+    
     /**
      * clearDataObject is used to restore all fields to their default values
      * 

Modified: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/util/TypeCreateUtility.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/util/TypeCreateUtility.java?view=diff&rev=536535&r1=536534&r2=536535
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/util/TypeCreateUtility.java (original)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/util/TypeCreateUtility.java Wed May  9 07:04:49 2007
@@ -26,10 +26,9 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import test.sdo21.CTSSuite;
-
 import commonj.sdo.DataObject;
 import commonj.sdo.Type;
+import commonj.sdo.helper.HelperContext;
 import commonj.sdo.helper.TypeHelper;
 
 /**
@@ -46,11 +45,11 @@
      * @throws IOException
      */
 
-    public static void createDynamicWithStaticResources() throws IOException {
+    public static void createDynamicWithStaticResources(HelperContext hc) throws IOException {
         // Populate the meta data for the test model (APITest)
         URL url = TypeCreateUtility.class.getResource(ParamatizedTestUtil.TEST_MODEL);
         InputStream inputStream = url.openStream();
-        CTSSuite.getTestHelper().getXSDHelper().define(inputStream, url.toString());
+        hc.getXSDHelper().define(inputStream, url.toString());
         inputStream.close();
     }
 
@@ -75,8 +74,8 @@
      * createDynamicallyWithStaticResources. The same XSD is used for the static
      * generation of SDO Types using XSD2JavaGenerator.
      */
-    public static void createDynamically() {
-        TypeHelper types = CTSSuite.getTestHelper().getTypeHelper();
+    public static void createDynamically(HelperContext hc) {
+        TypeHelper types = hc.getTypeHelper();
         Type stringType = types.getType("commonj.sdo", "String");
         Type intType = types.getType("commonj.sdo", "Int");
         Type booleanType = types.getType("commonj.sdo", "Boolean");
@@ -90,15 +89,11 @@
         Type bytesType = types.getType("commonj.sdo", "Bytes");
         Type integerType = types.getType("commonj.sdo", "Integer");
         Type charType = types.getType("commonj.sdo", "Character");
-        // Type dateXSDType = types.getType("http://www.w3.org/2001/XMLSchema",
-        // "date");
-        // Collection aliases = new ArrayList();
 
-        DataObject abstractTypeDO = CTSSuite.getTestHelper().getDataFactory().create("commonj.sdo", "Type");
+        DataObject abstractTypeDO = hc.getDataFactory().create("commonj.sdo", "Type");
         abstractTypeDO.set("uri", ParamatizedTestUtil.TEST_NAMESPACE);
         abstractTypeDO.set("name", "Abstract");
-        abstractTypeDO.setBoolean("abstract", true);
-        abstractTypeDO.setBoolean("sequenced", true);
+        // abstractTypeDO.setBoolean("abstract", true);
 
         DataObject firstProperty = abstractTypeDO.createDataObject("property");
         firstProperty.set("name", "firstName");
@@ -110,15 +105,29 @@
 
         Type abstractType = types.define(abstractTypeDO);
 
-        DataObject sequenceTypeDO = CTSSuite.getTestHelper().getDataFactory().create("commonj.sdo", "Type");
-        sequenceTypeDO.set("uri", ParamatizedTestUtil.TEST_NAMESPACE);
-        sequenceTypeDO.set("name", "Sequenced");
-        sequenceTypeDO.setBoolean("sequenced", true);
-
+        DataObject extendedTypeDO = hc.getDataFactory().create("commonj.sdo", "Type");
+        extendedTypeDO.set("uri", ParamatizedTestUtil.TEST_NAMESPACE);
+        extendedTypeDO.set("name", ParamatizedTestUtil.EXT_TYPE);
+        
         List baseTypes = new ArrayList();
         baseTypes.add(abstractType);
-        sequenceTypeDO.setList("baseType", baseTypes);
-
+        extendedTypeDO.setList("baseType", baseTypes);
+        
+        DataObject middleName = extendedTypeDO.createDataObject("property");
+        middleName.set("name", "middleName");
+        middleName.set("type", stringType);
+        
+        DataObject nickName = extendedTypeDO.createDataObject("property");
+        nickName.set("name", "nickName");
+        nickName.set("type", stringType);
+        
+        Type extendedType = types.define(extendedTypeDO);
+        
+        DataObject sequenceTypeDO = hc.getDataFactory().create("commonj.sdo", "Type");
+        sequenceTypeDO.set("uri", ParamatizedTestUtil.TEST_NAMESPACE);
+        sequenceTypeDO.set("name", ParamatizedTestUtil.SEQ_TYPE);
+        sequenceTypeDO.setBoolean("sequenced", true);
+        
         // TODO: Uncomment the following when SDOUtil.addAliasName is
         // implemented
         /*
@@ -135,10 +144,32 @@
         Numbers.set("name", "Numbers");
         Numbers.set("type", intType);
         Numbers.setBoolean("many", true);
+        
+        DataObject containManySeq = sequenceTypeDO.createDataObject("property");
+        containManySeq.set("name", "containMany");
+        containManySeq.set("type", sequenceTypeDO);
+        containManySeq.setBoolean("many", true);
+        containManySeq.setBoolean("containment", true);
+        
+        DataObject containSeq = sequenceTypeDO.createDataObject("property");
+        containSeq.set("name", "contain");
+        containSeq.set("type", sequenceTypeDO);
+        containSeq.setBoolean("containment", true);
 
         Type sequenceType = types.define(sequenceTypeDO);
 
-        DataObject testType = CTSSuite.getTestHelper().getDataFactory().create("commonj.sdo", "Type");
+        DataObject openTypeDO = hc.getDataFactory().create("commonj.sdo", "Type");
+        openTypeDO.set("uri", ParamatizedTestUtil.TEST_NAMESPACE);
+        openTypeDO.set("name", "Open");
+        openTypeDO.setBoolean("open", true);
+        
+        DataObject definedElem = openTypeDO.createDataObject("property");
+        definedElem.set("name", "defined");
+        definedElem.set("type", stringType);
+        
+        Type openType = types.define(openTypeDO);
+        
+        DataObject testType = hc.getDataFactory().create("commonj.sdo", "Type");
         testType.set("uri", ParamatizedTestUtil.TEST_NAMESPACE);
         testType.set("name", ParamatizedTestUtil.TEST_TYPE);
 
@@ -200,11 +231,11 @@
         longProperty.set("name", "longVal");
         longProperty.set("type", longType);
 
-        DataObject childrenProperty = testType.createDataObject("property");
-        childrenProperty.set("name", "children");
-        childrenProperty.setBoolean("many", true);
-        childrenProperty.setBoolean("containment", true);
-        childrenProperty.set("type", testType);
+        DataObject containManyProperty = testType.createDataObject("property");
+        containManyProperty.set("name", "containMany");
+        containManyProperty.setBoolean("many", true);
+        containManyProperty.setBoolean("containment", true);
+        containManyProperty.set("type", testType);
 
         DataObject bytesProperty = testType.createDataObject("property");
         bytesProperty.set("name", "bytesVal");
@@ -218,16 +249,31 @@
         charProperty.set("name", "charVal");
         charProperty.set("type", charType);
 
-        /*
-         * Problem with dateXSDType - prevents subsequent properties DataObject
-         * dateXSDProperty = testType.createDataObject("property");
-         * dateXSDProperty.set("name", "dateXSDVal");
-         * dateXSDProperty.set("type", dateXSDType);
-         */
+        DataObject readOnlyProperty = testType.createDataObject("property");
+        readOnlyProperty.set("name", "readOnlyVal");
+        readOnlyProperty.set("type", stringType);
+        readOnlyProperty.setBoolean("readOnly", true);
+       
         DataObject sequenceProperty = testType.createDataObject("property");
         sequenceProperty.set("name", "sequencedElem");
         sequenceProperty.set("type", sequenceType);
+        sequenceProperty.setBoolean("containment", true);
 
+        DataObject extendProperty = testType.createDataObject("property");
+        extendProperty.set("name", "extendedElem");
+        extendProperty.set("type", extendedType);
+        extendProperty.setBoolean("containment", true);
+        
+        DataObject openProperty = testType.createDataObject("property");
+        openProperty.set("name", "openElem");
+        openProperty.set("type", openType);
+        openProperty.setBoolean("containment", true);
+        
+        DataObject containProperty = testType.createDataObject("property");
+        containProperty.set("name", "contain");
+        containProperty.setBoolean("containment", true);
+        containProperty.set("type", testType); 
+        
         types.define(testType);
     }
 }

Added: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/TestTemplate.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/TestTemplate.java?view=auto&rev=536535
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/TestTemplate.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/TestTemplate.java Wed May  9 07:04:49 2007
@@ -0,0 +1,144 @@
+/*
+ *  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.
+ *  
+ *  $Rev$  $Date$
+ */
+package test.sdo21.tests;
+
+// static imports simply allow you to call assertTrue rather than
+// Assert.assertTrue
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.junit.Test;
+import org.junit.Ignore;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import test.sdo21.CTSSuite;
+import test.sdo21.framework.TestHelper;
+import test.sdo21.paramatizedTests.BaseSDOParamatizedTest;
+import test.sdo21.paramatizedTests.util.ParamatizedTestUtil;
+
+import commonj.sdo.DataObject;
+
+/**
+ * Example test class to be used as a template SDO test cases.
+ * <br>
+ * The test case can be run using Junit within eclipse, from normal command line
+ * junit, or within a WebSphere build environment by adding an target such as
+ * sampleTestTarget that is contained within the build.xml file of the
+ * WAS.soa.sdo.cts component. <br>
+ * <br>
+ * Once a test case has been completed and reviewed it can be added into the
+ * appropiate CTS Suite.<br>
+ * <br>
+ * This test class should make every effort to only use methods that are defined
+ * within the current SDO Specification. If utility methods are required they
+ * should be added to {@link test.sdo21.framework.TestHelper}  <br>
+ * <br>
+ * Please Document the overall intention of the test case and provide detailed
+ * javadoc for each test method. Please create modular test methods rather than
+ * single large test methods<br>
+ * <br>
+ * Resources:
+ * <UL>
+ * <LI><a href="http://www.junit.org/">Junit Fondation</a>
+ * Change History:
+ * <UL>
+ * <LI>Initial implementation
+ * </UL>
+ */
+public class TestTemplate {
+
+
+    /**
+     * Example test method. Please provide good description of the test case in
+     * javadoc including the intention, reference to the specification, etc.
+     */
+    @Test
+    public void myTestMethod() {
+
+        String expected = new String("bla bla bla");
+        String actual = new String("bla bla bla");
+        assertEquals("Your Message", expected, actual);
+    }
+
+    /**
+     * Sometimes you want to temporarily disable a test. Methods annotated with
+     * {@link org.junit.Test} that are also annotated with <code>@Ignore</code> will not be executed as tests. Native JUnit 4 test
+     *         runners should report the number of ignored tests along with the
+     *         number of tests that ran and the number of tests that failed.
+     *         <code>@Ignore</code> takes an optional default parameter if you want to record
+     *         why a test is being ignored:<br>
+     */
+    @Test
+    @Ignore("Function Foo is not clearly defined within the SDO 2.1 specification and is currently being defined as a part of the x.x specification.")
+    public void exampleIngoredTestCase() {
+        // test method here
+    }
+
+    /**
+     * Sometimes you may not have the resources to implement a test case. If is
+     * very very valuable to create method signatures in the appropiate classes
+     * for test cases that are currently not covered. In cases such as these
+     * please define and checkin method signatures with the following failure
+     * message. <br>
+     * <br>
+     * In this case you should ensure that the class that contains the test
+     * method is added to a testSuite such as
+     * {@link test.sdo21.paramatizedTests.CTSParamatizedSuite} so that it will
+     * be completed, or open a defect/JIRA to complete the test case.
+     */
+    @Test
+    public void exampleUnimplementedTestCase() {
+        fail(TestHelper.INCOMPLETE_TEST_CASE_FAILURE);
+        // test method here
+    }
+
+    /**
+     * When writing tests, it is common to find that several tests need similar
+     * objects created before they can run. Annotating a
+     * <code>public void</code> method with <code>@Before</code> causes that method to be run before the
+     *         {@link org.junit.Test} method. The <code>@Before</code> methods of superclasses will be run before those of the
+     *         current class. There is also an <code>@After</code> annotation
+     */
+    @Before
+    public void testCaseInit() {
+        // initMethod
+    }
+
+    /**
+     * Sometimes several tests need to share computationally expensive setup
+     * (like logging into a database). While this can compromise the
+     * independence of tests, sometimes it is a necessary optimization.
+     * Annotating a <code>public static void</code> no-arg method with
+     * <code>@BeforeClass</code> causes it to be run once before any of the test
+     *              methods in the class. The <code>@BeforeClass</code> methods of superclasses will be run before those the
+     *              current class.
+     */
+    @BeforeClass
+    public static void init() {
+        // init
+    }
+}

Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/TestTemplate.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/TestTemplate.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataObjectTest.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataObjectTest.java?view=diff&rev=536535&r1=536534&r2=536535
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataObjectTest.java (original)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataObjectTest.java Wed May  9 07:04:49 2007
@@ -20,9 +20,14 @@
  */
 package test.sdo21.tests.api;
 
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
-import junit.framework.TestCase;
+
 import test.sdo21.CTSSuite;
 import test.sdo21.framework.TestHelper;
 
@@ -30,17 +35,20 @@
 import commonj.sdo.Type;
 import commonj.sdo.Property;
 import commonj.sdo.helper.XMLHelper;
+import commonj.sdo.helper.HelperContext;
 
-public class DataObjectTest extends TestCase {
-    private TestHelper testHelper;
+/**
+ * Set of tests for DataObject APIs.
+ */
+public class DataObjectTest {
+    private static TestHelper testHelper;
     private boolean debug = false;
 
     /**
-     * Set of tests for DataObject APIs.
+     * set the testHelper for the class of test cases
      */
-    public DataObjectTest(String string) throws Exception {
-        super(string);
-
+    @BeforeClass
+    public static void setTestHelper() {
         testHelper = CTSSuite.getTestHelper();
     }
 
@@ -53,17 +61,20 @@
      * 
      * @throws Exception
      */
+    @Test
+    @Ignore("On demand open content property is not yet implemented in Tuscany.")
     public void testGetInstancePropertiesSize() throws Exception {
 
         // define a type with two properties
+    	HelperContext helperContext = testHelper.createHelperContext();
         String typeName = testHelper.createUniqueName();
-        DataObject typeDef = testHelper.createTypeDef("", typeName, true);
-        testHelper.createPropertyDef(typeDef, "p1", "commonj.sdo#String", false, false);
-        testHelper.createPropertyDef(typeDef, "p2", "commonj.sdo#String", false, false);
-        testHelper.getTypeHelper().define(typeDef);
+        DataObject typeDef = testHelper.createTypeDef("", typeName, true, helperContext);
+        testHelper.createPropertyDef(typeDef, "p1", "commonj.sdo#String", false, false, helperContext);
+        testHelper.createPropertyDef(typeDef, "p2", "commonj.sdo#String", false, false, helperContext);
+        helperContext.getTypeHelper().define(typeDef);
 
         // create a DataObject that uses this type
-        DataObject dobj = testHelper.getDataFactory().create("", typeName);
+        DataObject dobj = helperContext.getDataFactory().create("", typeName);
 
         // getInstanceProperties() should return p1, p2 even though they are not
         // set
@@ -95,18 +106,20 @@
         assertEquals(2, dobj.getInstanceProperties().size());
     }
 
+    @Test
     public void testIsSet_Boolean_false() throws Exception {
 
         // define a type with two properties
+    	HelperContext helperContext = testHelper.createHelperContext();
         String typeName = testHelper.createUniqueName();
-        DataObject typeDef = testHelper.createTypeDef("", typeName, true);
-        testHelper.createPropertyDef(typeDef, "b1", "commonj.sdo#Boolean", false, false);
-        testHelper.getTypeHelper().define(typeDef);
+        DataObject typeDef = testHelper.createTypeDef("", typeName, true, helperContext);
+        testHelper.createPropertyDef(typeDef, "b1", "commonj.sdo#Boolean", false, false, helperContext);
+        helperContext.getTypeHelper().define(typeDef);
 
         // create a DataObject that uses this type
-        DataObject testDO = testHelper.getDataFactory().create("", typeName);
+        DataObject testDO = helperContext.getDataFactory().create("", typeName);
 
-        Property p = testDO.getProperty("b1");
+        Property p = testDO.getInstanceProperty("b1");
         testDO.unset(p);
         assertFalse("testing that property is unset after unset is called", testDO.isSet(p));
         testDO.set(p, false);
@@ -114,18 +127,20 @@
             .isSet(p));
     }
 
+    @Test
     public void testIsSet_Boolean_true() throws Exception {
 
         // define a type with two properties
+    	HelperContext helperContext = testHelper.createHelperContext();
         String typeName = testHelper.createUniqueName();
-        DataObject typeDef = testHelper.createTypeDef("", typeName, true);
-        testHelper.createPropertyDef(typeDef, "b1", "commonj.sdo#Boolean", false, false);
-        testHelper.getTypeHelper().define(typeDef);
+        DataObject typeDef = testHelper.createTypeDef("", typeName, true, helperContext);
+        testHelper.createPropertyDef(typeDef, "b1", "commonj.sdo#Boolean", false, false, helperContext);
+        helperContext.getTypeHelper().define(typeDef);
 
         // create a DataObject that uses this type
-        DataObject testDO = testHelper.getDataFactory().create("", typeName);
+        DataObject testDO = helperContext.getDataFactory().create("", typeName);
 
-        Property p = testDO.getProperty("b1");
+        Property p = testDO.getInstanceProperty("b1");
         testDO.unset(p);
         assertFalse("testing that property is unset after unset is called", testDO.isSet(p));
         testDO.set(p, true);
@@ -133,18 +148,20 @@
             .isSet(p));
     }
 
+    @Test
     public void testIsSet_Integer_0() throws Exception {
 
         // define a type with two properties
+    	HelperContext helperContext = testHelper.createHelperContext();
         String typeName = testHelper.createUniqueName();
-        DataObject typeDef = testHelper.createTypeDef("", typeName, true);
-        testHelper.createPropertyDef(typeDef, "i1", "commonj.sdo#Integer", false, false);
-        testHelper.getTypeHelper().define(typeDef);
+        DataObject typeDef = testHelper.createTypeDef("", typeName, true, helperContext);
+        testHelper.createPropertyDef(typeDef, "i1", "commonj.sdo#Integer", false, false, helperContext);
+        helperContext.getTypeHelper().define(typeDef);
 
         // create a DataObject that uses this type
-        DataObject testDO = testHelper.getDataFactory().create("", typeName);
+        DataObject testDO = helperContext.getDataFactory().create("", typeName);
 
-        Property p = testDO.getProperty("i1");
+        Property p = testDO.getInstanceProperty("i1");
         testDO.unset(p);
         assertFalse("testing that property is unset after unset is called", testDO.isSet(p));
         testDO.set(p, java.math.BigInteger.valueOf(0));
@@ -152,24 +169,26 @@
             .isSet(p));
     }
 
+    @Test
     public void testIsSet_Integer_1() throws Exception {
 
         // define a type with two properties
+    	HelperContext helperContext = testHelper.createHelperContext();
         String typeName = testHelper.createUniqueName();
-        DataObject typeDef = testHelper.createTypeDef("", typeName, true);
-        testHelper.createPropertyDef(typeDef, "i1", "commonj.sdo#Integer", false, false);
-        testHelper.getTypeHelper().define(typeDef);
+        DataObject typeDef = testHelper.createTypeDef("", typeName, true, helperContext);
+        testHelper.createPropertyDef(typeDef, "i1", "commonj.sdo#Integer", false, false, helperContext);
+        helperContext.getTypeHelper().define(typeDef);
 
         // create a DataObject that uses this type
-        DataObject testDO = testHelper.getDataFactory().create("", typeName);
+        DataObject testDO = helperContext.getDataFactory().create("", typeName);
         try {
-            Property p = testDO.getProperty("default");
+            Property p = testDO.getInstanceProperty("default");
             System.out.println(" default " + p);
         } catch (Exception e) {
             System.out.println("coudl not get default " + e.toString());
         }
 
-        Property p = testDO.getProperty("i1");
+        Property p = testDO.getInstanceProperty("i1");
         testDO.unset(p);
         assertFalse("testing that property is unset after unset is called", testDO.isSet(p));
 
@@ -178,20 +197,22 @@
             .isSet(p));
     }
 
+    @Test
     public void testIsSet_int_1() throws Exception {
 
         // define a type with two properties
+    	HelperContext helperContext = testHelper.createHelperContext();
         String typeName = testHelper.createUniqueName();
-        DataObject typeDef = testHelper.createTypeDef("", typeName, true);
-        Type intType = testHelper.getTypeHelper().getType("commonj.sdo", "Int");
+        DataObject typeDef = testHelper.createTypeDef("", typeName, true, helperContext);
+        Type intType = helperContext.getTypeHelper().getType("commonj.sdo", "Int");
 
         testHelper.createPropertyDef(typeDef, "i1", intType, false, false);
-        testHelper.getTypeHelper().define(typeDef);
+        helperContext.getTypeHelper().define(typeDef);
 
         // create a DataObject that uses this type
-        DataObject testDO = testHelper.getDataFactory().create("", typeName);
+        DataObject testDO = helperContext.getDataFactory().create("", typeName);
 
-        Property p = testDO.getProperty("i1");
+        Property p = testDO.getInstanceProperty("i1");
         testDO.unset(p);
         assertFalse("testing that property is unset after unset is called", testDO.isSet(p));
 
@@ -200,20 +221,22 @@
             .isSet(p));
     }
 
+    @Test
     public void testIsSet_int_0() throws Exception {
         try {
 
             // define a type with two properties
+        	HelperContext helperContext = testHelper.createHelperContext();
             String typeName = testHelper.createUniqueName();
-            DataObject typeDef = testHelper.createTypeDef("", typeName, true);
-            Type intType = testHelper.getTypeHelper().getType("commonj.sdo", "Int");
+            DataObject typeDef = testHelper.createTypeDef("", typeName, true, helperContext);
+            Type intType = helperContext.getTypeHelper().getType("commonj.sdo", "Int");
             testHelper.createPropertyDef(typeDef, "i1", intType, false, false);
-            testHelper.getTypeHelper().define(typeDef);
+            helperContext.getTypeHelper().define(typeDef);
 
             // create a DataObject that uses this type
-            DataObject testDO = testHelper.getDataFactory().create("", typeName);
+            DataObject testDO = helperContext.getDataFactory().create("", typeName);
 
-            Property p = testDO.getProperty("i1");
+            Property p = testDO.getInstanceProperty("i1");
             testDO.unset(p);
             assertFalse("testing that property is unset after unset is called", testDO.isSet(p));
 



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org