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/04/30 14:44:22 UTC
svn commit: r533727 - in
/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21: framework/
framework/junit3_8/ paramatizedTests/ paramatizedTests/general/
Author: kelvingoodson
Date: Mon Apr 30 05:44:20 2007
New Revision: 533727
URL: http://svn.apache.org/viewvc?view=rev&rev=533727
Log:
put in place infrastructure to support parameterized tests having scope isolation, and to permit running subtrees of a junit suite of parameterized tests. Two classes modified to make use of this infrastructure. Deprecated BaseSDOParametizedTest in favour of ParameterizedTestBase.
Added:
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/ParamaterizedTestBase.java (with props)
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/ParameterFactory.java (with props)
Modified:
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/CTSTestCase.java
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/junit3_8/CTSTestCase.java
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/BaseSDOParamatizedTest.java
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/general/ActiveUpdatingTest.java
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/general/ContainmentTest.java
Modified: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/CTSTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/CTSTestCase.java?view=diff&rev=533727&r1=533726&r2=533727
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/CTSTestCase.java (original)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/CTSTestCase.java Mon Apr 30 05:44:20 2007
@@ -27,7 +27,7 @@
private HelperContext scope = null;
public static final String SDO_CTS_TESTHELPER_CLASS = "CTS_TEST_HELPER";
- private void initTestHelper() throws Exception {
+ private static void initTestHelper() throws Exception {
String helperClassName = System.getenv(SDO_CTS_TESTHELPER_CLASS);
if ((helperClassName == null) || (helperClassName.equals(""))) {
@@ -56,12 +56,11 @@
return scope;
}
- public TestHelper getTestHelper() {
+ public static TestHelper getTestHelper() {
if(testHelper == null) {
try {
initTestHelper();
} catch (Exception e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
}
Added: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/ParamaterizedTestBase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/ParamaterizedTestBase.java?view=auto&rev=533727
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/ParamaterizedTestBase.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/ParamaterizedTestBase.java Mon Apr 30 05:44:20 2007
@@ -0,0 +1,83 @@
+/*
+ * 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.framework;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.junit.Before;
+import org.junit.runners.Parameterized.Parameters;
+
+import test.sdo21.CTSSuite;
+
+import commonj.sdo.DataObject;
+
+/**
+ * BaseSDOParamatizedTest provides a DataObject and String instance variable
+ * which are populated by Junit Paramatized Test Runner prior to tests being
+ * run. The data method provides a Collection of DataObject/String pairs which
+ * should be used to populate these instance variables. This allows for test
+ * cases to be executed using a variety of Type registration and DataObject
+ * population combinations which is essentual for good SDO test coverage.
+ */
+public class ParamaterizedTestBase extends CTSTestCase {
+
+ protected ParameterFactory parameterFactory;
+ protected DataObject testDO;
+
+ public ParamaterizedTestBase(ParameterFactory pf) {
+ this.parameterFactory = pf;
+ }
+
+ /**
+ * Returns a collection of data populated DataObjects which are used during
+ * the test.
+ */
+ @Parameters
+ public static Collection data() {
+
+ // TODO: use properties file and TestHelper to populate this Collection
+ // with desired DataObjects
+ ArrayList list = new ArrayList();
+ list.add(new Object[] {new ParameterFactory(ParameterFactory.DYNAMIC_DATA)});
+ list.add(new Object[] {new ParameterFactory(ParameterFactory.MIXED_DATA)});
+
+ // add vendor specific paramaters
+ try {
+ test.sdo21.CTSSuite.init();
+ Collection c = getTestHelper().getParamatizedDataObject();
+ list.addAll(c);
+
+ } catch (Exception e) {
+ System.out.println("Could not add vendor specific paramaters");
+ e.printStackTrace();
+ }
+ return list;
+ }
+
+ @Before
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ parameterFactory.createTestData(getScope());
+ testDO = parameterFactory.getTestGraph();
+ }
+
+}
Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/ParamaterizedTestBase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/ParamaterizedTestBase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/ParameterFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/ParameterFactory.java?view=auto&rev=533727
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/ParameterFactory.java (added)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/ParameterFactory.java Mon Apr 30 05:44:20 2007
@@ -0,0 +1,202 @@
+/*
+ * 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.framework;
+
+import static org.junit.Assert.fail;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import test.sdo21.CTSSuite;
+import test.sdo21.paramatizedTests.util.TypeCreateUtility;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.HelperContext;
+
+/**
+ *
+ * Parameter Factory addresses the issue that Junit provides an infrastructure
+ * that permits instances of test data to be supplied to test classes on a 1:1
+ * basis, i.e. all tests in a class are run against a single instance of the
+ * data. This is an issue for us in that we want to have a fresh HelperContext
+ * and fresh instance data derived from the scope that the HelperContext
+ * provides, per test case execution. The Parameter factory allows a level of
+ * indirection whereby the junit infrastructure creates instances of the
+ * parameter factory to supply to each class, primed with an integer that
+ * permits variation of the factory behaviour. The factory instance can then be
+ * used by the test class setup method to create test data on a per test case
+ * basis.
+ *
+ */
+public class ParameterFactory {
+
+ private int variant;
+ private String tag;
+ protected DataObject testGraph;
+ private HelperContext scope;
+
+ public final static String TEST_TYPE = "APITest";
+ 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 static final int DYNAMIC_DATA = 0;
+ public static final int MIXED_DATA = 1;
+
+ public ParameterFactory(int variant) {
+ this.variant = variant;
+ }
+
+ public void createTestData(HelperContext scope)
+ {
+ this.scope = scope;
+ switch (getVariant()) {
+ case DYNAMIC_DATA: {
+ tag = "Dynamic";
+ testGraph = createDynamicDO();
+ break;
+ }
+ case MIXED_DATA: {
+ tag = "Mixed";
+ testGraph = createMixedDO();
+ break;
+ }
+ }
+ }
+
+ private DataObject createDynamicDO() {
+ // Populate the meta data for the test model (APITest)
+ URL url = getClass().getResource(TEST_MODEL);
+ InputStream inputStream;
+ try {
+ inputStream = url.openStream();
+ getScope().getXSDHelper().define(inputStream, url.toString());
+ inputStream.close();
+ } catch (IOException e1) {
+ e1.printStackTrace();
+ }
+ DataObject testDO =
+ getScope().getDataFactory().create(TEST_NAMESPACE, "APITest");
+ try {
+ populateFields(testDO);
+ } catch (Exception e) {
+ fail("Exception caught " + e.toString());
+ e.printStackTrace();
+ }
+ return testDO;
+ }
+
+ /**
+ * Creates and populates a DataObject that has Type define by an XSD but is
+ * dynamically populated.
+ */
+ private DataObject createMixedDO() {
+
+ try {
+ // Populate the meta data for the test model (APITest)
+ URL url = TypeCreateUtility.class.getResource(TEST_MODEL);
+ InputStream inputStream = url.openStream();
+ getScope().getXSDHelper().define(inputStream, url.toString());
+ inputStream.close();
+
+ DataObject testDO =
+ getScope().getDataFactory().create(TEST_NAMESPACE, TEST_TYPE);
+
+ try {
+ populateFields(testDO);
+ } catch (Exception e) {
+ fail("Exception caught " + e.toString());
+ e.printStackTrace();
+ }
+ return testDO;
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public HelperContext getScope() {
+ return scope;
+ }
+
+ public int getVariant() {
+ return variant;
+ }
+
+ public String getTag() {
+ return tag;
+ }
+
+
+ public DataObject getTestGraph() {
+ return testGraph;
+ }
+
+ /**
+ * populateFields uses set<Type> to set each of the fields in the
+ * DataObject. It is used to ensure a known set of expected values that are
+ * not other than the default values for the various fields.
+ *
+ * @param testDO
+ * @throws ExpectedConditionError
+ */
+ public void populateFields(DataObject testDO) throws Exception {
+ testDO.setString("stringVal", "String 1");
+ testDO.setBoolean("booleanVal", true);
+ testDO.setBoolean("booleanVal2", false);
+ testDO.setByte("byteVal", (byte)-127);
+ testDO.setString("stringVal2", "Second string!");
+ testDO.setBigDecimal("decimalVal", new BigDecimal(-3.00003));
+ testDO.setBigDecimal("decimalVal2", new BigDecimal(18883.999999));
+ testDO.setInt("intVal", (int)33333);
+ testDO.setFloat("floatVal", (float)0.88881);
+ testDO.setDouble("doubleVal", (double)119.13813);
+ testDO.setDate("dateVal", new Date(System.currentTimeMillis()));
+ testDO.setShort("shortVal", (short)-800);
+ testDO.setLong("longVal", (long)88881113);
+ List children = new ArrayList();
+ children.add(getScope().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",
+ getScope().getDataFactory().create(
+ getScope().getTypeHelper().getType(TEST_NAMESPACE, "Sequenced")));
+ }
+ }
+
+
+
+}
Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/ParameterFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/ParameterFactory.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/junit3_8/CTSTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/junit3_8/CTSTestCase.java?view=diff&rev=533727&r1=533726&r2=533727
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/junit3_8/CTSTestCase.java (original)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/framework/junit3_8/CTSTestCase.java Mon Apr 30 05:44:20 2007
@@ -26,6 +26,12 @@
public class CTSTestCase extends TestCase {
+ /*
+ * The CTS is designed to be invoked by arbitrary test harnesses but has affinity to junit.
+ * Some test classes are written in the junit 3.8 style where they must inherit from TestCase.
+ * Others are written in the 4.1 style. The pair of CTSTestCase superclasses support both these
+ * approaches. This class minimises duplication by delegating much function to the 4.1 style class.
+ */
test.sdo21.framework.CTSTestCase delegate;
public CTSTestCase(String title) {
@@ -49,8 +55,8 @@
return delegate.getScope();
}
- public TestHelper getTestHelper() {
- return delegate.getTestHelper();
+ public static TestHelper getTestHelper() {
+ return test.sdo21.framework.CTSTestCase.getTestHelper();
}
}
Modified: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/BaseSDOParamatizedTest.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/BaseSDOParamatizedTest.java?view=diff&rev=533727&r1=533726&r2=533727
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/BaseSDOParamatizedTest.java (original)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/BaseSDOParamatizedTest.java Mon Apr 30 05:44:20 2007
@@ -30,7 +30,7 @@
import org.junit.runners.Parameterized.Parameters;
-import test.sdo21.CTSSuite;
+import test.sdo21.CTSSuite;
import test.sdo21.paramatizedTests.util.ParamatizedTestUtil;
import test.sdo21.paramatizedTests.util.TypeCreateUtility;
@@ -43,6 +43,7 @@
* should be used to populate these instance variables. This allows for test
* cases to be executed using a variety of Type registration and DataObject
* population combinations which is essentual for good SDO test coverage.
+ * @deprecated @see {@link ParamaterizedTestBase}
*/
public class BaseSDOParamatizedTest {
Modified: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/general/ActiveUpdatingTest.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/general/ActiveUpdatingTest.java?view=diff&rev=533727&r1=533726&r2=533727
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/general/ActiveUpdatingTest.java (original)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/general/ActiveUpdatingTest.java Mon Apr 30 05:44:20 2007
@@ -31,8 +31,8 @@
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
-import test.sdo21.CTSSuite;
-import test.sdo21.paramatizedTests.BaseSDOParamatizedTest;
+import test.sdo21.framework.ParamaterizedTestBase;
+import test.sdo21.framework.ParameterFactory;
import commonj.sdo.DataObject;
import commonj.sdo.Sequence;
@@ -44,14 +44,14 @@
* updates.
*/
@RunWith(Parameterized.class)
-public class ActiveUpdatingTest extends BaseSDOParamatizedTest {
+public class ActiveUpdatingTest extends ParamaterizedTestBase {
/**
* Tests for proper updates to DataObject and their value changes due to the
* updates.
*/
- public ActiveUpdatingTest(DataObject testDO, String description) {
- super(testDO, description);
+ public ActiveUpdatingTest(ParameterFactory pf) {
+ super(pf);
}
/**
@@ -62,7 +62,7 @@
public void testActiveUpdatingList() {
Type type = testDO.getType();
- DataFactory df = CTSSuite.getTestHelper().getDataFactory();
+ DataFactory df = getScope().getDataFactory();
DataObject root = df.create(type);
DataObject child1 = df.create(type);
DataObject child2 = df.create(type);
@@ -76,7 +76,7 @@
root.setList("children", addList);
// Verify the pre-condition. The List initially has a size of 1.
- assertEquals("The List returned by getList was not of the expected size.", root.getList("children").size(), 1);
+ assertEquals("The List returned by getList was not of the expected size.", 1, root.getList("children").size());
returnedList = root.getList("children");
@@ -87,12 +87,12 @@
returnedList.add(child2);
- assertEquals("Update to returned List did not affect DataObject correctly. Size of children is not 2", root
- .getList("children").size(), 2);
- assertEquals("Update to returned List did not affect DataObject correctly. child1 is equal to root", child1
- .getContainer(), root);
- assertEquals("Update to returned List did not affect DataObject correctly. child2 is equal to root", child2
- .getContainer(), root);
+ assertEquals("Update to returned List did not affect DataObject correctly. Size of children is not 2",
+ 2, root.getList("children").size());
+ assertEquals("Update to returned List did not affect DataObject correctly. child1 is not equal to root",
+ root, child1.getContainer());
+ assertEquals("Update to returned List did not affect DataObject correctly. child2 is not equal to root",
+ root, child2.getContainer());
/**
* Delete a child and verify that the returned List is automatically
@@ -100,13 +100,14 @@
*/
child1.delete();
- assertEquals("Deleting a DataObject did not affect the returned List.", returnedList.size(), 1);
+ assertEquals("Deleting a DataObject did not affect the returned List.", 1, returnedList.size());
/**
* Verify that the DataObject delete did not affect the original List
* used in the DataObject.setList().
*/
+ // TODO switch the arguments in the rest of this file so that the expected value is the first comparison argument
assertEquals("Deleting a DataObject should not affect a List unassociated with the DataObject.",
addList.size(),
1);
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=533727&r1=533726&r2=533727
==============================================================================
--- 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 Mon Apr 30 05:44:20 2007
@@ -28,13 +28,13 @@
import java.util.ArrayList;
import java.util.List;
-import org.junit.Test;
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.paramatizedTests.BaseSDOParamatizedTest;
+import test.sdo21.framework.ParamaterizedTestBase;
+import test.sdo21.framework.ParameterFactory;
import commonj.sdo.DataObject;
import commonj.sdo.Property;
@@ -47,24 +47,16 @@
*
*/
@RunWith(Parameterized.class)
-public class ContainmentTest extends BaseSDOParamatizedTest {
- public ContainmentTest(DataObject testDO, String description) {
- super(testDO, description);
+public class ContainmentTest extends ParamaterizedTestBase {
+ public ContainmentTest(ParameterFactory pf) {
+ super(pf);
}
-
- /**
- * Insures that the different test cases do not affect each other. Is called
- * before each test.
- */
+
@Before
- public void clearContainment() {
- List addList = new ArrayList();
-
- // Ensure that any previous containment relationships are broken.
-
- addList.clear();
- testDO.setList("children", addList);
- testDO.detach();
+ public void setUp() throws Exception {
+ super.setUp();
+ List addList = new ArrayList();
+ testDO.setList("children", addList);
}
/**
@@ -73,7 +65,7 @@
*/
@Test
public void verifyIsContainment() {
- Property containmentProp = testDO.getProperty("children");
+ Property containmentProp = testDO.getInstanceProperty("children");
assertTrue("Property.isContainment() returned an unexpected value.", containmentProp.isContainment());
}
@@ -103,17 +95,10 @@
public void verifyGetContainer() {
List addList = new ArrayList();
Type type = testDO.getType();
- Property containmentProp = testDO.getProperty("children");
-
- DataObject dataObj1 = CTSSuite.getTestHelper().getDataFactory().create(type);
- DataObject dataObj2 = CTSSuite.getTestHelper().getDataFactory().create(type);
-
- // Ensure that any previous containment relationships are broken.
+ Property containmentProp = testDO.getInstanceProperty("children");
- addList.clear();
- testDO.setList("children", addList);
- testDO.detach();
- addList.clear();
+ DataObject dataObj1 = getScope().getDataFactory().create(type);
+ DataObject dataObj2 = getScope().getDataFactory().create(type);
addList.add(dataObj1);
addList.add(dataObj2);
@@ -134,11 +119,11 @@
*/
@Test
public void verifyGetContainmentProperty() {
- Property containmentProp = testDO.getProperty("children");
+ Property containmentProp = testDO.getInstanceProperty("children");
List addList = new ArrayList();
Type type = testDO.getType();
- DataObject dataObj1 = CTSSuite.getTestHelper().getDataFactory().create(type);
- DataObject dataObj2 = CTSSuite.getTestHelper().getDataFactory().create(type);
+ DataObject dataObj1 = getScope().getDataFactory().create(type);
+ DataObject dataObj2 = getScope().getDataFactory().create(type);
addList.add(dataObj1);
addList.add(dataObj2);
@@ -162,11 +147,11 @@
assertNull("testDO container != null", testDO.getContainer());
assertEquals("testDO.children != 0", 0, testDO.getList("children").size());
- Property containmentProp = testDO.getProperty("children");
+ Property containmentProp = testDO.getInstanceProperty("children");
List addList = new ArrayList();
Type type = testDO.getType();
- DataObject dataObj1 = CTSSuite.getTestHelper().getDataFactory().create(type);
- DataObject dataObj2 = CTSSuite.getTestHelper().getDataFactory().create(type);
+ DataObject dataObj1 = getScope().getDataFactory().create(type);
+ DataObject dataObj2 = getScope().getDataFactory().create(type);
addList.add(dataObj1);
addList.add(dataObj2);
@@ -190,11 +175,11 @@
*/
@Test
public void verifyAutomaticRemoval() {
- Property containmentProp = testDO.getProperty("children");
+ Property containmentProp = testDO.getInstanceProperty("children");
List addList = new ArrayList();
Type type = testDO.getType();
- DataObject dataObj1 = CTSSuite.getTestHelper().getDataFactory().create(type);
- DataObject dataObj2 = CTSSuite.getTestHelper().getDataFactory().create(type);
+ DataObject dataObj1 = getScope().getDataFactory().create(type);
+ DataObject dataObj2 = getScope().getDataFactory().create(type);
addList.add(dataObj1);
addList.add(dataObj2);
@@ -232,11 +217,11 @@
*/
@Test
public void verifyNewContainer() {
- Property containmentProp = testDO.getProperty("children");
+ Property containmentProp = testDO.getInstanceProperty("children");
List addList = new ArrayList();
Type type = testDO.getType();
- DataObject dataObj1 = CTSSuite.getTestHelper().getDataFactory().create(type);
- DataObject dataObj2 = CTSSuite.getTestHelper().getDataFactory().create(type);
+ DataObject dataObj1 = getScope().getDataFactory().create(type);
+ DataObject dataObj2 = getScope().getDataFactory().create(type);
addList.add(dataObj1);
addList.add(dataObj2);
@@ -267,11 +252,11 @@
*/
@Test
public void verifyDetachRemoval() {
- Property containmentProp = testDO.getProperty("children");
+ Property containmentProp = testDO.getInstanceProperty("children");
List addList = new ArrayList();
Type type = testDO.getType();
- DataObject dataObj1 = CTSSuite.getTestHelper().getDataFactory().create(type);
- DataObject dataObj2 = CTSSuite.getTestHelper().getDataFactory().create(type);
+ DataObject dataObj1 = getScope().getDataFactory().create(type);
+ DataObject dataObj2 = getScope().getDataFactory().create(type);
// After the following section, it should be true that: dataObj1
// contains testDO contains dataObj2
@@ -297,11 +282,11 @@
*/
@Test
public void verifyDetachContainer() {
- Property containmentProp = testDO.getProperty("children");
+ Property containmentProp = testDO.getInstanceProperty("children");
List addList = new ArrayList();
Type type = testDO.getType();
- DataObject dataObj1 = CTSSuite.getTestHelper().getDataFactory().create(type);
- DataObject dataObj2 = CTSSuite.getTestHelper().getDataFactory().create(type);
+ DataObject dataObj1 = getScope().getDataFactory().create(type);
+ DataObject dataObj2 = getScope().getDataFactory().create(type);
// After the following section, it should be true that: dataObj1
// contains testDO contains dataObj2
@@ -326,11 +311,11 @@
*/
@Test
public void verifyDetachContainedDOs() {
- Property containmentProp = testDO.getProperty("children");
+ Property containmentProp = testDO.getInstanceProperty("children");
List addList = new ArrayList();
Type type = testDO.getType();
- DataObject dataObj1 = CTSSuite.getTestHelper().getDataFactory().create(type);
- DataObject dataObj2 = CTSSuite.getTestHelper().getDataFactory().create(type);
+ DataObject dataObj1 = getScope().getDataFactory().create(type);
+ DataObject dataObj2 = getScope().getDataFactory().create(type);
// After the following section, it should be true that: dataObj1
// contains testDO contains dataObj2
@@ -351,11 +336,11 @@
*/
@Test
public void verifyDeleteRemoval() {
- Property containmentProp = testDO.getProperty("children");
+ Property containmentProp = testDO.getInstanceProperty("children");
List addList = new ArrayList();
Type type = testDO.getType();
- DataObject dataObj1 = CTSSuite.getTestHelper().getDataFactory().create(type);
- DataObject dataObj2 = CTSSuite.getTestHelper().getDataFactory().create(type);
+ DataObject dataObj1 = getScope().getDataFactory().create(type);
+ DataObject dataObj2 = getScope().getDataFactory().create(type);
// After the following section, it should be true that: dataObj1
// contains testDO contains dataObj2
@@ -378,11 +363,11 @@
*/
@Test
public void verifyDeleteResultsOnDeleted() {
- Property containmentProp = testDO.getProperty("children");
+ Property containmentProp = testDO.getInstanceProperty("children");
List addList = new ArrayList();
Type type = testDO.getType();
- DataObject dataObj1 = CTSSuite.getTestHelper().getDataFactory().create(type);
- DataObject dataObj2 = CTSSuite.getTestHelper().getDataFactory().create(type);
+ DataObject dataObj1 = getScope().getDataFactory().create(type);
+ DataObject dataObj2 = getScope().getDataFactory().create(type);
// After the following section, it should be true that: dataObj1
// contains testDO contains dataObj2
@@ -404,11 +389,11 @@
*/
@Test
public void verifyDeleteAsContainer() {
- Property containmentProp = testDO.getProperty("children");
+ Property containmentProp = testDO.getInstanceProperty("children");
List addList = new ArrayList();
Type type = testDO.getType();
- DataObject dataObj1 = CTSSuite.getTestHelper().getDataFactory().create(type);
- DataObject dataObj2 = CTSSuite.getTestHelper().getDataFactory().create(type);
+ DataObject dataObj1 = getScope().getDataFactory().create(type);
+ DataObject dataObj2 = getScope().getDataFactory().create(type);
// After the following section, it should be true that: dataObj1
// contains testDO contains dataObj2
@@ -431,11 +416,11 @@
*/
@Test
public void verifyDeleteAffectOnContained() {
- Property containmentProp = testDO.getProperty("children");
+ Property containmentProp = testDO.getInstanceProperty("children");
List addList = new ArrayList();
Type type = testDO.getType();
- DataObject dataObj1 = CTSSuite.getTestHelper().getDataFactory().create(type);
- DataObject dataObj2 = CTSSuite.getTestHelper().getDataFactory().create(type);
+ DataObject dataObj1 = getScope().getDataFactory().create(type);
+ DataObject dataObj2 = getScope().getDataFactory().create(type);
// After the following section, it should be true that: dataObj1
// contains testDO contains dataObj2
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org