summaryrefslogtreecommitdiff
path: root/qpid/java/perftests/src/test
diff options
context:
space:
mode:
authorKeith Wall <kwall@apache.org>2012-04-23 12:44:37 +0000
committerKeith Wall <kwall@apache.org>2012-04-23 12:44:37 +0000
commitf85f5bc89917b064d2fccad078c25bfa1176a616 (patch)
treea615c59db0ca8e1c63c7ed60d3558c730fb91e08 /qpid/java/perftests/src/test
parent0aad8136596154aece13f49368a66388bb0bbda3 (diff)
downloadqpid-python-f85f5bc89917b064d2fccad078c25bfa1176a616.tar.gz
QPID-3936: Change Performance Test Framework to support running of a series of test definition files and the production of a separate CSV per test definition.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1329215 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/client/ConsumerParticipantTest.java10
-rw-r--r--qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ParticipantResultFactoryTest.java10
-rw-r--r--qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ParticipantTestHelper.java16
-rw-r--r--qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ProducerParticipantTest.java14
-rw-r--r--qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/ClientRegistryTest.java42
-rw-r--r--qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/ControllerTest.java59
-rw-r--r--qpid/java/perftests/src/test/java/org/apache/qpid/disttest/message/ParticipantResultTest.java14
-rw-r--r--qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/aggregation/ParticipantResultAggregatorTest.java23
-rw-r--r--qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/aggregation/TestResultAggregatorTest.java20
-rw-r--r--qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/CSVFormaterTest.java9
-rw-r--r--qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/expectedOutput.csv4
-rw-r--r--qpid/java/perftests/src/test/java/org/apache/qpid/systest/disttest/endtoend/EndToEndTest.java25
12 files changed, 149 insertions, 97 deletions
diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ConsumerParticipantTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ConsumerParticipantTest.java
index 805ebd3be4..8bc7318b0c 100644
--- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ConsumerParticipantTest.java
+++ b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ConsumerParticipantTest.java
@@ -18,7 +18,7 @@
*/
package org.apache.qpid.disttest.client;
-import static org.apache.qpid.disttest.client.ParticipantTestHelper.assertExpectedResults;
+import static org.apache.qpid.disttest.client.ParticipantTestHelper.assertExpectedConsumerResults;
import static org.mockito.Matchers.anyLong;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.atLeastOnce;
@@ -104,7 +104,7 @@ public class ConsumerParticipantTest extends TestCase
ParticipantResult result = _consumerParticipant.doIt(CLIENT_NAME);
- assertExpectedResults(result, PARTICIPANT_NAME1, CLIENT_NAME, _testStartTime, numberOfMessages, PAYLOAD_SIZE_PER_MESSAGE, totalPayloadSize, null);
+ assertExpectedConsumerResults(result, PARTICIPANT_NAME1, CLIENT_NAME, _testStartTime, numberOfMessages, PAYLOAD_SIZE_PER_MESSAGE, totalPayloadSize, null);
_inOrder.verify(_delegate).consumeMessage(PARTICIPANT_NAME1, RECEIVE_TIMEOUT);
_inOrder.verify(_delegate).calculatePayloadSizeFrom(_mockMessage);
@@ -118,7 +118,7 @@ public class ConsumerParticipantTest extends TestCase
ParticipantResult result = _consumerParticipant.doIt(CLIENT_NAME);
- assertExpectedResults(result, PARTICIPANT_NAME1, CLIENT_NAME, _testStartTime, null, PAYLOAD_SIZE_PER_MESSAGE, null, duration);
+ assertExpectedConsumerResults(result, PARTICIPANT_NAME1, CLIENT_NAME, _testStartTime, null, PAYLOAD_SIZE_PER_MESSAGE, null, duration);
verify(_delegate, atLeastOnce()).consumeMessage(PARTICIPANT_NAME1, RECEIVE_TIMEOUT);
verify(_delegate, atLeastOnce()).calculatePayloadSizeFrom(_mockMessage);
@@ -134,7 +134,7 @@ public class ConsumerParticipantTest extends TestCase
ParticipantResult result = _consumerParticipant.doIt(CLIENT_NAME);
- assertExpectedResults(result, PARTICIPANT_NAME1, CLIENT_NAME, _testStartTime, numberOfMessages, PAYLOAD_SIZE_PER_MESSAGE, totalPayloadSize, null);
+ assertExpectedConsumerResults(result, PARTICIPANT_NAME1, CLIENT_NAME, _testStartTime, numberOfMessages, PAYLOAD_SIZE_PER_MESSAGE, totalPayloadSize, null);
verify(_delegate, times(numberOfMessages)).consumeMessage(PARTICIPANT_NAME1, RECEIVE_TIMEOUT);
verify(_delegate, times(numberOfMessages)).calculatePayloadSizeFrom(_mockMessage);
@@ -157,7 +157,7 @@ public class ConsumerParticipantTest extends TestCase
final int expectedPayloadResultPayloadSize = 0;
final long totalPayloadSize = firstPayloadSize + secondPayloadSize + thirdPayloadSize;
- assertExpectedResults(result, PARTICIPANT_NAME1, CLIENT_NAME, _testStartTime, numberOfMessages, expectedPayloadResultPayloadSize, totalPayloadSize, null);
+ assertExpectedConsumerResults(result, PARTICIPANT_NAME1, CLIENT_NAME, _testStartTime, numberOfMessages, expectedPayloadResultPayloadSize, totalPayloadSize, null);
verify(_delegate, times(numberOfMessages)).consumeMessage(PARTICIPANT_NAME1, RECEIVE_TIMEOUT);
verify(_delegate, times(numberOfMessages)).calculatePayloadSizeFrom(_mockMessage);
diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ParticipantResultFactoryTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ParticipantResultFactoryTest.java
index 73836f68e5..af906b5098 100644
--- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ParticipantResultFactoryTest.java
+++ b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ParticipantResultFactoryTest.java
@@ -76,6 +76,9 @@ public class ParticipantResultFactoryTest extends TestCase
long timeToLive = 60;
command.setTimeToLive(timeToLive);
+ int totalNumberOfConsumers = 0;
+ int totalNumberOfProducers = 1;
+
ProducerParticipantResult result = _participantResultFactory.createForProducer(PARTICIPANT_NAME,
REGISTERED_CLIENT_NAME,
command,
@@ -92,6 +95,8 @@ public class ParticipantResultFactoryTest extends TestCase
assertEquals(producerInterval, result.getInterval());
assertEquals(producerStartDelay, result.getStartDelay());
assertEquals(timeToLive, result.getTimeToLive());
+ assertEquals(totalNumberOfConsumers, result.getTotalNumberOfConsumers());
+ assertEquals(totalNumberOfProducers, result.getTotalNumberOfProducers());
}
public void testCreateForConsumer()
@@ -118,6 +123,9 @@ public class ParticipantResultFactoryTest extends TestCase
boolean synchronousConsumer = true;
command.setSynchronous(synchronousConsumer);
+ int totalNumberOfConsumers = 1;
+ int totalNumberOfProducers = 0;
+
ConsumerParticipantResult result = _participantResultFactory.createForConsumer(PARTICIPANT_NAME,
REGISTERED_CLIENT_NAME,
command,
@@ -135,6 +143,8 @@ public class ParticipantResultFactoryTest extends TestCase
assertEquals(isSelector, result.isSelector());
assertEquals(noLocal, result.isNoLocal());
assertEquals(synchronousConsumer, result.isSynchronousConsumer());
+ assertEquals(totalNumberOfConsumers, result.getTotalNumberOfConsumers());
+ assertEquals(totalNumberOfProducers, result.getTotalNumberOfProducers());
}
public void testCreateForError()
diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ParticipantTestHelper.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ParticipantTestHelper.java
index b30d5c1c7c..fa071881cc 100644
--- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ParticipantTestHelper.java
+++ b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ParticipantTestHelper.java
@@ -32,7 +32,21 @@ public class ParticipantTestHelper
assertTrue(message + " " + actual, actual >= minimumExpected);
}
- public static void assertExpectedResults(ParticipantResult result, String participantName, String registeredClientName, long expectedTestStartTime, Integer expectedNumberOfMessages, Integer expectedPayloadSize, Long expectedTotalPayloadProcessed, Long expectedMinimumExpectedDuration)
+ public static void assertExpectedConsumerResults(ParticipantResult result, String participantName, String registeredClientName, long expectedTestStartTime, Integer expectedNumberOfMessages, Integer expectedPayloadSize, Long expectedTotalPayloadProcessed, Long expectedMinimumExpectedDuration)
+ {
+ assertExpectedResults(result, participantName, registeredClientName, expectedTestStartTime, expectedNumberOfMessages, expectedPayloadSize, expectedTotalPayloadProcessed, expectedMinimumExpectedDuration);
+ assertEquals("Unexpected number of consumers", 1, result.getTotalNumberOfConsumers());
+ assertEquals("Unexpected number of producers", 0, result.getTotalNumberOfProducers());
+ }
+
+ public static void assertExpectedProducerResults(ParticipantResult result, String participantName, String registeredClientName, long expectedTestStartTime, Integer expectedNumberOfMessages, Integer expectedPayloadSize, Long expectedTotalPayloadProcessed, Long expectedMinimumExpectedDuration)
+ {
+ assertExpectedResults(result, participantName, registeredClientName, expectedTestStartTime, expectedNumberOfMessages, expectedPayloadSize, expectedTotalPayloadProcessed, expectedMinimumExpectedDuration);
+ assertEquals("Unexpected number of producers", 1, result.getTotalNumberOfProducers());
+ assertEquals("Unexpected number of consumers", 0, result.getTotalNumberOfConsumers());
+ }
+
+ private static void assertExpectedResults(ParticipantResult result, String participantName, String registeredClientName, long expectedTestStartTime, Integer expectedNumberOfMessages, Integer expectedPayloadSize, Long expectedTotalPayloadProcessed, Long expectedMinimumExpectedDuration)
{
assertFalse(result.hasError());
diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ProducerParticipantTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ProducerParticipantTest.java
index 3852948201..c78fc8837c 100644
--- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ProducerParticipantTest.java
+++ b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/client/ProducerParticipantTest.java
@@ -18,7 +18,7 @@
*/
package org.apache.qpid.disttest.client;
-import static org.apache.qpid.disttest.client.ParticipantTestHelper.assertExpectedResults;
+import static org.apache.qpid.disttest.client.ParticipantTestHelper.assertExpectedProducerResults;
import static org.mockito.Matchers.isA;
import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.inOrder;
@@ -87,7 +87,7 @@ public class ProducerParticipantTest extends TestCase
ParticipantResult result = _producer.doIt(CLIENT_NAME);
long expectedPublishedStartTime = _testStartTime + delay;
- assertExpectedResults(result, PARTICIPANT_NAME1, CLIENT_NAME, expectedPublishedStartTime, numberOfMessages, PAYLOAD_SIZE_PER_MESSAGE, totalPayloadSize, null);
+ assertExpectedProducerResults(result, PARTICIPANT_NAME1, CLIENT_NAME, expectedPublishedStartTime, numberOfMessages, PAYLOAD_SIZE_PER_MESSAGE, totalPayloadSize, null);
}
@@ -120,7 +120,7 @@ public class ProducerParticipantTest extends TestCase
_command.setDeliveryMode(deliveryMode);
ParticipantResult result = (ParticipantResult) _producer.doIt(CLIENT_NAME);
- assertExpectedResults(result, PARTICIPANT_NAME1, CLIENT_NAME, _testStartTime, numberOfMessages, PAYLOAD_SIZE_PER_MESSAGE, totalPayloadSize, null);
+ assertExpectedProducerResults(result, PARTICIPANT_NAME1, CLIENT_NAME, _testStartTime, numberOfMessages, PAYLOAD_SIZE_PER_MESSAGE, totalPayloadSize, null);
_inOrder.verify(_delegate).sendNextMessage(isA(CreateProducerCommand.class));
_inOrder.verify(_delegate).calculatePayloadSizeFrom(_mockMessage);
@@ -134,7 +134,7 @@ public class ProducerParticipantTest extends TestCase
_command.setMaximumDuration(duration);
ParticipantResult result = _producer.doIt(CLIENT_NAME);
- assertExpectedResults(result, PARTICIPANT_NAME1, CLIENT_NAME, _testStartTime, null, PAYLOAD_SIZE_PER_MESSAGE, null, duration);
+ assertExpectedProducerResults(result, PARTICIPANT_NAME1, CLIENT_NAME, _testStartTime, null, PAYLOAD_SIZE_PER_MESSAGE, null, duration);
verify(_delegate, atLeastOnce()).sendNextMessage(isA(CreateProducerCommand.class));
verify(_delegate, atLeastOnce()).calculatePayloadSizeFrom(_mockMessage);
@@ -151,7 +151,7 @@ public class ProducerParticipantTest extends TestCase
_command.setBatchSize(3);
ParticipantResult result = _producer.doIt(CLIENT_NAME);
- assertExpectedResults(result, PARTICIPANT_NAME1, CLIENT_NAME, _testStartTime, numberOfMessages, PAYLOAD_SIZE_PER_MESSAGE, totalPayloadSize, null);
+ assertExpectedProducerResults(result, PARTICIPANT_NAME1, CLIENT_NAME, _testStartTime, numberOfMessages, PAYLOAD_SIZE_PER_MESSAGE, totalPayloadSize, null);
verify(_delegate, times(numberOfMessages)).sendNextMessage(isA(CreateProducerCommand.class));
verify(_delegate, times(numberOfMessages)).calculatePayloadSizeFrom(_mockMessage);
@@ -172,7 +172,7 @@ public class ProducerParticipantTest extends TestCase
_command.setInterval(publishInterval);
ParticipantResult result = _producer.doIt(CLIENT_NAME);
- assertExpectedResults(result, PARTICIPANT_NAME1, CLIENT_NAME, _testStartTime, numberOfMessages, null, totalPayloadSize, expectedTimeToRunTest);
+ assertExpectedProducerResults(result, PARTICIPANT_NAME1, CLIENT_NAME, _testStartTime, numberOfMessages, null, totalPayloadSize, expectedTimeToRunTest);
verify(_delegate, times(numberOfMessages)).sendNextMessage(isA(CreateProducerCommand.class));
verify(_delegate, times(numberOfMessages)).calculatePayloadSizeFrom(_mockMessage);
@@ -196,7 +196,7 @@ public class ProducerParticipantTest extends TestCase
ParticipantResult result = _producer.doIt(CLIENT_NAME);
final int expectedPayloadResultPayloadSize = 0;
- assertExpectedResults(result, PARTICIPANT_NAME1, CLIENT_NAME, _testStartTime, numberOfMessages, expectedPayloadResultPayloadSize, totalPayloadSize, null);
+ assertExpectedProducerResults(result, PARTICIPANT_NAME1, CLIENT_NAME, _testStartTime, numberOfMessages, expectedPayloadResultPayloadSize, totalPayloadSize, null);
verify(_delegate, times(numberOfMessages)).sendNextMessage(isA(CreateProducerCommand.class));
verify(_delegate, times(numberOfMessages)).calculatePayloadSizeFrom(_mockMessage);
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 2c161012a9..cc969e1ef2 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
@@ -18,6 +18,9 @@
*/
package org.apache.qpid.disttest.controller;
+import java.util.Timer;
+import java.util.TimerTask;
+
import junit.framework.TestCase;
import org.apache.qpid.disttest.DistributedTestException;
@@ -25,6 +28,8 @@ import org.apache.qpid.disttest.DistributedTestException;
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 int AWAIT_DELAY = 100;
private ClientRegistry _clientRegistry = new ClientRegistry();
@@ -51,7 +56,44 @@ public class ClientRegistryTest extends TestCase
}
}
+ public void testAwaitOneClientWhenClientNotRegistered()
+ {
+ int numberOfClientsAbsent = _clientRegistry.awaitClients(1, AWAIT_DELAY);
+ assertEquals(1, numberOfClientsAbsent);
+ }
+ public void testAwaitOneClientWhenClientAlreadyRegistered()
+ {
+ _clientRegistry.registerClient(CLIENT1_REGISTERED_NAME);
+ int numberOfClientsAbsent = _clientRegistry.awaitClients(1, AWAIT_DELAY);
+ assertEquals(0, numberOfClientsAbsent);
+ }
+
+ public void testAwaitTwoClientWhenClientRegistersWhilstWaiting()
+ {
+ _clientRegistry.registerClient(CLIENT1_REGISTERED_NAME);
+ registerClientLater(CLIENT2_REGISTERED_NAME, 50);
+ int numberOfClientsAbsent = _clientRegistry.awaitClients(2, AWAIT_DELAY);
+ assertEquals(0, numberOfClientsAbsent);
+ }
+
+ private void registerClientLater(final String clientName, long delayInMillis)
+ {
+ doLater(new TimerTask()
+ {
+ @Override
+ public void run()
+ {
+ _clientRegistry.registerClient(clientName);
+ }
+ }, delayInMillis);
+ }
+
+ private void doLater(TimerTask task, long delayInMillis)
+ {
+ Timer timer = new Timer();
+ timer.schedule(task, delayInMillis);
+ }
}
diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/ControllerTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/ControllerTest.java
index c119656afd..bc58ea41c5 100644
--- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/ControllerTest.java
+++ b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/controller/ControllerTest.java
@@ -30,8 +30,6 @@ import static org.mockito.Mockito.when;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
-import java.util.Timer;
-import java.util.TimerTask;
import junit.framework.TestCase;
@@ -50,9 +48,7 @@ import org.mockito.stubbing.Answer;
public class ControllerTest extends TestCase
{
private static final String CLIENT1_REGISTERED_NAME = "client-uid1";
- private static final String CLIENT2_REGISTERED_NAME = "client-uid2";
- private static final int DELAY = 100;
private static final long COMMAND_RESPONSE_TIMEOUT = 1000;
private static final long REGISTRATION_TIMEOUT = 1000;
@@ -104,43 +100,19 @@ public class ControllerTest extends TestCase
}
}
- public void testControllerRequiresOneClientRegistration()
- {
- Config configWithOneClient = createMockConfig(1);
-
- _controller.setConfig(configWithOneClient);
- registerClientAndAwait(CLIENT1_REGISTERED_NAME);
- }
-
public void testControllerReceivesTwoExpectedClientRegistrations()
{
Config configWithTwoClients = createMockConfig(2);
_controller.setConfig(configWithTwoClients);
+ when(_clientRegistry.awaitClients(2, REGISTRATION_TIMEOUT)).thenReturn(0);
- registerClientLater(_controller, CLIENT1_REGISTERED_NAME);
- registerClientLater(_controller, CLIENT2_REGISTERED_NAME);
_controller.awaitClientRegistrations();
}
public void testControllerDoesntReceiveAnyRegistrations()
{
- try
- {
- _controller.awaitClientRegistrations();
- fail("Exception not thrown");
- }
- catch (DistributedTestException e)
- {
- // PASS
- }
- }
-
- public void testControllerDoesntReceiveTwoExpectedClientRegistrations()
- {
- Config configWithTwoClients = createMockConfig(2);
- _controller.setConfig(configWithTwoClients);
+ when(_clientRegistry.awaitClients(1, REGISTRATION_TIMEOUT)).thenReturn(1);
- registerClientLater(_controller, CLIENT1_REGISTERED_NAME); // only receives one out of two expected registrations
try
{
_controller.awaitClientRegistrations();
@@ -202,12 +174,6 @@ public class ControllerTest extends TestCase
return config;
}
- private void doLater(TimerTask task, long delayInMillis)
- {
- Timer timer = new Timer();
- timer.schedule(task, delayInMillis);
- }
-
private Config createMockConfig(int numberOfClients)
{
Config config = mock(Config.class);
@@ -215,27 +181,6 @@ public class ControllerTest extends TestCase
return config;
}
- private void registerClientAndAwait(String... clientNames)
- {
- for (String clientName : clientNames)
- {
- registerClientLater(_controller, clientName);
- }
- _controller.awaitClientRegistrations();
- }
-
- private void registerClientLater(final Controller controller, final String clientName)
- {
- doLater(new TimerTask()
- {
- @Override
- public void run()
- {
- controller.registerClient(new RegisterClientCommand(clientName, "dummy"));
- }
- }, DELAY);
- }
-
private TestRunnerFactory createTestFactoryReturningMock()
{
TestRunnerFactory testRunnerFactory = mock(TestRunnerFactory.class);
diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/message/ParticipantResultTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/message/ParticipantResultTest.java
index ee095ce199..4d636054c1 100644
--- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/message/ParticipantResultTest.java
+++ b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/message/ParticipantResultTest.java
@@ -18,7 +18,7 @@
*/
package org.apache.qpid.disttest.message;
-import static org.apache.qpid.disttest.message.ParticipantAttribute.BATCH_SIZE;
+import static org.apache.qpid.disttest.message.ParticipantAttribute.*;
import static org.apache.qpid.disttest.message.ParticipantAttribute.CONFIGURED_CLIENT_NAME;
import static org.apache.qpid.disttest.message.ParticipantAttribute.DELIVERY_MODE;
import static org.apache.qpid.disttest.message.ParticipantAttribute.ERROR_MESSAGE;
@@ -67,6 +67,9 @@ public class ParticipantResultTest extends TestCase
long endTime = startTime + timeTaken;
long maximumDuration = 1000;
+ int totalNumberOfConsumers = 1;
+ int totalNumberOfProducers = 1;
+
result.setParticipantName(participantName);
result.setTestName(testName);
result.setIterationNumber(iterationNumber);
@@ -74,12 +77,15 @@ public class ParticipantResultTest extends TestCase
result.setNumberOfMessagesProcessed(numberOfMessages);
result.setConfiguredClientName(clientConfiguredName);
- result.setBatchSize(10);
+ result.setBatchSize(batchSize);
result.setStartDate(new Date(startTime));
result.setEndDate(new Date(endTime));
result.setMaximumDuration(maximumDuration);
+ result.setTotalNumberOfConsumers(totalNumberOfConsumers);
+ result.setTotalNumberOfProducers(totalNumberOfProducers);
+
result.setErrorMessage(errorMessage);
assertEquals(participantName, result.getAttributes().get(PARTICIPANT_NAME));
@@ -87,8 +93,12 @@ public class ParticipantResultTest extends TestCase
assertEquals(clientConfiguredName, result.getAttributes().get(CONFIGURED_CLIENT_NAME));
assertEquals(numberOfMessages, result.getAttributes().get(NUMBER_OF_MESSAGES_PROCESSED));
assertEquals(timeTaken, result.getAttributes().get(TIME_TAKEN));
+ assertEquals(timeTaken, result.getAttributes().get(TIME_TAKEN));
+ assertEquals(timeTaken, result.getAttributes().get(TIME_TAKEN));
assertEquals(batchSize, result.getAttributes().get(BATCH_SIZE));
assertEquals(maximumDuration, result.getAttributes().get(MAXIMUM_DURATION));
+ assertEquals(totalNumberOfConsumers, result.getAttributes().get(TOTAL_NUMBER_OF_CONSUMERS));
+ assertEquals(totalNumberOfProducers, result.getAttributes().get(TOTAL_NUMBER_OF_PRODUCERS));
assertEquals(errorMessage, result.getAttributes().get(ERROR_MESSAGE));
assertEquals(iterationNumber, result.getAttributes().get(ITERATION_NUMBER));
}
diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/aggregation/ParticipantResultAggregatorTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/aggregation/ParticipantResultAggregatorTest.java
index 5cf84c77f1..db30595edd 100644
--- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/aggregation/ParticipantResultAggregatorTest.java
+++ b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/aggregation/ParticipantResultAggregatorTest.java
@@ -179,4 +179,27 @@ public class ParticipantResultAggregatorTest extends TestCase
assertEquals(0, aggregratedResult.getPayloadSize());
}
+ public void testSumNumberOfConsumerAndProducers() throws Exception
+ {
+ final int expectedNumberOfProducers = 1;
+ final int expectedNumberOfConsumers = 2;
+
+ ParticipantResult result1 = new ParticipantResult();
+ result1.setTotalNumberOfConsumers(1);
+
+ ParticipantResult result2 = new ParticipantResult();
+ result2.setTotalNumberOfConsumers(1);
+
+ ParticipantResult result3 = new ParticipantResult();
+ result2.setTotalNumberOfProducers(1);
+
+ _aggregator.aggregate(result1);
+ _aggregator.aggregate(result2);
+ _aggregator.aggregate(result3);
+
+ ParticipantResult aggregratedResult = _aggregator.getAggregatedResult();
+ assertEquals(expectedNumberOfConsumers, aggregratedResult.getTotalNumberOfConsumers());
+ assertEquals(expectedNumberOfProducers, aggregratedResult.getTotalNumberOfProducers());
+ }
+
}
diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/aggregation/TestResultAggregatorTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/aggregation/TestResultAggregatorTest.java
index 7cf900ca79..95f01d853a 100644
--- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/aggregation/TestResultAggregatorTest.java
+++ b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/aggregation/TestResultAggregatorTest.java
@@ -78,17 +78,17 @@ public class TestResultAggregatorTest extends TestCase
assertMinimalAggregatedResults(
aggregatedTestResult.getAllParticipantResult(),
TEST1_NAME, TEST1_ITERATION_NUMBER,
- NUMBER_OF_MESSAGES_CONSUMED_IN_TOTAL);
+ NUMBER_OF_MESSAGES_CONSUMED_IN_TOTAL, 2, 1);
assertMinimalAggregatedResults(
aggregatedTestResult.getAllConsumerParticipantResult(),
TEST1_NAME, TEST1_ITERATION_NUMBER,
- NUMBER_OF_MESSAGES_CONSUMED_IN_TOTAL);
+ NUMBER_OF_MESSAGES_CONSUMED_IN_TOTAL, 2, 0);
assertMinimalAggregatedResults(
aggregatedTestResult.getAllProducerParticipantResult(),
TEST1_NAME, TEST1_ITERATION_NUMBER,
- NUMBER_OF_MESSAGES_PRODUCED);
+ NUMBER_OF_MESSAGES_PRODUCED, 0, 1);
}
public void testAggregateResultsWhenParticipantErrored()
@@ -103,11 +103,13 @@ public class TestResultAggregatorTest extends TestCase
assertEquals(TestResultAggregator.AGGREGATED_ERROR_MESSAGE, aggregatedTestResult.getAllParticipantResult().getErrorMessage());
}
- private void assertMinimalAggregatedResults(ParticipantResult result, String expectedTestName, int expectedIterationNumber, long expectedNumberOfMessagesProcessed)
+ private void assertMinimalAggregatedResults(ParticipantResult result, String expectedTestName, int expectedIterationNumber, long expectedNumberOfMessagesProcessed, int expectedTotalNumberOfConsumers, int expectedTotalNumberOfProducers)
{
assertEquals("Unexpected test name in " + result.getParticipantName(), expectedTestName, result.getTestName());
assertEquals("Unexpected iteration number in " + result.getParticipantName(), expectedIterationNumber, result.getIterationNumber());
assertEquals("Unexpected number of messages processed in " + result.getParticipantName(), expectedNumberOfMessagesProcessed, result.getNumberOfMessagesProcessed());
+ assertEquals("Unexpected total number of consumers " + result.getParticipantName(), expectedTotalNumberOfConsumers, result.getTotalNumberOfConsumers());
+ assertEquals("Unexpected total number of producers " + result.getParticipantName(), expectedTotalNumberOfProducers, result.getTotalNumberOfProducers());
}
private TestResult createResultsFromTest()
@@ -115,25 +117,27 @@ public class TestResultAggregatorTest extends TestCase
TestResult testResult = new TestResult(TEST1_NAME);
ConsumerParticipantResult consumerResult1 = new ConsumerParticipantResult();
- setPropertiesOn(consumerResult1, TEST1_NAME, TEST1_ITERATION_NUMBER, CONSUMER_PARTICIPANT_NAME1, NUMBER_OF_MESSAGES_PROCESSED_PER_CONSUMER, PAYLOAD_SIZE, TOTAL_PAYLOAD_PROCESSED_PER_CONSUMER, CONSUMER1_STARTDATE, CONSUMER1_ENDDATE);
+ setPropertiesOn(consumerResult1, TEST1_NAME, TEST1_ITERATION_NUMBER, CONSUMER_PARTICIPANT_NAME1, NUMBER_OF_MESSAGES_PROCESSED_PER_CONSUMER, PAYLOAD_SIZE, TOTAL_PAYLOAD_PROCESSED_PER_CONSUMER, CONSUMER1_STARTDATE, CONSUMER1_ENDDATE, 1, 0);
testResult.addParticipantResult(consumerResult1);
ConsumerParticipantResult consumerResult2 = new ConsumerParticipantResult();
- setPropertiesOn(consumerResult2, TEST1_NAME, TEST1_ITERATION_NUMBER, CONSUMER_PARTICIPANT_NAME2, NUMBER_OF_MESSAGES_PROCESSED_PER_CONSUMER, PAYLOAD_SIZE, TOTAL_PAYLOAD_PROCESSED_PER_CONSUMER, CONSUMER2_STARTDATE, CONSUMER2_ENDDATE);
+ setPropertiesOn(consumerResult2, TEST1_NAME, TEST1_ITERATION_NUMBER, CONSUMER_PARTICIPANT_NAME2, NUMBER_OF_MESSAGES_PROCESSED_PER_CONSUMER, PAYLOAD_SIZE, TOTAL_PAYLOAD_PROCESSED_PER_CONSUMER, CONSUMER2_STARTDATE, CONSUMER2_ENDDATE, 1, 0);
testResult.addParticipantResult(consumerResult2);
ParticipantResult producerResult = new ProducerParticipantResult();
- setPropertiesOn(producerResult, TEST1_NAME, TEST1_ITERATION_NUMBER, PRODUCER_PARTICIPANT_NAME, NUMBER_OF_MESSAGES_PRODUCED, PAYLOAD_SIZE, TOTAL_PAYLOAD_PRODUCED_IN_TOTAL, PRODUCER_STARTDATE, PRODUCER_ENDDATE);
+ setPropertiesOn(producerResult, TEST1_NAME, TEST1_ITERATION_NUMBER, PRODUCER_PARTICIPANT_NAME, NUMBER_OF_MESSAGES_PRODUCED, PAYLOAD_SIZE, TOTAL_PAYLOAD_PRODUCED_IN_TOTAL, PRODUCER_STARTDATE, PRODUCER_ENDDATE, 0, 1);
testResult.addParticipantResult(producerResult);
return testResult;
}
- private void setPropertiesOn(ParticipantResult participantResult, String testName, int iterationNumber, String participantName, long numberOfMessagesProcessed, int payloadSize, long totalPayloadProcessed, long start, long end)
+ private void setPropertiesOn(ParticipantResult participantResult, String testName, int iterationNumber, String participantName, long numberOfMessagesProcessed, int payloadSize, long totalPayloadProcessed, long start, long end, int totalNumberOfConsumers, int totalNumberOfProducers)
{
participantResult.setParticipantName(participantName);
participantResult.setTestName(testName);
participantResult.setIterationNumber(iterationNumber);
+ participantResult.setTotalNumberOfConsumers(totalNumberOfConsumers);
+ participantResult.setTotalNumberOfProducers(totalNumberOfProducers);
participantResult.setNumberOfMessagesProcessed(numberOfMessagesProcessed);
participantResult.setPayloadSize(payloadSize);
diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/CSVFormaterTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/CSVFormaterTest.java
index 061ed6a28d..14fe7179da 100644
--- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/CSVFormaterTest.java
+++ b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/CSVFormaterTest.java
@@ -30,16 +30,18 @@ import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_SYNCHRONO
import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_TOPIC;
import static org.apache.qpid.disttest.message.ParticipantAttribute.ITERATION_NUMBER;
import static org.apache.qpid.disttest.message.ParticipantAttribute.MAXIMUM_DURATION;
-import static org.apache.qpid.disttest.message.ParticipantAttribute.PAYLOAD_SIZE;
import static org.apache.qpid.disttest.message.ParticipantAttribute.NUMBER_OF_MESSAGES_PROCESSED;
import static org.apache.qpid.disttest.message.ParticipantAttribute.PARTICIPANT_NAME;
+import static org.apache.qpid.disttest.message.ParticipantAttribute.PAYLOAD_SIZE;
import static org.apache.qpid.disttest.message.ParticipantAttribute.PRIORITY;
import static org.apache.qpid.disttest.message.ParticipantAttribute.PRODUCER_INTERVAL;
import static org.apache.qpid.disttest.message.ParticipantAttribute.PRODUCER_START_DELAY;
import static org.apache.qpid.disttest.message.ParticipantAttribute.TEST_NAME;
+import static org.apache.qpid.disttest.message.ParticipantAttribute.THROUGHPUT;
import static org.apache.qpid.disttest.message.ParticipantAttribute.TIME_TAKEN;
import static org.apache.qpid.disttest.message.ParticipantAttribute.TIME_TO_LIVE;
-import static org.apache.qpid.disttest.message.ParticipantAttribute.THROUGHPUT;
+import static org.apache.qpid.disttest.message.ParticipantAttribute.TOTAL_NUMBER_OF_CONSUMERS;
+import static org.apache.qpid.disttest.message.ParticipantAttribute.TOTAL_NUMBER_OF_PRODUCERS;
import static org.apache.qpid.disttest.message.ParticipantAttribute.TOTAL_PAYLOAD_PROCESSED;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -56,7 +58,6 @@ import org.apache.qpid.disttest.controller.ResultsForAllTests;
import org.apache.qpid.disttest.controller.TestResult;
import org.apache.qpid.disttest.message.ParticipantAttribute;
import org.apache.qpid.disttest.message.ParticipantResult;
-import org.apache.qpid.disttest.results.formatting.CSVFormater;
public class CSVFormaterTest extends TestCase
{
@@ -110,6 +111,8 @@ public class CSVFormaterTest extends TestCase
participantAttributes.put(IS_SELECTOR, false);
participantAttributes.put(IS_NO_LOCAL, true);
participantAttributes.put(IS_SYNCHRONOUS_CONSUMER, false);
+ participantAttributes.put(TOTAL_NUMBER_OF_CONSUMERS, 1);
+ participantAttributes.put(TOTAL_NUMBER_OF_PRODUCERS, 2);
participantAttributes.put(TOTAL_PAYLOAD_PROCESSED, 1024);
participantAttributes.put(THROUGHPUT, 2048);
participantAttributes.put(TIME_TAKEN, 1000);
diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/expectedOutput.csv b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/expectedOutput.csv
index 08cb2275b5..073fafb68a 100644
--- a/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/expectedOutput.csv
+++ b/qpid/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/expectedOutput.csv
@@ -1,2 +1,2 @@
-Test Name,Iteration number,Client Name,Participant name,Number of messages,Payload size (bytes),Priority,Time to live (ms),Delivery mode,Batch size,Maximum duration (ms),Producer start delay (ms),Producer interval (ms),Is topic,Is durable subscription,Is browsing subscription,Is selector,Is no local,Is synchronous consumer,Total payload processed (bytes),Throughput (kbytes/s),Time taken (ms),Error message
-TEST1,0,CONFIGURED_CLIENT1,PARTICIPANT,1,2,3,4,5,6,7,8,9,true,false,true,false,true,false,1024,2048,1000,error \ No newline at end of file
+testName,iterationNumber,clientName,participantName,numberOfMessages,payloadSizeB,priority,timeToLiveMs,deliveryMode,batchSize,maximumDurationMs,producerStartDelayMs,producerIntervalMs,isTopic,isDurableSubscription,isBrowsingSubscription,isSelector,isNoLocal,isSynchronousConsumer,totalNumberOfConsumers,totalNumberOfProducers,totalPayloadProcessedB,throughputKbPerS,timeTakenMs,errorMessage
+TEST1,0,CONFIGURED_CLIENT1,PARTICIPANT,1,2,3,4,5,6,7,8,9,true,false,true,false,true,false,1,2,1024,2048,1000,error \ No newline at end of file
diff --git a/qpid/java/perftests/src/test/java/org/apache/qpid/systest/disttest/endtoend/EndToEndTest.java b/qpid/java/perftests/src/test/java/org/apache/qpid/systest/disttest/endtoend/EndToEndTest.java
index c2ec1d6291..63c9b42858 100644
--- a/qpid/java/perftests/src/test/java/org/apache/qpid/systest/disttest/endtoend/EndToEndTest.java
+++ b/qpid/java/perftests/src/test/java/org/apache/qpid/systest/disttest/endtoend/EndToEndTest.java
@@ -19,7 +19,7 @@
package org.apache.qpid.systest.disttest.endtoend;
import static org.apache.qpid.disttest.AbstractRunner.JNDI_CONFIG_PROP;
-import static org.apache.qpid.disttest.ControllerRunner.OUTPUT_FILE_PROP;
+import static org.apache.qpid.disttest.ControllerRunner.OUTPUT_DIR_PROP;
import static org.apache.qpid.disttest.ControllerRunner.TEST_CONFIG_PROP;
import java.io.File;
@@ -39,18 +39,19 @@ public class EndToEndTest extends QpidBrokerTestCase
public void testRunner() throws Exception
{
- File csvOutputFile = createTemporaryCsvFile();
- assertFalse("CSV output file must exist",csvOutputFile.exists());
+ File csvOutputDir = createTemporaryCsvDirectory();
+ assertTrue("CSV output dir must not exist",csvOutputDir.isDirectory());
final String[] args = new String[] {TEST_CONFIG_PROP + "=" + TEST_CONFIG,
JNDI_CONFIG_PROP + "=" + JNDI_CONFIG_FILE,
- OUTPUT_FILE_PROP + "=" + csvOutputFile.getAbsolutePath()};
+ OUTPUT_DIR_PROP + "=" + csvOutputDir.getAbsolutePath()};
_runner = new ControllerRunner();
_runner.parseArgumentsIntoConfig(args);
_runner.runController();
- assertTrue("CSV output file must exist", csvOutputFile.exists());
- final String csvContents = FileUtils.readFileAsString(csvOutputFile);
+ File expectedCsvOutputFile = new File(csvOutputDir, "endtoend.csv");
+ assertTrue("CSV output file must exist", expectedCsvOutputFile.exists());
+ final String csvContents = FileUtils.readFileAsString(expectedCsvOutputFile);
final String[] csvLines = csvContents.split("\n");
int numberOfHeaders = 1;
@@ -82,13 +83,13 @@ public class EndToEndTest extends QpidBrokerTestCase
}
- private File createTemporaryCsvFile() throws IOException
+ private File createTemporaryCsvDirectory() throws IOException
{
- File csvFile = File.createTempFile(getName(), ".csv");
- csvFile.delete();
- csvFile.deleteOnExit();
-
- return csvFile;
+ String tmpDir = System.getProperty("java.io.tmpdir");
+ File csvDir = new File(tmpDir, "csv");
+ csvDir.mkdir();
+ csvDir.deleteOnExit();
+ return csvDir;
}
}