brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sjcorb...@apache.org
Subject [1/2] brooklyn-server git commit: TestSshCommand checks all assertions rather than throwing first
Date Wed, 22 Jun 2016 10:25:28 GMT
Repository: brooklyn-server
Updated Branches:
  refs/heads/master 004c6c1f0 -> 99d073f62


TestSshCommand checks all assertions rather than throwing first


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/c6266dde
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/c6266dde
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/c6266dde

Branch: refs/heads/master
Commit: c6266dde407756b93a06e037928371bd30f944ca
Parents: 004c6c1
Author: Sam Corbett <sam.corbett@cloudsoftcorp.com>
Authored: Wed Jun 22 10:22:28 2016 +0100
Committer: Sam Corbett <sam.corbett@cloudsoftcorp.com>
Committed: Wed Jun 22 10:22:28 2016 +0100

----------------------------------------------------------------------
 .../brooklyn/test/framework/TestFrameworkAssertions.java    | 9 +++++++++
 .../apache/brooklyn/test/framework/TestSshCommandImpl.java  | 8 +++++---
 2 files changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/c6266dde/test-framework/src/main/java/org/apache/brooklyn/test/framework/TestFrameworkAssertions.java
----------------------------------------------------------------------
diff --git a/test-framework/src/main/java/org/apache/brooklyn/test/framework/TestFrameworkAssertions.java
b/test-framework/src/main/java/org/apache/brooklyn/test/framework/TestFrameworkAssertions.java
index bc358f8..7f1406c 100644
--- a/test-framework/src/main/java/org/apache/brooklyn/test/framework/TestFrameworkAssertions.java
+++ b/test-framework/src/main/java/org/apache/brooklyn/test/framework/TestFrameworkAssertions.java
@@ -155,6 +155,15 @@ public class TestFrameworkAssertions {
         }
     }
 
+    public static <T> void checkActualAgainstAssertions(AssertionSupport support,
+            Map<String, Object> assertions, String target, T actual) {
+        try {
+            checkActualAgainstAssertions(assertions, target, actual);
+        } catch (Throwable t) {
+            support.fail(t);
+        }
+    }
+
     public static <T> void checkActualAgainstAssertions(Map<String, Object> assertions,
                                                          String target, T actual) {
         for (Map.Entry<String, Object> assertion : assertions.entrySet()) {

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/c6266dde/test-framework/src/main/java/org/apache/brooklyn/test/framework/TestSshCommandImpl.java
----------------------------------------------------------------------
diff --git a/test-framework/src/main/java/org/apache/brooklyn/test/framework/TestSshCommandImpl.java
b/test-framework/src/main/java/org/apache/brooklyn/test/framework/TestSshCommandImpl.java
index 3d2ae02..c65f4f9 100644
--- a/test-framework/src/main/java/org/apache/brooklyn/test/framework/TestSshCommandImpl.java
+++ b/test-framework/src/main/java/org/apache/brooklyn/test/framework/TestSshCommandImpl.java
@@ -197,15 +197,17 @@ public class TestSshCommandImpl extends TargetableTestComponentImpl
implements T
         LOG.debug("{}, Result is {}\nwith output [\n{}\n] and error [\n{}\n]", new Object[]
{
             this, result.getExitCode(), shorten(result.getStdout()), shorten(result.getStderr())
         });
+        TestFrameworkAssertions.AssertionSupport support = new TestFrameworkAssertions.AssertionSupport();
         for (Map<String, Object> assertion : exitCodeAssertions()) {
-            checkActualAgainstAssertions(assertion, "exit code", result.getExitCode());
+            checkActualAgainstAssertions(support, assertion, "exit code", result.getExitCode());
         }
         for (Map<String, Object> assertion : getAssertions(this, ASSERT_OUT)) {
-            checkActualAgainstAssertions(assertion, "stdout", result.getStdout());
+            checkActualAgainstAssertions(support, assertion, "stdout", result.getStdout());
         }
         for (Map<String, Object> assertion : getAssertions(this, ASSERT_ERR)) {
-            checkActualAgainstAssertions(assertion, "stderr", result.getStderr());
+            checkActualAgainstAssertions(support, assertion, "stderr", result.getStderr());
         }
+        support.validate();
     }
 
     private Result executeDownloadedScript(SshMachineLocation machineLocation, String url,
String scriptPath, Map<String, Object> env) {


Mime
View raw message