From ed30bcde2a746670bb334397698e47ca085c4df4 Mon Sep 17 00:00:00 2001 From: Keith Wall Date: Thu, 5 Jul 2012 14:56:45 +0000 Subject: QPID-4110 added topic support to performance tests. Specifically: - Added support for creating and tearing down durable subscriptions - Improved IterationValueTest so that we test the format for boolean properties (such as durableSubscription) - Added test and chart definitions Applied patch from Philip Harvey git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1357650 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/qpid/disttest/client/ClientTest.java | 2 +- .../controller/config/IterationValueTest.java | 33 ++++++++++++---------- 2 files changed, 19 insertions(+), 16 deletions(-) (limited to 'java/perftests/src/test') diff --git a/java/perftests/src/test/java/org/apache/qpid/disttest/client/ClientTest.java b/java/perftests/src/test/java/org/apache/qpid/disttest/client/ClientTest.java index 198baa6ef4..dd50766918 100644 --- a/java/perftests/src/test/java/org/apache/qpid/disttest/client/ClientTest.java +++ b/java/perftests/src/test/java/org/apache/qpid/disttest/client/ClientTest.java @@ -125,7 +125,7 @@ public class ClientTest extends TestCase _client.tearDownTest(); - verify(_delegate).closeTestConnections(); + verify(_delegate).tearDownTest(); verify(_participantRegistry).clear(); } diff --git a/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/IterationValueTest.java b/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/IterationValueTest.java index 7998eae37e..860f6af565 100644 --- a/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/IterationValueTest.java +++ b/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/IterationValueTest.java @@ -22,19 +22,19 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyZeroInteractions; -import java.util.Collections; +import java.util.HashMap; import java.util.Map; -import junit.framework.TestCase; - +import org.apache.qpid.disttest.message.CreateConnectionCommand; import org.apache.qpid.disttest.message.CreateConsumerCommand; -import org.apache.qpid.disttest.message.CreateProducerCommand; +import org.apache.qpid.test.utils.QpidTestCase; -public class IterationValueTest extends TestCase +public class IterationValueTest extends QpidTestCase { - private static final int MESSAGE_SIZE = 10; + private static final int MAXIMUM_DURATION = 10; + + private static final boolean IS_DURABLE_SUBSCRIPTION = true; - private CreateProducerCommand _createProducerCommand; private CreateConsumerCommand _createConsumerCommand; private Map _iterationValueMap; @@ -42,37 +42,40 @@ public class IterationValueTest extends TestCase protected void setUp() throws Exception { super.setUp(); - _createProducerCommand = mock(CreateProducerCommand.class); _createConsumerCommand = mock(CreateConsumerCommand.class); - _iterationValueMap = Collections.singletonMap("_messageSize", String.valueOf(MESSAGE_SIZE)); + _iterationValueMap = new HashMap(); + _iterationValueMap.put("_maximumDuration", String.valueOf(MAXIMUM_DURATION)); + _iterationValueMap.put("_durableSubscription", String.valueOf(IS_DURABLE_SUBSCRIPTION)); } public void testApplyPopulatedIterationValueToCommandWithMatchingProperties() throws Exception { IterationValue iterationValue = new IterationValue(_iterationValueMap); - iterationValue.applyToCommand(_createProducerCommand); + iterationValue.applyToCommand(_createConsumerCommand); - verify(_createProducerCommand).setMessageSize(MESSAGE_SIZE); + verify(_createConsumerCommand).setMaximumDuration(MAXIMUM_DURATION); + verify(_createConsumerCommand).setDurableSubscription(IS_DURABLE_SUBSCRIPTION); } public void testApplyPopulatedIterationValueToCommandWithoutMatchingProperties() throws Exception { IterationValue iterationValue = new IterationValue(_iterationValueMap); - iterationValue.applyToCommand(_createConsumerCommand); + CreateConnectionCommand createConnectionCommand = mock(CreateConnectionCommand.class); + iterationValue.applyToCommand(createConnectionCommand); - verifyZeroInteractions(_createConsumerCommand); + verifyZeroInteractions(createConnectionCommand); } public void testApplyUnpopulatedIterationValueToCommand() throws Exception { IterationValue iterationValue = new IterationValue(); - iterationValue.applyToCommand(_createProducerCommand); + iterationValue.applyToCommand(_createConsumerCommand); - verifyZeroInteractions(_createProducerCommand); + verifyZeroInteractions(_createConsumerCommand); } } -- cgit v1.2.1