mirror of
https://github.com/apache/activemq.git
synced 2025-02-16 23:16:52 +00:00
https://issues.apache.org/jira/browse/AMQ-5578 - remove timing deps from the test
This commit is contained in:
parent
023b2ac045
commit
2949e8dbf7
@ -17,6 +17,7 @@
|
||||
package org.apache.activemq.store.kahadb.disk.journal;
|
||||
|
||||
import org.apache.activemq.store.kahadb.KahaDBStore;
|
||||
import org.apache.activemq.util.Wait;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
@ -61,16 +62,23 @@ public class PreallocationJournalTest {
|
||||
store.setPreallocationStrategy(preallocationStrategy);
|
||||
store.start();
|
||||
|
||||
// time for files to get there.. i know this is a brittle test! need to find
|
||||
// a better way (callbacks?) to notify when the journal is completely up
|
||||
TimeUnit.MILLISECONDS.sleep(500);
|
||||
File journalLog = new File(dataDirectory, "db-1.log");
|
||||
assertTrue(journalLog.exists());
|
||||
final File journalLog = new File(dataDirectory, "db-1.log");
|
||||
assertTrue("file exists", Wait.waitFor(new Wait.Condition() {
|
||||
@Override
|
||||
public boolean isSatisified() throws Exception {
|
||||
return journalLog.exists();
|
||||
}
|
||||
}));
|
||||
|
||||
|
||||
FileInputStream is = new FileInputStream(journalLog);
|
||||
FileChannel channel = is.getChannel();
|
||||
assertEquals(Journal.DEFAULT_MAX_FILE_LENGTH, channel.size());
|
||||
final FileChannel channel = is.getChannel();
|
||||
assertTrue("file size as expected", Wait.waitFor(new Wait.Condition() {
|
||||
@Override
|
||||
public boolean isSatisified() throws Exception {
|
||||
return Journal.DEFAULT_MAX_FILE_LENGTH == channel.size();
|
||||
}
|
||||
}));
|
||||
|
||||
channel.position(1 * 1024 * 1024 + 1);
|
||||
ByteBuffer buff = ByteBuffer.allocate(1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user