diff options
Diffstat (limited to 'sca-java-2.x/branches/2.0-Beta1/compliance-tests/policy/src/test')
3 files changed, 0 insertions, 312 deletions
diff --git a/sca-java-2.x/branches/2.0-Beta1/compliance-tests/policy/src/test/java/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java b/sca-java-2.x/branches/2.0-Beta1/compliance-tests/policy/src/test/java/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java deleted file mode 100644 index 136e5668c0..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/compliance-tests/policy/src/test/java/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java +++ /dev/null @@ -1,238 +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.BufferedWriter;
-import java.io.File;
-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 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
- Properties ps = new Properties();
- ps.setProperty("defaultScheme", "vm");
- ps.setProperty("org.apache.tuscany.sca.binding.ws.jaxws.ri.JAXWSBindingProviderFactory.defaultPort", "8080");
- launcher = NodeFactory.newInstance(ps);
-
- 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]);
- // 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 {
- 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();
- } // 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 message has variable parts within it
- // 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("\\*\\*\\*");
-
- if (expectedMessageParts.length > 1){
- int foundParts = 0;
- for(int i = 0; i < expectedMessageParts.length; i++){
- if (receivedMessage.indexOf(expectedMessageParts[i]) > -1 ){
- foundParts++;
- }
- }
-
- if (foundParts == expectedMessageParts.length){
- 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() ) {
- // Truncate the received message to the length of the expected message
- receivedMessage = receivedMessage.substring(0, expectedMessage.length() );
- } // 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 + "=*");
- 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
diff --git a/sca-java-2.x/branches/2.0-Beta1/compliance-tests/policy/src/test/resources/oasis-sca-tests.properties b/sca-java-2.x/branches/2.0-Beta1/compliance-tests/policy/src/test/resources/oasis-sca-tests.properties deleted file mode 100644 index 0d8cc27a45..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/compliance-tests/policy/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=Java
-
-# 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=target/oasis-contributions/%1.zip
-
diff --git a/sca-java-2.x/branches/2.0-Beta1/compliance-tests/policy/src/test/resources/tuscany-oasis-sca-tests-errors.properties b/sca-java-2.x/branches/2.0-Beta1/compliance-tests/policy/src/test/resources/tuscany-oasis-sca-tests-errors.properties deleted file mode 100644 index 8a17b24f8b..0000000000 --- a/sca-java-2.x/branches/2.0-Beta1/compliance-tests/policy/src/test/resources/tuscany-oasis-sca-tests-errors.properties +++ /dev/null @@ -1,44 +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.
-
-POL_3001=TUSCANY-3370
-POL_3002=TUSCANY-3370
-POL_3003=org.oasisopen.sca.ServiceRuntimeException: [Contribution: POL_3003, Artifact: META-INF/definitions.xml, Definitions: jar:file:***/POL_3003.zip!/META-INF/definitions.xml] - [ASM10001,POL30002] Duplicate intent {http://docs.oasis-open.org/ns/opencsa/scatests/200903}dupIntent found in domain
-POL_3004=org.oasisopen.sca.ServiceRuntimeException: [Contribution: POL_3004, Artifact: META-INF/definitions.xml, Definitions: jar:file:***/POL_3004.zip!/META-INF/definitions.xml] - [POL30004] Intent twoDefaults has more than one qualifier marked as the default qualifier
-POL_3005=org.oasisopen.sca.ServiceRuntimeException: [Contribution: POL_3005, Artifact: META-INF/definitions.xml, Definitions: jar:file:***/POL_3005.zip!/META-INF/definitions.xml] - [POL30005] The intent dupQualifiers has more than one qualifier with the name qual1
-POL_3006=org.oasisopen.sca.ServiceRuntimeException: [Contribution: POL_3006, Artifact: META-INF/definitions.xml, Definitions: jar:file:***/POL_3006.zip!/META-INF/definitions.xml] - [POL30006] The profile intent name bad.ProfileIntent must not have the character "." in it
-POL_3009=org.oasisopen.sca.ServiceRuntimeException: [Contribution: POL_3009, Artifact: META-INF/definitions.xml, Definitions: jar:file:***/POL_3009.zip!/META-INF/definitions.xml] - [POL30010] The policy set TwoIntentMapPolicySet has more than one intent map with the name testIntent6
-POL_3012=org.oasisopen.sca.ServiceRuntimeException: [Contribution: http://tuscany.apache.org/SystemContribution] - [POL30015] Required Intent - {http://docs.oasis-open.org/ns/opencsa/scatests/200903}undefinedIntent2 not found for ProfileIntent {http://docs.oasis-open.org/ns/opencsa/scatests/200903}badProfileIntent
-POL_3013=org.oasisopen.sca.ServiceRuntimeException: [Contribution: http://tuscany.apache.org/SystemContribution] - [POL30016] Excluded Intent {http://docs.oasis-open.org/ns/opencsa/scatests/200903}undefinedIntent not found for intent {http://docs.oasis-open.org/ns/opencsa/scatests/200903}noMuxIntent
-POL_3014=org.oasisopen.sca.ServiceRuntimeException: [Contribution: Policy_General, Definitions: jar:file:***/Policy_General.zip!/META-INF/definitions.xml] - DuplicatePolicySet
-POL_3015=org.apache.tuscany.sca.contribution.processor.ContributionReadException: javax.xml.xpath.XPathExpressionException
-POL_3016=org.apache.tuscany.sca.contribution.processor.ContributionReadException: javax.xml.xpath.XPathExpressionException
-POL_3017=org.oasisopen.sca.ServiceRuntimeException: [Contribution: http://tuscany.apache.org/SystemContribution] - [POL30020] The policy set {http://docs.oasis-open.org/ns/opencsa/scatests/200903}BadIntentMapPolicySet intent map testIntent6 has missing qualifiers: testIntent6.qual2 The intent map qualifiers must match the provided intent qualifiers.
-POL_3018=org.oasisopen.sca.ServiceRuntimeException: [Contribution: POL_3018, Artifact: META-INF/definitions.xml, Definitions: jar:file:***/POL_3018.zip!/META-INF/definitions.xml] - [POL30021] Intent Map provides for Intent not specified as provided by parent PolicySet - BadIntentMapPolicySet
-POL_3020=TUSCANY-3371
-POL_4012=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200912}, Component: TestClient, Service: TestInvocation] - [POL40009,ASM60009,ASM60010,JCA70001,JCA70003] Intent {http://docs.oasis-open.org/ns/opencsa/scatests/200903}testIntent3 and {http://docs.oasis-open.org/ns/opencsa/scatests/200903}testIntent4 are mutually exclusive
-POL_4027=org.oasisopen.sca.ServiceRuntimeException: [Contribution: POL_4027, Artifact: META-INF/definitions.xml, Definitions: jar:file:***/POL_4027.zip!/META-INF/definitions.xml] - [POL40020] Duplicate binding type {http://docs.oasis-open.org/ns/opencsa/sca/200912}dupBinding.type found in domain
-POL_4028=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200912}] - [POL40002] The policy {http://docs.oasis-open.org/ns/opencsa/scatests/200903}PolicySetExtAttachProp has been attached to a property or one of its children. This is not allowed.
-POL_5001=org.oasisopen.sca.ServiceRuntimeException: [Contribution: http://tuscany.apache.org/SystemContribution] - [POL50001] An extension to support the implementation type {http://docs.oasis-open.org/ns/opencsa/sca/200912}unknown.type cant be found in the domain
-POL_9006=TUSCANY-1649
-POL_9009=TUSCANY-1649
-POL_9015=TUSCANY-1649
-POL_9016=TUSCANY-1649
-POL_9017=TUSCANY-1649
-POL_9018=TUSCANY-1649
-POL_10001=TUSCANY-3381
-POL_11001=org.oasisopen.sca.ServiceRuntimeException: [Contribution: POL_11001, Artifact: Test_POL_11001.composite] - XMLSchema validation error occured in: Test_POL_11001.composite ,line = ***, column = ***, Message = cvc-complex-type.2.4.a: Invalid content was found starting with element 'policySetAttachment'. One of '{"http://docs.oasis-open.org/ns/opencsa/sca/200912":documentation, "http://docs.oasis-open.org/ns/opencsa/sca/200912":interface, "http://docs.oasis-open.org/ns/opencsa/sca/200912":binding, "http://docs.oasis-open.org/ns/opencsa/sca/200912":callback, WC[##other:"http://docs.oasis-open.org/ns/opencsa/sca/200912"]}' is expected
\ No newline at end of file |