From d922544c36c311d1f59b524c96e552d9646022e5 Mon Sep 17 00:00:00 2001 From: antelder Date: Mon, 21 Jun 2010 10:15:06 +0000 Subject: Updates to get the jms test suite runner working git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@956527 13f79535-47bb-0310-9956-ffa450edef68 --- .../trunk/compliance-tests/binding-jms/pom.xml | 14 ++++- .../tuscany/sca/otest/TuscanyRuntimeBridge.java | 62 ++++++++-------------- .../src/test/resources/oasis-sca-tests.properties | 2 +- .../tuscany-oasis-sca-tests-errors.properties | 26 +++++++++ 4 files changed, 62 insertions(+), 42 deletions(-) (limited to 'sca-java-2.x') diff --git a/sca-java-2.x/trunk/compliance-tests/binding-jms/pom.xml b/sca-java-2.x/trunk/compliance-tests/binding-jms/pom.xml index e864b59192..cf604a3d92 100644 --- a/sca-java-2.x/trunk/compliance-tests/binding-jms/pom.xml +++ b/sca-java-2.x/trunk/compliance-tests/binding-jms/pom.xml @@ -44,6 +44,18 @@ 2.0-SNAPSHOT + + org.apache.tuscany.sca.shades + tuscany-jms + 2.0-SNAPSHOT + + + + org.apache.activemq + activemq-core + 5.2.0 + + @@ -106,7 +118,7 @@ oasis-binding-jms-test-runner 1.0-SNAPSHOT jar - commons-logging.properties,oasis-sca-tests.properties + commons-logging.properties,oasis-sca-tests.properties,tuscany-oasis-sca-tests-errors.properties ${project.build.directory}/test-classes diff --git a/sca-java-2.x/trunk/compliance-tests/binding-jms/src/test/java/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java b/sca-java-2.x/trunk/compliance-tests/binding-jms/src/test/java/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java index 6f4aa8e86a..d9490c641e 100644 --- a/sca-java-2.x/trunk/compliance-tests/binding-jms/src/test/java/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java +++ b/sca-java-2.x/trunk/compliance-tests/binding-jms/src/test/java/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java @@ -22,19 +22,17 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; import java.io.BufferedWriter; -import java.io.File; 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.ContributionLocationHelper; import org.apache.tuscany.sca.node.Node; import org.apache.tuscany.sca.node.NodeFactory; +import testClient.TestException_Exception; import client.RuntimeBridge; -import client.TestConfiguration; /** * An implementation of the Runtime Bridge for the Apache Tuscany SCA runtime (version 2.x) @@ -47,8 +45,6 @@ public class TuscanyRuntimeBridge implements RuntimeBridge { protected NodeFactory launcher; protected Node node; protected Properties expectedErrorMessages; - - TestConfiguration testConfiguration = null; public TuscanyRuntimeBridge() { // read test error mapping @@ -61,22 +57,7 @@ public class TuscanyRuntimeBridge implements RuntimeBridge { } } - public TestConfiguration getTestConfiguration() { - return testConfiguration; - } - - public void setTestConfiguration(TestConfiguration testConfiguration) { - this.testConfiguration = testConfiguration; - } - - public boolean startContribution(String compositeName, - String contributionLocation, String[] contributionNames) - throws Exception { - //TODO: - return startContribution(contributionLocation, contributionNames); - } - - public boolean startContribution(String contributionLocation, String[] contributionNames) throws Exception { + public boolean startContribution(String compositeName, String contributionLocation, String[] contributionNames) throws Exception { try { // Tuscany specific code which starts the contribution(s) holding the test Properties ps = new Properties(); @@ -85,12 +66,12 @@ public class TuscanyRuntimeBridge implements RuntimeBridge { launcher = NodeFactory.newInstance(ps); Contribution[] contributions = new Contribution[contributionNames.length]; - String[] contributionURIs = getContributionURIs(contributionLocation); + 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(testConfiguration.getComposite(), contributions); + node = launcher.createNode(compositeName, contributions); // Start the node node.start(); @@ -113,21 +94,14 @@ public class TuscanyRuntimeBridge implements RuntimeBridge { * the contribution * @return the contribution locations as an array of Strings */ - protected String[] getContributionURIs(String contributionLocation) throws Exception { - String[] locations; - locations = testConfiguration.getContributionNames(); + 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", locations[i]); - // Looks like bugs in the oasis code that sometimes still uses jars for some - if (aLocation.endsWith("_POJO.zip") && !aLocation.endsWith("ASM_8005_Java-1.0.zip")) { - aLocation = aLocation.substring(0, aLocation.length()-3) + "jar"; - } - if (!(new File(aLocation)).exists()) { - aLocation = aLocation.replace(".zip", ".jar"); - } + String aLocation = contributionLocation.replaceAll("%1", contributionNames[i]); + locations[i] = aLocation; } // end for } else { @@ -151,15 +125,11 @@ public class TuscanyRuntimeBridge implements RuntimeBridge { 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(); + String receivedMessage = getErrorMessage(ex);//ex.getMessage(); if (expectedMessage == null){ writeMissingMessage(testName, ex); @@ -178,7 +148,7 @@ public class TuscanyRuntimeBridge implements RuntimeBridge { } // Deal with the case where the message has variable parts within it - // marked with the characters ***. Here we tokenize the epected string + // 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("\\*\\*\\*"); @@ -235,4 +205,16 @@ public class TuscanyRuntimeBridge implements RuntimeBridge { } } + 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/trunk/compliance-tests/binding-jms/src/test/resources/oasis-sca-tests.properties b/sca-java-2.x/trunk/compliance-tests/binding-jms/src/test/resources/oasis-sca-tests.properties index ff9c3dce2d..33192c49e5 100644 --- a/sca-java-2.x/trunk/compliance-tests/binding-jms/src/test/resources/oasis-sca-tests.properties +++ b/sca-java-2.x/trunk/compliance-tests/binding-jms/src/test/resources/oasis-sca-tests.properties @@ -18,7 +18,7 @@ # 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=POJO +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 diff --git a/sca-java-2.x/trunk/compliance-tests/binding-jms/src/test/resources/tuscany-oasis-sca-tests-errors.properties b/sca-java-2.x/trunk/compliance-tests/binding-jms/src/test/resources/tuscany-oasis-sca-tests-errors.properties index 404300e759..1788c1f2b8 100644 --- a/sca-java-2.x/trunk/compliance-tests/binding-jms/src/test/resources/tuscany-oasis-sca-tests-errors.properties +++ b/sca-java-2.x/trunk/compliance-tests/binding-jms/src/test/resources/tuscany-oasis-sca-tests-errors.properties @@ -14,4 +14,30 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. +BJM_3001=org.oasisopen.sca.ServiceRuntimeException: [Contribution: BJM_3001, Artifact: Test_BJM_3001.composite] - URI must start with the scheme jms: for uri: http://test.sca.oasisopen.org/ +BJM_3002=Test service got an exception during execution: org.apache.tuscany.sca.binding.jms.JMSBindingException JMS Destination jndi:BJM_3002_Queue not found with create mode of "ifnotexist" while registering binding Reference1 invoker +BJM_3003=No error expected +BJM_3004=No error expected +BJM_3005=No error expected +BJM_3010=**testcase incomplete** +BJM_3011=org.apache.tuscany.sca.binding.jms.JMSBindingException: Error starting JMSServiceBinding +BJM_3012=**testcase incomplete** +BJM_3013=org.apache.tuscany.sca.binding.jms.JMSBindingException: Error starting JMSServiceBinding +BJM_3014=**testcase incomplete** +BJM_3015=**testcase incomplete** +BJM_3017=org.oasisopen.sca.ServiceRuntimeException: [Contribution: BJM_3017, Artifact: Test_BJM_3017.composite] - XMLSchema validation error occured in: Test_BJM_3017.composite ,line = 36, column = 17, Message = cvc-complex-type.2.4.a: Invalid content was found starting with element 'activationSpec'. One of '{"http://docs.oasis-open.org/ns/opencsa/sca/200912":response, "http://docs.oasis-open.org/ns/opencsa/sca/200912":headers, "http://docs.oasis-open.org/ns/opencsa/sca/200912":messageSelection, "http://docs.oasis-open.org/ns/opencsa/sca/200912":resourceAdapter, "http://docs.oasis-open.org/ns/opencsa/sca/200912":operationProperties}' is expected. +BJM_3018=**testcase incomplete** +BJM_3019=**testcase incomplete** +BJM_3020=**testcase incomplete** +BJM_3021=**testcase incomplete** +BJM_3022=**testcase incomplete** +BJM_3023=**testcase incomplete** +BJM_3024=**testcase incomplete** +BJM_3025=**testcase incomplete** +BJM_3026=**testcase incomplete** +BJM_3029=**testcase incomplete** +BJM_3034=**testcase incomplete** +BJM_3037=**testcase incomplete** +BJM_4011=* + -- cgit v1.2.3