From 6865c59e74f19ed6057d03583944b47abd6e036e Mon Sep 17 00:00:00 2001 From: antelder Date: Tue, 26 Oct 2010 07:46:08 +0000 Subject: Create branch for next release git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1027394 13f79535-47bb-0310-9956-ffa450edef68 --- .../testing/compliance-tests/binding-ws/pom.xml | 145 ++++++++++++++ .../compliance-tests/binding-ws/sca_variables.dtd | 28 +++ .../tuscany/sca/otest/TuscanyRuntimeBridge.java | 217 +++++++++++++++++++++ .../src/test/resources/oasis-sca-tests.properties | 30 +++ .../tuscany-oasis-sca-tests-errors.properties | 33 ++++ 5 files changed, 453 insertions(+) create mode 100644 sca-java-2.x/branches/2.0-Beta1/testing/compliance-tests/binding-ws/pom.xml create mode 100644 sca-java-2.x/branches/2.0-Beta1/testing/compliance-tests/binding-ws/sca_variables.dtd create mode 100644 sca-java-2.x/branches/2.0-Beta1/testing/compliance-tests/binding-ws/src/test/java/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java create mode 100644 sca-java-2.x/branches/2.0-Beta1/testing/compliance-tests/binding-ws/src/test/resources/oasis-sca-tests.properties create mode 100644 sca-java-2.x/branches/2.0-Beta1/testing/compliance-tests/binding-ws/src/test/resources/tuscany-oasis-sca-tests-errors.properties (limited to 'sca-java-2.x/branches/2.0-Beta1/testing/compliance-tests/binding-ws') diff --git a/sca-java-2.x/branches/2.0-Beta1/testing/compliance-tests/binding-ws/pom.xml b/sca-java-2.x/branches/2.0-Beta1/testing/compliance-tests/binding-ws/pom.xml new file mode 100644 index 0000000000..d88e44cae9 --- /dev/null +++ b/sca-java-2.x/branches/2.0-Beta1/testing/compliance-tests/binding-ws/pom.xml @@ -0,0 +1,145 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-compliance-tests + 2.0-Beta1-SNAPSHOT + ../pom.xml + + tuscany-compliance-test-binding-ws + Apache Tuscany SCA Specification Compliance Tests Binding WS + + + + + + + org.apache.tuscany.sca + tuscany-otests-sca-ws-tests + 2.0-Beta1-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-base-runtime-pom + 2.0-Beta1-SNAPSHOT + pom + + + + org.apache.tuscany.sca + tuscany-binding-jms + 2.0-Beta1-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-osgi-runtime-pom + 2.0-Beta1-SNAPSHOT + pom + + + + org.apache.tuscany.sca + tuscany-binding-ws-runtime-axis2 + 2.0-Beta1-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-host-jetty + 2.0-Beta1-SNAPSHOT + + + + + org.codehaus.woodstox + wstx-asl + 3.2.4 + runtime + + + stax + stax-api + + + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + + + org.apache.maven.plugins + maven-surefire-plugin + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + unpack + test-compile + + unpack + + + + + org.apache.tuscany.sca + oasis-ws-contributions + 2.0-Beta1-SNAPSHOT + zip + ${project.build.directory}/oasis-contributions + + + org.apache.tuscany.sca + tuscany-otests-sca-ws-tests + 2.0-Beta1-SNAPSHOT + jar + commons-logging.properties,oasis-sca-tests.properties + ${project.build.directory}/test-classes + + + + + + + + + + diff --git a/sca-java-2.x/branches/2.0-Beta1/testing/compliance-tests/binding-ws/sca_variables.dtd b/sca-java-2.x/branches/2.0-Beta1/testing/compliance-tests/binding-ws/sca_variables.dtd new file mode 100644 index 0000000000..f29713a20d --- /dev/null +++ b/sca-java-2.x/branches/2.0-Beta1/testing/compliance-tests/binding-ws/sca_variables.dtd @@ -0,0 +1,28 @@ + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-2.x/branches/2.0-Beta1/testing/compliance-tests/binding-ws/src/test/java/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java b/sca-java-2.x/branches/2.0-Beta1/testing/compliance-tests/binding-ws/src/test/java/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java new file mode 100644 index 0000000000..139e8b31fd --- /dev/null +++ b/sca-java-2.x/branches/2.0-Beta1/testing/compliance-tests/binding-ws/src/test/java/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java @@ -0,0 +1,217 @@ +/* + * 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 org.apache.tuscany.sca.node.Contribution; +import org.apache.tuscany.sca.node.Node; +import org.apache.tuscany.sca.node.NodeFactory; + +import testClient.TestException_Exception; +import client.RuntimeBridge; + +/** + * 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; + + 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 boolean startContribution(String compositeName, 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, contributionNames); + for (int i = 0; i < contributions.length; i++) { + contributions[i] = new Contribution(contributionNames[i], contributionURIs[i]); + } // end for + + node = launcher.createNode(compositeName, 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, String[] contributionNames) throws Exception { + String[] locations = new String[contributionNames.length]; + + if (locations != null && contributionLocation != null) { + + for (int i = 0; i < locations.length; i++) { + String aLocation = contributionLocation.replaceAll("%1", contributionNames[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(); + } // end if + if (launcher != null) { + launcher.destroy(); + } // end if + } // end method stopContribution + + public void checkError(String testName, Throwable ex) throws Throwable { + + String expectedMessage = expectedErrorMessages.getProperty(testName); + String receivedMessage = getErrorMessage(ex);//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 expected 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) { + } + } + + protected String getErrorMessage(Throwable ex) { + String errorMessage = null; + + if (ex instanceof TestException_Exception) { + TestException_Exception te = (TestException_Exception) ex; + errorMessage = te.getFaultInfo().getMessage(); + } else { + errorMessage = ex.getMessage(); + } + + return errorMessage; + } +} // end class TuscanyRuntimeBridge diff --git a/sca-java-2.x/branches/2.0-Beta1/testing/compliance-tests/binding-ws/src/test/resources/oasis-sca-tests.properties b/sca-java-2.x/branches/2.0-Beta1/testing/compliance-tests/binding-ws/src/test/resources/oasis-sca-tests.properties new file mode 100644 index 0000000000..dc3296ae8c --- /dev/null +++ b/sca-java-2.x/branches/2.0-Beta1/testing/compliance-tests/binding-ws/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=target/oasis-contributions/%1/target/%1.zip + diff --git a/sca-java-2.x/branches/2.0-Beta1/testing/compliance-tests/binding-ws/src/test/resources/tuscany-oasis-sca-tests-errors.properties b/sca-java-2.x/branches/2.0-Beta1/testing/compliance-tests/binding-ws/src/test/resources/tuscany-oasis-sca-tests-errors.properties new file mode 100644 index 0000000000..572a5f1841 --- /dev/null +++ b/sca-java-2.x/branches/2.0-Beta1/testing/compliance-tests/binding-ws/src/test/resources/tuscany-oasis-sca-tests-errors.properties @@ -0,0 +1,33 @@ +# 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. + +BWS_2001=org.oasisopen.sca.ServiceRuntimeException: [Contribution: BWS_2001, Artifact: Test_BWS_2001.composite] - [BWS20001] The URI value for binding.ws on an SCA reference must be absolute. Non-absolute value found /TEST_BWS_2001Component2/Service1 +BWS_2002=org.oasisopen.sca.ServiceRuntimeException: [Contribution: BWS_2002, Artifact: Test_BWS_2002.composite] - Invalid WebService binding wsdlElement attribute: http://test.sca.oasisopen.org/#wsdl.port(NonExistentPortName) +BWS_2003=org.oasisopen.sca.ServiceRuntimeException: [Contribution: BWS_2003, Artifact: Test_BWS_2003.composite] - [BWS20003] The wsdlElement attribute of a binding.ws on an SCA service must not specify the wsdl.service form of URI. The following URI was found http://test.sca.oasisopen.org/#wsdl.service(Service1Service) +BWS_2005=org.oasisopen.sca.ServiceRuntimeException: [Contribution: BWS_2005, Composite: {http://docs.oasis-open.org/ns/opencsa/scatests/200903}TEST_BWS_2005] - [BWS20005][BWS20010] The WSDL binding transport http://example.com/foo/bar is not supported by Tuscany +BWS_2007=org.apache.tuscany.sca.runtime.ActivationException: org.apache.tuscany.sca.runtime.ActivationException: org.oasisopen.sca.ServiceRuntimeException: Component TEST_BWS_2007Component2 Service Service1 interface is incompatible with the interface of the reference binding - Service1 - Operations called operation1 are not compatible Operation argument types source = {http://www.w3.org/2001/XMLSchema}float target = {http://www.w3.org/2001/XMLSchema}string don't match for output types|||Operations called operation1 are not compatible||| - [(***)Endpoint: URI = TEST_BWS_2007Component2#service-binding(Service1/Service1)] +BWS_2011=org.oasisopen.sca.ServiceRuntimeException: [Contribution: BWS_2011, Composite: {http://docs.oasis-open.org/ns/opencsa/scatests/200903}TEST_BWS_2011] - [BWS20005][BWS20010] The WSDL binding transport http://example.com/foo/bar is not supported by Tuscany +BWS_2013=org.oasisopen.sca.ServiceRuntimeException: [Contribution: BWS_2013, Composite: {http://docs.oasis-open.org/ns/opencsa/scatests/200903}TEST_BWS_2013] - [BWS20005][BWS20010] The WSDL binding transport http://example.com/foo/bar is not supported by Tuscany +BWS_2015=org.oasisopen.sca.ServiceRuntimeException: [Contribution: BWS_2015, Artifact: Test_BWS_2015.composite] - [BWS20017] binding.ws has a @wsdli:wsdlLocation attribute but no @wsdlElement attribute +BWS_2016=org.oasisopen.sca.ServiceRuntimeException: [Contribution: BWS_2016, Composite: {http://docs.oasis-open.org/ns/opencsa/scatests/200903}TEST_BWS_2016] - Exception locating wsdli:location resource: org.apache.tuscany.sca.contribution.processor.ContributionReadException: java.io.FileNotFoundException: http://example.org/Service1.wsdl +BWS_2017=org.oasisopen.sca.ServiceRuntimeException: [Contribution: BWS_2017, Artifact: Test_BWS_2017.composite] - [BWS20019] with binding.ws you can only specify one of url, wsa:EndpointReference, #wsdl.service or #wsdl.port. The following were found [uri, wsa:EndpointReference] +BWS_2018=org.oasisopen.sca.ServiceRuntimeException: [Contribution: BWS_2018, Artifact: Test_BWS_2018.composite] - [BWS20020] For the callback element of an SCA service, the binding must not specify an endpoint address URI or a WS-Addressing wsa:EndpointReference +BWS_2019=org.oasisopen.sca.ServiceRuntimeException: [Contribution: BWS_2019, Artifact: Test_BWS_2019.composite] - XMLSchema validation error occured in: Test_BWS_2019.composite ,line = 36, column = 10, Message = cvc-complex-type.3.2.2: Attribute 'invalidAttribute' is not allowed to appear in element 'binding.ws'. +BWS_2020=org.oasisopen.sca.ServiceRuntimeException [BWS20025] Unable to determine destination endpoint for endpoint reference (***)EndpointReference: URI = TEST_BWS_2020Component1#reference-binding(reference1/Reference1) RESOLVED_BINDING Target = (***)Endpoint: +BWS_2022=org.apache.tuscany.sca.runtime.ActivationException: org.apache.tuscany.sca.runtime.ActivationException: org.apache.tuscany.sca.runtime.ActivationException: org.apache.tuscany.sca.runtime.ActivationException: org.oasisopen.sca.ServiceRuntimeException: Component TEST_BWS_2022Component1 Reference reference1 interface is incompatible with the interface of the reference binding Reference1 - Callback interface doesn't match as one of the callback interfaces is null - [(***)EndpointReference: URI = TEST_BWS_2022Component1#reference-binding(reference1/Reference1) RESOLVED_BINDING Target = (***)Endpoint: ] +BWS_4008=org.apache.tuscany.sca.runtime.ActivationException: org.apache.tuscany.sca.runtime.ActivationException: org.apache.tuscany.sca.runtime.ActivationException: org.apache.tuscany.sca.runtime.ActivationException: org.oasisopen.sca.ServiceRuntimeException: rpc/encoded WSDL style not supported. Component TEST_BWS_4008Component1 Reference reference1 Binding Reference1 +BWS_5003=A header representing a Message Addressing Property is not valid and the message cannot be processed \ No newline at end of file -- cgit v1.2.3