brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [27/50] brooklyn-server git commit: Suppress and log exceptions in tearDown test method
Date Mon, 01 Feb 2016 17:49:31 GMT
Suppress and log exceptions in tearDown test method


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

Branch: refs/heads/0.6.0
Commit: 4facfeb1825b58ac345a20d90bfe787f85e82f68
Parents: 331cc47
Author: Andrew Kennedy <andrew.kennedy@cloudsoftcorp.com>
Authored: Wed Nov 13 16:29:08 2013 +0000
Committer: Andrew Kennedy <andrew.kennedy@cloudsoftcorp.com>
Committed: Wed Nov 13 16:29:08 2013 +0000

----------------------------------------------------------------------
 .../entity/BrooklynMgmtContextTestSupport.java         | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/4facfeb1/software/base/src/test/java/brooklyn/entity/BrooklynMgmtContextTestSupport.java
----------------------------------------------------------------------
diff --git a/software/base/src/test/java/brooklyn/entity/BrooklynMgmtContextTestSupport.java
b/software/base/src/test/java/brooklyn/entity/BrooklynMgmtContextTestSupport.java
index 1e0ff46..bef60ff 100644
--- a/software/base/src/test/java/brooklyn/entity/BrooklynMgmtContextTestSupport.java
+++ b/software/base/src/test/java/brooklyn/entity/BrooklynMgmtContextTestSupport.java
@@ -1,5 +1,7 @@
 package brooklyn.entity;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 
@@ -10,6 +12,8 @@ import brooklyn.test.entity.TestApplication;
 
 public class BrooklynMgmtContextTestSupport {
 
+    private static final Logger LOG = LoggerFactory.getLogger(BrooklynMgmtContextTestSupport.class);
+
     protected TestApplication app;
     protected ManagementContext mgmt;
 
@@ -25,8 +29,13 @@ public class BrooklynMgmtContextTestSupport {
 
     @AfterMethod(alwaysRun=true)
     public void tearDown() throws Exception {
-        if (mgmt != null) Entities.destroyAll(mgmt);
-        mgmt = null;
+        try {
+            if (mgmt != null) Entities.destroyAll(mgmt);
+        } catch (Throwable t) {
+            LOG.error("Caught exception in tearDown method", t);
+        } finally {
+            mgmt = null;
+        }
     }
     
 }


Mime
View raw message