From 3bd7bc08b97a4d6a9ff95873971b0b2939d63d69 Mon Sep 17 00:00:00 2001 From: antelder Date: Wed, 28 Jul 2010 11:07:50 +0000 Subject: 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 --- sca-java-2.x/trunk/compliance-tests/policy/pom.xml | 25 +++------ .../tuscany/sca/otest/TuscanyRuntimeBridge.java | 62 +++++++++------------- .../tuscany-oasis-sca-tests-errors.properties | 35 ++++++++---- 3 files changed, 56 insertions(+), 66 deletions(-) (limited to 'sca-java-2.x') diff --git a/sca-java-2.x/trunk/compliance-tests/policy/pom.xml b/sca-java-2.x/trunk/compliance-tests/policy/pom.xml index d2b5b925a3..548716f02f 100644 --- a/sca-java-2.x/trunk/compliance-tests/policy/pom.xml +++ b/sca-java-2.x/trunk/compliance-tests/policy/pom.xml @@ -78,24 +78,13 @@ maven-surefire-plugin - **/POL_3001_TestCase.java - **/POL_3002_TestCase.java - **/POL_3012_TestCase.java - **/POL_3020_TestCase.java - **/POL_4003_TestCase.java - **/POL_4028_TestCase.java - - **/POL_9006_TestCase.java - **/POL_9009_TestCase.java - **/POL_9015_TestCase.java - **/POL_9016_TestCase.java - **/POL_9017_TestCase.java - **/POL_9018_TestCase.java - - **/POL_10001_TestCase.java - **/POL_10002_TestCase.java - - **/POL_11001_TestCase.java + + **/POL_3002_TestCase.java + **/POL_4015_TestCase.java + **/POL_4016_TestCase.java + + + **/POL_3001_TestCase.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 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 diff --git a/sca-java-2.x/trunk/compliance-tests/policy/src/test/resources/tuscany-oasis-sca-tests-errors.properties b/sca-java-2.x/trunk/compliance-tests/policy/src/test/resources/tuscany-oasis-sca-tests-errors.properties index 8a17b24f8b..3a6e06654c 100644 --- a/sca-java-2.x/trunk/compliance-tests/policy/src/test/resources/tuscany-oasis-sca-tests-errors.properties +++ b/sca-java-2.x/trunk/compliance-tests/policy/src/test/resources/tuscany-oasis-sca-tests-errors.properties @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. -POL_3001=TUSCANY-3370 +POL_3001=Test service got an exception during execution: org.oasisopen.sca.ServiceRuntimeException WSDL document is using SOAP v1.2 but SOAP v1.1 is required by the specified policy intents 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 @@ -30,15 +30,28 @@ POL_3016=org.apache.tuscany.sca.contribution.processor.ContributionReadException 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_4001=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200912}, Component: TestClient, Service: TestInvocation] - The intent {http://docs.oasis-open.org/ns/opencsa/scatests/200903}testIntentExt2 associated with policy subject ***Endpoint: URI = TestClient#service-binding(TestInvocation/TestInvocation) has no matching policy set +POL_4004=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200912}, Component: TEST_POL_4004Component1, Composite: {http://docs.oasis-open.org/ns/opencsa/scatests/200903}TestCompositeImplIntent, Component: TestComposite0Component1, Composite: {http://docs.oasis-open.org/ns/opencsa/scatests/200903}TestComposite0, Component: TestComposite0Component1] - The intent {http://docs.oasis-open.org/ns/opencsa/scatests/200903}testImplIntent.qual2 associated with policy subject {http://docs.oasis-open.org/ns/opencsa/sca/200912}implementation.java (class=org.oasisopen.sca.test.service1Impl) has no matching policy set +POL_4005=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200912}, Component: TEST_POL_4005Component1, Service: Service1] - The intent {http://docs.oasis-open.org/ns/opencsa/scatests/200903}testImplIntent.qual2 associated with policy subject ***Endpoint: URI = TEST_POL_4005Component1#service-binding(Service1/Service1) has no matching policy set +POL_4006=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200912}, Component: TestClient, Service: TestInvocation] - The intent {http://docs.oasis-open.org/ns/opencsa/scatests/200903}HighIntent associated with policy subject ***Endpoint: URI = TestClient#service-binding(TestInvocation/TestInvocation) has no matching policy set +POL_4009=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200912}, Component: TEST_POL_4009Component1, Composite: {http://docs.oasis-open.org/ns/opencsa/scatests/200903}TestCompositeImplPolicySet, Component: TestComposite0Component1, Composite: {http://docs.oasis-open.org/ns/opencsa/scatests/200903}TestComposite0, Component: TestComposite0Component1] - The intent {http://docs.oasis-open.org/ns/opencsa/scatests/200903}testImplIntent2 associated with policy subject {http://docs.oasis-open.org/ns/opencsa/sca/200912}implementation.java (class=org.oasisopen.sca.test.service1Impl) has no matching policy set +POL_4010=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200912}, Component: TestClient, Service: TestInvocation] - The intent {http://docs.oasis-open.org/ns/opencsa/scatests/200903}DirectIntent associated with policy subject ***Endpoint: URI = TestClient#service-binding(TestInvocation/TestInvocation) has no matching policy set +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}testIntent*** and {http://docs.oasis-open.org/ns/opencsa/scatests/200903}testIntent*** are mutually exclusive +POL_4018=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200912}, Component: TestClient, Service: TestInvocation] - The intent {http://docs.oasis-open.org/ns/opencsa/scatests/200903}DirectIntent associated with policy subject ***Endpoint: URI = TestClient#service-binding(TestInvocation/TestInvocation) has no matching policy set +POL_4027=org.oasisopen.sca.ServiceRuntimeException: [Contribution: POL_4027, Artifact: META-INF/definitions.xml, Definitions:*** - [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_4033=org.oasisopen.sca.ServiceRuntimeException: [Contribution: POL_4033, Artifact: META-INF/definitions.xml, Definitions:*** - ContributionReadException occurred due to: org.apache.tuscany.sca.contribution.processor.ContributionReadException: javax.xml.xpath.XPathExpressionException 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 +POL_9006=org.oasisopen.sca.ServiceRuntimeException: [] - The Component reference reference1 can not require transactedOneWay because the implementation for Component TEST_POL_9006Component1 requires managedTransaction.local +POL_9009=org.oasisopen.sca.ServiceRuntimeException: [] - The Component service Service1 can not require transactedOneWay because the implementation for Component TEST_POL_9009Component2 requires managedTransaction.local +POL_9015=org.oasisopen.sca.ServiceRuntimeException: [] - The component service Service1 can not require propagatesTransaction because the implementation for component TEST_POL_9015Component1 requires managedTransaction.local +POL_9016=org.oasisopen.sca.ServiceRuntimeException: [] - The component service Service1 can not require propagatesTransaction because the implementation for component TEST_POL_9016Component1 requires noManagedTransaction +POL_9017=org.oasisopen.sca.ServiceRuntimeException: [] - The component reference reference1 can not require propagatesTransaction because the implementation for component TEST_POL_9017Component1 requires managedTransaction.local +POL_9018=org.oasisopen.sca.ServiceRuntimeException: [] - The component reference reference1 can not require propagatesTransaction because the implementation for component TEST_POL_9018Component1 requires noManagedTransaction +POL_9019=org.oasisopen.sca.ServiceRuntimeException: [***] - The Component reference reference1 can not require transactedOneWay because the implementation for Component TEST_POL_9019Component1 requires managedTransaction.local +POL_9020=org.oasisopen.sca.ServiceRuntimeException: [] - The component reference reference1 can not require transactedOneWay because the operation operation1 is a two way operation +POL_9021=org.oasisopen.sca.ServiceRuntimeException: [] - The component reference reference1 can not require immediateOneWay because the operation operation1 is a two way operation +POL_9022=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200912}, Component: TEST_POL_9022Component1, Reference: reference1] - [POL40009,ASM60009,ASM60010,JCA70001,JCA70003] Intent {http://docs.oasis-open.org/ns/opencsa/sca/200912}*** and {http://docs.oasis-open.org/ns/opencsa/sca/200912}*** are mutually exclusive +POL_9023=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200912}, Component: TEST_POL_9023Component2, Service: Service1] - [POL40009,ASM60009,ASM60010,JCA70001,JCA70003] Intent {http://docs.oasis-open.org/ns/opencsa/sca/200912}*** and {http://docs.oasis-open.org/ns/opencsa/sca/200912}*** are mutually exclusive +POL_10001=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200912}, Component: TestClient, Service: TestInvocation] - The noListener intent may only be specified on a reference. +POL_11001=org.oasisopen.sca.ServiceRuntimeException: [Contribution: POL_11001, Artifact: Test_POL_11001.composite] - XMLSchema validation error occured in: Test_POL_11001.composite ,line = 21, column = 4, Message = cvc-complex-type.3.2.2: Attribute 'badAttribute' is not allowed to appear in element 'policySetAttachment'. \ No newline at end of file -- cgit v1.2.3