From e1790bde73952a95055f0e1f1e9ed00fd4d10fae Mon Sep 17 00:00:00 2001 From: antelder Date: Thu, 4 Mar 2010 23:24:20 +0000 Subject: Move back to the provious version of the runtim ebridge as thats what the published jars are still using git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@919232 13f79535-47bb-0310-9956-ffa450edef68 --- .../tuscany/sca/otest/TuscanyRuntimeBridge.java | 45 ++++++++++++++++++---- 1 file changed, 37 insertions(+), 8 deletions(-) (limited to 'sca-java-2.x/trunk/compliance-tests/policy/src/test/java') 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 63036d305c..8e79d1f9af 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 @@ -22,6 +22,7 @@ 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; @@ -46,6 +47,8 @@ public class TuscanyRuntimeBridge implements RuntimeBridge { protected NodeFactory launcher; protected Node node; protected Properties expectedErrorMessages; + + TestConfiguration testConfiguration = null; public TuscanyRuntimeBridge() { // read test error mapping @@ -58,18 +61,33 @@ public class TuscanyRuntimeBridge implements RuntimeBridge { } } - public boolean startContribution(String compositeName, String contributionLocation, String[] contributionNames) throws Exception { + 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 { 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); + 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(compositeName, contributions); + node = launcher.createNode(testConfiguration.getComposite(), contributions); // Start the node node.start(); @@ -92,14 +110,21 @@ public class TuscanyRuntimeBridge implements RuntimeBridge { * 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]; + 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", contributionNames[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"); + } locations[i] = aLocation; } // end for } else { @@ -123,6 +148,10 @@ 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 { @@ -146,7 +175,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 expected string + // 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("\\*\\*\\*"); -- cgit v1.2.3