diff options
| author | Keith Wall <kwall@apache.org> | 2012-07-05 14:56:45 +0000 |
|---|---|---|
| committer | Keith Wall <kwall@apache.org> | 2012-07-05 14:56:45 +0000 |
| commit | 438918ae57bb00e3ee4e769fe9e7b214fdbc2a38 (patch) | |
| tree | 12a1db4de8416e81935897b6c729889e566f6c90 /java/perftests | |
| parent | 0f739b3390a09b1558c117d20897a4d74c104754 (diff) | |
| download | qpid-python-438918ae57bb00e3ee4e769fe9e7b214fdbc2a38.tar.gz | |
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 <phil@philharveyonline.com>
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1357650 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/perftests')
14 files changed, 501 insertions, 36 deletions
diff --git a/java/perftests/etc/chartdefs/1500-Topic-NumberOfConsumers.chartdef b/java/perftests/etc/chartdefs/1500-Topic-NumberOfConsumers.chartdef new file mode 100644 index 0000000000..05bfd73b3b --- /dev/null +++ b/java/perftests/etc/chartdefs/1500-Topic-NumberOfConsumers.chartdef @@ -0,0 +1,29 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +chartType=LINE +chartTitle=Number of topic consumers +chartSubtitle=Transient 1KB messages +xAxisTitle=Numer of consumers +yAxisTitle=Throughput (KB/s) + +series.1.statement=SELECT testName, throughputKbPerS FROM Topic-NumberOfConsumers WHERE participantName = 'All' +series.1.legend=Current +series.1.dir=${csvCurrentDir} + diff --git a/java/perftests/etc/chartdefs/1501-Topic-NumberOfTopics.chartdef b/java/perftests/etc/chartdefs/1501-Topic-NumberOfTopics.chartdef new file mode 100644 index 0000000000..3d9a04b5b6 --- /dev/null +++ b/java/perftests/etc/chartdefs/1501-Topic-NumberOfTopics.chartdef @@ -0,0 +1,28 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +chartType=LINE +chartTitle=Number of topics +chartSubtitle=Transient 1KB messages +xAxisTitle=Numer of topics +yAxisTitle=Throughput (KB/s) + +series.1.statement=SELECT testName, throughputKbPerS FROM Topic-NumberOfTopics WHERE participantName = 'All' +series.1.legend=Current +series.1.dir=${csvCurrentDir} diff --git a/java/perftests/etc/chartdefs/1502-Topic-Persistence.chartdef b/java/perftests/etc/chartdefs/1502-Topic-Persistence.chartdef new file mode 100644 index 0000000000..aa449f48c9 --- /dev/null +++ b/java/perftests/etc/chartdefs/1502-Topic-Persistence.chartdef @@ -0,0 +1,28 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +chartType=BAR +chartTitle=Topic transient/durable subscriptions +chartSubtitle=1KB messages +xAxisTitle=Durable subscription +yAxisTitle=Throughput (KB/s) + +series.1.statement=SELECT isDurableSubscription, throughputKbPerS FROM Topic-Persistence WHERE participantName = 'All Consumers' +series.1.legend=Current +series.1.dir=${csvCurrentDir} diff --git a/java/perftests/etc/chartdefs/1503-Topic-AckModes.chartdef b/java/perftests/etc/chartdefs/1503-Topic-AckModes.chartdef new file mode 100644 index 0000000000..6a7e6016f1 --- /dev/null +++ b/java/perftests/etc/chartdefs/1503-Topic-AckModes.chartdef @@ -0,0 +1,28 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +chartType=BAR +chartTitle=Topic acknowledge modes +chartSubtitle=Transient 1KB messages +xAxisTitle=Ack Mode +yAxisTitle=Throughput (KB/s) + +series.1.statement=SELECT acknowledgeMode, throughputKbPerS FROM Topic-AckModes WHERE participantName = 'All' +series.1.legend=Current +series.1.dir=${csvCurrentDir} diff --git a/java/perftests/etc/testdefs/Topic-AckModes.js b/java/perftests/etc/testdefs/Topic-AckModes.js new file mode 100644 index 0000000000..0ad519aa50 --- /dev/null +++ b/java/perftests/etc/testdefs/Topic-AckModes.js @@ -0,0 +1,67 @@ +var duration = 30000; +var topicName = "topic://amq.topic/?routingkey='testTopic'"; + +var jsonObject = { + _tests: [ + { + "_name": "Topic ack modes", + "_iterations": [ + { + "_acknowledgeMode": 1 + }, + { + "_acknowledgeMode": 2 + }, + { + "_acknowledgeMode": 3 + } + ], + "_clients": [ + { + "_name": "producingClient", + "_connections":[ + { + "_name": "connection1", + "_factory": "connectionfactory", + "_sessions": [ + { + "_sessionName": "session1", + "_producers": [ + { + "_name": "Producer", + "_destinationName": topicName, + "_maximumDuration": duration + } + ] + } + ] + } + ] + } + ] + .concat(QPID.times(10, + { + "_name": "consumingClient-__INDEX", + "_connections":[ + { + "_name": "connection1", + "_factory": "connectionfactory", + "_sessions": [ + { + "_sessionName": "session1", + "_consumers": [ + { + "_name": "Consumer-__INDEX", + "_destinationName": topicName, + "_maximumDuration": duration, + } + ] + } + ] + } + ] + }, + "__INDEX")) + }] +}; + diff --git a/java/perftests/etc/testdefs/Topic-NumberOfConsumers.js b/java/perftests/etc/testdefs/Topic-NumberOfConsumers.js new file mode 100644 index 0000000000..9351987115 --- /dev/null +++ b/java/perftests/etc/testdefs/Topic-NumberOfConsumers.js @@ -0,0 +1,64 @@ +var jsonObject = { + _tests:[] +}; + +var duration = 30000; +var topicName = "topic://amq.topic/?routingkey='testTopic.1'"; + +var numbersOfConsumers = [1, 10, 50, 100]; + +for(i=0; i < numbersOfConsumers.length ; i++) +{ + var numberOfConsumers = numbersOfConsumers[i]; + var test = { + "_name": numberOfConsumers, + "_clients":[ + { + "_name": "producingClient", + "_connections":[ + { + "_name": "connection1", + "_factory": "connectionfactory", + "_sessions": [ + { + "_sessionName": "session1", + "_producers": [ + { + "_name": "Producer1", + "_destinationName": topicName, + "_maximumDuration": duration + } + ] + } + ] + } + ] + } + ].concat(QPID.times(numberOfConsumers, + { + "_name": "consumingClient-__INDEX", + "_connections":[ + { + "_name": "connection1", + "_factory": "connectionfactory", + "_sessions": [ + { + "_sessionName": "session1", + "_consumers": [ + { + "_name": "Consumer-__INDEX", + "_destinationName": topicName, + "_maximumDuration": duration + } + ] + } + ] + } + ] + }, + "__INDEX")) + }; + + jsonObject._tests= jsonObject._tests.concat(test); +} + diff --git a/java/perftests/etc/testdefs/Topic-NumberOfTopics.js b/java/perftests/etc/testdefs/Topic-NumberOfTopics.js new file mode 100644 index 0000000000..227650a16d --- /dev/null +++ b/java/perftests/etc/testdefs/Topic-NumberOfTopics.js @@ -0,0 +1,69 @@ +var jsonObject = { + _tests:[] +}; + +var duration = 30000; +var topicName = "topic://amq.topic/?routingkey='testTopic.__INDEX'"; + +var numbersOfTopics = [1, 10, 50, 100]; + +// Each test has n pairs of producers and consumers, each with a different topic + +for(i=0; i < numbersOfTopics.length ; i++) +{ + var numberOfTopics = numbersOfTopics[i]; + var test = { + "_name": numberOfTopics, + "_clients": + QPID.times(numberOfTopics, + { + "_name": "producingClient-__INDEX", + "_connections":[ + { + "_name": "connection1", + "_factory": "connectionfactory", + "_sessions": [ + { + "_sessionName": "session1", + "_producers": [ + { + "_name": "Producer-__INDEX", + "_destinationName": topicName, + "_maximumDuration": duration + } + ] + } + ] + } + ] + }, + "__INDEX") + .concat( + QPID.times(numberOfTopics, + { + "_name": "consumingClient-__INDEX", + "_connections":[ + { + "_name": "connection1", + "_factory": "connectionfactory", + "_sessions": [ + { + "_sessionName": "session1", + "_consumers": [ + { + "_name": "Consumer-__INDEX", + "_destinationName": topicName, + "_maximumDuration": duration + } + ] + } + ] + } + ] + }, + "__INDEX")) + }; + + jsonObject._tests= jsonObject._tests.concat(test); +} + diff --git a/java/perftests/etc/testdefs/Topic-Persistence.js b/java/perftests/etc/testdefs/Topic-Persistence.js new file mode 100644 index 0000000000..d843d37861 --- /dev/null +++ b/java/perftests/etc/testdefs/Topic-Persistence.js @@ -0,0 +1,69 @@ +var duration = 30000; +var topicName = "topic://amq.topic/?routingkey='testTopic'"; + +var jsonObject = { + _tests: [ + { + "_name": "Topic persistence", + "_iterations": [ + // note that we use _durableSubscription (the JaveBeans property name) + // rather than _isDurableSubscription (the field name) + { + "_deliveryMode": 1, + "_durableSubscription": false + }, + { + "_deliveryMode": 2, + "_durableSubscription": true + } + ], + "_clients": [ + { + "_name": "producingClient", + "_connections":[ + { + "_name": "connection1", + "_factory": "connectionfactory", + "_sessions": [ + { + "_sessionName": "session1", + "_producers": [ + { + "_name": "Producer", + "_destinationName": topicName, + "_maximumDuration": duration, + } + ] + } + ] + } + ] + } + ] + .concat(QPID.times(10, + { + "_name": "consumingClient-__INDEX", + "_connections":[ + { + "_name": "connection1", + "_factory": "connectionfactory", + "_sessions": [ + { + "_sessionName": "session1", + "_consumers": [ + { + "_name": "Consumer-__INDEX", + "_destinationName": topicName, + "_isTopic": true, + "_maximumDuration": duration, + } + ] + } + ] + } + ] + }, + "__INDEX")) + }] +}; + diff --git a/java/perftests/src/main/java/org/apache/qpid/disttest/client/Client.java b/java/perftests/src/main/java/org/apache/qpid/disttest/client/Client.java index 2478b49cfd..0d5457c992 100644 --- a/java/perftests/src/main/java/org/apache/qpid/disttest/client/Client.java +++ b/java/perftests/src/main/java/org/apache/qpid/disttest/client/Client.java @@ -176,7 +176,7 @@ public class Client { LOGGER.debug("Tearing down test on client: " + _clientJmsDelegate.getClientName()); - _clientJmsDelegate.closeTestConnections(); + _clientJmsDelegate.tearDownTest(); } else { diff --git a/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/QueueConfig.java b/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/QueueConfig.java index cffc2b7c50..45a4551cbc 100644 --- a/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/QueueConfig.java +++ b/java/perftests/src/main/java/org/apache/qpid/disttest/controller/config/QueueConfig.java @@ -38,7 +38,6 @@ public class QueueConfig public QueueConfig(String name, boolean durable, Map<String, Object> attributes) { - super(); this._name = name; this._durable = durable; this._attributes = attributes; @@ -49,8 +48,6 @@ public class QueueConfig return _name; } - // TODO x-qpid-capacity and x-qpid-flow-resume-capacity need to be typed as numeric but we currrently - // pass these as a string. public Map<String, Object> getAttributes() { return _attributes; diff --git a/java/perftests/src/main/java/org/apache/qpid/disttest/jms/ClientJmsDelegate.java b/java/perftests/src/main/java/org/apache/qpid/disttest/jms/ClientJmsDelegate.java index f1dd911f0b..15c4f5f70f 100644 --- a/java/perftests/src/main/java/org/apache/qpid/disttest/jms/ClientJmsDelegate.java +++ b/java/perftests/src/main/java/org/apache/qpid/disttest/jms/ClientJmsDelegate.java @@ -35,6 +35,7 @@ import javax.jms.MessageProducer; import javax.jms.Queue; import javax.jms.Session; import javax.jms.TextMessage; +import javax.jms.Topic; import javax.naming.Context; import javax.naming.NamingException; @@ -72,6 +73,7 @@ public class ClientJmsDelegate private Map<String, Session> _testSessions; private Map<String, MessageProducer> _testProducers; private Map<String, MessageConsumer> _testConsumers; + private Map<String, Session> _testSubscriptions; private Map<String, MessageProvider> _testMessageProviders; private final MessageProvider _defaultMessageProvider; @@ -92,6 +94,7 @@ public class ClientJmsDelegate _testSessions = new HashMap<String, Session>(); _testProducers = new HashMap<String, MessageProducer>(); _testConsumers = new HashMap<String, MessageConsumer>(); + _testSubscriptions = new HashMap<String, Session>(); _testMessageProviders = new HashMap<String, MessageProvider>(); _defaultMessageProvider = new MessageProvider(null); } @@ -255,9 +258,31 @@ public class ClientJmsDelegate synchronized(session) { - final Destination destination = command.isTopic() ? session.createTopic(command.getDestinationName()) - : session.createQueue(command.getDestinationName()); - final MessageConsumer jmsConsumer = session.createConsumer(destination, command.getSelector()); + Destination destination; + MessageConsumer jmsConsumer; + if(command.isTopic()) + { + Topic topic = session.createTopic(command.getDestinationName()); + if(command.isDurableSubscription()) + { + String subscription = "subscription-" + command.getParticipantName() + System.currentTimeMillis(); + jmsConsumer = session.createDurableSubscriber(topic, subscription); + + _testSubscriptions.put(subscription, session); + LOGGER.debug("created durable suscription " + subscription + " to topic " + topic); + } + else + { + jmsConsumer = session.createConsumer(topic, command.getSelector()); + } + + destination = topic; + } + else + { + destination = session.createQueue(command.getDestinationName()); + jmsConsumer = session.createConsumer(destination, command.getSelector()); + } _testConsumers.put(command.getParticipantName(), jmsConsumer); } @@ -521,36 +546,59 @@ public class ClientJmsDelegate return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("clientName", _clientName).toString(); } - public void closeTestConnections() + public void tearDownTest() { StringBuilder jmsErrorMessages = new StringBuilder(); - int failedCloseCounter = 0; - for (final Map.Entry<String, Connection> entry : _testConnections.entrySet()) + int failureCounter = 0; + + for(String subscription : _testSubscriptions.keySet()) { - final Connection connection = entry.getValue(); + Session session = _testSubscriptions.get(subscription); + try + { + session.unsubscribe(subscription); + } + catch (JMSException e) + { + LOGGER.error("Failed to unsubscribe '" + subscription + "' :" + e.getLocalizedMessage(), e); + failureCounter++; + appendErrorMessage(jmsErrorMessages, e); + } + } + + for (Map.Entry<String, Connection> entry : _testConnections.entrySet()) + { + Connection connection = entry.getValue(); try { connection.close(); } - catch (final JMSException e) + catch (JMSException e) { LOGGER.error("Failed to close connection '" + entry.getKey() + "' :" + e.getLocalizedMessage(), e); - failedCloseCounter++; - if (jmsErrorMessages.length() > 0) - { - jmsErrorMessages.append('\n'); - } - jmsErrorMessages.append(e.getMessage()); + failureCounter++; + appendErrorMessage(jmsErrorMessages, e); } } + _testConnections.clear(); _testSessions.clear(); _testProducers.clear(); _testConsumers.clear(); - if (failedCloseCounter > 0) + + if (failureCounter > 0) + { + throw new DistributedTestException("Tear down test encountered " + failureCounter + " failures with the following errors: " + jmsErrorMessages.toString()); + } + } + + private void appendErrorMessage(StringBuilder errorMessages, JMSException e) + { + if (errorMessages.length() > 0) { - throw new DistributedTestException("Close failed for " + failedCloseCounter + " connection(s) with the following errors: " + jmsErrorMessages.toString()); + errorMessages.append('\n'); } + errorMessages.append(e.getMessage()); } public void closeTestConsumer(String consumerName) diff --git a/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/ParticipantResultAggregator.java b/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/ParticipantResultAggregator.java index dde717c71b..4dcabe6c7b 100644 --- a/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/ParticipantResultAggregator.java +++ b/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/ParticipantResultAggregator.java @@ -25,6 +25,7 @@ import java.util.TreeSet; import org.apache.qpid.disttest.message.ConsumerParticipantResult; import org.apache.qpid.disttest.message.ParticipantResult; +import org.apache.qpid.disttest.message.ProducerParticipantResult; public class ParticipantResultAggregator { @@ -43,6 +44,9 @@ public class ParticipantResultAggregator private NavigableSet<Integer> _encounteredIterationNumbers = new TreeSet<Integer>(); private NavigableSet<Integer> _encounteredBatchSizes = new TreeSet<Integer>(); private NavigableSet<Integer> _encounteredAcknowledgeMode = new TreeSet<Integer>(); + private NavigableSet<Integer> _encounteredDeliveryModes = new TreeSet<Integer>(); + private NavigableSet<Boolean> _encounteredDurableSubscriptions = new TreeSet<Boolean>(); + private NavigableSet<Boolean> _encounteredTopics = new TreeSet<Boolean>(); private NavigableSet<String> _encountedTestNames = new TreeSet<String>(); private SeriesStatistics _latencyStatistics = new SeriesStatistics(); @@ -116,6 +120,17 @@ public class ParticipantResultAggregator _encounteredIterationNumbers.add(result.getIterationNumber()); _encounteredBatchSizes.add(result.getBatchSize()); _encounteredAcknowledgeMode.add(result.getAcknowledgeMode()); + if (result instanceof ProducerParticipantResult) + { + ProducerParticipantResult producerParticipantResult = (ProducerParticipantResult) result; + _encounteredDeliveryModes.add(producerParticipantResult.getDeliveryMode()); + } + else if(result instanceof ConsumerParticipantResult) + { + ConsumerParticipantResult consumerParticipantResult = (ConsumerParticipantResult)result; + _encounteredDurableSubscriptions.add(consumerParticipantResult.isDurableSubscription()); + _encounteredTopics.add(consumerParticipantResult.isTopic()); + } } private void setComputedVariableAttributes(ParticipantResult aggregatedResult) @@ -151,6 +166,26 @@ public class ParticipantResultAggregator { aggregatedResult.setAcknowledgeMode(_encounteredAcknowledgeMode.first()); } + if (aggregatedResult instanceof ProducerParticipantResult) + { + ProducerParticipantResult producerParticipantResult = (ProducerParticipantResult) aggregatedResult; + if(_encounteredDeliveryModes.size() == 1) + { + producerParticipantResult.setDeliveryMode(_encounteredDeliveryModes.first()); + } + } + if (aggregatedResult instanceof ConsumerParticipantResult) + { + ConsumerParticipantResult consumerParticipantResult = (ConsumerParticipantResult) aggregatedResult; + if(_encounteredDurableSubscriptions.size() == 1) + { + consumerParticipantResult.setDurableSubscription(_encounteredDurableSubscriptions.first()); + } + if(_encounteredTopics.size() == 1) + { + consumerParticipantResult.setTopic(_encounteredTopics.first()); + } + } } private double calculateThroughputInKiloBytesPerSecond() 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<String, String> _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<String, String>(); + _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); } } |
