Repository: incubator-geode Updated Branches: refs/heads/feature/GEODE-409 26fbf659c -> f5a44dcc8
GEODE-407, GEODE-349: Fixing race in testDatastoreCommitsWithPutAllAndRI This test performed and operation on the server and then asserted that an update happened on the client. But clients are notified asynchronously, so the client needs to wait until the update arrives. Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/f5a44dcc Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/f5a44dcc Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/f5a44dcc Branch: refs/heads/feature/GEODE-409 Commit: f5a44dcc89c92c2bba37819af137d2fa5a8e2d79 Parents: 26fbf65 Author: Dan Smith <[email protected]> Authored: Mon Oct 19 16:25:46 2015 -0700 Committer: Dan Smith <[email protected]> Committed: Mon Oct 19 16:27:12 2015 -0700 ---------------------------------------------------------------------- .../cache/ClientServerTransactionDUnitTest.java | 22 ++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f5a44dcc/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/ClientServerTransactionDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/ClientServerTransactionDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/ClientServerTransactionDUnitTest.java index 1bf0953..bb47574 100644 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/ClientServerTransactionDUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/ClientServerTransactionDUnitTest.java @@ -917,8 +917,6 @@ public void testClientCommitAndDataStoreGetsEvent() throws Exception { }); } - - public void testDatastoreCommitsWithPutAllAndRI() throws Exception { Host host = Host.getHost(0); VM accessor = host.getVM(0); @@ -959,12 +957,24 @@ public void testClientCommitAndDataStoreGetsEvent() throws Exception { client.invoke(new SerializableCallable() { public Object call() throws Exception { - Region<CustId, Customer> custRegion = getCache().getRegion(CUSTOMER); + final Region<CustId, Customer> custRegion = getCache().getRegion(CUSTOMER); // Region<OrderId, Order> orderRegion = getCache().getRegion(ORDER); // Region<CustId,Customer> refRegion = getCache().getRegion(D_REFERENCE); - ClientListener cl = (ClientListener) custRegion.getAttributes().getCacheListeners()[0]; - assertTrue(cl.invoked); - assertEquals("it should be 1 but its:"+cl.invokeCount,1,cl.invokeCount); + final ClientListener cl = (ClientListener) custRegion.getAttributes().getCacheListeners()[0]; + waitForCriterion(new WaitCriterion() { + + @Override + public boolean done() { + return cl.invoked; + } + + @Override + public String description() { + return "Listener was not invoked in 30 seconds"; + } + }, 30000, 100, true); + + assertEquals(1,cl.invokeCount); return null; } });
