From 75558fef044008f76c928637fc59f1516cc3faf0 Mon Sep 17 00:00:00 2001 From: antelder Date: Tue, 3 Nov 2009 11:04:28 +0000 Subject: Delete old otest location, now moved to https://svn.apache.org/repos/asf/tuscany/otest/ git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@832392 13f79535-47bb-0310-9956-ffa450edef68 --- .../newlayout/tuscany-java-caa-test-runner/pom.xml | 183 ------------------ .../src/test/resources/oasis-sca-tests.properties | 30 --- .../tuscany-oasis-sca-tests-errors.properties | 56 ------ .../sca/otest/TuscanyOSGiRuntimeBridge.java | 164 ---------------- .../tuscany/sca/otest/TuscanyRuntimeBridge.java | 208 --------------------- 5 files changed, 641 deletions(-) delete mode 100644 java/sca/otest/newlayout/tuscany-java-caa-test-runner/pom.xml delete mode 100644 java/sca/otest/newlayout/tuscany-java-caa-test-runner/src/test/resources/oasis-sca-tests.properties delete mode 100644 java/sca/otest/newlayout/tuscany-java-caa-test-runner/src/test/resources/tuscany-oasis-sca-tests-errors.properties delete mode 100644 java/sca/otest/newlayout/tuscany-java-caa-test-runner/src/test/tjava/org/apache/tuscany/sca/otest/TuscanyOSGiRuntimeBridge.java delete mode 100644 java/sca/otest/newlayout/tuscany-java-caa-test-runner/src/test/tjava/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java (limited to 'java/sca/otest/newlayout/tuscany-java-caa-test-runner') diff --git a/java/sca/otest/newlayout/tuscany-java-caa-test-runner/pom.xml b/java/sca/otest/newlayout/tuscany-java-caa-test-runner/pom.xml deleted file mode 100644 index fc1ce3eccb..0000000000 --- a/java/sca/otest/newlayout/tuscany-java-caa-test-runner/pom.xml +++ /dev/null @@ -1,183 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-SNAPSHOT - ../pom.xml - - tuscany-otests-sca-j-caa-tests - Apache Tuscany SCA Specification Tests for SCA-J CAA - - - - org.apache.tuscany.sca - tuscany-node-impl - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-node-launcher-equinox - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-deployment - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-binding-ws-axis2 - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-host-jetty - 2.0-SNAPSHOT - - - - javax.servlet - servlet-api - 2.5 - - - - com.sun.xml.ws - jaxws-rt - 2.1.7 - - - - junit - junit - 4.5 - test - - - - - - - - ${artifactId} - - - org.apache.maven.plugins - maven-antrun-plugin - 1.3 - - - - ant - ant-trax - 1.6.5 - - - - - - copy-files-from-svn - generate-resources - - run - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - 1.3 - - - add-test-source - generate-sources - - add-test-source - - - - src/test/tjava - - - - - - - - diff --git a/java/sca/otest/newlayout/tuscany-java-caa-test-runner/src/test/resources/oasis-sca-tests.properties b/java/sca/otest/newlayout/tuscany-java-caa-test-runner/src/test/resources/oasis-sca-tests.properties deleted file mode 100644 index 9bd40612ee..0000000000 --- a/java/sca/otest/newlayout/tuscany-java-caa-test-runner/src/test/resources/oasis-sca-tests.properties +++ /dev/null @@ -1,30 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -# 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 - -# 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.TuscanyRuntimeBridge - -# The location of the contributions for the test suite -# %1 represents the placement of the name of each contribution into the location URI -org.oasis.sca.tests.assembly.contribution.location=../sca-java-caa/%1/target/%1.zip - diff --git a/java/sca/otest/newlayout/tuscany-java-caa-test-runner/src/test/resources/tuscany-oasis-sca-tests-errors.properties b/java/sca/otest/newlayout/tuscany-java-caa-test-runner/src/test/resources/tuscany-oasis-sca-tests-errors.properties deleted file mode 100644 index c76ed8cfff..0000000000 --- a/java/sca/otest/newlayout/tuscany-java-caa-test-runner/src/test/resources/tuscany-oasis-sca-tests-errors.properties +++ /dev/null @@ -1,56 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -JCA_2001=org.apache.tuscany.sca.interfacedef.OverloadedOperationException: Cannot overload operation operation1 on org.oasisopen.sca.test.Service1Overload as it is a @Remotable interface -JCA_3001=org.oasisopen.sca.ServiceRuntimeException: [Contribution: JCA_3001, Composite: {http://docs.oasis-open.org/ns/opencsa/scatests/200903}TEST_JCA_3001] - Class Not Found Exception: Service1 -JCA_3002=org.oasisopen.sca.ServiceRuntimeException: [Contribution: JCA_3002, Composite: {http://docs.oasis-open.org/ns/opencsa/scatests/200903}TEST_JCA_3002] - Class Not Found Exception: Service1 -JCA_3003=org.oasisopen.sca.ServiceRuntimeException: [Contribution: JCA_3003, Composite: {http://docs.oasis-open.org/ns/opencsa/scatests/200903}TEST_JCA_3003] - Class Not Found Exception: Service3Callback -JCA_3004=org.oasisopen.sca.ServiceRuntimeException: [Contribution: JCA_3004, Composite: {http://docs.oasis-open.org/ns/opencsa/scatests/200903}TEST_JCA_3004] - Class Not Found Exception: Service3Callback -JCA_3006=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TEST_JCA_3006Component2] - Component service interface incompatible with implementation service interface: Component = TEST_JCA_3006Component2 Service = Service3WithCallback Callback operation not found on target -JCA_3007=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TEST_JCA_3007Component1] - Component reference interface incompatible with implementation reference interface: Component = TEST_JCA_3007Component1 Reference = reference1 Callback operation not found on target -JCA_3008=org.oasisopen.sca.ServiceRuntimeException: [Contribution: JCA_3008, Artifact: Test_JCA_3008.composite] - XMLSchema validation error occured in: Test_JCA_3008.composite ,line = 30, column = 13, Message = cvc-complex-type.3.2.2: Attribute 'oops' is not allowed to appear in element 'interface.java'. -JCA_3009=org.apache.tuscany.sca.interfacedef.InvalidAnnotationException: @Remotable annotation present in a interface marked as not remotable in the SCDL -JCA_3011=org.oasisopen.sca.ServiceRuntimeException: [Contribution: JCA_3011, Composite: {http://docs.oasis-open.org/ns/opencsa/scatests/200903}TEST_JCA_3011] - JCA30006 Forbidden annotation interface org.oasisopen.sca.annotation.Property found in class org.oasisopen.sca.test.JCA3011Service -JCA_3012=org.oasisopen.sca.ServiceRuntimeException: [Contribution: JCA_3012, Composite: {http://docs.oasis-open.org/ns/opencsa/scatests/200903}TEST_JCA_3012] - JCA30007 Forbidden annotation interface org.oasisopen.sca.annotation.Property found in class org.oasisopen.sca.test.JCA3012Service3Callback -JCA_10001=org.apache.tuscany.sca.contribution.processor.ContributionResolveException: org.apache.tuscany.sca.implementation.java.introspect.impl.IllegalPropertyException: Argument 1 of method operation1 in class class org.oasisopen.sca.test.service1BadAnnotation can not be a Property -JCA_10002=org.oasisopen.sca.ServiceRuntimeException: [Contribution: JCA_10002, Composite: {http://docs.oasis-open.org/ns/opencsa/scatests/200903}TEST_JCA_10002] - JCA9002 SCA annotations are not permitted on static members: org.oasisopen.sca.test.service1Sta -JCA_10003=org.oasisopen.sca.ServiceRuntimeException: [Contribution: JCA_10003, Composite: {http://docs.oasis-open.org/ns/opencsa/scatests/200903}TEST_JCA_10003] - JCA9002 SCA annotations are not permitted on static members: org.oasisopen.sca.test.service1Sta -JCA_10004=org.apache.tuscany.sca.contribution.processor.ContributionResolveException: org.apache.tuscany.sca.implementation.java.introspect.impl.IllegalCallbackReferenceException: JCA90046 @Callback on field of method must not have any parameters -JCA_10006=org.apache.tuscany.sca.contribution.processor.ContributionResolveException: org.apache.tuscany.sca.implementation.java.introspect.impl.InvalidConstructorException: JCA90003 constructor parameters must have @Property or @Reference annotation -JCA_10007=org.apache.tuscany.sca.contribution.processor.ContributionResolveException: org.apache.tuscany.sca.implementation.java.introspect.impl.IllegalDestructorException: Destructor must not have argments -JCA_10008=org.apache.tuscany.sca.contribution.processor.ContributionResolveException: org.apache.tuscany.sca.implementation.java.introspect.impl.IllegalInitException: Initializer must not have argments -JCA_10009=org.apache.tuscany.sca.contribution.processor.ContributionResolveException: org.apache.tuscany.sca.implementation.java.introspect.impl.IllegalPropertyException: Final field serviceName in class org.oasisopen.sca.test.service1BadPropImpl can not be annotated as a Property -JCA_10010=org.apache.tuscany.sca.contribution.processor.ContributionResolveException: org.apache.tuscany.sca.implementation.java.introspect.impl.InvalidPropertyException: Missing property name: public org.oasisopen.sca.test.service1ConstrBadPropImpl(java.lang.String)[0] -JCA_10011=org.apache.tuscany.sca.contribution.processor.ContributionResolveException: org.apache.tuscany.sca.implementation.java.introspect.impl.InvalidPropertyException: JCA_90014 Constructor property must not have required=false: org.oasisopen.sca.test.service1ConstrBadPropImpl -JCA_10014=org.apache.tuscany.sca.contribution.processor.ContributionResolveException: org.apache.tuscany.sca.implementation.java.introspect.impl.InvalidReferenceException: JCA90018 @Reference in a Constructor must have a name attributeorg.oasisopen.sca.test.service1ConstrBad -JCA_10015=org.apache.tuscany.sca.contribution.processor.ContributionResolveException: org.apache.tuscany.sca.implementation.java.introspect.impl.InvalidReference -JCA_10046=org.oasisopen.sca.ServiceRuntimeException: [Contribution: JCA_General_Java] - Exception while generating WSDL: -JCA_10047=org.apache.tuscany.sca.contribution.processor.ContributionResolveException: org.apache.tuscany.sca.implementation.java.IntrospectionException: JCA90041 @Scope annotation not allowed on service interface -JCA_10048=org.apache.tuscany.sca.contribution.processor.ContributionResolveException: org.apache.tuscany.sca.implementation.java.IntrospectionException: JCA???? Implementation missing service method operation2 service interface org.oasisopen.sca.test.Service1Superset -JCA_10049=org.apache.tuscany.sca.contribution.processor.ContributionResolveException: org.apache.tuscany.sca.implementation.java.IntrospectionException: JCA90050 The number of Strings in the names attribute array of the @Service annotation MUST match the number of elements in the value attribute array -JCA_10050=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TEST_JCA_10050Component1] - Duplicate service name: Component = TEST_JCA_10050Component1 Service = Service1 -JCA_10051=org.apache.tuscany.sca.contribution.processor.ContributionResolveException: org.apache.tuscany.sca.implementation.java.IntrospectionException: JCA90059 The array of interfaces or classes specified by the value attribute of the @Service annotation -JCA_10052=org.apache.tuscany.sca.contribution.processor.ContributionResolveException: org.apache.tuscany.sca.implementation.java.IntrospectionException: JCA90060 The value of each element in the @Service names array MUST be unique amongst all the other element values in the array -JCA_11005=* org.apache.tuscany.sca.contribution.processor.ContributionReadException: java.io.FileNotFoundException: C:TuscanySVN2.x-trunkotestnewlayouttuscany-java-caa-test-runner..sca-java-caaJCA_11005targetJCA_11005.zip (The system cannot find the path specified) -# Intent and PolicySet related tests -JCA_8001=[POL40009] Intent {http://docs.oasis-open.org/ns/opencsa/scatests/200903}testIntent2 and {http://docs.oasis-open.org/ns/opencsa/scatests/200903}testIntent1 are mutually exclusive -JCA_8002=Method that is not an SCA reference cannot have policySet/intent annotations -JCA_8003=Field that is not an SCA reference cannot have policySet/intent annotations -JCA_8004=Constructor parameter that is not an SCA reference cannot have policySet/intent annotations -JCA_8006=[POL40009] Intent {http://docs.oasis-open.org/ns/opencsa/scatests/200903}testIntent2 and {http://docs.oasis-open.org/ns/opencsa/scatests/200903}testIntent1 are mutually exclusive -JCA_8008=Method that is not an SCA reference cannot have policySet/intent annotations -JCA_8009=Field that is not an SCA reference cannot have policySet/intent annotations -JCA_8010=Constructor parameter that is not an SCA reference cannot have policySet/intent annotations diff --git a/java/sca/otest/newlayout/tuscany-java-caa-test-runner/src/test/tjava/org/apache/tuscany/sca/otest/TuscanyOSGiRuntimeBridge.java b/java/sca/otest/newlayout/tuscany-java-caa-test-runner/src/test/tjava/org/apache/tuscany/sca/otest/TuscanyOSGiRuntimeBridge.java deleted file mode 100644 index afea19fe0b..0000000000 --- a/java/sca/otest/newlayout/tuscany-java-caa-test-runner/src/test/tjava/org/apache/tuscany/sca/otest/TuscanyOSGiRuntimeBridge.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.otest; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; - -import java.io.IOException; -import java.io.InputStream; -import java.util.Properties; - -import org.apache.tuscany.sca.node.Node; -import org.apache.tuscany.sca.node.equinox.launcher.Contribution; -import org.apache.tuscany.sca.node.equinox.launcher.ContributionLocationHelper; -import org.apache.tuscany.sca.node.equinox.launcher.NodeLauncher; - -import client.RuntimeBridge; -import client.TestConfiguration; - - -/** - * An implementation of the Runtime Bridge for the Apache Tuscany SCA runtime (version 2.x) - * - */ -public class TuscanyOSGiRuntimeBridge implements RuntimeBridge { - - static final String CONTRIBUTION_LOCATION_PROPKEY = "OASIS_TESTENV_CONTRIBUTION_LOCATION"; - - protected NodeLauncher launcher; - protected Node node; - TestConfiguration testConfiguration = null; - protected Properties expectedErrorMessages; - - public TuscanyOSGiRuntimeBridge() { - // read test error mapping - expectedErrorMessages = new Properties(); - try { - InputStream propertiesStream = this.getClass().getResourceAsStream("/tuscany-oasis-sca-tests-errors.properties"); - expectedErrorMessages.load(propertiesStream); - } catch (IOException e) { - System.out.println("Unable to read oasis-sca-tests-errors.properties file"); - } - } - - public TestConfiguration getTestConfiguration() { - return testConfiguration; - } - - public void setTestConfiguration(TestConfiguration testConfiguration) { - this.testConfiguration = testConfiguration; - } - - public boolean startContribution(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); - for (int i = 0; i < contributions.length; i++) { - contributions[i] = new Contribution(contributionNames[i], contributionURIs[i]); - } // end for - - node = launcher.createNode(testConfiguration.getComposite(), contributions); - System.out.println("SCA Node API ClassLoader: " + node.getClass().getClassLoader()); - // Start the node - node.start(); - } catch (Exception e) { - System.out.println(e.getMessage()); - e.printStackTrace(); - throw e; - } // end try - - return true; - } // end method startContribution - - /** - * Gets the location of the Contributions as URIs - * @param contributionLocation - a location pattern URI, which contains one or more "%1" - * substrings, which are substituted with the name of the contribution to get the URI of - * the contribution - * @return the contribution locations as an array of Strings - */ - 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", locations[i]); - - locations[i] = aLocation; - } // end for - } else { - if (locations == null) { - // No contribution specified - throw an Exception - throw new Exception("Unable to start SCA runtime - no contribution supplied - error"); - } else { - // No contribution location supplied - throw an Exception - throw new Exception("Unable to start SCA runtime - no contribution location supplied - error"); - } // end if - } // end if - - return locations; - } // end getContributionURI - - public void stopContribution() { - if (node != null) { - node.stop(); - node.destroy(); - } // end if - if (launcher != null) { - 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(); - - if (expectedMessage == null){ - fail("Null expected error message for test " + testName + - "Please add message to oasis-sca-tests-errors.properties"); - } - - if (receivedMessage == null){ - fail("Null received error message for test " + testName); - } - - int messageStart = receivedMessage.indexOf("] - "); - - if (messageStart < 0){ - fail("Message separator not found for test " + testName); - } - - receivedMessage = receivedMessage.substring(messageStart + 4); - - assertEquals( expectedMessage, receivedMessage ); - - return; - } - -} // end class TuscanyRuntimeBridge diff --git a/java/sca/otest/newlayout/tuscany-java-caa-test-runner/src/test/tjava/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java b/java/sca/otest/newlayout/tuscany-java-caa-test-runner/src/test/tjava/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java deleted file mode 100644 index fa4f6f6dd4..0000000000 --- a/java/sca/otest/newlayout/tuscany-java-caa-test-runner/src/test/tjava/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.otest; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.io.BufferedWriter; -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 client.RuntimeBridge; -import client.TestConfiguration; - -/** - * An implementation of the Runtime Bridge for the Apache Tuscany SCA runtime (version 2.x) - * - */ -public class TuscanyRuntimeBridge implements RuntimeBridge { - - static final String CONTRIBUTION_LOCATION_PROPKEY = "OASIS_TESTENV_CONTRIBUTION_LOCATION"; - - protected NodeFactory launcher; - protected Node node; - protected Properties expectedErrorMessages; - - TestConfiguration testConfiguration = null; - - public TuscanyRuntimeBridge() { - // read test error mapping - expectedErrorMessages = new Properties(); - try { - InputStream propertiesStream = this.getClass().getResourceAsStream("/tuscany-oasis-sca-tests-errors.properties"); - expectedErrorMessages.load(propertiesStream); - } catch (IOException e) { - System.out.println("Unable to read oasis-sca-tests-errors.properties file"); - } - } - - public TestConfiguration getTestConfiguration() { - return testConfiguration; - } - - public void setTestConfiguration(TestConfiguration testConfiguration) { - this.testConfiguration = testConfiguration; - } - - 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); - for (int i = 0; i < contributions.length; i++) { - contributions[i] = new Contribution(contributionNames[i], contributionURIs[i]); - } // end for - - node = launcher.createNode(testConfiguration.getComposite(), contributions); - // Start the node - node.start(); - - // For debugging - // print out the composites that have been read in success cases - // System.out.println(((NodeImpl)node).dumpDomainComposite()); - } catch (Exception e) { - System.out.println(e.getMessage()); - e.printStackTrace(); - throw e; - } // end try - - return true; - } // end method startContribution - - /** - * Gets the location of the Contributions as URIs - * @param contributionLocation - a location pattern URI, which contains one or more "%1" - * substrings, which are substituted with the name of the contribution to get the URI of - * the contribution - * @return the contribution locations as an array of Strings - */ - 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", locations[i]); - - locations[i] = aLocation; - } // end for - } else { - if (locations == null) { - // No contribution specified - throw an Exception - throw new Exception("Unable to start SCA runtime - no contribution supplied - error"); - } else { - // No contribution location supplied - throw an Exception - throw new Exception("Unable to start SCA runtime - no contribution location supplied - error"); - } // end if - } // end if - - return locations; - } // end getContributionURI - - public void stopContribution() { - if (node != null) { - node.stop(); - node.destroy(); - } // end if - if (launcher != null) { - 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(); - - if (expectedMessage == null){ - writeMissingMessage(testName, ex); - fail("Null expected error message for test " + testName + - "Please add message to oasis-sca-tests-errors.properties"); - } // end if - - if (receivedMessage == null){ - ex.printStackTrace(); - fail("Null received error message for test " + testName); - } // end if - - if (expectedMessage.startsWith("*")) { - // allow using * to ignore a message comparison - return; - } - - // Deal with the case where the end of the message is variable (eg contains absolute filenames) - // and where the only relevant part is the start of the message - in this case the expected - // message only contains the stem section which is unchanging... - if( receivedMessage.length() > expectedMessage.length() ) { - if (receivedMessage.contains(expectedMessage)) { - return; - } else { - receivedMessage = receivedMessage.substring(0, expectedMessage.length() ); - } - return; - } // end if - - if (!expectedMessage.equals(receivedMessage)) { - writeIncorrectMessage(testName, expectedMessage, receivedMessage); - } - - assertEquals( expectedMessage, receivedMessage ); - - return; - - } - - protected void writeMissingMessage(String testName, Throwable ex) { - try { - BufferedWriter out = new BufferedWriter(new FileWriter("target/OTestMissingMsgs.txt", true)); - out.write(testName + "=* " + ex.getMessage()); - out.newLine(); - out.close(); - } catch (IOException e) { - } - } - - protected void writeIncorrectMessage(String testName, String expected, String received) { - try { - BufferedWriter out = new BufferedWriter(new FileWriter("target/OTestIncorrectMsgs.txt", true)); - out.write(testName); out.newLine(); - out.write(" " + expected); out.newLine(); - out.write(" " + received); out.newLine(); - out.close(); - } catch (IOException e) { - } - } - -} // end class TuscanyRuntimeBridge -- cgit v1.2.3