summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2009-10-15 09:09:24 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2009-10-15 09:09:24 +0000
commitf2a4472a0f3839dbb5791ceb6813d2a6ff58360f (patch)
tree921a360f7adff8c556f15a22b6fe91f04f91aaea
parent6181cda14e54525c28ce344b00e55cddca4f0ab4 (diff)
Update the Tuscany assmebly tests runner to log missing and incorrect test messages to files in the target directory, enable starting expected messages with an '*' to bypass failing a test due to the message
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@825442 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--java/sca/otest/newlayout/tuscany-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-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 8ceb44e976..e2a38ae6f3 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
@@ -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
@@ -153,6 +155,11 @@ public class TuscanyRuntimeBridge implements RuntimeBridge {
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 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
@@ -161,6 +168,10 @@ public class TuscanyRuntimeBridge implements RuntimeBridge {
// 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 );
@@ -168,4 +179,25 @@ public class TuscanyRuntimeBridge implements RuntimeBridge {
}
+ 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