From 6181cda14e54525c28ce344b00e55cddca4f0ab4 Mon Sep 17 00:00:00 2001 From: antelder Date: Thu, 15 Oct 2009 09:07:23 +0000 Subject: Update test runner to log missing and incorrect expected test messages to files in the target directory and to enable using a '*' at the start of the expected message to bypass failing a test due to message, and update the expected message file with all the required tests using an * for the messages for now git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@825441 13f79535-47bb-0310-9956-ffa450edef68 --- .../tuscany-oasis-sca-tests-errors.properties | 74 ++++++++++++---------- .../tuscany/sca/otest/TuscanyRuntimeBridge.java | 34 +++++++++- 2 files changed, 72 insertions(+), 36 deletions(-) (limited to 'java') 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 index b830911614..c3e5104256 100644 --- 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 @@ -14,39 +14,43 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. - -ASM_4002=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1] - Duplicate service name: Component = TestComponent1 Service = Service1 -ASM_4003=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1] - Duplicate reference name: Component = TestComponent1 Reference = Reference1 -ASM_4004=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1] - Duplicate property name: Component = TestComponent1 Property = propertyName -ASM_4007=org.apache.tuscany.sca.contribution.processor.ContributionReadException: Error: property has both @type and @element attribute values - propertyName -ASM_4008=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1] - [ASM_4008] No value configured on a mustSupply property: Component = TestComponent1 Property = propertyName -ASM_5004=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestClient] - Too many targets on reference: reference1 -ASM_5005=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1] - Duplicate service name: Component = TestComponent1 Service = Service1 -ASM_5006=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1] - Component type service not found for component service (missing @Remotable annotation?): Component = TestComponent1 Service = InvalidName -ASM_5007=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1] - Duplicate reference name: Component = TestComponent1 Reference = Reference1 -ASM_5008=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1] - Component type reference not found for component reference: Component = TestComponent1 Reference = InvalidName -ASM_5009=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}] - Duplicate component name: Composite = {http://docs.oasis-open.org/ns/opencsa/sca/200903} Component = TestComponent1 -ASM_5010=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1] - Component service interface incompatible with implementation service interface: Component = TestComponent1 Service = Service1 -ASM_5014=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1] - Component reference multiplicity incompatible with reference multiplicity: Component = TestComponent1 Reference = Reference1 -ASM_5023=OASIS issue opened -ASM_5024=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1, Reference: Reference1] - Composite {http://docs.oasis-open.org/ns/opencsa/sca/200903} Component TestComponent1 Reference Reference1 must not specify endpoints using both target attribute and with binding uri attribute -ASM_5027=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1] - Duplicate component property name: Component = TestComponent1 Property = serviceName -ASM_5028=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1] - Property not found for component property: Component = TestComponent1 Property = randomName -ASM_5029=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TestComponent1] - The property component TestComponent1 property complexType has many values but its "many" attribute is set to false -ASM_5030=org.oasisopen.sca.ServiceRuntimeException: [Contribution: ASM_5030, Artifact: Test_ASM_5030.composite] - ASM50033: value attribute exists for the property element -ASM_5035=org.apache.tuscany.sca.contribution.processor.ContributionReadException: Error: property has both @type and @element attribute values - complexType -ASM_5036=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TEST_ASM_5036Component1] - [ASM_5036] The property component TEST_ASM_5036Component1 property complexType has XSD type {http://docs.oasis-open.org/ns/opencsa/scatests/200903}ComplexType2 while its component type property has the XSD type {http://docs.oasis-open.org/ns/opencsa/scatests/200903}ComplexType1 -ASM_5037=org.oasisopen.sca.ServiceRuntimeException: [Composite: {http://docs.oasis-open.org/ns/opencsa/sca/200903}, Component: TEST_ASM_5037Component1] - Property not found for component property: Component = TEST_ASM_5037Component1 Property = bogusName -ASM_6016=Unknown error message - need to determine the correct error message for this testcase -ASM_6020=Unknown error message - need to determine the correct error message for this testcase -ASM_6023=Unknown error message - need to determine the correct error message for this testcase -ASM_6024=org.oasisopen.sca.ServiceRuntimeException: [Composite: http://tuscany.apache.org/xmlns/sca/1.1] - Component implementation not resolved: Component = TestComponent1 Uri = null -ASM_6030=Unknown error message - need to determine the correct error message for this testcase -ASM_7002=Unknown error message - need to determine the correct error message for this testcase -ASM_7003=Unknown error message - need to determine the correct error message for this testcase -ASM_8007=org.oasisopen.sca.ServiceRuntimeException: [Composite: http://tuscany.apache.org/xmlns/sca/1.1] - Component service interface incompatible with implementation service interface: Component = TestComponent2 Service = Service1 -ASM_8008=org.oasisopen.sca.ServiceRuntimeException: [Composite: http://tuscany.apache.org/xmlns/sca/1.1] - Component reference interface incompatible with implementation reference interface: Component = TestComponent1 Reference = Reference1 -ASM_8009=org.oasisopen.sca.ServiceRuntimeException: [Composite: http://tuscany.apache.org/xmlns/sca/1.1] - Component reference interface incompatible with implementation reference interface: Component = TEST_ASM_8009Component1 Reference = Reference1 -ASM_8018=org.oasisopen.sca.ServiceRuntimeException: [Composite: http://tuscany.apache.org/xmlns/sca/1.1] - Component service interface incompatible with implementation service interface: Component = TestClient Service = TestInvocation -ASM_10001=org.oasisopen.sca.ServiceRuntimeException: [] - Duplicate intent {http://docs.oasis-open.org/ns/opencsa/scatests/200903}Fred found in domain +JCA_10046=* +JCA_11005=* +JCA_8002=* +JCA_8006=* +JCA_8003=* +JCA_3007=* +JCA_3008=* +JCA_10050=* +JCA_10047=* +JCA_10003=* +JCA_10011=* +JCA_2001=* +JCA_3003=* +JCA_8004=* +JCA_3004=* +JCA_10048=* +JCA_8010=* +JCA_10014=* +JCA_3011=* +JCA_10052=* +JCA_3002=* +JCA_10008=* +JCA_3001=* +JCA_3006=* +JCA_10002=* +JCA_3009=* +JCA_10051=* +JCA_8008=* +JCA_10049=* +JCA_8001=* +JCA_10010=* +JCA_8009=* +JCA_10009=* +JCA_10015=* +JCA_10007=* +JCA_10004=* +JCA_10001=* +JCA_3012=* +JCA_10006=* 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 index 8ceb44e976..3dbb95ce8b 100644 --- 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 @@ -21,6 +21,8 @@ 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.FileWriter; import java.io.IOException; import java.io.InputStream; import java.util.Properties; @@ -29,7 +31,6 @@ 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 org.apache.tuscany.sca.node.impl.NodeImpl; import client.RuntimeBridge; import client.TestConfiguration; @@ -145,6 +146,7 @@ public class TuscanyRuntimeBridge implements RuntimeBridge { 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 @@ -154,6 +156,11 @@ public class TuscanyRuntimeBridge implements RuntimeBridge { 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... @@ -162,10 +169,35 @@ public class TuscanyRuntimeBridge implements RuntimeBridge { 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 -- cgit v1.2.3