From eb11fd83f7908876fe6041086d6025c9468de672 Mon Sep 17 00:00:00 2001 From: lresende Date: Tue, 10 Nov 2009 21:17:39 +0000 Subject: Moving SDO CTS git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@834672 13f79535-47bb-0310-9956-ffa450edef68 --- sdo-java/trunk-cts/pom.xml | 68 + sdo-java/trunk-cts/sdo2.1-tuscany/pom.xml | 81 + .../vendor/tuscany/dataObjectFactory/package.html | 5 + .../tuscany/testHelper/TuscanyTestHelper.java | 148 + .../sdo21/vendor/tuscany/testHelper/package.html | 5 + .../tests/sdo21/vendor/tuscany/api/TypeTest.java | 102 + .../vendor/tuscany/tests/AdoptedCtsTestSuite.java | 42 + .../vendor/tuscany/tests/OptionalCtsTestSuite.java | 36 + .../tuscany/tests/TuscanyOptionalTestSuite.java | 36 + sdo-java/trunk-cts/sdo2.1/BUILDING.txt | 22 + sdo-java/trunk-cts/sdo2.1/LICENSE.txt | 203 ++ sdo-java/trunk-cts/sdo2.1/pom.xml | 50 + .../sdo2.1/src/main/java/test/sdo21/CTSSuite.java | 71 + .../java/test/sdo21/ProposedForAdoptionSuite.java | 43 + .../src/main/java/test/sdo21/UnderReviewSuite.java | 68 + .../java/test/sdo21/framework/CTSTestCase.java | 78 + .../test/sdo21/framework/DataObjectFactory.java | 71 + .../main/java/test/sdo21/framework/TestHelper.java | 190 ++ .../test/sdo21/framework/junit3_8/CTSTestCase.java | 62 + .../main/java/test/sdo21/framework/package.html | 25 + .../sdo2.1/src/main/java/test/sdo21/package.html | 25 + .../java/test/sdo21/tests/CTSGeneralSuite.java | 77 + .../test/sdo21/tests/ConsistencyTestTemplate.java | 195 ++ .../tests/TestData/StandardDynamicFactory.java | 226 ++ .../test/sdo21/tests/TestData/StandardFactory.java | 72 + .../sdo21/tests/TestData/StandardXSDFactory.java | 39 + .../test/sdo21/tests/TestData/TestDataFactory.java | 9 + .../main/java/test/sdo21/tests/TestTemplate.java | 138 + .../test/sdo21/tests/api/CTSConsistencyBase.java | 57 + .../test/sdo21/tests/api/ChangeSummaryTest.java | 122 + .../tests/api/ContainmentCyclePreventionTest.java | 481 +++ .../api/ContainmentCycleSerializationTest.java | 495 +++ .../tests/api/CopyHelper/CopyEqualityTest.java | 148 + .../DataFactory/DataFactoryConsistencyBase.java | 139 + .../DataFactory/DataFactoryConsistencyDynamic.java | 34 + .../DataFactory/DataFactoryConsistencySuite.java | 31 + .../api/DataFactory/DataFactoryConsistencyXSD.java | 34 + .../api/DataGraph/DataGraphConsistencyBase.java | 147 + .../api/DataGraph/DataGraphConsistencyDynamic.java | 34 + .../api/DataGraph/DataGraphConsistencySuite.java | 31 + .../api/DataGraph/DataGraphConsistencyXSD.java | 34 + .../api/DataObject/DataObjectConsistencyBase.java | 739 ++++ .../DataObject/DataObjectConsistencyDynamic.java | 34 + .../api/DataObject/DataObjectConsistencySuite.java | 31 + .../api/DataObject/DataObjectConsistencyXSD.java | 34 + .../sdo21/tests/api/DataObject/DataObjectTest.java | 395 +++ .../tests/api/DynamicTypesFromSchemaTestCase.java | 295 ++ .../java/test/sdo21/tests/api/PropertyTest.java | 263 ++ .../api/Sequence/SequenceConsistencyBase.java | 907 +++++ .../api/Sequence/SequenceConsistencyDynamic.java | 34 + .../api/Sequence/SequenceConsistencySuite.java | 31 + .../tests/api/Sequence/SequenceConsistencyXSD.java | 34 + .../sdo21/tests/api/Sequence/SequenceTest.java | 100 + .../test/sdo21/tests/api/SequenceAddOpenTest.java | 435 +++ .../test/sdo21/tests/api/SequenceAddTypedTest.java | 599 ++++ .../sdo21/tests/api/TypeHelper/TypeHelperTest.java | 436 +++ .../main/java/test/sdo21/tests/api/TypeTest.java | 354 ++ .../sdo21/tests/api/XMLHelper/QNameTestCase.java | 137 + .../api/XMLHelper/XMLHelperConsistencyBase.java | 156 + .../api/XMLHelper/XMLHelperConsistencyDynamic.java | 34 + .../api/XMLHelper/XMLHelperConsistencySuite.java | 31 + .../api/XMLHelper/XMLHelperConsistencyXSD.java | 34 + .../test/sdo21/tests/api/XMLWithoutSchemaTest.java | 151 + .../main/java/test/sdo21/tests/api/package.html | 25 + .../sdo21/tests/conversion/ConversionBase.java | 287 ++ .../sdo21/tests/conversion/DateConversionTest.java | 397 +++ .../tests/conversion/StringConversionTest.java | 746 ++++ .../sdo21/tests/conversion/TypeConversionTest.java | 3583 ++++++++++++++++++++ .../tests/conversion/TypeConversionTest2.java | 1301 +++++++ .../java/test/sdo21/tests/conversion/package.html | 25 + .../test/sdo21/tests/general/XMLHelperTest.java | 651 ++++ .../test/sdo21/tests/general/XSDHelperTest.java | 239 ++ .../java/test/sdo21/tests/general/package.html | 25 + .../src/main/java/test/sdo21/tests/package.html | 25 + .../sdo21/tests/scenarios/DataObjectListTest.java | 542 +++ .../main/java/test/sdo21/tests/util/CTSUtil.java | 207 ++ .../sdo21/tests/util/XMLDifferenceException.java | 35 + .../test/sdo21/tests/util/XMLEqualityChecker.java | 324 ++ .../java/test/sdo21/tests/xsd/XSDBaseTestCase.java | 126 + .../java/test/sdo21/tests/xsd/XSDChoiceTest.java | 173 + .../test/sdo21/tests/xsd/XSDComplexTypeTest.java | 863 +++++ .../test/sdo21/tests/xsd/XSDSimpleTypeTest.java | 364 ++ .../sdo2.1/src/main/resources/api_test.xsd | 89 + .../sdo2.1/src/main/resources/choice/TC224.xsd | 33 + .../sdo2.1/src/main/resources/choice/TC225.xsd | 33 + .../sdo2.1/src/main/resources/choice/TC226.xsd | 33 + .../sdo2.1/src/main/resources/choice/TC227.xsd | 33 + .../src/main/resources/complexType/cT_01.xsd | 27 + .../src/main/resources/complexType/cT_02.xsd | 27 + .../src/main/resources/complexType/cT_03.xsd | 35 + .../src/main/resources/complexType/cT_04.xsd | 35 + .../src/main/resources/complexType/cT_05.xsd | 35 + .../src/main/resources/complexType/cT_06.xsd | 29 + .../src/main/resources/complexType/cT_07.xsd | 27 + .../src/main/resources/complexType/cT_09.xsd | 35 + .../src/main/resources/complexType/cT_10.xsd | 36 + .../src/main/resources/complexType/cT_10_b.xsd | 43 + .../src/main/resources/complexType/cT_11.xsd | 35 + .../src/main/resources/complexType/cT_11_b.xsd | 39 + .../src/main/resources/complexType/cT_17.xsd | 8 + .../src/main/resources/complexType/cT_18.xsd | 29 + .../src/main/resources/complexType/cT_18a.xsd | 29 + .../src/main/resources/complexType/cT_19.xsd | 28 + .../src/main/resources/complexType/cT_20.xsd | 29 + .../src/main/resources/complexType/cT_21.xsd | 33 + .../src/main/resources/complexType/cT_22.xsd | 29 + .../src/main/resources/complexType/cT_23.xsd | 33 + .../src/main/resources/complexType/cT_24.xsd | 26 + .../src/main/resources/complexType/cT_25.xsd | 26 + .../src/main/resources/complexType/cT_26.xsd | 26 + .../src/main/resources/complexType/cT_27.xsd | 26 + .../src/main/resources/complexType/cT_28.xsd | 70 + .../src/main/resources/complexType/cT_29.xsd | 67 + .../src/main/resources/complexType/cT_30.xsd | 33 + .../src/main/resources/complexType/cT_31.xsd | 43 + .../src/main/resources/complexType/cT_32.xsd | 43 + .../src/main/resources/complexType/cT_42.xsd | 27 + .../src/main/resources/complexType/cT_43.xsd | 26 + .../src/main/resources/complexType/cT_44.xsd | 26 + .../src/main/resources/complexType/cT_45.xsd | 24 + .../src/main/resources/complexType/cT_46.xsd | 27 + .../src/main/resources/complexType/cT_47.xsd | 27 + .../src/main/resources/complexType/cT_48.xsd | 49 + .../src/main/resources/complexType/cT_49.xsd | 72 + .../sdo2.1/src/main/resources/customer1.xml | 8 + .../sdo2.1/src/main/resources/customer2.xml | 8 + .../src/main/resources/dynamicTypesFromSchema.xsd | 199 ++ .../src/main/resources/dynamicTypesFromSchema0.xml | 78 + .../src/main/resources/dynamicTypesFromSchema1.xml | 62 + .../src/main/resources/dynamicTypesFromSchema2.xml | 47 + .../trunk-cts/sdo2.1/src/main/resources/mixed2.xml | 12 + .../sdo2.1/src/main/resources/mixedopen.xml | 13 + .../trunk-cts/sdo2.1/src/main/resources/open.xsd | 48 + .../src/main/resources/openContentProperty.xml | 12 + .../src/main/resources/sampleSDOSchema/Person.xsd | 26 + .../trunk-cts/sdo2.1/src/main/resources/simple.xsd | 38 + .../src/main/resources/simpleType/annotation.xsd | 29 + .../src/main/resources/simpleType/anonymous.xsd | 28 + .../src/main/resources/simpleType/derived.xsd | 28 + .../src/main/resources/simpleType/derived2.xsd | 29 + .../src/main/resources/simpleType/derivedUnion.xsd | 40 + .../src/main/resources/simpleType/enumeration.xsd | 49 + .../src/main/resources/simpleType/finalList.xsd | 26 + .../main/resources/simpleType/finalRestriction.xsd | 26 + .../src/main/resources/simpleType/finalUnion.xsd | 26 + .../sdo2.1/src/main/resources/simpleType/list.xsd | 24 + .../src/main/resources/simpleType/restriction.xsd | 26 + .../sdo2.1/src/main/resources/simpleType/union.xsd | 24 + .../src/main/resources/simpleWithChangeSummary.xml | 28 + .../src/main/resources/simpleWithChangeSummary.xsd | 49 + .../resources/simpleWithChangeSummaryUndone.xml | 19 + 151 files changed, 21658 insertions(+) create mode 100644 sdo-java/trunk-cts/pom.xml create mode 100644 sdo-java/trunk-cts/sdo2.1-tuscany/pom.xml create mode 100644 sdo-java/trunk-cts/sdo2.1-tuscany/src/main/java/test/sdo21/vendor/tuscany/dataObjectFactory/package.html create mode 100644 sdo-java/trunk-cts/sdo2.1-tuscany/src/main/java/test/sdo21/vendor/tuscany/testHelper/TuscanyTestHelper.java create mode 100644 sdo-java/trunk-cts/sdo2.1-tuscany/src/main/java/test/sdo21/vendor/tuscany/testHelper/package.html create mode 100644 sdo-java/trunk-cts/sdo2.1-tuscany/src/main/java/tests/sdo21/vendor/tuscany/api/TypeTest.java create mode 100644 sdo-java/trunk-cts/sdo2.1-tuscany/src/test/java/test/sdo21/vendor/tuscany/tests/AdoptedCtsTestSuite.java create mode 100644 sdo-java/trunk-cts/sdo2.1-tuscany/src/test/java/test/sdo21/vendor/tuscany/tests/OptionalCtsTestSuite.java create mode 100644 sdo-java/trunk-cts/sdo2.1-tuscany/src/test/java/test/sdo21/vendor/tuscany/tests/TuscanyOptionalTestSuite.java create mode 100644 sdo-java/trunk-cts/sdo2.1/BUILDING.txt create mode 100644 sdo-java/trunk-cts/sdo2.1/LICENSE.txt create mode 100644 sdo-java/trunk-cts/sdo2.1/pom.xml create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/CTSSuite.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/ProposedForAdoptionSuite.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/UnderReviewSuite.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/framework/CTSTestCase.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/framework/DataObjectFactory.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/framework/TestHelper.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/framework/junit3_8/CTSTestCase.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/framework/package.html create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/package.html create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/CTSGeneralSuite.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/ConsistencyTestTemplate.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/StandardDynamicFactory.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/StandardFactory.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/StandardXSDFactory.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/TestDataFactory.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/TestTemplate.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/api/CTSConsistencyBase.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/api/ChangeSummaryTest.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/api/ContainmentCyclePreventionTest.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/api/ContainmentCycleSerializationTest.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/api/CopyHelper/CopyEqualityTest.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataFactory/DataFactoryConsistencyBase.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataFactory/DataFactoryConsistencyDynamic.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataFactory/DataFactoryConsistencySuite.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataFactory/DataFactoryConsistencyXSD.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataGraph/DataGraphConsistencyBase.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataGraph/DataGraphConsistencyDynamic.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataGraph/DataGraphConsistencySuite.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataGraph/DataGraphConsistencyXSD.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataObject/DataObjectConsistencyBase.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataObject/DataObjectConsistencyDynamic.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataObject/DataObjectConsistencySuite.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataObject/DataObjectConsistencyXSD.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/api/DataObject/DataObjectTest.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/api/DynamicTypesFromSchemaTestCase.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/api/PropertyTest.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/api/Sequence/SequenceConsistencyBase.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/api/Sequence/SequenceConsistencyDynamic.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/api/Sequence/SequenceConsistencySuite.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/api/Sequence/SequenceConsistencyXSD.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/api/Sequence/SequenceTest.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/api/SequenceAddOpenTest.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/api/SequenceAddTypedTest.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/api/TypeHelper/TypeHelperTest.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/api/TypeTest.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/api/XMLHelper/QNameTestCase.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/api/XMLHelper/XMLHelperConsistencyBase.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/api/XMLHelper/XMLHelperConsistencyDynamic.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/api/XMLHelper/XMLHelperConsistencySuite.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/api/XMLHelper/XMLHelperConsistencyXSD.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/api/XMLWithoutSchemaTest.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/api/package.html create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/conversion/ConversionBase.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/conversion/DateConversionTest.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/conversion/StringConversionTest.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/conversion/TypeConversionTest.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/conversion/TypeConversionTest2.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/conversion/package.html create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/general/XMLHelperTest.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/general/XSDHelperTest.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/general/package.html create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/package.html create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/scenarios/DataObjectListTest.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/util/CTSUtil.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/util/XMLDifferenceException.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/util/XMLEqualityChecker.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/xsd/XSDBaseTestCase.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/xsd/XSDChoiceTest.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/xsd/XSDComplexTypeTest.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/xsd/XSDSimpleTypeTest.java create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/api_test.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/choice/TC224.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/choice/TC225.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/choice/TC226.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/choice/TC227.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/complexType/cT_01.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/complexType/cT_02.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/complexType/cT_03.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/complexType/cT_04.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/complexType/cT_05.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/complexType/cT_06.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/complexType/cT_07.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/complexType/cT_09.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/complexType/cT_10.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/complexType/cT_10_b.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/complexType/cT_11.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/complexType/cT_11_b.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/complexType/cT_17.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/complexType/cT_18.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/complexType/cT_18a.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/complexType/cT_19.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/complexType/cT_20.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/complexType/cT_21.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/complexType/cT_22.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/complexType/cT_23.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/complexType/cT_24.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/complexType/cT_25.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/complexType/cT_26.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/complexType/cT_27.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/complexType/cT_28.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/complexType/cT_29.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/complexType/cT_30.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/complexType/cT_31.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/complexType/cT_32.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/complexType/cT_42.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/complexType/cT_43.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/complexType/cT_44.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/complexType/cT_45.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/complexType/cT_46.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/complexType/cT_47.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/complexType/cT_48.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/complexType/cT_49.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/customer1.xml create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/customer2.xml create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/dynamicTypesFromSchema.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/dynamicTypesFromSchema0.xml create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/dynamicTypesFromSchema1.xml create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/dynamicTypesFromSchema2.xml create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/mixed2.xml create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/mixedopen.xml create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/open.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/openContentProperty.xml create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/sampleSDOSchema/Person.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/simple.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/simpleType/annotation.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/simpleType/anonymous.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/simpleType/derived.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/simpleType/derived2.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/simpleType/derivedUnion.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/simpleType/enumeration.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/simpleType/finalList.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/simpleType/finalRestriction.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/simpleType/finalUnion.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/simpleType/list.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/simpleType/restriction.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/simpleType/union.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/simpleWithChangeSummary.xml create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/simpleWithChangeSummary.xsd create mode 100644 sdo-java/trunk-cts/sdo2.1/src/main/resources/simpleWithChangeSummaryUndone.xml (limited to 'sdo-java/trunk-cts') diff --git a/sdo-java/trunk-cts/pom.xml b/sdo-java/trunk-cts/pom.xml new file mode 100644 index 0000000000..65aeb92fb0 --- /dev/null +++ b/sdo-java/trunk-cts/pom.xml @@ -0,0 +1,68 @@ + + + + + org.apache.tuscany + parent + 3-SNAPSHOT + + + 4.0.0 + org.apache.tuscany + tuscany-sdo-cts + Community Test Suite + 1.0-SNAPSHOT + pom + + + + + apache.incubator + Apache Incubator Repository + http://people.apache.org/repo/m2-incubating-repository/ + + true + + + false + + + + + apache.snapshots + Apache SNAPSHOT Repository + http://people.apache.org/repo/m2-snapshot-repository + + false + + + true + + + + + + install + + + sdo2.1 + sdo2.1-tuscany + + diff --git a/sdo-java/trunk-cts/sdo2.1-tuscany/pom.xml b/sdo-java/trunk-cts/sdo2.1-tuscany/pom.xml new file mode 100644 index 0000000000..283d3fbdac --- /dev/null +++ b/sdo-java/trunk-cts/sdo2.1-tuscany/pom.xml @@ -0,0 +1,81 @@ + + 4.0.0 + + + tuscany-sdo-cts + org.apache.tuscany + 1.0-SNAPSHOT + + + org.apache.tuscany.cts + tuscany-sdo-cts-tuscany + Tuscany SDO 2.1 CTS + 1.0-SNAPSHOT + + + 2.1 + + + + + + maven-compiler-plugin + + 1.5 + 1.5 + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + **/AdoptedCtsTestSuite.java + + + **/OptionalCtsTestSuite.java + + + + + + + + + + junit + junit + 4.1 + + + org.apache.tuscany.sdo + tuscany-sdo-api-r${specVersion} + 1.0-SNAPSHOT + + + org.apache.tuscany.cts + tuscany-sdo-cts-standard + 1.0-SNAPSHOT + + + org.apache.tuscany.sdo + tuscany-sdo-impl + 1.0-SNAPSHOT + + + stax + stax-api + 1.0.1 + provided + true + + + org.codehaus.woodstox + wstx-asl + 3.2.0 + runtime + + + + diff --git a/sdo-java/trunk-cts/sdo2.1-tuscany/src/main/java/test/sdo21/vendor/tuscany/dataObjectFactory/package.html b/sdo-java/trunk-cts/sdo2.1-tuscany/src/main/java/test/sdo21/vendor/tuscany/dataObjectFactory/package.html new file mode 100644 index 0000000000..414d58e830 --- /dev/null +++ b/sdo-java/trunk-cts/sdo2.1-tuscany/src/main/java/test/sdo21/vendor/tuscany/dataObjectFactory/package.html @@ -0,0 +1,5 @@ + + +Contains implementation of DataObject Factory from Tuscany. + + diff --git a/sdo-java/trunk-cts/sdo2.1-tuscany/src/main/java/test/sdo21/vendor/tuscany/testHelper/TuscanyTestHelper.java b/sdo-java/trunk-cts/sdo2.1-tuscany/src/main/java/test/sdo21/vendor/tuscany/testHelper/TuscanyTestHelper.java new file mode 100644 index 0000000000..24e29704ed --- /dev/null +++ b/sdo-java/trunk-cts/sdo2.1-tuscany/src/main/java/test/sdo21/vendor/tuscany/testHelper/TuscanyTestHelper.java @@ -0,0 +1,148 @@ +/** + * + * 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.vendor.tuscany.testHelper; + +import static org.junit.Assert.fail; + +import java.io.InputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.OutputStream; +import java.util.Collection; +import java.util.List; +import java.util.logging.Logger; + +import javax.xml.stream.XMLStreamWriter; + +import org.apache.tuscany.sdo.util.SDOUtil; + +import test.sdo21.framework.DataObjectFactory; +import test.sdo21.framework.TestHelper; + +import commonj.sdo.DataGraph; +import commonj.sdo.DataObject; +import commonj.sdo.Type; +import commonj.sdo.helper.HelperContext; +import commonj.sdo.helper.TypeHelper; + +/** + * Implementation of TestHelper for Tuscany. + */ +public class TuscanyTestHelper implements TestHelper { + + private static List staticArtifacts = null; + private static final Logger logger = Logger.getLogger(TuscanyTestHelper.class.getName()); + + public void init() { + } + + public DataObject createTypeDef(String uri, String name, boolean open, HelperContext helperContext) { + throw new IllegalStateException("This method is deprecated in the TestHelper interface and we should not introduce dependencies on it in the test suite"); + } + + public DataObject createPropertyDef(DataObject typeDef, + String propertyName, + Type type, + boolean isMany, + boolean isContainment) { + throw new IllegalStateException("This method is deprecated in the TestHelper interface and we should not introduce dependencies on it in the test suite"); + } + + public DataObject createPropertyDef(DataObject typeDef, + String propertyName, + String typeName, + boolean isMany, + boolean isContainment, + HelperContext helperContext) { + throw new IllegalStateException("This method is deprecated in the TestHelper interface and we should not introduce dependencies on it in the test suite"); + } + + public String createUniqueName() { + return "name-" + System.currentTimeMillis() + "-" + ((int)(1000 * Math.random())); + } + + + + /** + * Create an empty data graph. + * + * @return the new data graph instance. + */ + public DataGraph createDataGraph() { + return SDOUtil.createDataGraph(); + } + + /** + * Create a new HelperContext, a new scope + * @return the new HelperContext instance. + */ + public HelperContext createHelperContext() { + return SDOUtil.createHelperContext(); + } + + + /** + * Create a new ObjectOutputStream + * + * @return the new ObjectOutputStream instance. + */ + public ObjectOutputStream createObjectOutputStream(OutputStream os, HelperContext helperContext) { + try { + return SDOUtil.createObjectOutputStream(os, helperContext); + } catch (java.io.IOException e) { + fail("IOException during createObjectOutputStream."); + return null; + } + } + + /** + * Create a new ObjectInputStream + * + * @return the new ObjectInputStream instance. + */ + public ObjectInputStream createObjectInputStream(InputStream is, HelperContext helperContext) { + try { + return SDOUtil.createObjectInputStream(is, helperContext); + } catch (java.io.IOException e) { + fail("IOException during createObjectOutputStream."); + return null; + } + } + + /** + * Serialize a DataObject using an XMLStreamHelper + */ + public void serializeViaXMLStreamHelper(TypeHelper typeHelper, DataObject dataObject, XMLStreamWriter serializer) { + try { + SDOUtil.createXMLStreamHelper(typeHelper).saveObject(dataObject, serializer); + } catch (javax.xml.stream.XMLStreamException e) { + fail("XMLStreamException during saveObject."); + } + } + + public DataObjectFactory createDataObjectFactory(String factory, HelperContext helperContext) { + throw new IllegalStateException("This method is deprecated in the TestHelper interface and we should not introduce dependencies on it in the test suite"); + } + + public Collection getParamatizedDataObject() { + throw new IllegalStateException("This method is deprecated in the TestHelper interface and we should not introduce dependencies on it in the test suite"); + } + +} diff --git a/sdo-java/trunk-cts/sdo2.1-tuscany/src/main/java/test/sdo21/vendor/tuscany/testHelper/package.html b/sdo-java/trunk-cts/sdo2.1-tuscany/src/main/java/test/sdo21/vendor/tuscany/testHelper/package.html new file mode 100644 index 0000000000..71f356ab14 --- /dev/null +++ b/sdo-java/trunk-cts/sdo2.1-tuscany/src/main/java/test/sdo21/vendor/tuscany/testHelper/package.html @@ -0,0 +1,5 @@ + + +Contains implementation of test helpers from Tuscany. + + diff --git a/sdo-java/trunk-cts/sdo2.1-tuscany/src/main/java/tests/sdo21/vendor/tuscany/api/TypeTest.java b/sdo-java/trunk-cts/sdo2.1-tuscany/src/main/java/tests/sdo21/vendor/tuscany/api/TypeTest.java new file mode 100644 index 0000000000..1558a6341e --- /dev/null +++ b/sdo-java/trunk-cts/sdo2.1-tuscany/src/main/java/tests/sdo21/vendor/tuscany/api/TypeTest.java @@ -0,0 +1,102 @@ +/* + * 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: 537885 $ $Date: 2007-05-14 16:39:47 +0100 (Mon, 14 May 2007) $ + */ +package tests.sdo21.vendor.tuscany.api; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotSame; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import java.util.List; + +import org.junit.After; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; + +import test.sdo21.framework.CTSTestCase; +import test.sdo21.tests.ConsistencyTestTemplate; +import test.sdo21.tests.TestData.StandardDynamicFactory; +import test.sdo21.tests.TestData.StandardFactory; +import test.sdo21.tests.TestData.StandardXSDFactory; +import test.sdo21.tests.TestData.TestDataFactory; +import test.sdo21.tests.api.CTSConsistencyBase; + +import commonj.sdo.DataObject; +import commonj.sdo.Property; +import commonj.sdo.Type; + + +public abstract class TypeTest extends CTSConsistencyBase { + public TypeTest() { + } + + public static class DynamicMetadata extends TypeTest { + public DynamicMetadata() { + + } + public TestDataFactory createTestDataFactory() { + + return new StandardDynamicFactory(); + } + } + + public static class XSDMetadata extends TypeTest { + + public XSDMetadata() { + } + + public TestDataFactory createTestDataFactory() { + + return new StandardXSDFactory(); + } + } + + + @Before + public void setUp () throws Exception { + super.setUp(); + } + + @After + public void tearDown() throws Exception { + super.tearDown(); + } + + + /** + * Verify the value returned by Type.getAliasNames() when there are alias + * names to return + */ + @Ignore("typeGetAliasNames test case is suppressed until SDOUtil.addAliasName is implemented.") + @Test + public void typeGetAliasNames() { + Type sequencedType = testDO.getInstanceProperty("sequencedElem").getType(); + List aliases = sequencedType.getAliasNames(); + + assertEquals("The List returned by Type.getAliasNames was not of the expected size.", 1, aliases.size()); + + String aliasName = (String)aliases.get(1); + assertEquals("The alias returned by Type.getAliasNames was not the expected name.", "Seq2", aliasName); + } + +} diff --git a/sdo-java/trunk-cts/sdo2.1-tuscany/src/test/java/test/sdo21/vendor/tuscany/tests/AdoptedCtsTestSuite.java b/sdo-java/trunk-cts/sdo2.1-tuscany/src/test/java/test/sdo21/vendor/tuscany/tests/AdoptedCtsTestSuite.java new file mode 100644 index 0000000000..52f4f783e9 --- /dev/null +++ b/sdo-java/trunk-cts/sdo2.1-tuscany/src/test/java/test/sdo21/vendor/tuscany/tests/AdoptedCtsTestSuite.java @@ -0,0 +1,42 @@ +/* + * 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.vendor.tuscany.tests; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + + +/** + *

