From 8227d226f54d00bb430e1e0985bbef7596864e28 Mon Sep 17 00:00:00 2001 From: antelder Date: Mon, 2 Nov 2009 09:59:23 +0000 Subject: Try out moving the otests out of 2.x trunk by copying the tuscany/sca/java/otest folder to tuscany/otest. - A copy not a move so the old one can continued to be used. Can worry about the name tuscany/otest later git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@831839 13f79535-47bb-0310-9956-ffa450edef68 --- otest/newlayout/tuscany-test-runner/pom.xml | 170 ++++++++++++++++ .../src/test/resources/oasis-sca-tests.properties | 30 +++ .../tuscany-oasis-sca-tests-errors.properties | 86 ++++++++ .../sca/otest/TuscanyOSGiRuntimeBridge.java | 164 +++++++++++++++ .../tuscany/sca/otest/TuscanyRuntimeBridge.java | 223 +++++++++++++++++++++ 5 files changed, 673 insertions(+) create mode 100644 otest/newlayout/tuscany-test-runner/pom.xml create mode 100644 otest/newlayout/tuscany-test-runner/src/test/resources/oasis-sca-tests.properties create mode 100644 otest/newlayout/tuscany-test-runner/src/test/resources/tuscany-oasis-sca-tests-errors.properties create mode 100644 otest/newlayout/tuscany-test-runner/src/test/tjava/org/apache/tuscany/sca/otest/TuscanyOSGiRuntimeBridge.java create mode 100644 otest/newlayout/tuscany-test-runner/src/test/tjava/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java (limited to 'otest/newlayout/tuscany-test-runner') diff --git a/otest/newlayout/tuscany-test-runner/pom.xml b/otest/newlayout/tuscany-test-runner/pom.xml new file mode 100644 index 0000000000..286e28abb3 --- /dev/null +++ b/otest/newlayout/tuscany-test-runner/pom.xml @@ -0,0 +1,170 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 2.0-SNAPSHOT + ../pom.xml + + tuscany-otests-asm-tests + Apache Tuscany SCA Specification Tests + + + + org.apache.tuscany.sca + tuscany-node-impl + 2.0-SNAPSHOT + + + org.apache.tuscany.sca + tuscany-deployment + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-node-impl-osgi + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-node-launcher + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-node-launcher-equinox + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 2.0-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-host-jetty + 2.0-SNAPSHOT + + + + org.oasis-open.sca.assembly + General_Java + 1.0 + + + + javax.servlet + servlet-api + 2.5 + + + + com.sun.xml.ws + jaxws-rt + 2.1.7 + + + + junit + junit + 4.5 + test + + + + + + + + ${artifactId} + + + org.apache.maven.plugins + maven-antrun-plugin + 1.3 + + + + ant + ant-trax + 1.6.5 + + + + + + copy-files-from-svn + generate-resources + + run + + + + + + + + + + + + + + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.3 + + + add-test-source + generate-sources + + add-test-source + + + + src/test/tjava + + + + + + + + diff --git a/otest/newlayout/tuscany-test-runner/src/test/resources/oasis-sca-tests.properties b/otest/newlayout/tuscany-test-runner/src/test/resources/oasis-sca-tests.properties new file mode 100644 index 0000000000..880a23c53d --- /dev/null +++ b/otest/newlayout/tuscany-test-runner/src/test/resources/oasis-sca-tests.properties @@ -0,0 +1,30 @@ +# 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. + +# OASIS SCA Assembly test properties +# The implementation type to use for Assembly test suite +# org.oasis.sca.tests.assembly.lang=BPEL +org.oasis.sca.tests.assembly.lang=Java + +# The class to use as the Runtime Bridge for the SCA runtime under test +#org.oasis.sca.tests.assembly.runtime_bridge=org.apache.tuscany.sca.otest.TuscanyOSGiRuntimeBridge +org.oasis.sca.tests.assembly.runtime_bridge=org.apache.tuscany.sca.otest.TuscanyRuntimeBridge + +# The location of the contributions for the test suite +# %1 represents the placement of the name of each contribution into the location URI +org.oasis.sca.tests.assembly.contribution.location=../sca-assembly/%1/target/%1.zip + diff --git a/otest/newlayout/tuscany-test-runner/src/test/resources/tuscany-oasis-sca-tests-errors.properties b/otest/newlayout/tuscany-test-runner/src/test/resources/tuscany-oasis-sca-tests-errors.properties new file mode 100644 index 0000000000..948070cf16 --- /dev/null +++ b/otest/newlayout/tuscany-test-runner/src/test/resources/tuscany-oasis-sca-tests-errors.properties @@ -0,0 +1,86 @@ +# 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. + +ASM_4002=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1] - Duplicate service name: Component = TestComponent1 Service = Service1 +ASM_4003=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1] - Duplicate reference name: Component = TestComponent1 Reference = Reference1 +ASM_4004=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1] - Duplicate property name: Component = TestComponent1 Property = propertyName +ASM_4007=org.apache.tuscany.sca.contribution.processor.ContributionReadException: Error: property has both @type and @element attribute values - propertyName +ASM_4008=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1] - [ASM_4008] No value configured on a mustSupply property: Component = TestComponent1 Property = propertyName +ASM_5004=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestClient] - Too many targets on reference: reference1 +ASM_5005=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1] - Duplicate service name: Component = TestComponent1 Service = Service1 +ASM_5006=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1] - Component type service not found for component service (missing @Remotable annotation?): Component = TestComponent1 Service = InvalidName +ASM_5007=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1] - Duplicate reference name: Component = TestComponent1 Reference = Reference1 +ASM_5008=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1] - Component type reference not found for component reference: Component = TestComponent1 Reference = InvalidName +ASM_5009=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}] - Duplicate component name: Composite = {http://docs.oasis-open.org/ns/opencsa/sca/200903} Component = TestComponent1 +ASM_5010=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1] - Component service interface incompatible with implementation service interface: Component = TestComponent1 Service = Service1 +ASM_5014=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1] - Component reference multiplicity incompatible with reference multiplicity: Component = TestComponent1 Reference = Reference1 +ASM_5023=OASIS issue opened +ASM_5024=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1, Reference: Reference1] - Composite {http://docs.oasis-open.org/ns/opencsa/sca/200903} Component TestComponent1 Reference Reference1 must not specify endpoints using both target attribute and with binding uri attribute +ASM_5027=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1] - Duplicate component property name: Component = TestComponent1 Property = serviceName +ASM_5028=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1] - Property not found for component property: Component = TestComponent1 Property = randomName +ASM_5029=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1] - The property component TestComponent1 property complexType has many values but its "many" attribute is set to false +ASM_5030=org.oasisopen.sca.ServiceRuntimeException: [Contribution: ASM_5030, Artifact: Test_ASM_5030.composite] - ASM50033: value attribute exists for the property element +ASM_5035=org.apache.tuscany.sca.contribution.processor.ContributionReadException: Error: property has both @type and @element attribute values - complexType +ASM_5036=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TEST_ASM_5036Component1] - [ASM_5036] The property component TEST_ASM_5036Component1 property complexType has XSD type {http://docs.oasis-open.org/ns/opencsa/scatests/200903}ComplexType2 while its component type property has the XSD type {http://docs.oasis-open.org/ns/opencsa/scatests/200903}ComplexType1 +ASM_5037=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TEST_ASM_5037Component1] - Property not found for component property: Component = TEST_ASM_5037Component1 Property = bogusName +ASM_6001=org.oasisopen.sca.ServiceRuntimeException: [Contribution: ASM_6001, Artifact: TestDuplicate1.composite] - [ASM_6001] More than one composite with the same name {http://docs.oasis-open.org/ns/opencsa/scatests/200903}DuplicateComposite found in contribution +ASM_6002=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1] - Duplicate service name: Component = TestComponent1 Service = Service1 +ASM_6003=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1, Composite: {http://docs.oasis-open.org/ns/opencsa/scatests/200903}TestComposite17] - Promoted component service not found: Composite = {http://docs.oasis-open.org/ns/opencsa/scatests/200903}TestComposite17 Service = SpuriousComponent/SpuriousService +ASM_6005=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1] - Duplicate reference name: Component = TestComponent1 Reference = Reference1 +ASM_6006=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1, Composite: {http://docs.oasis-open.org/ns/opencsa/scatests/200903}TestComposite20] - Promoted component reference not found: Composite = {http://docs.oasis-open.org/ns/opencsa/scatests/200903}TestComposite20 Reference = Composite20Componentz/Reference1 +ASM_6008=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TEST_ASM_6008Component1, Composite: {http://docs.oasis-open.org/ns/opencsa/scatests/200903}TestComposite22] - Interface of composite reference Reference1 must be compatible with the interface declared by promoted component reference. Operation not found on target +ASM_6012=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TEST_ASM_6012TestComponent1] - Duplicate property name: Component = TEST_ASM_6012TestComponent1 Property = propertyName +ASM_6016=Need Policy Check +ASM_6020=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1, Reference: Reference1] - No target services found for the component reference to be autowired: Reference1 +ASM_6021=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TEST_ASM_6021TestComponent1, Composite: {http://docs.oasis-open.org/ns/opencsa/scatests/200903}TestComposite31] - Promoted component service not found: Composite = {http://docs.oasis-open.org/ns/opencsa/scatests/200903}TestComposite31 Service = Not_A_URI_of_a_Component +ASM_6022=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1, Composite: {http://docs.oasis-open.org/ns/opencsa/scatests/200903}TestComposite32, Component: TestComponent1] - No targets for reference: Composite = {http://docs.oasis-open.org/ns/opencsa/scatests/200903}TestComposite32 Reference = Reference1 +ASM_6023=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1] - [ASM_4008] No value configured on a mustSupply property: Component = TestComponent1 Property = simpleType +ASM_6024=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1] - Component implementation not resolved: Component = TestComponent1 Uri = TestComponent1 +ASM_6025=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}] - Duplicate component name: Composite = {http://docs.oasis-open.org/ns/opencsa/sca/200903} Component = TestComponent1 +ASM_6028=org.apache.tuscany.sca.contribution.processor.ContributionReadException: Error: property has both @type and @element attribute values - InvalidProperty +ASM_6029=org.apache.tuscany.sca.contribution.processor.ContributionResolveException: Error: Composite {http://docs.oasis-open.org/ns/opencsa/scatests/200903}TEST_ASM_6029 can only include another composite with the identical @local attribute value +ASM_6030=org.apache.tuscany.sca.contribution.processor.ContributionResolveException: Error: Composite {http://docs.oasis-open.org/ns/opencsa/scatests/200903}Invalid_composite_name is not a valid composite within the domain +ASM_6031=org.oasisopen.sca.ServiceRuntimeException: [] - [POL40009] Intent {http://docs.oasis-open.org/ns/opencsa/sca/200903}suspendsTransaction and {http://docs.oasis-open.org/ns/opencsa/sca/200903}propagatesTransaction are mutually exclusive +ASM_6032=org.oasisopen.sca.ServiceRuntimeException: [] - [POL40009] Intent {http://docs.oasis-open.org/ns/opencsa/sca/200903}propagatesTransaction and {http://docs.oasis-open.org/ns/opencsa/sca/200903}suspendsTransaction are mutually exclusive +ASM_6033=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1, Composite: {http://docs.oasis-open.org/ns/opencsa/scatests/200903}TestComposite41, Component: TestComponent1] - Component type reference not found for component reference: Component = TestComponent1 Reference = reference1 +ASM_8001=TODO +ASM_8004=org.apache.tuscany.sca.interfacedef.InvalidCallbackException: Callback org.oasisopen.sca.test.Service6Callback must be remotable on remotable interface org.oasisopen.sca.test.Service6 +ASM_8005=org.apache.tuscany.sca.interfacedef.InvalidCallbackException: Callbackorg.oasisopen.sca.test.Service7Callback must not be remotable on local interface org.oasisopen.sca.test.Service7 +ASM_8006=org.oasisopen.sca.ServiceRuntimeException: [Contribution: ASM_8006, Composite: {http://docs.oasis-open.org/ns/opencsa/scatests/200903}TEST_ASM_8006] - The interface.wsdl element has a forward interface with a callback declared in the WSDL {http://test.sca.oasisopen.org/}Service9Callback and a callback interface also declared using the callbackInterface attribute {http://test.sca.oasisopen.org/}Service8Callback but the callback interfaces are not equal. +ASM_8007=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent2] - Component service interface incompatible with implementation service interface: Component = TestComponent2 Service = Service1 +ASM_8008=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1] - Component reference interface incompatible with implementation reference interface: Component = TestComponent1 Reference = Reference1 +ASM_8009=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TEST_ASM_8009Component1] - Component reference interface incompatible with implementation reference interface: Component = TEST_ASM_8009Component1 Reference = Reference1 +ASM_8010=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TEST_ASM_8010Component2] - Component reference interface incompatible with implementation reference interface: Component = TEST_ASM_8010Component2 Reference = Service1 +ASM_8011=TODO +ASM_8012=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TEST_ASM_8012Component1, Composite: {http://docs.oasis-open.org/ns/opencsa/scatests/200903}TestComposite64] - Interface of composite reference Reference1 must be compatible with the interface declared by promoted component reference. +ASM_8018=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestClient] - Component service interface incompatible with implementation service interface: Component = TestClient Service = TestInvocation +ASM_8019=org.oasisopen.sca.ServiceRuntimeException: [Contribution: ASM_8019, Artifact: Test_ASM_8019.composite] - The interface.wsdl interface {http://test.sca.oasisopen.org/}Service1 element can only have a remotable attribute with the value "true" as WSDL interface are assumed to be remotable by default. The value that was found is: false. +ASM_9002=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1] - Multiple bindings with the same name for a service: Service = Service1 Binding name = Fred +ASM_10001=org.oasisopen.sca.ServiceRuntimeException: [Contribution: General, Definitions: jar:file:***/General/target/General.zip!/META-INF/definitions.xml] - Duplicate intent {http://docs.oasis-open.org/ns/opencsa/scatests/200903}Fred found in domain +ASM_10003=org.oasisopen.sca.ServiceRuntimeException: [Contribution: ASM_10003, Artifact: META-INF/definitions.xml, Definitions: jar:file:***ASM_10003.zip!/META-INF/definitions.xml] - XMLSchema validation error occured in: Test_ASM_10003.composite ,line = 17, column = 2, Message = cvc-complex-type.2.4.a: Invalid content was found starting with element 'component'. One of '{"http://docs.oasis-open.org/ns/opencsa/sca/200903":documentation, "http://docs.oasis-open.org/ns/opencsa/sca/200903":intent, "http://docs.oasis-open.org/ns/opencsa/sca/200903":policySet, "http://docs.oasis-open.org/ns/opencsa/sca/200903":binding, "http://docs.oasis-open.org/ns/opencsa/sca/200903":bindingType, "http://docs.oasis-open.org/ns/opencsa/sca/200903":implementationType, WC[##other:"http://docs.oasis-open.org/ns/opencsa/sca/200903"]}' is expected. +ASM_12007=TODO +ASM_12008=TODO +ASM_12011=TODO +ASM_12012=org.oasisopen.sca.ServiceRuntimeException: [Contribution: ASM_12012, Artifact: META-INF/sca-contribution.xml] - XMLSchema validation error occured in: Test_ASM_12012.composite ,line = 16, column = 2, Message = cvc-complex-type.2.4.a: Invalid content was found starting with element 'component'. One of '{"http://docs.oasis-open.org/ns/opencsa/sca/200903":documentation, "http://docs.oasis-open.org/ns/opencsa/sca/200903":deployable, "http://docs.oasis-open.org/ns/opencsa/sca/200903":importBase, "http://docs.oasis-open.org/ns/opencsa/sca/200903":exportBase, WC[##other:"http://docs.oasis-open.org/ns/opencsa/sca/200903"]}' is expected. +ASM_13001=org.oasisopen.sca.ServiceRuntimeException: [Contribution: ASM_13001, Artifact: Test_ASM_13001.composite] - XMLSchema validation error occured in: Test_ASM_13001.composite ,line = 25, column = 9, Message = cvc-complex-type.2.4.a: Invalid content was found starting with element 'sevrice'. One of '{"http://docs.oasis-open.org/ns/opencsa/sca/200903":service, "http://docs.oasis-open.org/ns/opencsa/sca/200903":reference, "http://docs.oasis-open.org/ns/opencsa/sca/200903":property, WC[##other:"http://docs.oasis-open.org/ns/opencsa/sca/200903"]}' is expected. +ASM_13002=org.oasisopen.sca.ServiceRuntimeException: [Contribution: ASM_13002, Artifact: Test_ASM_13002.composite] - XMLSchema validation error occured in: Test_ASM_13002.composite ,line = 28, column = 13, Message = cvc-complex-type.2.4.a: Invalid content was found starting with element 'operation'. One of '{"http://docs.oasis-open.org/ns/opencsa/sca/200903":binding, "http://docs.oasis-open.org/ns/opencsa/sca/200903":callback, WC[##other:"http://docs.oasis-open.org/ns/opencsa/sca/200903"]}' is expected. +ASM_13003=org.oasisopen.sca.ServiceRuntimeException: [Contribution: ASM_13003, Artifact: Test_ASM_13003.composite] - XMLSchema validation error occured in: Test_ASM_13003.composite ,line = 23, column = 5, Message = cvc-complex-type.2.4.a: Invalid content was found starting with element 'binding.ws'. One of '{"http://docs.oasis-open.org/ns/opencsa/sca/200903":documentation, "http://docs.oasis-open.org/ns/opencsa/sca/200903":include, "http://docs.oasis-open.org/ns/opencsa/sca/200903":service, "http://docs.oasis-open.org/ns/opencsa/sca/200903":property, "http://docs.oasis-open.org/ns/opencsa/sca/200903":component, "http://docs.oasis-open.org/ns/opencsa/sca/200903":reference, "http://docs.oasis-open.org/ns/opencsa/sca/200903":wire, WC[##other:"http://docs.oasis-open.org/ns/opencsa/sca/200903"]}' is expected. +ASM_13004=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestClient, Composite: {http://docs.oasis-open.org/ns/opencsa/scatests/200903}TestClient_0002, Component: TestClient_0002TestClient] - [ASM_4008] No value configured on a mustSupply property +ASM_13005=org.oasisopen.sca.ServiceRuntimeException: [Contribution: ASM_13005, Artifact: Test_ASM_13005.composite] - XMLSchema validation error occured in: Test_ASM_13005.composite ,line = 25, column = 9, Message = cvc-elt.2: The value of {abstract} in the element declaration for 'implementation' must be false. +ASM_13006=org.oasisopen.sca.ServiceRuntimeException: [Contribution: ASM_13006, Artifact: Test_ASM_13006.composite] - XMLSchema validation error occured in: Test_ASM_13006.composite ,line = 28, column = 13, Message = cvc-complex-type.3.2.2: Attribute 'callback' is not allowed to appear in element 'interface.java'. +ASM_13007=org.oasisopen.sca.ServiceRuntimeException: [Contribution: ASM_13007, Artifact: Test_ASM_13007.composite] - XMLSchema validation error occured in: Test_ASM_13007.composite ,line = 29, column = 9, Message = cvc-complex-type.3.2.2: Attribute 'mulplicity' is not allowed to appear in element 'reference'. +ASM_13008=org.oasisopen.sca.ServiceRuntimeException: [Contribution: ASM_13008, Artifact: Test_ASM_13008.composite] - XMLSchema validation error occured in: Test_ASM_13008.composite ,line = 40, column = 14, Message = cvc-complex-type.2.4.a: Invalid content was found starting with element 'operation'. One of '{"http://docs.oasis-open.org/ns/opencsa/sca/200903":documentation, "http://docs.oasis-open.org/ns/opencsa/sca/200903":wireFormat, "http://docs.oasis-open.org/ns/opencsa/sca/200903":operationSelector}' is expected. \ No newline at end of file diff --git a/otest/newlayout/tuscany-test-runner/src/test/tjava/org/apache/tuscany/sca/otest/TuscanyOSGiRuntimeBridge.java b/otest/newlayout/tuscany-test-runner/src/test/tjava/org/apache/tuscany/sca/otest/TuscanyOSGiRuntimeBridge.java new file mode 100644 index 0000000000..afea19fe0b --- /dev/null +++ b/otest/newlayout/tuscany-test-runner/src/test/tjava/org/apache/tuscany/sca/otest/TuscanyOSGiRuntimeBridge.java @@ -0,0 +1,164 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.otest; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; + +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.equinox.launcher.Contribution; +import org.apache.tuscany.sca.node.equinox.launcher.ContributionLocationHelper; +import org.apache.tuscany.sca.node.equinox.launcher.NodeLauncher; + +import client.RuntimeBridge; +import client.TestConfiguration; + + +/** + * An implementation of the Runtime Bridge for the Apache Tuscany SCA runtime (version 2.x) + * + */ +public class TuscanyOSGiRuntimeBridge implements RuntimeBridge { + + static final String CONTRIBUTION_LOCATION_PROPKEY = "OASIS_TESTENV_CONTRIBUTION_LOCATION"; + + protected NodeLauncher launcher; + protected Node node; + TestConfiguration testConfiguration = null; + protected Properties expectedErrorMessages; + + public TuscanyOSGiRuntimeBridge() { + // read test error mapping + expectedErrorMessages = new Properties(); + try { + InputStream propertiesStream = this.getClass().getResourceAsStream("/tuscany-oasis-sca-tests-errors.properties"); + expectedErrorMessages.load(propertiesStream); + } catch (IOException e) { + System.out.println("Unable to read oasis-sca-tests-errors.properties file"); + } + } + + public TestConfiguration getTestConfiguration() { + return testConfiguration; + } + + public void setTestConfiguration(TestConfiguration testConfiguration) { + this.testConfiguration = testConfiguration; + } + + public boolean startContribution(String contributionLocation, String[] contributionNames) throws Exception { + try { + // Tuscany specific code which starts the contribution(s) holding the test + launcher = NodeLauncher.newInstance(); + + Contribution[] contributions = new Contribution[contributionNames.length]; + String[] contributionURIs = getContributionURIs(contributionLocation); + for (int i = 0; i < contributions.length; i++) { + contributions[i] = new Contribution(contributionNames[i], contributionURIs[i]); + } // end for + + node = launcher.createNode(testConfiguration.getComposite(), contributions); + System.out.println("SCA Node API ClassLoader: " + node.getClass().getClassLoader()); + // Start the node + node.start(); + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + throw e; + } // end try + + return true; + } // end method startContribution + + /** + * Gets the location of the Contributions as URIs + * @param contributionLocation - a location pattern URI, which contains one or more "%1" + * substrings, which are substituted with the name of the contribution to get the URI of + * the contribution + * @return the contribution locations as an array of Strings + */ + protected String[] getContributionURIs(String contributionLocation) throws Exception { + String[] locations; + locations = testConfiguration.getContributionNames(); + + if (locations != null && contributionLocation != null) { + + for (int i = 0; i < locations.length; i++) { + String aLocation = contributionLocation.replaceAll("%1", locations[i]); + + locations[i] = aLocation; + } // end for + } else { + if (locations == null) { + // No contribution specified - throw an Exception + throw new Exception("Unable to start SCA runtime - no contribution supplied - error"); + } else { + // No contribution location supplied - throw an Exception + throw new Exception("Unable to start SCA runtime - no contribution location supplied - error"); + } // end if + } // end if + + return locations; + } // end getContributionURI + + public void stopContribution() { + if (node != null) { + node.stop(); + node.destroy(); + } // end if + if (launcher != null) { + launcher.destroy(); + } // end if + } // end method stopContribution + + public String getContributionLocation(Class testClass) { + return ContributionLocationHelper.getContributionLocation(testConfiguration.getTestClass()); + } // end method getContributionLocation + + public void checkError(String testName, Throwable ex) throws Throwable { + String expectedMessage = expectedErrorMessages.getProperty(testName); + String receivedMessage = ex.getMessage(); + + if (expectedMessage == null){ + fail("Null expected error message for test " + testName + + "Please add message to oasis-sca-tests-errors.properties"); + } + + if (receivedMessage == null){ + fail("Null received error message for test " + testName); + } + + int messageStart = receivedMessage.indexOf("] - "); + + if (messageStart < 0){ + fail("Message separator not found for test " + testName); + } + + receivedMessage = receivedMessage.substring(messageStart + 4); + + assertEquals( expectedMessage, receivedMessage ); + + return; + } + +} // end class TuscanyRuntimeBridge diff --git a/otest/newlayout/tuscany-test-runner/src/test/tjava/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java b/otest/newlayout/tuscany-test-runner/src/test/tjava/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java new file mode 100644 index 0000000000..9591be0192 --- /dev/null +++ b/otest/newlayout/tuscany-test-runner/src/test/tjava/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java @@ -0,0 +1,223 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.otest; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +import java.io.BufferedWriter; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; +import java.util.StringTokenizer; + +import org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.ContributionLocationHelper; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; + +import client.RuntimeBridge; +import client.TestConfiguration; + +/** + * An implementation of the Runtime Bridge for the Apache Tuscany SCA runtime (version 2.x) + * + */ +public class TuscanyRuntimeBridge implements RuntimeBridge { + + static final String CONTRIBUTION_LOCATION_PROPKEY = "OASIS_TESTENV_CONTRIBUTION_LOCATION"; + + protected NodeFactory launcher; + protected Node node; + protected Properties expectedErrorMessages; + + TestConfiguration testConfiguration = null; + + public TuscanyRuntimeBridge() { + // read test error mapping + expectedErrorMessages = new Properties(); + try { + InputStream propertiesStream = this.getClass().getResourceAsStream("/tuscany-oasis-sca-tests-errors.properties"); + expectedErrorMessages.load(propertiesStream); + } catch (IOException e) { + System.out.println("Unable to read oasis-sca-tests-errors.properties file"); + } + } + + public TestConfiguration getTestConfiguration() { + return testConfiguration; + } + + public void setTestConfiguration(TestConfiguration testConfiguration) { + this.testConfiguration = testConfiguration; + } + + public boolean startContribution(String contributionLocation, String[] contributionNames) throws Exception { + try { + // Tuscany specific code which starts the contribution(s) holding the test + launcher = NodeFactory.newInstance(); + + Contribution[] contributions = new Contribution[contributionNames.length]; + String[] contributionURIs = getContributionURIs(contributionLocation); + for (int i = 0; i < contributions.length; i++) { + contributions[i] = new Contribution(contributionNames[i], contributionURIs[i]); + } // end for + + node = launcher.createNode(testConfiguration.getComposite(), contributions); + // Start the node + node.start(); + + // For debugging + // print out the composites that have been read in success cases + // System.out.println(((NodeImpl)node).dumpDomainComposite()); + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + throw e; + } // end try + + return true; + } // end method startContribution + + /** + * Gets the location of the Contributions as URIs + * @param contributionLocation - a location pattern URI, which contains one or more "%1" + * substrings, which are substituted with the name of the contribution to get the URI of + * the contribution + * @return the contribution locations as an array of Strings + */ + protected String[] getContributionURIs(String contributionLocation) throws Exception { + String[] locations; + locations = testConfiguration.getContributionNames(); + + if (locations != null && contributionLocation != null) { + + for (int i = 0; i < locations.length; i++) { + String aLocation = contributionLocation.replaceAll("%1", locations[i]); + + locations[i] = aLocation; + } // end for + } else { + if (locations == null) { + // No contribution specified - throw an Exception + throw new Exception("Unable to start SCA runtime - no contribution supplied - error"); + } else { + // No contribution location supplied - throw an Exception + throw new Exception("Unable to start SCA runtime - no contribution location supplied - error"); + } // end if + } // end if + + return locations; + } // end getContributionURI + + public void stopContribution() { + if (node != null) { + node.stop(); + node.destroy(); + } // end if + if (launcher != null) { + launcher.destroy(); + } // end if + } // end method stopContribution + + public String getContributionLocation(Class testClass) { + return ContributionLocationHelper.getContributionLocation(testConfiguration.getTestClass()); + } // end method getContributionLocation + + public void checkError(String testName, Throwable ex) throws Throwable { + + String expectedMessage = expectedErrorMessages.getProperty(testName); + String receivedMessage = ex.getMessage(); + + if (expectedMessage == null){ + writeMissingMessage(testName, ex); + fail("Null expected error message for test " + testName + + "Please add message to oasis-sca-tests-errors.properties"); + } // end if + + if (receivedMessage == null){ + ex.printStackTrace(); + fail("Null received error message for test " + testName); + } // end if + + if (expectedMessage.startsWith("*")) { + // allow using * to ignore a message comparison + return; + } + + // Deal with the case where the message has variable parts within it + // marked with the characters ***. Here we tokenize the epected string + // and make sure all the individual parts are present in the results string + String expectedMessageParts[] = expectedMessage.split("\\*\\*\\*"); + + if (expectedMessageParts.length > 1){ + int foundParts = 0; + for(int i = 0; i < expectedMessageParts.length; i++){ + if (receivedMessage.indexOf(expectedMessageParts[i]) > -1 ){ + foundParts++; + } + } + + if (foundParts == expectedMessageParts.length){ + return; + } + } + + + // Deal with the case where the end of the message is variable (eg contains absolute filenames) + // and where the only relevant part is the start of the message - in this case the expected + // message only contains the stem section which is unchanging... + if( receivedMessage.length() > expectedMessage.length() ) { + // Truncate the received message to the length of the expected message + receivedMessage = receivedMessage.substring(0, expectedMessage.length() ); + } // end if + + if (!expectedMessage.equals(receivedMessage)) { + writeIncorrectMessage(testName, expectedMessage, receivedMessage); + } + + assertEquals( expectedMessage, receivedMessage ); + + return; + + } + + protected void writeMissingMessage(String testName, Throwable ex) { + try { + BufferedWriter out = new BufferedWriter(new FileWriter("target/OTestMissingMsgs.txt", true)); + out.write(testName + "=*"); + out.newLine(); + out.close(); + } catch (IOException e) { + } + } + + protected void writeIncorrectMessage(String testName, String expected, String received) { + try { + BufferedWriter out = new BufferedWriter(new FileWriter("target/OTestIncorrectMsgs.txt", true)); + out.write(testName); out.newLine(); + out.write(" " + expected); out.newLine(); + out.write(" " + received); out.newLine(); + out.close(); + } catch (IOException e) { + } + } + +} // end class TuscanyRuntimeBridge -- cgit v1.2.3