brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [10/18] brooklyn-server git commit: more logging for assertion failures
Date Fri, 04 Mar 2016 16:15:55 GMT
more logging for assertion failures


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

Branch: refs/heads/master
Commit: 6531c6809f273e5bbdd8ce8acfb2996d2ff90908
Parents: a9376d1
Author: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Authored: Wed Feb 24 15:05:41 2016 -0800
Committer: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Committed: Wed Feb 24 15:09:21 2016 -0800

----------------------------------------------------------------------
 .../main/java/org/apache/brooklyn/test/Asserts.java |  2 +-
 .../brooklyn/util/exceptions/ExceptionsTest.java    | 16 ++++++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6531c680/utils/common/src/main/java/org/apache/brooklyn/test/Asserts.java
----------------------------------------------------------------------
diff --git a/utils/common/src/main/java/org/apache/brooklyn/test/Asserts.java b/utils/common/src/main/java/org/apache/brooklyn/test/Asserts.java
index d0b4e13..aa74d1b 100644
--- a/utils/common/src/main/java/org/apache/brooklyn/test/Asserts.java
+++ b/utils/common/src/main/java/org/apache/brooklyn/test/Asserts.java
@@ -961,7 +961,7 @@ public class Asserts {
                     (System.currentTimeMillis()-startTime)+"ms elapsed "+
                     "(rethrowing): "+t);
             throw Exceptions.propagateAnnotated("failed succeeds-eventually, "+attempt+"
attempts, "+
-                (System.currentTimeMillis()-startTime)+"ms elapsed", t);
+                (System.currentTimeMillis()-startTime)+"ms elapsed: "+Exceptions.collapseText(t),
t);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/6531c680/utils/common/src/test/java/org/apache/brooklyn/util/exceptions/ExceptionsTest.java
----------------------------------------------------------------------
diff --git a/utils/common/src/test/java/org/apache/brooklyn/util/exceptions/ExceptionsTest.java
b/utils/common/src/test/java/org/apache/brooklyn/util/exceptions/ExceptionsTest.java
index a24d131..d5dcd04 100644
--- a/utils/common/src/test/java/org/apache/brooklyn/util/exceptions/ExceptionsTest.java
+++ b/utils/common/src/test/java/org/apache/brooklyn/util/exceptions/ExceptionsTest.java
@@ -157,6 +157,22 @@ public class ExceptionsTest {
     }
     
     @Test
+    public void testCollapseDoesNotIncludeRootCauseTwiceIfAppendedUncollapsed() throws Exception
{
+        NullPointerException npe = new NullPointerException("simulated2");
+        IllegalStateException ise = new IllegalStateException("simulated1: "+npe, npe);
+        
+        assertEquals(Exceptions.collapseText(ise), "simulated1: java.lang.NullPointerException:
simulated2");
+    }
+    
+    @Test
+    public void testCollapseDoesNotIncludeRootCauseTwiceIfAppendedCollapsed() throws Exception
{
+        NullPointerException npe = new NullPointerException("simulated2");
+        IllegalStateException ise = new IllegalStateException("simulated1: "+Exceptions.collapseText(npe),
npe);
+        
+        assertEquals(Exceptions.collapseText(ise), "simulated1: NullPointerException: simulated2");
+    }
+    
+    @Test
     public void test12CollapseCompound() throws Exception {
         RuntimeException e = Exceptions.create("test1", MutableSet.of(new IllegalStateException("test2"),
new IllegalStateException("test3")));
         assert12StandardChecks(e, false);


Mime
View raw message