You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by la...@apache.org on 2017/12/20 00:33:52 UTC
[geode] branch feature/GEODE-4077 created (now 24e664f)
This is an automated email from the ASF dual-hosted git repository.
ladyvader pushed a change to branch feature/GEODE-4077
in repository https://gitbox.apache.org/repos/asf/geode.git.
at 24e664f Replaced WaitCriterion and Thread.sleep() with Awaitility.await().
This branch includes the following new commits:
new 24e664f Replaced WaitCriterion and Thread.sleep() with Awaitility.await().
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
--
To stop receiving notification emails like this one, please contact
['"commits@geode.apache.org" <co...@geode.apache.org>'].
[geode] 01/01: Replaced WaitCriterion and Thread.sleep() with
Awaitility.await().
Posted by la...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
ladyvader pushed a commit to branch feature/GEODE-4077
in repository https://gitbox.apache.org/repos/asf/geode.git
commit 24e664f5dda057f67a492c90258b13e4121d868d
Author: Lynn Hughes-Godfrey <lh...@pivotal.io>
AuthorDate: Fri Dec 15 17:17:36 2017 -0800
Replaced WaitCriterion and Thread.sleep() with Awaitility.await().
---
.../internal/cache/ha/HASlowReceiverDUnitTest.java | 39 ++++++++++++----------
1 file changed, 21 insertions(+), 18 deletions(-)
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HASlowReceiverDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HASlowReceiverDUnitTest.java
index 7242527..1b6bc7b 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HASlowReceiverDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/ha/HASlowReceiverDUnitTest.java
@@ -19,7 +19,9 @@ import static org.junit.Assert.*;
import java.net.SocketException;
import java.util.Properties;
+import java.util.concurrent.TimeUnit;
+import org.awaitility.Awaitility;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@@ -219,23 +221,19 @@ public class HASlowReceiverDUnitTest extends JUnit4DistributedTestCase {
}
public static void checkRedundancyLevel(final Integer redundantServers) {
- WaitCriterion wc = new WaitCriterion() {
- public boolean done() {
- return pool.getRedundantNames().size() == redundantServers.intValue();
- }
-
- public String description() {
- return "Expected redundant count (" + pool.getRedundantNames().size() + ") to become "
- + redundantServers.intValue();
- }
- };
- Wait.waitForCriterion(wc, 200 * 1000, 1000, true);
+ Awaitility.await().atMost(20, TimeUnit.SECONDS).until(() -> {
+ // check for slow client queue is removed or not.
+ assertTrue(
+ "Expected redundant count (" + pool.getRedundantNames().size() + ") to become "
+ + redundantServers.intValue(),
+ pool.getRedundantNames().size() == redundantServers.intValue());
+ });
}
// Test slow client
@Test
public void testSlowClient() throws Exception {
- setBridgeObeserverForAfterQueueDestroyMessage();
+ setBridgeObserverForAfterQueueDestroyMessage();
Host host = Host.getHost(0);
clientVM.invoke(
() -> HASlowReceiverDUnitTest.createClientCache(NetworkUtils.getServerHostName(host),
@@ -246,18 +244,23 @@ public class HASlowReceiverDUnitTest extends JUnit4DistributedTestCase {
IgnoredException.addIgnoredException(SocketException.class.getName());
final IgnoredException ex2 =
IgnoredException.addIgnoredException(InterruptedException.class.getName());
+
putEntries();
- Thread.sleep(20000);// wait for put to block and allow server to remove
- // client queue
+
+ Awaitility.await().atMost(60, TimeUnit.SECONDS).until(() -> {
+ // check for slow client queue is removed or not.
+ assertTrue("isUnresponsiveClientRemoved is false, but should be true " + "after 60 seconds",
+ isUnresponsiveClientRemoved);
+ });
+
+ // verify that we get reconnected
clientVM.invoke(() -> HASlowReceiverDUnitTest.checkRedundancyLevel(new Integer(2)));
- // check for slow client queue is removed or not.
- assertTrue("isUnresponsiveClientRemoved is false, but should be true " + "after 20 seconds",
- isUnresponsiveClientRemoved);
+
ex1.remove();
ex2.remove();
}
- public static void setBridgeObeserverForAfterQueueDestroyMessage() throws Exception {
+ public static void setBridgeObserverForAfterQueueDestroyMessage() throws Exception {
PoolImpl.AFTER_QUEUE_DESTROY_MESSAGE_FLAG = true;
ClientServerObserverHolder.setInstance(new ClientServerObserverAdapter() {
@Override
--
To stop receiving notification emails like this one, please contact
"commits@geode.apache.org" <co...@geode.apache.org>.