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
This commit is contained in:
antelder 2010-06-21 10:15:06 +00:00
parent 800c9d8d74
commit d922544c36
4 changed files with 62 additions and 42 deletions
sca-java-2.x/trunk/compliance-tests/binding-jms

View file

@ -44,6 +44,18 @@
<version>2.0-SNAPSHOT</version> <version>2.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency>
<groupId>org.apache.tuscany.sca.shades</groupId>
<artifactId>tuscany-jms</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-core</artifactId>
<version>5.2.0</version>
</dependency>
<!-- This is need when running with Sun JDK which gets an unsupported operation exception creating an XMLStreamReader from a DOMSource <!-- This is need when running with Sun JDK which gets an unsupported operation exception creating an XMLStreamReader from a DOMSource
when Tuscany is writing a property value --> when Tuscany is writing a property value -->
<dependency> <dependency>
@ -106,7 +118,7 @@
<artifactId>oasis-binding-jms-test-runner</artifactId> <artifactId>oasis-binding-jms-test-runner</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<type>jar</type> <type>jar</type>
<excludes>commons-logging.properties,oasis-sca-tests.properties</excludes> <excludes>commons-logging.properties,oasis-sca-tests.properties,tuscany-oasis-sca-tests-errors.properties</excludes>
<outputDirectory>${project.build.directory}/test-classes</outputDirectory> <outputDirectory>${project.build.directory}/test-classes</outputDirectory>
</artifactItem> </artifactItem>
</artifactItems> </artifactItems>

View file

@ -22,19 +22,17 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import java.io.BufferedWriter; import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.Properties; import java.util.Properties;
import org.apache.tuscany.sca.node.Contribution; 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.Node;
import org.apache.tuscany.sca.node.NodeFactory; import org.apache.tuscany.sca.node.NodeFactory;
import testClient.TestException_Exception;
import client.RuntimeBridge; import client.RuntimeBridge;
import client.TestConfiguration;
/** /**
* An implementation of the Runtime Bridge for the Apache Tuscany SCA runtime (version 2.x) * 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 NodeFactory launcher;
protected Node node; protected Node node;
protected Properties expectedErrorMessages; protected Properties expectedErrorMessages;
TestConfiguration testConfiguration = null;
public TuscanyRuntimeBridge() { public TuscanyRuntimeBridge() {
// read test error mapping // read test error mapping
@ -61,22 +57,7 @@ public class TuscanyRuntimeBridge implements RuntimeBridge {
} }
} }
public TestConfiguration getTestConfiguration() { public boolean startContribution(String compositeName, String contributionLocation, String[] contributionNames) throws Exception {
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 {
try { try {
// Tuscany specific code which starts the contribution(s) holding the test // Tuscany specific code which starts the contribution(s) holding the test
Properties ps = new Properties(); Properties ps = new Properties();
@ -85,12 +66,12 @@ public class TuscanyRuntimeBridge implements RuntimeBridge {
launcher = NodeFactory.newInstance(ps); launcher = NodeFactory.newInstance(ps);
Contribution[] contributions = new Contribution[contributionNames.length]; Contribution[] contributions = new Contribution[contributionNames.length];
String[] contributionURIs = getContributionURIs(contributionLocation); String[] contributionURIs = getContributionURIs(contributionLocation, contributionNames);
for (int i = 0; i < contributions.length; i++) { for (int i = 0; i < contributions.length; i++) {
contributions[i] = new Contribution(contributionNames[i], contributionURIs[i]); contributions[i] = new Contribution(contributionNames[i], contributionURIs[i]);
} // end for } // end for
node = launcher.createNode(testConfiguration.getComposite(), contributions); node = launcher.createNode(compositeName, contributions);
// Start the node // Start the node
node.start(); node.start();
@ -113,21 +94,14 @@ public class TuscanyRuntimeBridge implements RuntimeBridge {
* the contribution * the contribution
* @return the contribution locations as an array of Strings * @return the contribution locations as an array of Strings
*/ */
protected String[] getContributionURIs(String contributionLocation) throws Exception { protected String[] getContributionURIs(String contributionLocation, String[] contributionNames) throws Exception {
String[] locations; String[] locations = new String[contributionNames.length];
locations = testConfiguration.getContributionNames();
if (locations != null && contributionLocation != null) { if (locations != null && contributionLocation != null) {
for (int i = 0; i < locations.length; i++) { for (int i = 0; i < locations.length; i++) {
String aLocation = contributionLocation.replaceAll("%1", locations[i]); String aLocation = contributionLocation.replaceAll("%1", contributionNames[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");
}
locations[i] = aLocation; locations[i] = aLocation;
} // end for } // end for
} else { } else {
@ -151,15 +125,11 @@ public class TuscanyRuntimeBridge implements RuntimeBridge {
launcher.destroy(); launcher.destroy();
} // end if } // end if
} // end method stopContribution } // 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 { public void checkError(String testName, Throwable ex) throws Throwable {
String expectedMessage = expectedErrorMessages.getProperty(testName); String expectedMessage = expectedErrorMessages.getProperty(testName);
String receivedMessage = ex.getMessage(); String receivedMessage = getErrorMessage(ex);//ex.getMessage();
if (expectedMessage == null){ if (expectedMessage == null){
writeMissingMessage(testName, ex); writeMissingMessage(testName, ex);
@ -178,7 +148,7 @@ public class TuscanyRuntimeBridge implements RuntimeBridge {
} }
// Deal with the case where the message has variable parts within it // 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 // and make sure all the individual parts are present in the results string
String expectedMessageParts[] = expectedMessage.split("\\*\\*\\*"); 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 } // end class TuscanyRuntimeBridge

View file

@ -18,7 +18,7 @@
# OASIS SCA Assembly test properties # OASIS SCA Assembly test properties
# The implementation type to use for Assembly test suite # The implementation type to use for Assembly test suite
# org.oasis.sca.tests.assembly.lang=BPEL # 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 # 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.TuscanyOSGiRuntimeBridge

View file

@ -14,4 +14,30 @@
# KIND, either express or implied. See the License for the # KIND, either express or implied. See the License for the
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # 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=*