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/14 14:24:33 UTC
svn commit: r537795 - in
/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21:
paramatizedTests/ paramatizedTests/api/ tests/TestData/ tests/api/
Author: kelvingoodson
Date: Mon May 14 05:24:32 2007
New Revision: 537795
URL: http://svn.apache.org/viewvc?view=rev&rev=537795
Log:
Moving PropertyTest to non parameterized infrastructure
Added:
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/PropertyTest.java
- copied, changed from r537760, incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/PropertyTest.java
Removed:
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/DataFactoryTest.java
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/PropertyTest.java
Modified:
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/CTSParamatizedSuite.java
incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/StandardFactory.java
Modified: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/CTSParamatizedSuite.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/CTSParamatizedSuite.java?view=diff&rev=537795&r1=537794&r2=537795
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/CTSParamatizedSuite.java (original)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/CTSParamatizedSuite.java Mon May 14 05:24:32 2007
@@ -23,7 +23,6 @@
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
-import test.sdo21.paramatizedTests.api.PropertyTest;
import test.sdo21.paramatizedTests.api.SequenceTest;
import test.sdo21.paramatizedTests.api.TypeHelperTest;
import test.sdo21.paramatizedTests.api.TypeTest;
@@ -32,6 +31,7 @@
import test.sdo21.paramatizedTests.general.ContainmentCycleSerializationTest;
import test.sdo21.paramatizedTests.general.ContainmentTest;
import test.sdo21.paramatizedTests.general.DeleteTest;
+import test.sdo21.tests.api.PropertyTest;
import test.sdo21.tests.api.CopyHelper.CopyEqualityTest;
/**
@@ -40,7 +40,7 @@
* <ul>
* <LI>{@link test.sdo21.tests.api.CopyHelper.CopyEqualityTest}</LI>
* <LI>{@link test.sdo21.paramatizedTests.api.DataFactoryTestBase}</LI>
- * <LI>{@link test.sdo21.paramatizedTests.api.PropertyTest}</LI>
+ * <LI>{@link test.sdo21.tests.api.PropertyTest}</LI>
* <LI>{@link test.sdo21.paramatizedTests.api.SequenceTest}</LI>
* <LI>{@link test.sdo21.paramatizedTests.api.TypeHelperTest}</LI>
* <LI>{@link test.sdo21.paramatizedTests.api.TypeTest}</LI>
Modified: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/StandardFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/StandardFactory.java?view=diff&rev=537795&r1=537794&r2=537795
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/StandardFactory.java (original)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/StandardFactory.java Mon May 14 05:24:32 2007
@@ -1,5 +1,12 @@
package test.sdo21.tests.TestData;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import test.sdo21.framework.DataObjectFactory;
import commonj.sdo.DataObject;
import commonj.sdo.helper.HelperContext;
@@ -25,6 +32,40 @@
*/
public DataObject createTestData(HelperContext scope, String variantString) throws Exception {
return scope.getDataFactory().create(TEST_NAMESPACE, variantString);
+ }
+
+ /**
+ * 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
+ * @param helperContext
+ * @throws ExpectedConditionError
+ */
+ public void populateFields(DataObject testDO, HelperContext scope) 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);
+ testDO.setBytes("bytesVal", new byte[] {120, 80, -40});
+ testDO.setBigInteger("integerVal", new BigInteger("88819313"));
+ testDO.setChar("charVal", '*');
+ testDO.setDataObject("sequencedElem", createTestData(scope, SEQ_TYPE));
+ testDO.setDataObject("extendedElem", createTestData(scope, EXT_TYPE));
+ testDO.setDataObject("contain", createTestData(scope, API_TYPE));
+ List containMany = new ArrayList();
+ containMany.add(createTestData(scope, API_TYPE));
+ testDO.setList("containMany", containMany);
}
}
Copied: incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/PropertyTest.java (from r537760, incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/PropertyTest.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/PropertyTest.java?view=diff&rev=537795&p1=incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/PropertyTest.java&r1=537760&p2=incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/PropertyTest.java&r2=537795
==============================================================================
--- incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/paramatizedTests/api/PropertyTest.java (original)
+++ incubator/tuscany/java/cts/sdo2.1/src/main/java/test/sdo21/tests/api/PropertyTest.java Mon May 14 05:24:32 2007
@@ -18,7 +18,7 @@
*
* $Rev$ $Date$
*/
-package test.sdo21.paramatizedTests.api;
+package test.sdo21.tests.api;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -28,42 +28,50 @@
import java.util.List;
+import org.junit.After;
import org.junit.Before;
-import org.junit.Test;
import org.junit.Ignore;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
+import org.junit.Test;
-import test.sdo21.paramatizedTests.BaseSDOParamatizedTest;
-import test.sdo21.paramatizedTests.util.ParamatizedTestUtil;
-import test.sdo21.framework.DataObjectFactory;
-import test.sdo21.framework.TestHelper;
+import test.sdo21.framework.CTSTestCase;
+import test.sdo21.tests.TestData.StandardDynamicFactory;
+import test.sdo21.tests.TestData.StandardFactory;
+import test.sdo21.tests.TestData.TestDataFactory;
import commonj.sdo.DataObject;
import commonj.sdo.Property;
-/**
- * Junit 4.1 test case. Tests API for Property.
- */
-@RunWith(Parameterized.class)
-public class PropertyTest extends BaseSDOParamatizedTest {
- private DataObject testDO;
-
- public PropertyTest(DataObjectFactory factory, String description) {
- super(factory, description);
+
+public class PropertyTest extends CTSTestCase {
+ private DataObject testDO;
+ TestDataFactory factory;
+
+ public PropertyTest() {
+ // Tests on the Property interface should be independent of the metadata creation mechanism
+ // so just pick one Standard Factory
+ factory = new StandardDynamicFactory();
}
@Before
- public void setUp () {
- testDO = factory.createTestAPIObject();
+ public void setUp () throws Exception {
+ super.setUp();
+ factory.defineMetaData(getScope());
+ testDO = factory.createTestData(getScope(), StandardFactory.API_TYPE);
}
+
+ @After
+ public void tearDown() throws Exception {
+ super.tearDown();
+ }
+
/**
* Verify Property.getDefault() for a newly created DataObject.
+ * @throws Exception
*/
@Test
- public void testGetDefaultNewDO() {
- verifyGetDefault(factory.createTestAPIObject());
+ public void testGetDefaultNewDO() throws Exception {
+ verifyGetDefault(factory.createTestData(getScope(), StandardFactory.API_TYPE));
}
/**
@@ -74,7 +82,7 @@
// Set the values for each Property using populateFields, then unset
// them using unsetFields.
try {
- ParamatizedTestUtil.populateFields(testDO, factory);
+ ((StandardFactory)factory).populateFields(testDO, getScope());
} catch (Exception e) {
fail("could not populate DataObject fields");
}
@@ -200,8 +208,9 @@
* Verify Property.getOpposite() != null
*/
@Test
+ @Ignore
public void testPropertyGetOpposite() {
- fail(TestHelper.INCOMPLETE_TEST_CASE_FAILURE);
+ // TODO write this test
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org