activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cshan...@apache.org
Subject activemq git commit: https://issues.apache.org/jira/browse/AMQ-6065
Date Sun, 29 Nov 2015 15:06:36 GMT
Repository: activemq
Updated Branches:
  refs/heads/master 673c2928a -> 39a20bd78


https://issues.apache.org/jira/browse/AMQ-6065

Fixed test case so that a System.exit call will not take down the
JVM and cause the test suite to abort in Jenkins early


Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/39a20bd7
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/39a20bd7
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/39a20bd7

Branch: refs/heads/master
Commit: 39a20bd788c664105c18886abf77c372cf9229aa
Parents: 673c292
Author: Christopher L. Shannon <christopher.l.shannon@gmail.com>
Authored: Sun Nov 29 10:05:27 2015 -0500
Committer: Christopher L. Shannon <christopher.l.shannon@gmail.com>
Committed: Sun Nov 29 10:05:27 2015 -0500

----------------------------------------------------------------------
 activemq-broker/pom.xml                         |  5 ++++
 .../util/DefaultIOExceptionHandlerTest.java     | 26 ++++++++++++++++----
 pom.xml                                         |  7 ++++++
 3 files changed, 33 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/39a20bd7/activemq-broker/pom.xml
----------------------------------------------------------------------
diff --git a/activemq-broker/pom.xml b/activemq-broker/pom.xml
index 5f8545b..b905db3 100755
--- a/activemq-broker/pom.xml
+++ b/activemq-broker/pom.xml
@@ -79,6 +79,11 @@
       <scope>test</scope>
     </dependency>
     <dependency>
+        <groupId>com.github.stefanbirkner</groupId>
+        <artifactId>system-rules</artifactId>
+        <scope>test</scope>
+    </dependency>
+    <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-log4j12</artifactId>
       <scope>test</scope>

http://git-wip-us.apache.org/repos/asf/activemq/blob/39a20bd7/activemq-broker/src/test/java/org/apache/activemq/util/DefaultIOExceptionHandlerTest.java
----------------------------------------------------------------------
diff --git a/activemq-broker/src/test/java/org/apache/activemq/util/DefaultIOExceptionHandlerTest.java
b/activemq-broker/src/test/java/org/apache/activemq/util/DefaultIOExceptionHandlerTest.java
index a9e2070..0d63e1e 100644
--- a/activemq-broker/src/test/java/org/apache/activemq/util/DefaultIOExceptionHandlerTest.java
+++ b/activemq-broker/src/test/java/org/apache/activemq/util/DefaultIOExceptionHandlerTest.java
@@ -17,27 +17,43 @@
 
 package org.apache.activemq.util;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.io.IOException;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
+
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.broker.SuppressReplyException;
+import org.junit.Rule;
 import org.junit.Test;
-
-
-import static org.junit.Assert.*;
+import org.junit.contrib.java.lang.system.ExpectedSystemExit;
+import org.junit.contrib.java.lang.system.internal.NoExitSecurityManager;
 
 public class DefaultIOExceptionHandlerTest {
 
+    @Rule
+    public final ExpectedSystemExit exit = ExpectedSystemExit.none();
+
     DefaultIOExceptionHandler underTest = new DefaultIOExceptionHandler();
 
-    @Test
+    @Test(timeout=20000)
     public void testHandleWithShutdownOnExit() throws Exception {
+        exit.expectSystemExit();
         doTest(true);
+        assertTrue(Wait.waitFor(new Wait.Condition() {
+            @Override
+            public boolean isSatisified() throws Exception {
+                return ((NoExitSecurityManager)System.getSecurityManager()).isCheckExitCalled();
+            }
+        }, 10000));
+
     }
 
-    @Test
+    @Test(timeout=20000)
     public void testHandleWithOutShutdownOnExit() throws Exception {
         doTest(false);
     }

http://git-wip-us.apache.org/repos/asf/activemq/blob/39a20bd7/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index f988a3f..d26d332 100755
--- a/pom.xml
+++ b/pom.xml
@@ -117,6 +117,7 @@
     <spring-version>4.1.8.RELEASE</spring-version>
     <spring-osgi-version>1.2.1</spring-osgi-version>
     <stax2-api-version>3.0.2</stax2-api-version>
+    <system-rules-version>1.13.0</system-rules-version>
     <velocity-version>1.7</velocity-version>
     <woodstox-core-asl-version>4.2.0</woodstox-core-asl-version>
     <xalan-version>2.7.2</xalan-version>
@@ -996,6 +997,12 @@
         <scope>test</scope>
       </dependency>
       <dependency>
+        <groupId>com.github.stefanbirkner</groupId>
+        <artifactId>system-rules</artifactId>
+        <version>${system-rules-version}</version>
+        <scope>test</scope>
+      </dependency>
+      <dependency>
         <groupId>org.mockito</groupId>
         <artifactId>mockito-core</artifactId>
         <version>${mockito-version}</version>


Mime
View raw message