Skip to content

Commit

Permalink
Cannot wait for sync in this test as there are extra backups
Browse files Browse the repository at this point in the history
  • Loading branch information
Francisco Borges committed Nov 19, 2012
1 parent b95b043 commit cb99eea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
Expand Up @@ -222,20 +222,14 @@ protected void waitForTopology(final HornetQServer server, String clusterConnect
throw new Exception(msg);
}

protected final static void waitForComponent(final HornetQComponent component, final long seconds) throws Exception
protected final static void
waitForComponent(final HornetQComponent component, final long seconds) throws InterruptedException
{
long time = System.currentTimeMillis();
long toWait = seconds * 1000;
while (!component.isStarted())
{
try
{
Thread.sleep(50);
}
catch (InterruptedException e)
{
// ignore
}
Thread.sleep(50);
if (System.currentTimeMillis() > (time + toWait))
{
fail("component did not start within timeout of " + seconds);
Expand Down
Expand Up @@ -47,18 +47,18 @@ public void testStartLiveFirst() throws Exception

startServers(liveServers);
startServers(backupServers);
waitForBackupSyncs();
waitForBackups();

sendCrashReceive();
waitForTopology(backupServers.get(0).getServer(), liveServers.size(), 2);
sendCrashBackupReceive();
}

private void waitForBackupSyncs()
private void waitForBackups() throws InterruptedException
{
for (TestableServer backupServer : backupServers)
{
waitForRemoteBackupSynchronization(backupServer.getServer());
waitForComponent(backupServer.getServer(), 5);
}
}

Expand All @@ -69,6 +69,7 @@ private void startServers(List<TestableServer> servers) throws Exception
testableServer.start();
}
}

@Override
public void testStartBackupFirst() throws Exception
{
Expand All @@ -77,7 +78,7 @@ public void testStartBackupFirst() throws Exception

startServers(backupServers);
startServers(liveServers);
waitForBackupSyncs();
waitForBackups();

waitForTopology(liveServers.get(0).getServer(), liveServers.size(), 2);
sendCrashReceive();
Expand Down

0 comments on commit cb99eea

Please sign in to comment.