Configuration config = createDefaultConfig(false);
config.setBackup(true);
HornetQServer server = new HornetQServerImpl(config);
server.start();
ServerLocator locator = HornetQClient.createServerLocatorWithoutHA(new TransportConfiguration(ServiceTestBase.INVM_CONNECTOR_FACTORY));
try
{
StorageManager storage = getStorage();
ReplicationManagerImpl manager = new ReplicationManagerImpl((ClientSessionFactoryInternal) locator.createSessionFactory(), factory);
manager.start();
Journal replicatedJournal = new ReplicatedJournal((byte)1, new FakeJournal(), manager);
replicatedJournal.appendPrepareRecord(1, new FakeData(), false);
final CountDownLatch latch = new CountDownLatch(1);
storage.afterCompleteOperations(new IOAsyncTask()
{
public void onError(final int errorCode, final String errorMessage)
{
}
public void done()
{
latch.countDown();
}
});
Assert.assertTrue(latch.await(1, TimeUnit.SECONDS));
Assert.assertEquals(0, manager.getActiveTokens().size());
manager.stop();
}
finally
{
server.stop();
}
}