From ce8ce56837922f872e9ba6ffb1d4ef35cf85d88f Mon Sep 17 00:00:00 2001 From: slaws Date: Wed, 21 Oct 2009 13:12:16 +0000 Subject: TUSCANY-3343 Add in the ability to include the string "***" in an expected message to indicate that some text at the marked point should not be compared. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@828004 13f79535-47bb-0310-9956-ffa450edef68 --- .../tuscany-oasis-sca-tests-errors.properties | 4 ++-- .../tuscany/sca/otest/TuscanyRuntimeBridge.java | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) (limited to 'java/sca/otest/newlayout/tuscany-test-runner/src') diff --git a/java/sca/otest/newlayout/tuscany-test-runner/src/test/resources/tuscany-oasis-sca-tests-errors.properties b/java/sca/otest/newlayout/tuscany-test-runner/src/test/resources/tuscany-oasis-sca-tests-errors.properties index afe5210fa5..b9d16437e1 100644 --- a/java/sca/otest/newlayout/tuscany-test-runner/src/test/resources/tuscany-oasis-sca-tests-errors.properties +++ b/java/sca/otest/newlayout/tuscany-test-runner/src/test/resources/tuscany-oasis-sca-tests-errors.properties @@ -70,8 +70,8 @@ ASM_8012=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oas ASM_8018=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestClient] - Component service interface incompatible with implementation service interface: Component = TestClient Service = TestInvocation ASM_8019=org.oasisopen.sca.ServiceRuntimeException: [Contribution: ASM_8019, Artifact: Test_ASM_8019.composite] - The interface.wsdl interface {http://test.sca.oasisopen.org/}Service1 element can only have a remotable attribute with the value "true" as WSDL interface are assumed to be remotable by default. The value that was found is: false. ASM_9002=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1] - Multiple bindings with the same name for a service: Service = Service1 Binding name = Fred -ASM_10001=org.oasisopen.sca.ServiceRuntimeException: [Contribution: General, Definitions: jar:file:/C:/Tuscany/2.x-daily/otest/newlayout/tuscany-test-runner/../sca-assembly/General/target/General.zip!/META-INF/definitions.xml] - Duplicate intent {http://docs.oasis-open.org/ns/opencsa/scatests/200903}Fred found in domain -ASM_10003=org.oasisopen.sca.ServiceRuntimeException: [Contribution: ASM_10003, Artifact: META-INF/definitions.xml, Definitions: jar:file:/C:/Tuscany/2.x-daily/otest/newlayout/tuscany-test-runner/../sca-assembly/ASM_10003/target/ASM_10003.zip!/META-INF/definitions.xml] - XMLSchema validation error occured in: null ,line = 17, column = 2, Message = cvc-complex-type.2.4.a: Invalid content was found starting with element 'component'. One of '{"http://docs.oasis-open.org/ns/opencsa/sca/200903":documentation, "http://docs.oasis-open.org/ns/opencsa/sca/200903":intent, "http://docs.oasis-open.org/ns/opencsa/sca/200903":policySet, "http://docs.oasis-open.org/ns/opencsa/sca/200903":binding, "http://docs.oasis-open.org/ns/opencsa/sca/200903":bindingType, "http://docs.oasis-open.org/ns/opencsa/sca/200903":implementationType, WC[##other:"http://docs.oasis-open.org/ns/opencsa/sca/200903"]}' is expected. +ASM_10001=org.oasisopen.sca.ServiceRuntimeException: [Contribution: General, Definitions: jar:file:***/General/target/General.zip!/META-INF/definitions.xml] - Duplicate intent {http://docs.oasis-open.org/ns/opencsa/scatests/200903}Fred found in domain +ASM_10003=org.oasisopen.sca.ServiceRuntimeException: [Contribution: ASM_10003, Artifact: META-INF/definitions.xml, Definitions: jar:file:***ASM_10003.zip!/META-INF/definitions.xml] - XMLSchema validation error occured in: Test_ASM_10003.composite ,line = 17, column = 2, Message = cvc-complex-type.2.4.a: Invalid content was found starting with element 'component'. One of '{"http://docs.oasis-open.org/ns/opencsa/sca/200903":documentation, "http://docs.oasis-open.org/ns/opencsa/sca/200903":intent, "http://docs.oasis-open.org/ns/opencsa/sca/200903":policySet, "http://docs.oasis-open.org/ns/opencsa/sca/200903":binding, "http://docs.oasis-open.org/ns/opencsa/sca/200903":bindingType, "http://docs.oasis-open.org/ns/opencsa/sca/200903":implementationType, WC[##other:"http://docs.oasis-open.org/ns/opencsa/sca/200903"]}' is expected. ASM_12007=TODO ASM_12008=TODO ASM_12011=TODO diff --git a/java/sca/otest/newlayout/tuscany-test-runner/src/test/tjava/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java b/java/sca/otest/newlayout/tuscany-test-runner/src/test/tjava/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java index e2a38ae6f3..9591be0192 100644 --- a/java/sca/otest/newlayout/tuscany-test-runner/src/test/tjava/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java +++ b/java/sca/otest/newlayout/tuscany-test-runner/src/test/tjava/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java @@ -26,6 +26,7 @@ import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; import java.util.Properties; +import java.util.StringTokenizer; import org.apache.tuscany.sca.node.Contribution; import org.apache.tuscany.sca.node.ContributionLocationHelper; @@ -161,6 +162,25 @@ public class TuscanyRuntimeBridge implements RuntimeBridge { 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... -- cgit v1.2.3