summaryrefslogtreecommitdiffstats
path: root/java/sca/otest/newlayout/tuscany-java-caa-test-runner/src/test/tjava/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2009-10-15 09:07:23 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2009-10-15 09:07:23 +0000
commit6181cda14e54525c28ce344b00e55cddca4f0ab4 (patch)
tree7138ccea067325fdaa1ddab0a47e50a2019e3105 /java/sca/otest/newlayout/tuscany-java-caa-test-runner/src/test/tjava/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java
parent305ce8eea6f2ddd0e9d9a0aeab3bd1854ffc2f96 (diff)
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
Diffstat (limited to '')
-rw-r--r--java/sca/otest/newlayout/tuscany-java-caa-test-runner/src/test/tjava/org/apache/tuscany/sca/otest/TuscanyRuntimeBridge.java34
1 files changed, 33 insertions, 1 deletions
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