From 49668061453ae65d71f2ba37cbf0e2a10cbafbd6 Mon Sep 17 00:00:00 2001 From: slaws Date: Thu, 4 Mar 2010 12:09:29 +0000 Subject: Fix up OSGi version of the bridge also git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@918959 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/otest/TuscanyOSGiRuntimeBridge.java | 27 ++++++---------------- 1 file changed, 7 insertions(+), 20 deletions(-) (limited to 'otest/newlayout/tuscany-test-runner') diff --git a/otest/newlayout/tuscany-test-runner/src/test/tjava/org/apache/tuscany/sca/otest/TuscanyOSGiRuntimeBridge.java b/otest/newlayout/tuscany-test-runner/src/test/tjava/org/apache/tuscany/sca/otest/TuscanyOSGiRuntimeBridge.java index 8b909b0483..6f7af61cee 100644 --- a/otest/newlayout/tuscany-test-runner/src/test/tjava/org/apache/tuscany/sca/otest/TuscanyOSGiRuntimeBridge.java +++ b/otest/newlayout/tuscany-test-runner/src/test/tjava/org/apache/tuscany/sca/otest/TuscanyOSGiRuntimeBridge.java @@ -44,7 +44,6 @@ public class TuscanyOSGiRuntimeBridge implements RuntimeBridge { protected NodeLauncher launcher; protected Node node; - TestConfiguration testConfiguration = null; protected Properties expectedErrorMessages; public TuscanyOSGiRuntimeBridge() { @@ -58,26 +57,18 @@ public class TuscanyOSGiRuntimeBridge implements RuntimeBridge { } } - public TestConfiguration getTestConfiguration() { - return testConfiguration; - } - - public void setTestConfiguration(TestConfiguration testConfiguration) { - this.testConfiguration = testConfiguration; - } - - 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 launcher = NodeLauncher.newInstance(); 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); System.out.println("SCA Node API ClassLoader: " + node.getClass().getClassLoader()); // Start the node node.start(); @@ -97,17 +88,16 @@ public class TuscanyOSGiRuntimeBridge 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]); + String aLocation = contributionLocation.replaceAll("%1", contributionNames[i]); locations[i] = aLocation; - } // end for + } // end for } else { if (locations == null) { // No contribution specified - throw an Exception @@ -130,9 +120,6 @@ public class TuscanyOSGiRuntimeBridge implements RuntimeBridge { } // 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); -- cgit v1.2.3