test fix on DuplicateCacheTest

Waiting for proper executor to finish
This commit is contained in:
Clebert Suconic 2015-08-31 19:48:37 -04:00
parent b53cce1c24
commit 0f8750573c
1 changed files with 21 additions and 0 deletions

View File

@ -16,7 +16,12 @@
*/
package org.apache.activemq.artemis.tests.integration.persistence;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.core.io.IOCallback;
import org.apache.activemq.artemis.core.persistence.impl.journal.OperationContextImpl;
import org.apache.activemq.artemis.core.postoffice.DuplicateIDCache;
import org.apache.activemq.artemis.core.postoffice.impl.DuplicateIDCacheImpl;
import org.apache.activemq.artemis.core.transaction.impl.TransactionImpl;
@ -69,6 +74,22 @@ public class DuplicateCacheTest extends StorageManagerTestBase {
cache.deleteFromCache(id);
final CountDownLatch latch = new CountDownLatch(1);
OperationContextImpl.getContext().executeOnCompletion(new IOCallback() {
@Override
public void done() {
latch.countDown();
}
@Override
public void onError(int errorCode, String errorMessage) {
}
});
Assert.assertTrue(latch.await(1, TimeUnit.MINUTES));
Assert.assertFalse(cache.contains(id));
}