+ * Provided to execute the SDO CTS for tuscany environment. + *

+ * {@link test.sdo21.CTSSuite} contains all adopted test cases for the CTS. + * New test cases, or test cases that do not have consencus by the community + * should be placed in the {@link test.sdo21.UnderReviewSuite} suite. + *

+ */ +@RunWith(Suite.class) +@Suite.SuiteClasses( {test.sdo21.CTSSuite.class}) +public class AdoptedCtsTestSuite { + + +} diff --git a/sdo-java/trunk-cts/sdo2.1-tuscany/src/test/java/test/sdo21/vendor/tuscany/tests/OptionalCtsTestSuite.java b/sdo-java/trunk-cts/sdo2.1-tuscany/src/test/java/test/sdo21/vendor/tuscany/tests/OptionalCtsTestSuite.java new file mode 100644 index 0000000000..ea98f5f37f --- /dev/null +++ b/sdo-java/trunk-cts/sdo2.1-tuscany/src/test/java/test/sdo21/vendor/tuscany/tests/OptionalCtsTestSuite.java @@ -0,0 +1,36 @@ +/* + * 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.vendor.tuscany.tests; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +/** + * Provided to execute the non adopted test cases in the SDO CTS within tuscany + * environment using the maven plugin. The {@link test.sdo21.CTSSuite} suite contains + * test cases that have been 'adopted' by the community, {@link test.sdo21.UnderReviewSuite} + * contains new test cases under review for inclusion. + */ +@RunWith(Suite.class) +@Suite.SuiteClasses( {test.sdo21.UnderReviewSuite.class, + test.sdo21.vendor.tuscany.tests.TuscanyOptionalTestSuite.class}) +public class OptionalCtsTestSuite { + +} diff --git a/sdo-java/trunk-cts/sdo2.1-tuscany/src/test/java/test/sdo21/vendor/tuscany/tests/TuscanyOptionalTestSuite.java b/sdo-java/trunk-cts/sdo2.1-tuscany/src/test/java/test/sdo21/vendor/tuscany/tests/TuscanyOptionalTestSuite.java new file mode 100644 index 0000000000..0704643b4c --- /dev/null +++ b/sdo-java/trunk-cts/sdo2.1-tuscany/src/test/java/test/sdo21/vendor/tuscany/tests/TuscanyOptionalTestSuite.java @@ -0,0 +1,36 @@ +/* + * 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.vendor.tuscany.tests; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +/** + * Provided to execute the non adopted test cases in the SDO CTS within tuscany + * environment using the maven plugin. The {@link test.sdo21.CTSSuite} suite contains + * test cases that have been 'adopted' by the community, {@link test.sdo21.UnderReviewSuite} + * contains new test cases under review for inclusion. + */ +@RunWith(Suite.class) +@Suite.SuiteClasses( {tests.sdo21.vendor.tuscany.api.TypeTest.DynamicMetadata.class, + tests.sdo21.vendor.tuscany.api.TypeTest.XSDMetadata.class}) +public class TuscanyOptionalTestSuite { + +} diff --git a/sdo-java/trunk-cts/sdo2.1/BUILDING.txt b/sdo-java/trunk-cts/sdo2.1/BUILDING.txt new file mode 100644 index 0000000000..d80e5346a7 --- /dev/null +++ b/sdo-java/trunk-cts/sdo2.1/BUILDING.txt @@ -0,0 +1,22 @@ +Building the SDO 2.1 Community Test Suite +========================================================================= + + +Initial Setup +------------- +1) Install J2SE JDK 1.4.2 or above +2) Install Maven: +Download Maven 2.0.4 (download from http://maven.apache.org/download.html). + + + +Building +-------- + +1) Edit the pom.xml to enable a specific implementation to be tested (?) +2) Execute: mvn + + +Note: Depending on the load being experienced by remote Maven 2.0 repositories you may have to execute mvn several times + until required dependencies are all located in your local maven repository. After you have completed a full successful + build you can use "mvn -o" which is much faster. diff --git a/sdo-java/trunk-cts/sdo2.1/LICENSE.txt b/sdo-java/trunk-cts/sdo2.1/LICENSE.txt new file mode 100644 index 0000000000..6b0b1270ff --- /dev/null +++ b/sdo-java/trunk-cts/sdo2.1/LICENSE.txt @@ -0,0 +1,203 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed 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. + diff --git a/sdo-java/trunk-cts/sdo2.1/pom.xml b/sdo-java/trunk-cts/sdo2.1/pom.xml new file mode 100644 index 0000000000..06116554f2 --- /dev/null +++ b/sdo-java/trunk-cts/sdo2.1/pom.xml @@ -0,0 +1,50 @@ + + + tuscany-sdo-cts + org.apache.tuscany + 1.0-SNAPSHOT + + 4.0.0 + org.apache.tuscany.cts + tuscany-sdo-cts-standard + Community Test Suite for SDO 2.1 + 1.0-SNAPSHOT + + + + maven-compiler-plugin + + 1.5 + 1.5 + + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + + + + + + junit + junit + 4.1 + + + org.apache.tuscany.sdo + tuscany-sdo-api-r${specVersion} + 1.0-SNAPSHOT + + + org.apache.ws.commons.schema + XmlSchema + 1.2 + + + + 2.1 + + diff --git a/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/CTSSuite.java b/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/CTSSuite.java new file mode 100644 index 0000000000..21f4129a32 --- /dev/null +++ b/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/CTSSuite.java @@ -0,0 +1,71 @@ +/* + * 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; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +/** + * The main "root" CTS test suite which includes execution of the following + * sub-categorized CTS within Junit 4.1 environment: + * + * In general vendors will simply execute their junit 4.1 harness with this + * class in order to run the CTS. They can optionally include the individual + * test cases that they wish to use. New test cases, or test cases that do not + * have consencus by the community should be placed in the + * {@link test.sdo21.UnderReviewSuite} suite. + */ + +@RunWith(Suite.class) +@Suite.SuiteClasses( {test.sdo21.tests.CTSGeneralSuite.class}) +public class CTSSuite { + + /** + * Name of environment variable for vendor specific implementation for + * implementation of {@link test.sdo21.framework.TestHelper} + */ + public static final String SDO_CTS_TESTHELPER_CLASS = "CTS_TEST_HELPER"; + + + /** + * Main method allows tests to be run directly from command-line. + * + * @param args + */ + // TODO: add some usefull paramaters here such as helper class or junit + // runner + public static void main(String[] args) { + try { + // TODO: provide vender specific initialization + org.junit.runner.JUnitCore.runClasses(Class.forName("test.sdo21.CTSSuite")); + } catch (ClassNotFoundException e) { + System.out.println("Exception " + e.toString()); + e.printStackTrace(); + } + } + + + +} diff --git a/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/ProposedForAdoptionSuite.java b/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/ProposedForAdoptionSuite.java new file mode 100644 index 0000000000..73355b0b3a --- /dev/null +++ b/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/ProposedForAdoptionSuite.java @@ -0,0 +1,43 @@ +/* + * 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: 538933 $ $Date: 2007-05-17 15:11:43 +0100 (Thu, 17 May 2007) $ + */ +package test.sdo21; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +import test.sdo21.tests.CTSGeneralSuite; +import test.sdo21.tests.api.TypeTest; +import test.sdo21.tests.api.DataFactory.DataFactoryConsistencySuite; +import test.sdo21.tests.api.DataGraph.DataGraphConsistencySuite; +import test.sdo21.tests.api.XMLHelper.QNameTestCase; + +/** + * This suite of tests is for test cases which have been reviewed, by + * a member of the community and proposed on the mailing list as suitable for adoption. + * After mailing list discussion or in the absence of any contention, lazy consensus + * the tests can be moved to the appropriate place, i.e. the {@link CTSGeneralSuite} or back to + * the {@link UnderReviewSuite} suite. + */ +@RunWith(Suite.class) +@Suite.SuiteClasses( {QNameTestCase.class}) +public class ProposedForAdoptionSuite { + +} diff --git a/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/UnderReviewSuite.java b/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/UnderReviewSuite.java new file mode 100644 index 0000000000..5ac65e7d7f --- /dev/null +++ b/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/UnderReviewSuite.java @@ -0,0 +1,68 @@ +/* + * 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; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +import test.sdo21.tests.api.ChangeSummaryTest; +import test.sdo21.tests.api.ContainmentCyclePreventionTest; +import test.sdo21.tests.api.ContainmentCycleSerializationTest; +import test.sdo21.tests.api.PropertyTest; +import test.sdo21.tests.api.XMLWithoutSchemaTest; +import test.sdo21.tests.api.TypeHelper.TypeHelperTest; +import test.sdo21.tests.api.CopyHelper.CopyEqualityTest; +import test.sdo21.tests.api.Sequence.SequenceConsistencySuite; +import test.sdo21.tests.api.Sequence.SequenceTest; +import test.sdo21.tests.api.XMLHelper.XMLHelperConsistencySuite; +import test.sdo21.tests.conversion.StringConversionTest; +import test.sdo21.tests.conversion.TypeConversionTest2; + +/** + * This suite of tests is for new test cases, or test cases that are currently + * under review by the community. Once a test has been adopted it can be moved + * into {@link test.sdo21.tests.CTSGeneralSuite} for inclusion into + * the CTS. + */ +@RunWith(Suite.class) +@Suite.SuiteClasses( {ProposedForAdoptionSuite.class, + + StringConversionTest.class, + XMLWithoutSchemaTest.class, + SequenceConsistencySuite.class, + TypeHelperTest.class, + XMLHelperConsistencySuite.class, + ContainmentCyclePreventionTest.DynamicMetadata.class, + ContainmentCyclePreventionTest.XSDMetadata.class, + ContainmentCycleSerializationTest.DynamicMetadata.class, + ContainmentCycleSerializationTest.XSDMetadata.class, + CopyEqualityTest.DynamicMetadata.class, + CopyEqualityTest.XSDMetadata.class, + PropertyTest.class, + TypeConversionTest2.class, + ChangeSummaryTest.class, + + SequenceTest.class + + }) +public class UnderReviewSuite { + +} diff --git a/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/framework/CTSTestCase.java b/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/framework/CTSTestCase.java new file mode 100644 index 0000000000..4fd3e71541 --- /dev/null +++ b/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/framework/CTSTestCase.java @@ -0,0 +1,78 @@ +/* + * 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 junit.framework.TestCase; +import commonj.sdo.helper.HelperContext; + +/** + * A superclass for tests classes. It creates a HelperContext per test case invocation + * and provides initialization/access to the implementation sepcific test helper. + * See also the {@link test.sdo21.framework.junit3_8.CTSTestCase} Junit 3.8 variant of this + * class which inherits from {@link TestCase} in the junit 3.8 style of testing, + * but delegates to this class for much of its CTS function. + */ +public class CTSTestCase { + + private static TestHelper testHelper = null; + private HelperContext scope = null; + public static final String SDO_CTS_TESTHELPER_CLASS = "CTS_TEST_HELPER"; + + private static void initTestHelper() throws Exception { + String helperClassName = System.getenv(SDO_CTS_TESTHELPER_CLASS); + + if ((helperClassName == null) || (helperClassName.equals(""))) { + System.out.println(SDO_CTS_TESTHELPER_CLASS + " was not set - attempting Tuscany implementation : " + + helperClassName); + helperClassName = "test.sdo21.vendor.tuscany.testHelper.TuscanyTestHelper"; + } + + testHelper = (TestHelper)Class.forName(helperClassName).newInstance(); + System.out.println("Loaded " + helperClassName); + // initialize SDO implementation + testHelper.init(); + } + + + public void setUp() throws Exception { + scope = getTestHelper().createHelperContext(); + } + + + public void tearDown() throws Exception { + scope = null; + } + + public HelperContext getScope() { + return scope; + } + + public static TestHelper getTestHelper() { + if(testHelper == null) { + try { + initTestHelper(); + } catch (Exception e) { + e.printStackTrace(); + } + } + return testHelper; + } + +} diff --git a/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/framework/DataObjectFactory.java b/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/framework/DataObjectFactory.java new file mode 100644 index 0000000000..35feecce79 --- /dev/null +++ b/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/framework/DataObjectFactory.java @@ -0,0 +1,71 @@ +/* + * 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.framework; + +import test.sdo21.tests.ConsistencyTestTemplate; +import test.sdo21.tests.TestData.StandardFactory; +import test.sdo21.tests.TestData.TestDataFactory; +import test.sdo21.tests.api.CTSConsistencyBase; +import commonj.sdo.DataObject; +import commonj.sdo.helper.HelperContext; + +/** + * Vendors can provide an implementation of this interface to provide + * DataObjects in the appropriate manner for the test scenario. + * @deprecated + * @see TestDataFactory + * @see CTSConsistencyBase + * @see StandardFactory + * @see ConsistencyTestTemplate + */ +public interface DataObjectFactory { + + /** + * Returns the scoped used for this DataObjectFactory + * @return + */ + public HelperContext getHelperContext(); + + /** + * Returns the name of the static package used for this DataObjectFactory. + * Returns null in the case of dynamic. + * @return + */ + public String getPackage(); + + /** + * Creates and returns a DataObject of Type 'APITest' + * @return + */ + public DataObject createTestAPIObject(); + + /** + * Creates and returns a DataObject of Type 'Sequenced' + * @return + */ + public DataObject createSequencedObject(); + + /** + * Creates and returns a DataObject of Type 'Extended' + * @return + */ + public DataObject createExtendedObject(); +} diff --git a/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/framework/TestHelper.java b/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/framework/TestHelper.java new file mode 100644 index 0000000000..7bbe7ee11d --- /dev/null +++ b/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/framework/TestHelper.java @@ -0,0 +1,190 @@ +/* + * 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.framework; + +import java.io.InputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.OutputStream; +import java.util.Collection; + +import test.sdo21.tests.ConsistencyTestTemplate; +import test.sdo21.tests.TestData.StandardDynamicFactory; +import test.sdo21.tests.TestData.StandardFactory; +import test.sdo21.tests.TestData.StandardXSDFactory; +import test.sdo21.tests.TestData.TestDataFactory; +import test.sdo21.tests.util.CTSUtil; + +import commonj.sdo.DataGraph; +import commonj.sdo.DataObject; +import commonj.sdo.Type; +import commonj.sdo.helper.HelperContext; + +/** + * Vendors can provide an implementation of this interface to bootstrap their + * SDO implementation. + */ +public interface TestHelper { + + public static final String INCOMPLETE_TEST_CASE_FAILURE = "The following test case is incomplete"; + + /** + * Initialize the SDO implementation being tests. + */ + public void init(); + + /** + * Returns collection containing DataObject, String pairs to be used as + * arguments to paramatized test cases. DataObjects should adhere to + * api_test.xsd and should be populated. The String should be a description + * of the mechanism used to create and populate the DataObject. + * + * @deprecated @see {@link ConsistencyTestTemplate} + */ + public Collection getParamatizedDataObject(); + + /** + * Convenience method for creating a type definition. + * + * @param uri + * @param name + * @param helperContext + * @return + * @deprecated + * @see CTSUtil + */ + public DataObject createTypeDef(String uri, String name, boolean open, HelperContext helperContext); + + /** + * Convenience method for creating a property definition + * + * @param typeDef The type definition that this property should be added to + * @param name The name for the property + * @param type The type to assign to the property + * @param isMany + * @param isContainment + * @return + * @deprecated + * @see CTSUtil + */ + public DataObject createPropertyDef(DataObject typeDef, + String name, + Type type, + boolean isMany, + boolean isContainment); + + /** + * Convenience method for creating a property definition + * + * @param typeDef The type definition that this property should be added to + * @param name The name for the property + * @param type The type to assign to the property e.g. + * "commonj.sdo#DataObject" + * @param isMany + * @param isContainment + * @param helperContext + * @return + * + * @deprecated + * @see CTSUtil + + */ + public DataObject createPropertyDef(DataObject typeDef, + String name, + String type, + boolean isMany, + boolean isContainment, + HelperContext helperContext); + + /** + * Convenience method for creating a unique name that can be used for a + * property or type. + * + * @return String containing a unique name + * + * @deprecated + * @see CTSUtil + + */ + public String createUniqueName(); + + /** + * Create an empty data graph. + * + * @return the new data graph instance. + */ + public DataGraph createDataGraph(); + + /** + * Create a new HelperContext, a new scope + * + * @return the new HelperContext instance. + */ + public HelperContext createHelperContext(); + + /** + * Create a new DataObjectFactory + * + * @return the new DataObjectFactory instance. + * @deprecated + * @see TestDataFactory + * @see StandardFactory + * @see StandardDynamicFactory + * @see StandardXSDFactory + * + */ + public DataObjectFactory createDataObjectFactory(String factory, + HelperContext helperContext); + + /** + * @return Static SDO that adhere's to simple.xsd + + public DataObject getSimpleSDO(); + */ + /** + * @return Static Quote SDO from simple.xsd defintion. + + public DataObject getSimpleQuoteSDO(); + */ + + /** + * Create a new ObjectOutputStream + * + * @return the new ObjectOutputStream instance. + */ + public ObjectOutputStream createObjectOutputStream(OutputStream os, + HelperContext helperContext); + + /** + * Create a new ObjectInutStream + * + * @return the new ObjectInputStream instance. + */ + public ObjectInputStream createObjectInputStream(InputStream is, + HelperContext helperContext); + + /** + * Serialize a DataObject using an XMLStreamHelper + */ +// public void serializeViaXMLStreamHelper(TypeHelper typeHelper, +// DataObject dataObject, +// XMLStreamWriter serializer); +} diff --git a/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/framework/junit3_8/CTSTestCase.java b/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/framework/junit3_8/CTSTestCase.java new file mode 100644 index 0000000000..c7d202b6b0 --- /dev/null +++ b/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/framework/junit3_8/CTSTestCase.java @@ -0,0 +1,62 @@ +/* + * 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.junit3_8; + +import test.sdo21.framework.TestHelper; +import commonj.sdo.helper.HelperContext; + +import junit.framework.TestCase; + +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) { + super(title); + delegate = new test.sdo21.framework.CTSTestCase(); + } + + @Override + public void setUp() throws Exception { + super.setUp(); + delegate.setUp(); + } + + @Override + public void tearDown() throws Exception { + delegate.tearDown(); + super.tearDown(); + } + + public HelperContext getScope() { + return delegate.getScope(); + } + + public static TestHelper getTestHelper() { + return test.sdo21.framework.CTSTestCase.getTestHelper(); + } + +} diff --git a/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/framework/package.html b/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/framework/package.html new file mode 100644 index 0000000000..2f776d9b3f --- /dev/null +++ b/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/framework/package.html @@ -0,0 +1,25 @@ + + + +Contains framework of this test suite. + + diff --git a/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/package.html b/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/package.html new file mode 100644 index 0000000000..f842ec817c --- /dev/null +++ b/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/package.html @@ -0,0 +1,25 @@ + + + +Contains main CTS test file. + + diff --git a/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/CTSGeneralSuite.java b/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/CTSGeneralSuite.java new file mode 100644 index 0000000000..5d517feb58 --- /dev/null +++ b/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/CTSGeneralSuite.java @@ -0,0 +1,77 @@ +/* + * 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; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +import test.sdo21.tests.api.DynamicTypesFromSchemaTestCase; +import test.sdo21.tests.api.SequenceAddOpenTest; +import test.sdo21.tests.api.SequenceAddTypedTest; +import test.sdo21.tests.api.TypeTest; +import test.sdo21.tests.api.DataFactory.DataFactoryConsistencySuite; +import test.sdo21.tests.api.DataGraph.DataGraphConsistencySuite; +import test.sdo21.tests.api.DataObject.DataObjectConsistencySuite; +import test.sdo21.tests.api.DataObject.DataObjectTest; +import test.sdo21.tests.conversion.DateConversionTest; +import test.sdo21.tests.conversion.TypeConversionTest; +import test.sdo21.tests.general.XMLHelperTest; +import test.sdo21.tests.general.XSDHelperTest; +import test.sdo21.tests.scenarios.DataObjectListTest; +import test.sdo21.tests.xsd.XSDChoiceTest; +import test.sdo21.tests.xsd.XSDComplexTypeTest; +import test.sdo21.tests.xsd.XSDSimpleTypeTest; + +/** + * Declares general test classes to be run within Junit 4.1 Suite for SDO CTS + * which includes the following classes:
+ * + * New test cases, or test cases that do not have consencus by the community + * should be placed in the {@link test.sdo21.UnderReviewSuite} suite. + */ +@RunWith(Suite.class) +@Suite.SuiteClasses( {DateConversionTest.class, + XSDHelperTest.class, + XMLHelperTest.class, + DataObjectTest.class, + DynamicTypesFromSchemaTestCase.class, + XSDChoiceTest.class, + XSDComplexTypeTest.class, + DataObjectListTest.class, + TypeConversionTest.class, + XSDSimpleTypeTest.class, + SequenceAddOpenTest.class, + SequenceAddTypedTest.class, + DataObjectConsistencySuite.class, + DataGraphConsistencySuite.class, + DataFactoryConsistencySuite.class, + + TypeTest.DynamicMetadata.class, + TypeTest.XSDMetadata.class + }) +public class CTSGeneralSuite { + +} diff --git a/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/ConsistencyTestTemplate.java b/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/ConsistencyTestTemplate.java new file mode 100644 index 0000000000..d37686a4bf --- /dev/null +++ b/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/ConsistencyTestTemplate.java @@ -0,0 +1,195 @@ +/* + * 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 org.junit.After; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +import test.sdo21.tests.TestData.StandardDynamicFactory; +import test.sdo21.tests.TestData.StandardXSDFactory; +import test.sdo21.tests.TestData.TestDataFactory; +import test.sdo21.tests.api.CTSConsistencyBase; + +import commonj.sdo.DataObject; + +/** + * Example test class to be used as a template for SDO test cases which apply + * the same set of tests to a number of data sets of the same shape, but backed + * by metadata created in different ways, e.g. from and xsd, using the dynamic API, + * or, in the case of vendor specific tests, using statically generated classes. + * + * This class extends {@link CTSConsistencyBase} + * which requires a concrete derived class to provide a factory which will be used to + * populate a DataObject called testSDO. The concrete test can be written to conform + * to the expected shape of test data created by the factory it chooses to instantiate
+ *
+ * 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.
+ *
+ * Once a test case has been completed and reviewed it can be added into the + * appropiate CTS Suite.
+ *
+ * Tests class must 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}.
+ *
+ * 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. Please use provide links back to the Main class under test + * and to the page in the specification as demonstrated below
+ *
+ * Resources: + * + * + * @see DataObject + * @see 2.1 spec section 3.11 + */ +public abstract class ConsistencyTestTemplate extends CTSConsistencyBase { + + public ConsistencyTestTemplate() { + } + + + /** + * A concrete class which provides a factory that creates appropriate metadata for the + * test case using the SDO dynamic API. This can be referenced as a class to be tested + * from within a junit suite declaration. Additional derived classes creating alternative + * factories may be supplied ellsewhere and referenced by other junit suite declarations, + * for example, in a vendor specific extension that uses statically generated classes. + */ + public static class DynamicMetadata extends ConsistencyTestTemplate { + public DynamicMetadata() { + + } + public TestDataFactory createTestDataFactory() { + + return new StandardDynamicFactory(); + } + } + + /** + * A concrete class which provides a factory that creates appropriate metadata for the + * test case using an XML schema. This can be referenced as a class to be tested + * from within a junit suite declaration. Additional derived classes creating alternative + * factories may be supplied ellsewhere and referenced by other junit suite declarations, + * for example, in a vendor specific extension that uses statically generated classes. + */ + public static class XSDMetadata extends ConsistencyTestTemplate { + + public XSDMetadata() { + } + + public TestDataFactory createTestDataFactory() { + + return new StandardXSDFactory(); + } + } + + + @Before + public void setUp () throws Exception { + super.setUp(); + } + + @After + public void tearDown() throws Exception { + super.tearDown(); + } + /** + * 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 @Ignore 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. + * @Ignore takes an optional default parameter if you want to record + * why a test is being ignored:
+ */ + @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 ignore + * message.
+ *
+ * In this case you should ensure that the class that contains the test + * method is added to a testSuite such as + * {@link test.sdo21.UnderReviewSuite} so that it will + * be completed, or open a defect/JIRA to complete the test case. + */ + @Test + @Ignore("This test method requires implementation") + public void exampleUnimplementedTestCase() { + } + + /** + * When writing tests, it is common to find that several tests need similar + * objects created before they can run. Annotating a + * public void method with @Before causes that method to be run before the + * {@link org.junit.Test} method. The @Before methods of superclasses will be run before those of the + * current class. There is also an @After 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 public static void no-arg method with + * @BeforeClass causes it to be run once before any of the test + * methods in the class. The @BeforeClass methods of superclasses will be run before those the + * current class. + */ + @BeforeClass + public static void init() { + // init + } +} diff --git a/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/StandardDynamicFactory.java b/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/StandardDynamicFactory.java new file mode 100644 index 0000000000..872325b059 --- /dev/null +++ b/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/StandardDynamicFactory.java @@ -0,0 +1,226 @@ +package test.sdo21.tests.TestData; + +import java.util.ArrayList; +import java.util.List; + +import commonj.sdo.DataObject; +import commonj.sdo.Type; +import commonj.sdo.helper.HelperContext; +import commonj.sdo.helper.TypeHelper; + +public class StandardDynamicFactory extends StandardFactory { + + public void defineMetaData(HelperContext hc) { + TypeHelper types = hc.getTypeHelper(); + + Type t = types.getType(TEST_NAMESPACE, "Abstract"); + if (t != null) { + // the test types have already been defined in this HelperContext (this will happen when the + // implementation being tested does not support multiple contexts, which is not a 2.1 requirement). + return; + } + + Type stringType = types.getType("commonj.sdo", "String"); + Type intType = types.getType("commonj.sdo", "Int"); + Type booleanType = types.getType("commonj.sdo", "Boolean"); + Type byteType = types.getType("commonj.sdo", "Byte"); + Type decimalType = types.getType("commonj.sdo", "Decimal"); + Type floatType = types.getType("commonj.sdo", "Float"); + Type doubleType = types.getType("commonj.sdo", "Double"); + Type dateType = types.getType("commonj.sdo", "Date"); + Type shortType = types.getType("commonj.sdo", "Short"); + Type longType = types.getType("commonj.sdo", "Long"); + Type bytesType = types.getType("commonj.sdo", "Bytes"); + Type integerType = types.getType("commonj.sdo", "Integer"); + Type charType = types.getType("commonj.sdo", "Character"); + + DataObject abstractTypeDO = hc.getDataFactory().create("commonj.sdo", "Type"); + abstractTypeDO.set("uri", TEST_NAMESPACE); + abstractTypeDO.set("name", "Abstract"); + abstractTypeDO.setBoolean("abstract", true); + + DataObject firstProperty = abstractTypeDO.createDataObject("property"); + firstProperty.set("name", "firstName"); + firstProperty.set("type", stringType); + + DataObject lastProperty = abstractTypeDO.createDataObject("property"); + lastProperty.set("name", "lastName"); + lastProperty.set("type", stringType); + + Type abstractType = types.define(abstractTypeDO); + + DataObject extendedTypeDO = hc.getDataFactory().create("commonj.sdo", "Type"); + extendedTypeDO.set("uri", TEST_NAMESPACE); + extendedTypeDO.set("name", EXT_TYPE); + + List baseTypes = new ArrayList(); + baseTypes.add(abstractType); + 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", TEST_NAMESPACE); + sequenceTypeDO.set("name", SEQ_TYPE); + sequenceTypeDO.setBoolean("sequenced", true); + + // TODO: Uncomment the following when SDOUtil.addAliasName is + // implemented + /* + * aliases.clear(); aliases.add("Seq2"); sequenceTypeDO.set("aliasName", + * aliases); + */ + + DataObject Letters = sequenceTypeDO.createDataObject("property"); + Letters.set("name", "Letters"); + Letters.set("type", stringType); + Letters.setBoolean("many", true); + + DataObject Numbers = sequenceTypeDO.createDataObject("property"); + 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 openTypeDO = hc.getDataFactory().create("commonj.sdo", "Type"); + openTypeDO.set("uri", 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", TEST_NAMESPACE); + testType.set("name", API_TYPE); + + DataObject stringProperty = testType.createDataObject("property"); + stringProperty.set("name", "stringVal"); + stringProperty.set("type", stringType); + + DataObject booleanProperty = testType.createDataObject("property"); + booleanProperty.set("name", "booleanVal"); + booleanProperty.set("type", booleanType); + + DataObject boolean2Property = testType.createDataObject("property"); + boolean2Property.set("name", "booleanVal2"); + boolean2Property.set("type", booleanType); + + DataObject byteProperty = testType.createDataObject("property"); + byteProperty.set("name", "byteVal"); + byteProperty.set("type", byteType); + + DataObject string2Property = testType.createDataObject("property"); + string2Property.set("name", "stringVal2"); + string2Property.set("type", stringType); + + DataObject decimalProperty = testType.createDataObject("property"); + decimalProperty.set("name", "decimalVal"); + decimalProperty.set("type", decimalType); + + DataObject decimal2Property = testType.createDataObject("property"); + decimal2Property.set("name", "decimalVal2"); + decimal2Property.set("type", decimalType); + + // TODO: Uncomment the following when SDOUtil.addAliasName is + // implemented + /* + * aliases.clear(); aliases.add("Dec2"); + * decimal2Property.set("aliasName", aliases); + */ + DataObject intProperty = testType.createDataObject("property"); + intProperty.set("name", "intVal"); + intProperty.set("type", intType); + + DataObject floatProperty = testType.createDataObject("property"); + floatProperty.set("name", "floatVal"); + floatProperty.set("type", floatType); + + DataObject doubleProperty = testType.createDataObject("property"); + doubleProperty.set("name", "doubleVal"); + doubleProperty.set("type", doubleType); + + DataObject dateProperty = testType.createDataObject("property"); + dateProperty.set("name", "dateVal"); + dateProperty.set("type", dateType); + + DataObject shortProperty = testType.createDataObject("property"); + shortProperty.set("name", "shortVal"); + shortProperty.set("type", shortType); + + DataObject longProperty = testType.createDataObject("property"); + longProperty.set("name", "longVal"); + longProperty.set("type", longType); + + 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"); + bytesProperty.set("type", bytesType); + + DataObject integerProperty = testType.createDataObject("property"); + integerProperty.set("name", "integerVal"); + integerProperty.set("type", integerType); + + DataObject charProperty = testType.createDataObject("property"); + charProperty.set("name", "charVal"); + charProperty.set("type", charType); + + 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); + + } + + +} diff --git a/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/StandardFactory.java b/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/StandardFactory.java new file mode 100644 index 0000000000..eee92ee366 --- /dev/null +++ b/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/StandardFactory.java @@ -0,0 +1,72 @@ +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; + +/** + * Abstract base class for creating tests data of an specific nature. + * Concrete specializations of this class may create the metadata by various means, + * e.g. the SDO Dynamic API or XSD to SDO conversion, or some other implementation + * specific means, e.g. generation of static classes. + * + * All derived classes must create equivalent metatdata by whatever means is chosen. + * + */ +public abstract class StandardFactory implements TestDataFactory { + + public static final String TEST_NAMESPACE = "http://www.example.com/api_test"; + public static final String API_TYPE = "APITest"; + public final static String SEQ_TYPE = "Sequenced"; + public final static String EXT_TYPE = "Extended"; + public static final String ABSTRACT_TYPE = "Abstract"; + + /** + * this factory currently simple makes the assumption that the variant string is the + * name of a type for which an empty instance is required + */ + public DataObject createTestData(HelperContext scope, String variantString) throws Exception { + return scope.getDataFactory().create(TEST_NAMESPACE, variantString); + } + + /** + * populateFields uses set 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); + } + +} diff --git a/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/StandardXSDFactory.java b/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/StandardXSDFactory.java new file mode 100644 index 0000000000..828b0117e6 --- /dev/null +++ b/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/StandardXSDFactory.java @@ -0,0 +1,39 @@ +package test.sdo21.tests.TestData; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; + +import commonj.sdo.helper.HelperContext; +import commonj.sdo.Type; + +/** + * + * Concrete specialization of the StandardFactory test data creation factory + * which uses an XSD to create the required metadata. + * + */ +public class StandardXSDFactory extends StandardFactory { + + public final static String TEST_MODEL = "/api_test.xsd"; + + + public void defineMetaData(HelperContext hc) throws IOException { + + Type t = hc.getTypeHelper().getType(TEST_NAMESPACE, "Abstract"); + if (t != null) { + // the test types have already been defined in this HelperContext (this will happen when the + // implementation being tested does not support multiple contexts, which is not a 2.1 requirement). + return; + } + + // Populate the meta data for the test model (APITest) + URL url = this.getClass().getResource(TEST_MODEL); + InputStream inputStream = url.openStream(); + hc.getXSDHelper().define(inputStream, url.toString()); + inputStream.close(); + + } + + +} diff --git a/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/TestDataFactory.java b/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/TestDataFactory.java new file mode 100644 index 0000000000..bb84374784 --- /dev/null +++ b/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/TestData/TestDataFactory.java @@ -0,0 +1,9 @@ +package test.sdo21.tests.TestData; + +import commonj.sdo.DataObject; +import commonj.sdo.helper.HelperContext; + +public interface TestDataFactory { + public void defineMetaData(HelperContext scope) throws Exception; + public DataObject createTestData(HelperContext scope, String variant) throws Exception; +} diff --git a/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/TestTemplate.java b/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/TestTemplate.java new file mode 100644 index 0000000000..5c25d43e97 --- /dev/null +++ b/sdo-java/trunk-cts/sdo2.1/src/main/java/test/sdo21/tests/TestTemplate.java @@ -0,0 +1,138 @@ +/* + * 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 org.junit.After; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +import test.sdo21.framework.CTSTestCase; + +/** + * Example test class to be used as a template SDO test cases. + *
+ * 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.
+ *
+ * Once a test case has been completed and reviewed it can be added into the + * appropiate CTS Suite.
+ *
+ * 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}
+ *
+ * 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
+ *
+ * Resources: + *