activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject git commit: https://issues.apache.org/jira/browse/AMQ-4682 - take account of granularity of filesystem lastModified in tests, > 2seconds, resolved intermittent failures
Date Thu, 03 Oct 2013 15:17:19 GMT
Updated Branches:
  refs/heads/trunk 5eb4e6b8a -> 1fdc2c477


https://issues.apache.org/jira/browse/AMQ-4682 - take account of granularity of filesystem
lastModified in tests, > 2seconds, resolved intermittent failures


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

Branch: refs/heads/trunk
Commit: 1fdc2c477ba5628123bbe7702635af69c333d091
Parents: 5eb4e6b
Author: gtully <gary.tully@gmail.com>
Authored: Thu Oct 3 16:16:23 2013 +0100
Committer: gtully <gary.tully@gmail.com>
Committed: Thu Oct 3 16:17:01 2013 +0100

----------------------------------------------------------------------
 .../apache/activemq/RuntimeConfigTestSupport.java | 18 +++++++++++++++++-
 .../java/org/apache/activemq/VirtualDestTest.java |  8 +++++++-
 2 files changed, 24 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/1fdc2c47/activemq-runtime-config/src/test/java/org/apache/activemq/RuntimeConfigTestSupport.java
----------------------------------------------------------------------
diff --git a/activemq-runtime-config/src/test/java/org/apache/activemq/RuntimeConfigTestSupport.java
b/activemq-runtime-config/src/test/java/org/apache/activemq/RuntimeConfigTestSupport.java
index 44afa58..24894c3 100644
--- a/activemq-runtime-config/src/test/java/org/apache/activemq/RuntimeConfigTestSupport.java
+++ b/activemq-runtime-config/src/test/java/org/apache/activemq/RuntimeConfigTestSupport.java
@@ -19,11 +19,15 @@ package org.apache.activemq;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
+import java.util.Date;
 import java.util.concurrent.TimeUnit;
 import org.apache.activemq.broker.BrokerFactory;
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.spring.Utils;
 import org.junit.After;
+import org.junit.Rule;
+import org.junit.rules.TestWatcher;
+import org.junit.runner.Description;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.core.io.Resource;
@@ -35,10 +39,21 @@ public class RuntimeConfigTestSupport {
     public static final String EMPTY_UPDATABLE_CONFIG = "emptyUpdatableConfig1000" ;
     BrokerService brokerService;
 
+    @Rule
+    public TestWatcher watchman = new TestWatcher() {
+        @Override
+        public void starting(Description description) {
+          LOG.info("{} being run...", description.getMethodName());
+        }
+    };
+
     public void startBroker(String configFileName) throws Exception {
         brokerService = createBroker(configFileName);
         brokerService.start();
         brokerService.waitUntilStarted();
+
+        // File system lastMod time granularity can be up to 2 seconds
+        TimeUnit.SECONDS.sleep(SLEEP);
     }
 
     public BrokerService createBroker(String configFileName) throws Exception {
@@ -57,9 +72,10 @@ public class RuntimeConfigTestSupport {
         FileInputStream modifications = new FileInputStream(new File(resource.getFile(),
newConfigName + ".xml"));
         modifications.getChannel().transferTo(0, Long.MAX_VALUE, current.getChannel());
         current.flush();
+        current.getChannel().force(true);
         current.close();
         modifications.close();
-        LOG.info("Updated: " + file);
+        LOG.info("Updated: " + file + " (" + file.lastModified() + ") " + new Date(file.lastModified()));
 
         if (sleep > 0) {
             // wait for mods to kick in

http://git-wip-us.apache.org/repos/asf/activemq/blob/1fdc2c47/activemq-runtime-config/src/test/java/org/apache/activemq/VirtualDestTest.java
----------------------------------------------------------------------
diff --git a/activemq-runtime-config/src/test/java/org/apache/activemq/VirtualDestTest.java
b/activemq-runtime-config/src/test/java/org/apache/activemq/VirtualDestTest.java
index 73ce790..e408afd 100644
--- a/activemq-runtime-config/src/test/java/org/apache/activemq/VirtualDestTest.java
+++ b/activemq-runtime-config/src/test/java/org/apache/activemq/VirtualDestTest.java
@@ -16,8 +16,8 @@
  */
 package org.apache.activemq;
 
+import java.util.concurrent.TimeUnit;
 import javax.jms.Message;
-import javax.jms.MessageConsumer;
 import javax.jms.MessageProducer;
 import javax.jms.Session;
 import javax.jms.TextMessage;
@@ -78,6 +78,8 @@ public class VirtualDestTest extends RuntimeConfigTestSupport {
         brokerService.start();
         brokerService.waitUntilStarted();
 
+        TimeUnit.SECONDS.sleep(SLEEP);
+
         assertTrue("broker alive", brokerService.isStarted());
 
         DestinationInterceptor[] interceptors  = brokerService.getDestinationInterceptors();
@@ -108,6 +110,8 @@ public class VirtualDestTest extends RuntimeConfigTestSupport {
         brokerService.start();
         brokerService.waitUntilStarted();
 
+        TimeUnit.SECONDS.sleep(SLEEP);
+
         assertTrue("broker alive", brokerService.isStarted());
 
         DestinationInterceptor[] interceptors  = brokerService.getDestinationInterceptors();
@@ -194,6 +198,8 @@ public class VirtualDestTest extends RuntimeConfigTestSupport {
         brokerService.start();
         brokerService.waitUntilStarted();
 
+        TimeUnit.SECONDS.sleep(SLEEP);
+
         assertEquals("one interceptor", 1, brokerService.getDestinationInterceptors().length);
         exerciseVirtualTopic("A.Default");
 


Mime
View raw message