summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/compliance-tests/policy/src/test/java/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2010-07-28 11:07:50 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2010-07-28 11:07:50 +0000
commit3bd7bc08b97a4d6a9ff95873971b0b2939d63d69 (patch)
treeaee4d9c399498f184f253c4c851402e10c14c7bb /sca-java-2.x/trunk/compliance-tests/policy/src/test/java/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java
parenta7924f87bed97d3f31355d51ab0079a99cb56caa (diff)
Update policy compliance tests in trunk to match the latest oasis code
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@980019 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--sca-java-2.x/trunk/compliance-tests/policy/src/test/java/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java62
1 files changed, 25 insertions, 37 deletions
diff --git a/sca-java-2.x/trunk/compliance-tests/policy/src/test/java/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java b/sca-java-2.x/trunk/compliance-tests/policy/src/test/java/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java
index 136e5668c0..ac2759114f 100644
--- a/sca-java-2.x/trunk/compliance-tests/policy/src/test/java/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java
+++ b/sca-java-2.x/trunk/compliance-tests/policy/src/test/java/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java
@@ -29,12 +29,11 @@ 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 +46,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 +58,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 +67,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 +95,18 @@ 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";
- }
+ String aLocation = contributionLocation.replaceAll("%1", contributionNames[i]);
+
if (!(new File(aLocation)).exists()) {
- aLocation = aLocation.replace(".zip", ".jar");
+ aLocation = aLocation.replace(".zip", ".jar");
}
+
locations[i] = aLocation;
} // end for
} else {
@@ -151,15 +130,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 +153,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("\\*\\*\\*");
@@ -234,5 +209,18 @@ public class TuscanyRuntimeBridge implements RuntimeBridge {
} 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