You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by gt...@apache.org on 2015/05/13 17:30:21 UTC
activemq git commit: https://issues.apache.org/jira/browse/AMQ-4705 -
harden test - ensure existance before attempted mod
Repository: activemq
Updated Branches:
refs/heads/master eaf766b35 -> fee7c1cf4
https://issues.apache.org/jira/browse/AMQ-4705 - harden test - ensure existance before attempted mod
Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/fee7c1cf
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/fee7c1cf
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/fee7c1cf
Branch: refs/heads/master
Commit: fee7c1cf4ca5361eda416ac13f253f5fa37ef6ac
Parents: eaf766b
Author: gtully <ga...@gmail.com>
Authored: Wed May 13 16:29:49 2015 +0100
Committer: gtully <ga...@gmail.com>
Committed: Wed May 13 16:30:06 2015 +0100
----------------------------------------------------------------------
.../store/kahadb/KahaDBDeleteLockTest.java | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq/blob/fee7c1cf/activemq-unit-tests/src/test/java/org/apache/activemq/store/kahadb/KahaDBDeleteLockTest.java
----------------------------------------------------------------------
diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/store/kahadb/KahaDBDeleteLockTest.java b/activemq-unit-tests/src/test/java/org/apache/activemq/store/kahadb/KahaDBDeleteLockTest.java
index b57a5c7..53de603 100644
--- a/activemq-unit-tests/src/test/java/org/apache/activemq/store/kahadb/KahaDBDeleteLockTest.java
+++ b/activemq-unit-tests/src/test/java/org/apache/activemq/store/kahadb/KahaDBDeleteLockTest.java
@@ -41,6 +41,7 @@ public class KahaDBDeleteLockTest {
@Before
public void createMaster() throws Exception{
master = new BrokerService();
+ master.setDeleteAllMessagesOnStartup(true);
master.setBrokerName("Master");
master.setDataDirectoryFile(testDataDir);
@@ -56,6 +57,7 @@ public class KahaDBDeleteLockTest {
public void stopBrokerJustInCase() throws Exception {
if (master != null) {
master.stop();
+ master.waitUntilStopped();
}
}
@@ -91,10 +93,19 @@ public class KahaDBDeleteLockTest {
public void testModifyLockFile() throws Exception {
assertTrue(master.isStarted());
+ final File lockFile = new File(kahaDataDir, "lock");
+ assertTrue("lock file exists via modification time", Wait.waitFor(new Wait.Condition() {
+ @Override
+ public boolean isSatisified() throws Exception {
+ return lockFile.lastModified() > 0;
+ }
+ }));
+
// ensure modification will be seen, milisecond granularity
- TimeUnit.MILLISECONDS.sleep(1);
- RandomAccessFile file = new RandomAccessFile(new File(kahaDataDir, "lock"), "rw");
+ TimeUnit.MILLISECONDS.sleep(10);
+ RandomAccessFile file = new RandomAccessFile(lockFile, "rw");
file.write(4);
+ file.getChannel().force(true);
file.close();
assertTrue("Master stops on lock file modification", Wait.waitFor(new Wait.Condition() {
@@ -102,7 +113,7 @@ public class KahaDBDeleteLockTest {
public boolean isSatisified() throws Exception {
return master.isStopped();
}
- }, 5000));
+ }, 10000));
}
-}
\ No newline at end of file
+}