summaryrefslogtreecommitdiff
path: root/qpid/java/perftests/src/test
diff options
context:
space:
mode:
authorAlex Rudyy <orudyy@apache.org>2012-10-23 20:05:55 +0000
committerAlex Rudyy <orudyy@apache.org>2012-10-23 20:05:55 +0000
commitd1e6de3be23418071a717f08d643593a9040c204 (patch)
treef128823bfb53e0f4d529d9db3255f1c2f0cb1a0f /qpid/java/perftests/src/test
parent2f61f4fde4b3e600f6934b4dd0b69ac4e339e6c6 (diff)
downloadqpid-python-d1e6de3be23418071a717f08d643593a9040c204.tar.gz
QPID-4385: perf test ClientRegistry timeout now only applies to each registration, not to the whole registration sequence, thus allowing large number of clients to register without false timeouts.
Applied patch from Philip Harvey <phil@philharveyonline.com> git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1401426 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/perftests/src/test')
-rw-r--r--qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/ClientRegistryTest.java39
1 files changed, 38 insertions, 1 deletions
diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/ClientRegistryTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/ClientRegistryTest.java
index cc969e1ef2..acb17eee0c 100644
--- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/ClientRegistryTest.java
+++ b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/ClientRegistryTest.java
@@ -29,6 +29,8 @@ public class ClientRegistryTest extends TestCase
{
private static final String CLIENT1_REGISTERED_NAME = "CLIENT1_REGISTERED_NAME";
private static final String CLIENT2_REGISTERED_NAME = "CLIENT2_REGISTERED_NAME";
+ private static final String CLIENT3_REGISTERED_NAME = "CLIENT3_REGISTERED_NAME";
+
private static final int AWAIT_DELAY = 100;
private ClientRegistry _clientRegistry = new ClientRegistry();
@@ -70,7 +72,7 @@ public class ClientRegistryTest extends TestCase
assertEquals(0, numberOfClientsAbsent);
}
- public void testAwaitTwoClientWhenClientRegistersWhilstWaiting()
+ public void testAwaitTwoClientsWhenClientRegistersWhilstWaiting()
{
_clientRegistry.registerClient(CLIENT1_REGISTERED_NAME);
registerClientLater(CLIENT2_REGISTERED_NAME, 50);
@@ -79,6 +81,41 @@ public class ClientRegistryTest extends TestCase
assertEquals(0, numberOfClientsAbsent);
}
+ public void testAwaitTimeoutForPromptRegistrations()
+ {
+ registerClientsLaterAndAssertResult("Clients registering every 100ms should be within 600ms timeout",
+ new int[] {300, 400, 500},
+ 600,
+ 0);
+ }
+
+ public void testAwaitTimeoutForWhenThirdRegistrationIsLate()
+ {
+ registerClientsLaterAndAssertResult("Third client registering tardily should exceed timeout",
+ new int[] {300, 400, 1500},
+ 600,
+ 1);
+ }
+
+ public void testAwaitTimeoutWhenSecondAndThirdRegistrationsAreLate()
+ {
+ registerClientsLaterAndAssertResult("Second and third clients registering tardily should exceed timeout",
+ new int[] {300, 1500, 1500},
+ 600,
+ 2);
+ }
+
+ private void registerClientsLaterAndAssertResult(String message, int[] registrationDelays, int timeout, int expectedNumberOfAbsentees)
+ {
+ registerClientLater(CLIENT1_REGISTERED_NAME, registrationDelays[0]);
+ registerClientLater(CLIENT2_REGISTERED_NAME, registrationDelays[1]);
+ registerClientLater(CLIENT3_REGISTERED_NAME, registrationDelays[2]);
+
+ int numberOfClientsAbsent = _clientRegistry.awaitClients(3, timeout);
+
+ assertEquals(message, expectedNumberOfAbsentees, numberOfClientsAbsent);
+ }
+
private void registerClientLater(final String clientName, long delayInMillis)
{
doLater(new TimerTask()