You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kp...@apache.org on 2012/08/03 14:14:12 UTC
svn commit: r1368910 [23/27] - in /qpid/branches/asyncstore: ./ bin/
cpp/bindings/qmf/ruby/ cpp/bindings/qmf2/ruby/ cpp/bindings/qpid/python/
cpp/bindings/qpid/ruby/ cpp/bindings/qpid/ruby/features/
cpp/bindings/qpid/ruby/features/step_definitions/ cpp...
Modified: qpid/branches/asyncstore/java/perftests/src/main/java/org/apache/qpid/disttest/jms/ClientJmsDelegate.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/perftests/src/main/java/org/apache/qpid/disttest/jms/ClientJmsDelegate.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/perftests/src/main/java/org/apache/qpid/disttest/jms/ClientJmsDelegate.java (original)
+++ qpid/branches/asyncstore/java/perftests/src/main/java/org/apache/qpid/disttest/jms/ClientJmsDelegate.java Fri Aug 3 12:13:32 2012
@@ -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);
}
@@ -193,7 +196,7 @@ public class ClientJmsDelegate
final boolean transacted = command.getAcknowledgeMode() == Session.SESSION_TRANSACTED;
final Session newSession = connection.createSession(transacted, command.getAcknowledgeMode());
- LOGGER.info("Created session " + command.getSessionName() + " with transacted = " + newSession.getTransacted() + " and acknowledgeMode = " + newSession.getAcknowledgeMode());
+ LOGGER.debug("Created session " + command.getSessionName() + " with transacted = " + newSession.getTransacted() + " and acknowledgeMode = " + newSession.getAcknowledgeMode());
addSession(command.getSessionName(), newSession);
}
@@ -212,30 +215,35 @@ public class ClientJmsDelegate
{
throw new DistributedTestException("No test session found called: " + command.getSessionName(), command);
}
- final Destination destination = session.createQueue(command.getDestinationName());
- final MessageProducer jmsProducer = session.createProducer(destination);
- if (command.getPriority() != -1)
- {
- jmsProducer.setPriority(command.getPriority());
- }
- if (command.getTimeToLive() > 0)
- {
- jmsProducer.setTimeToLive(command.getTimeToLive());
- }
- if (command.getDeliveryMode() == DeliveryMode.NON_PERSISTENT
- || command.getDeliveryMode() == DeliveryMode.PERSISTENT)
+ synchronized(session)
{
- jmsProducer.setDeliveryMode(command.getDeliveryMode());
- }
+ final Destination destination = session.createQueue(command.getDestinationName());
+
+ final MessageProducer jmsProducer = session.createProducer(destination);
+
+ if (command.getPriority() != -1)
+ {
+ jmsProducer.setPriority(command.getPriority());
+ }
+ if (command.getTimeToLive() > 0)
+ {
+ jmsProducer.setTimeToLive(command.getTimeToLive());
+ }
+
+ if (command.getDeliveryMode() == DeliveryMode.NON_PERSISTENT
+ || command.getDeliveryMode() == DeliveryMode.PERSISTENT)
+ {
+ jmsProducer.setDeliveryMode(command.getDeliveryMode());
+ }
- addProducer(command.getParticipantName(), jmsProducer);
+ addProducer(command.getParticipantName(), jmsProducer);
+ }
}
catch (final JMSException jmse)
{
throw new DistributedTestException("Unable to create new producer: " + command, jmse);
}
-
}
public void createConsumer(final CreateConsumerCommand command)
@@ -247,11 +255,37 @@ public class ClientJmsDelegate
{
throw new DistributedTestException("No test session found called: " + command.getSessionName(), command);
}
- final Destination destination = command.isTopic() ? session.createTopic(command.getDestinationName())
- : session.createQueue(command.getDestinationName());
- final MessageConsumer jmsConsumer = session.createConsumer(destination, command.getSelector());
- _testConsumers.put(command.getParticipantName(), jmsConsumer);
+ synchronized(session)
+ {
+ 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);
+ }
}
catch (final JMSException jmse)
{
@@ -346,7 +380,10 @@ public class ClientJmsDelegate
final Session session = _testSessions.get(sessionName);
if (session.getTransacted())
{
- session.commit();
+ synchronized(session)
+ {
+ session.commit();
+ }
}
else if (message != null && session.getAcknowledgeMode() == Session.CLIENT_ACKNOWLEDGE)
{
@@ -461,13 +498,16 @@ public class ClientJmsDelegate
try
{
final Session session = _testSessions.get(sessionName);
- if (session.getTransacted())
+ synchronized(session)
{
- session.rollback();
- }
- else if (session.getAcknowledgeMode() == Session.CLIENT_ACKNOWLEDGE)
- {
- session.recover();
+ if (session.getTransacted())
+ {
+ session.rollback();
+ }
+ else if (session.getAcknowledgeMode() == Session.CLIENT_ACKNOWLEDGE)
+ {
+ session.recover();
+ }
}
}
catch (final JMSException jmse)
@@ -482,13 +522,16 @@ public class ClientJmsDelegate
try
{
final Session session = _testSessions.get(sessionName);
- if (session.getTransacted())
- {
- session.rollback();
- }
- else
+ synchronized(session)
{
- session.recover();
+ if (session.getTransacted())
+ {
+ session.rollback();
+ }
+ else
+ {
+ session.recover();
+ }
}
}
catch (final JMSException jmse)
@@ -503,38 +546,62 @@ 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())
+ {
+ 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())
{
- final Connection connection = entry.getValue();
+ 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();
+ _testSubscriptions.clear();
_testSessions.clear();
_testProducers.clear();
_testConsumers.clear();
- if (failedCloseCounter > 0)
+
+ if (failureCounter > 0)
{
- throw new DistributedTestException("Close failed for " + failedCloseCounter + " connection(s) with the following errors: " + jmsErrorMessages.toString());
+ 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)
+ {
+ errorMessages.append('\n');
+ }
+ errorMessages.append(e.getMessage());
+ }
+
public void closeTestConsumer(String consumerName)
{
MessageConsumer consumer = _testConsumers.get(consumerName);
@@ -543,7 +610,7 @@ public class ClientJmsDelegate
try
{
consumer.close();
- LOGGER.info("Closed test consumer " + consumerName);
+ LOGGER.debug("Closed test consumer " + consumerName);
}
catch (JMSException e)
{
@@ -568,15 +635,16 @@ public class ClientJmsDelegate
}
}
+ /** only supports text messages - returns 0 for other message types */
public int calculatePayloadSizeFrom(Message message)
{
try
{
if (message != null && message instanceof TextMessage)
{
- return ((TextMessage) message).getText().getBytes().length;
+ return ((TextMessage) message).getText().getBytes().length;
}
- // TODO support other message types
+
return 0;
}
catch (JMSException e)
Modified: qpid/branches/asyncstore/java/perftests/src/main/java/org/apache/qpid/disttest/jms/ControllerJmsDelegate.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/perftests/src/main/java/org/apache/qpid/disttest/jms/ControllerJmsDelegate.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/perftests/src/main/java/org/apache/qpid/disttest/jms/ControllerJmsDelegate.java (original)
+++ qpid/branches/asyncstore/java/perftests/src/main/java/org/apache/qpid/disttest/jms/ControllerJmsDelegate.java Fri Aug 3 12:13:32 2012
@@ -48,11 +48,13 @@ public class ControllerJmsDelegate
{
private static final Logger LOGGER = LoggerFactory.getLogger(ControllerJmsDelegate.class);
+ private static final String QUEUE_CREATOR_CLASS_NAME_SYSTEM_PROPERTY = "qpid.disttest.queue.creator.class";
+
private final Map<String, Destination> _clientNameToQueueMap = new ConcurrentHashMap<String, Destination>();
private final Connection _connection;
private final Destination _controllerQueue;
private final Session _session;
- private final QueueCreator _queueCreator;
+ private QueueCreator _queueCreator;
private List<CommandListener> _commandListeners = new CopyOnWriteArrayList<CommandListener>();
@@ -63,7 +65,39 @@ public class ControllerJmsDelegate
_connection.start();
_controllerQueue = (Destination) context.lookup("controllerqueue");
_session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- _queueCreator = new QpidQueueCreator();
+
+ createVendorSpecificQueueCreator();
+ }
+
+ private void createVendorSpecificQueueCreator()
+ {
+ String queueCreatorClassName = System.getProperty(QUEUE_CREATOR_CLASS_NAME_SYSTEM_PROPERTY);
+ if(queueCreatorClassName == null)
+ {
+ queueCreatorClassName = QpidQueueCreator.class.getName();
+ }
+ else
+ {
+ LOGGER.info("Using overridden queue creator class " + queueCreatorClassName);
+ }
+
+ try
+ {
+ Class<? extends QueueCreator> queueCreatorClass = (Class<? extends QueueCreator>) Class.forName(queueCreatorClassName);
+ _queueCreator = queueCreatorClass.newInstance();
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new DistributedTestException("Unable to instantiate queue creator using class name " + queueCreatorClassName, e);
+ }
+ catch (InstantiationException e)
+ {
+ throw new DistributedTestException("Unable to instantiate queue creator using class name " + queueCreatorClassName, e);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new DistributedTestException("Unable to instantiate queue creator using class name " + queueCreatorClassName, e);
+ }
}
public void start()
Modified: qpid/branches/asyncstore/java/perftests/src/main/java/org/apache/qpid/disttest/jms/QpidQueueCreator.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/perftests/src/main/java/org/apache/qpid/disttest/jms/QpidQueueCreator.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/perftests/src/main/java/org/apache/qpid/disttest/jms/QpidQueueCreator.java (original)
+++ qpid/branches/asyncstore/java/perftests/src/main/java/org/apache/qpid/disttest/jms/QpidQueueCreator.java Fri Aug 3 12:13:32 2012
@@ -21,7 +21,6 @@ package org.apache.qpid.disttest.jms;
import java.util.List;
import javax.jms.Session;
-
import org.apache.qpid.client.AMQDestination;
import org.apache.qpid.client.AMQSession;
import org.apache.qpid.disttest.DistributedTestException;
@@ -29,11 +28,9 @@ import org.apache.qpid.disttest.controll
import org.apache.qpid.framing.FieldTable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-
public class QpidQueueCreator implements QueueCreator
{
private static final Logger LOGGER = LoggerFactory.getLogger(QpidQueueCreator.class);
-
private static final FieldTable EMPTY_QUEUE_BIND_ARGUMENTS = new FieldTable();
@Override
@@ -69,7 +66,7 @@ public class QpidQueueCreator implements
EMPTY_QUEUE_BIND_ARGUMENTS, destination.getExchangeName(),
destination, autoDelete);
- LOGGER.info("Created queue " + queueConfig);
+ LOGGER.debug("Created queue " + queueConfig);
}
catch (Exception e)
{
@@ -86,12 +83,11 @@ public class QpidQueueCreator implements
// use #deleteQueue.
AMQDestination destination = (AMQDestination) session.createQueue(queueConfig.getName());
session.sendQueueDelete(destination.getAMQQueueName());
- LOGGER.info("Deleted queue " + queueConfig.getName());
+ LOGGER.debug("Deleted queue " + queueConfig.getName());
}
catch (Exception e)
{
throw new DistributedTestException("Failed to delete queue:" + queueConfig.getName(), e);
}
}
-
}
Modified: qpid/branches/asyncstore/java/perftests/src/main/java/org/apache/qpid/disttest/message/ConsumerParticipantResult.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/perftests/src/main/java/org/apache/qpid/disttest/message/ConsumerParticipantResult.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/perftests/src/main/java/org/apache/qpid/disttest/message/ConsumerParticipantResult.java (original)
+++ qpid/branches/asyncstore/java/perftests/src/main/java/org/apache/qpid/disttest/message/ConsumerParticipantResult.java Fri Aug 3 12:13:32 2012
@@ -18,13 +18,15 @@
*/
package org.apache.qpid.disttest.message;
-import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_BROWSIING_SUBSCRIPTION;
+import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_BROWSING_SUBSCRIPTION;
import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_DURABLE_SUBSCRIPTION;
import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_NO_LOCAL;
import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_SELECTOR;
import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_SYNCHRONOUS_CONSUMER;
import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_TOPIC;
+import java.util.Collection;
+
public class ConsumerParticipantResult extends ParticipantResult
{
private boolean _topic;
@@ -34,6 +36,12 @@ public class ConsumerParticipantResult e
private boolean _noLocal;
private boolean _synchronousConsumer;
+ private Collection<Long> _messageLatencies;
+ private long _minLatency;
+ private long _maxLatency;
+ private double _averageLatency;
+ private double _latencyStandardDeviation;
+
public ConsumerParticipantResult()
{
super(CommandType.CONSUMER_PARTICIPANT_RESULT);
@@ -57,7 +65,7 @@ public class ConsumerParticipantResult e
}
- @OutputAttribute(attribute=IS_BROWSIING_SUBSCRIPTION)
+ @OutputAttribute(attribute=IS_BROWSING_SUBSCRIPTION)
public boolean isBrowsingSubscription()
{
return _browsingSubscription;
@@ -115,4 +123,59 @@ public class ConsumerParticipantResult e
{
return _topic;
}
+
+ public Collection<Long> getMessageLatencies()
+ {
+ return _messageLatencies;
+ }
+
+ public void setMessageLatencies(Collection<Long> messageLatencies)
+ {
+ _messageLatencies = messageLatencies;
+ }
+
+ @OutputAttribute(attribute=ParticipantAttribute.MIN_LATENCY)
+ public long getMinLatency()
+ {
+ return _minLatency;
+ }
+
+ public void setMinLatency(long minLatency)
+ {
+ _minLatency = minLatency;
+ }
+
+ @OutputAttribute(attribute=ParticipantAttribute.MAX_LATENCY)
+ public long getMaxLatency()
+ {
+ return _maxLatency;
+ }
+
+ public void setMaxLatency(long maxLatency)
+ {
+ _maxLatency = maxLatency;
+ }
+
+ @OutputAttribute(attribute=ParticipantAttribute.AVERAGE_LATENCY)
+ public double getAverageLatency()
+ {
+ return _averageLatency;
+ }
+
+ public void setAverageLatency(double averageLatency)
+ {
+ _averageLatency = averageLatency;
+ }
+
+ @OutputAttribute(attribute=ParticipantAttribute.LATENCY_STANDARD_DEVIATION)
+ public double getLatencyStandardDeviation()
+ {
+ return _latencyStandardDeviation;
+ }
+
+ public void setLatencyStandardDeviation(double latencyStandardDeviation)
+ {
+ _latencyStandardDeviation = latencyStandardDeviation;
+ }
+
}
Modified: qpid/branches/asyncstore/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateConsumerCommand.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateConsumerCommand.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateConsumerCommand.java (original)
+++ qpid/branches/asyncstore/java/perftests/src/main/java/org/apache/qpid/disttest/message/CreateConsumerCommand.java Fri Aug 3 12:13:32 2012
@@ -28,7 +28,7 @@ public class CreateConsumerCommand exten
private boolean _noLocal;
private boolean _synchronous;
private long _receiveTimeout = 5000;
-
+ private boolean _evaluateLatency;
public CreateConsumerCommand()
{
@@ -105,4 +105,14 @@ public class CreateConsumerCommand exten
{
return _receiveTimeout;
}
+
+ public boolean isEvaluateLatency()
+ {
+ return _evaluateLatency;
+ }
+
+ public void setEvaluateLatency(boolean evaluateLatency)
+ {
+ _evaluateLatency = evaluateLatency;
+ }
}
Modified: qpid/branches/asyncstore/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantAttribute.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantAttribute.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantAttribute.java (original)
+++ qpid/branches/asyncstore/java/perftests/src/main/java/org/apache/qpid/disttest/message/ParticipantAttribute.java Fri Aug 3 12:13:32 2012
@@ -45,7 +45,7 @@ public enum ParticipantAttribute
PRODUCER_INTERVAL("producerIntervalMs"),
IS_TOPIC("isTopic"),
IS_DURABLE_SUBSCRIPTION("isDurableSubscription"),
- IS_BROWSIING_SUBSCRIPTION("isBrowsingSubscription"),
+ IS_BROWSING_SUBSCRIPTION("isBrowsingSubscription"),
IS_SELECTOR("isSelector"),
IS_NO_LOCAL("isNoLocal"),
IS_SYNCHRONOUS_CONSUMER("isSynchronousConsumer"),
@@ -54,7 +54,12 @@ public enum ParticipantAttribute
TOTAL_PAYLOAD_PROCESSED("totalPayloadProcessedB"),
THROUGHPUT("throughputKbPerS"),
TIME_TAKEN("timeTakenMs"),
- ERROR_MESSAGE("errorMessage");
+ ERROR_MESSAGE("errorMessage"),
+ MIN_LATENCY("minLatency"),
+ MAX_LATENCY("maxLatency"),
+ AVERAGE_LATENCY("averageLatency"),
+ LATENCY_STANDARD_DEVIATION("latencyStandardDeviation")
+ ;
private String _displayName;
Modified: qpid/branches/asyncstore/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/ParticipantResultAggregator.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/ParticipantResultAggregator.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/ParticipantResultAggregator.java (original)
+++ qpid/branches/asyncstore/java/perftests/src/main/java/org/apache/qpid/disttest/results/aggregation/ParticipantResultAggregator.java Fri Aug 3 12:13:32 2012
@@ -23,7 +23,9 @@ import java.util.Date;
import java.util.NavigableSet;
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
{
@@ -42,8 +44,13 @@ 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();
+
public ParticipantResultAggregator(Class<? extends ParticipantResult> targetClass, String aggregateResultName)
{
_aggregatedResultName = aggregateResultName;
@@ -56,12 +63,31 @@ public class ParticipantResultAggregator
{
rollupConstantAttributes(result);
computeVariableAttributes(result);
+ if (result instanceof ConsumerParticipantResult)
+ {
+ ConsumerParticipantResult consumerParticipantResult = (ConsumerParticipantResult)result;
+ _latencyStatistics.addMessageLatencies(consumerParticipantResult.getMessageLatencies());
+ _latencyStatistics.aggregate();
+ }
}
}
public ParticipantResult getAggregatedResult()
{
- ParticipantResult aggregatedResult = new ParticipantResult(_aggregatedResultName);
+ ParticipantResult aggregatedResult;
+ if (_targetClass == ConsumerParticipantResult.class)
+ {
+ ConsumerParticipantResult consumerParticipantResult = new ConsumerParticipantResult(_aggregatedResultName);
+ consumerParticipantResult.setAverageLatency(_latencyStatistics.getAverage());
+ consumerParticipantResult.setMinLatency(_latencyStatistics.getMinimum());
+ consumerParticipantResult.setMaxLatency(_latencyStatistics.getMaximum());
+ consumerParticipantResult.setLatencyStandardDeviation(_latencyStatistics.getStandardDeviation());
+ aggregatedResult = consumerParticipantResult;
+ }
+ else
+ {
+ aggregatedResult = new ParticipantResult(_aggregatedResultName);
+ }
setRolledUpConstantAttributes(aggregatedResult);
setComputedVariableAttributes(aggregatedResult);
@@ -94,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)
@@ -129,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()
Modified: qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/client/ClientTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/client/ClientTest.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/client/ClientTest.java (original)
+++ qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/client/ClientTest.java Fri Aug 3 12:13:32 2012
@@ -125,7 +125,7 @@ public class ClientTest extends TestCase
_client.tearDownTest();
- verify(_delegate).closeTestConnections();
+ verify(_delegate).tearDownTest();
verify(_participantRegistry).clear();
}
Modified: qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/client/ConsumerParticipantTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/client/ConsumerParticipantTest.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/client/ConsumerParticipantTest.java (original)
+++ qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/client/ConsumerParticipantTest.java Fri Aug 3 12:13:32 2012
@@ -29,6 +29,8 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import java.util.Collection;
+
import javax.jms.Message;
import javax.jms.Session;
@@ -36,6 +38,7 @@ import junit.framework.TestCase;
import org.apache.qpid.disttest.DistributedTestException;
import org.apache.qpid.disttest.jms.ClientJmsDelegate;
+import org.apache.qpid.disttest.message.ConsumerParticipantResult;
import org.apache.qpid.disttest.message.CreateConsumerCommand;
import org.apache.qpid.disttest.message.ParticipantResult;
import org.mockito.InOrder;
@@ -177,4 +180,24 @@ public class ConsumerParticipantTest ext
verify(_delegate).closeTestConsumer(PARTICIPANT_NAME1);
}
+ public void testLatency() throws Exception
+ {
+ int numberOfMessages = 1;
+ long totalPayloadSize = PAYLOAD_SIZE_PER_MESSAGE * numberOfMessages;
+ _command.setNumberOfMessages(numberOfMessages);
+ _command.setEvaluateLatency(true);
+ _consumerParticipant = new ConsumerParticipant(_delegate, _command);
+ ParticipantResult result = _consumerParticipant.doIt(CLIENT_NAME);
+
+ assertExpectedConsumerResults(result, PARTICIPANT_NAME1, CLIENT_NAME, _testStartTime,
+ Session.CLIENT_ACKNOWLEDGE, null, numberOfMessages, PAYLOAD_SIZE_PER_MESSAGE, totalPayloadSize, null);
+
+ _inOrder.verify(_delegate).consumeMessage(PARTICIPANT_NAME1, RECEIVE_TIMEOUT);
+ _inOrder.verify(_delegate).calculatePayloadSizeFrom(_mockMessage);
+ _inOrder.verify(_delegate).commitOrAcknowledgeMessage(_mockMessage, SESSION_NAME1);
+ assertTrue("Unexpected consuemr results", result instanceof ConsumerParticipantResult);
+ Collection<Long> latencies = ((ConsumerParticipantResult)result).getMessageLatencies();
+ assertNotNull("Message latency is not cllected", latencies);
+ assertEquals("Unexpected message latency results", 1, latencies.size());
+ }
}
Modified: qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/client/MessageProviderTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/client/MessageProviderTest.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/client/MessageProviderTest.java (original)
+++ qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/client/MessageProviderTest.java Fri Aug 3 12:13:32 2012
@@ -59,6 +59,7 @@ public class MessageProviderTest extends
{
MessageProvider messageProvider = new MessageProvider(null)
{
+ @Override
public String getMessagePayload(CreateProducerCommand command)
{
return super.getMessagePayload(command);
Modified: qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/client/ProducerParticipantTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/client/ProducerParticipantTest.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/client/ProducerParticipantTest.java (original)
+++ qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/client/ProducerParticipantTest.java Fri Aug 3 12:13:32 2012
@@ -121,7 +121,7 @@ public class ProducerParticipantTest ext
_command.setBatchSize(batchSize);
_command.setDeliveryMode(deliveryMode);
- ParticipantResult result = (ParticipantResult) _producer.doIt(CLIENT_NAME);
+ ParticipantResult result = _producer.doIt(CLIENT_NAME);
assertExpectedProducerResults(result, PARTICIPANT_NAME1, CLIENT_NAME, _testStartTime,
Session.AUTO_ACKNOWLEDGE, null, numberOfMessages, PAYLOAD_SIZE_PER_MESSAGE, totalPayloadSize, null);
Modified: qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/client/property/ListPropertyValueTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/client/property/ListPropertyValueTest.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/client/property/ListPropertyValueTest.java (original)
+++ qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/client/property/ListPropertyValueTest.java Fri Aug 3 12:13:32 2012
@@ -32,6 +32,7 @@ public class ListPropertyValueTest exten
private ListPropertyValue _generator;
private List<PropertyValue> _items;
+ @Override
public void setUp() throws Exception
{
super.setUp();
Modified: qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/client/property/PropertyValueFactoryTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/client/property/PropertyValueFactoryTest.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/client/property/PropertyValueFactoryTest.java (original)
+++ qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/client/property/PropertyValueFactoryTest.java Fri Aug 3 12:13:32 2012
@@ -24,6 +24,7 @@ public class PropertyValueFactoryTest ex
{
private PropertyValueFactory _factory;
+ @Override
public void setUp() throws Exception
{
super.setUp();
Modified: qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/client/property/RandomPropertyValueTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/client/property/RandomPropertyValueTest.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/client/property/RandomPropertyValueTest.java (original)
+++ qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/client/property/RandomPropertyValueTest.java Fri Aug 3 12:13:32 2012
@@ -26,6 +26,7 @@ public class RandomPropertyValueTest ext
{
private RandomPropertyValue _generator;
+ @Override
public void setUp() throws Exception
{
super.setUp();
Modified: qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/client/property/RangePropertyValueTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/client/property/RangePropertyValueTest.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/client/property/RangePropertyValueTest.java (original)
+++ qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/client/property/RangePropertyValueTest.java Fri Aug 3 12:13:32 2012
@@ -26,6 +26,7 @@ public class RangePropertyValueTest exte
{
private RangePropertyValue _generator;
+ @Override
public void setUp() throws Exception
{
super.setUp();
Modified: qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ConfigReaderTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ConfigReaderTest.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ConfigReaderTest.java (original)
+++ qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/ConfigReaderTest.java Fri Aug 3 12:13:32 2012
@@ -25,10 +25,8 @@ import java.util.Map;
import junit.framework.TestCase;
-import org.apache.qpid.disttest.ConfigFileHelper;
-import org.apache.qpid.disttest.client.MessageProvider;
+import org.apache.qpid.disttest.ConfigFileTestHelper;
import org.apache.qpid.disttest.client.property.PropertyValue;
-import org.apache.qpid.disttest.controller.CommandForClient;
public class ConfigReaderTest extends TestCase
{
@@ -38,7 +36,7 @@ public class ConfigReaderTest extends Te
protected void setUp()
{
ConfigReader configReader = new ConfigReader();
- Reader reader = ConfigFileHelper.getConfigFileReader(getClass(), "sampleConfig.json");
+ Reader reader = ConfigFileTestHelper.getConfigFileReader(getClass(), "sampleConfig.json");
_config = configReader.readConfig(reader);
}
@@ -110,4 +108,38 @@ public class ConfigReaderTest extends Te
assertNotNull("id property is not found", properties.get("id"));
}
+ public void testReadsJS() throws Exception
+ {
+ ConfigReader configReader = new ConfigReader();
+ String path = getClass().getResource("ConfigReaderTest-test-config.js").toURI().getPath();
+ _config = configReader.getConfigFromFile(path);
+ List<TestConfig> testConfigs = _config.getTestConfigs();
+ assertEquals("Unexpected number of tests", 2, testConfigs.size());
+ TestConfig testConfig1 = _config.getTestConfigs().get(0);
+ List<ClientConfig> cleintConfigs = testConfig1.getClients();
+ assertEquals("Unexpected number of test 1 clients", 2, cleintConfigs.size());
+ List<QueueConfig> queueConfigs = testConfig1.getQueues();
+ assertEquals("Unexpected number of test 1 queue", 1, queueConfigs.size());
+ assertEquals("Unexpected queue name", "Json-Queue-Name", queueConfigs.get(0).getName());
+ ClientConfig cleintConfig = cleintConfigs.get(0);
+ List<ConnectionConfig> connectionConfigs = cleintConfig.getConnections();
+ assertEquals("Unexpected number of connections", 1, connectionConfigs.size());
+ List<SessionConfig> sessionConfigs = connectionConfigs.get(0).getSessions();
+ assertEquals("Unexpected number of sessions", 1, sessionConfigs.size());
+ assertEquals("Unexpected ack mode", 0, sessionConfigs.get(0).getAcknowledgeMode());
+
+ TestConfig testConfig2 = _config.getTestConfigs().get(1);
+ List<ClientConfig> cleintConfigs2 = testConfig2.getClients();
+ assertEquals("Unexpected number of test 1 clients", 2, cleintConfigs2.size());
+ List<QueueConfig> queueConfigs2 = testConfig2.getQueues();
+ assertEquals("Unexpected number of test 1 queue", 1, queueConfigs2.size());
+ assertEquals("Unexpected queue name", "Json-Queue-Name", queueConfigs2.get(0).getName());
+ ClientConfig cleintConfig2 = cleintConfigs2.get(0);
+ List<ConnectionConfig> connectionConfigs2 = cleintConfig2.getConnections();
+ assertEquals("Unexpected number of connections", 1, connectionConfigs2.size());
+ List<SessionConfig> sessionConfigs2 = connectionConfigs2.get(0).getSessions();
+ assertEquals("Unexpected number of sessions", 1, sessionConfigs2.size());
+ assertEquals("Unexpected ack mode", 1, sessionConfigs2.get(0).getAcknowledgeMode());
+ }
+
}
Modified: qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/IterationValueTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/IterationValueTest.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/IterationValueTest.java (original)
+++ qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/controller/config/IterationValueTest.java Fri Aug 3 12:13:32 2012
@@ -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
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);
}
}
Modified: qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/message/ParticipantResultTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/message/ParticipantResultTest.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/message/ParticipantResultTest.java (original)
+++ qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/message/ParticipantResultTest.java Fri Aug 3 12:13:32 2012
@@ -22,7 +22,7 @@ import static org.apache.qpid.disttest.m
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;
-import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_BROWSIING_SUBSCRIPTION;
+import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_BROWSING_SUBSCRIPTION;
import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_DURABLE_SUBSCRIPTION;
import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_NO_LOCAL;
import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_SELECTOR;
@@ -127,7 +127,7 @@ public class ParticipantResultTest exten
assertEquals(topic, result.getAttributes().get(IS_TOPIC));
assertEquals(durable, result.getAttributes().get(IS_DURABLE_SUBSCRIPTION));
- assertEquals(browsingSubscription, result.getAttributes().get(IS_BROWSIING_SUBSCRIPTION));
+ assertEquals(browsingSubscription, result.getAttributes().get(IS_BROWSING_SUBSCRIPTION));
assertEquals(selector, result.getAttributes().get(IS_SELECTOR));
assertEquals(noLocal, result.getAttributes().get(IS_NO_LOCAL));
assertEquals(synchronousConsumer, result.getAttributes().get(IS_SYNCHRONOUS_CONSUMER));
Modified: qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/results/aggregation/TestResultAggregatorTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/results/aggregation/TestResultAggregatorTest.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/results/aggregation/TestResultAggregatorTest.java (original)
+++ qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/results/aggregation/TestResultAggregatorTest.java Fri Aug 3 12:13:32 2012
@@ -19,6 +19,7 @@
package org.apache.qpid.disttest.results.aggregation;
import java.util.Date;
+import java.util.List;
import junit.framework.TestCase;
@@ -26,8 +27,6 @@ import org.apache.qpid.disttest.controll
import org.apache.qpid.disttest.message.ConsumerParticipantResult;
import org.apache.qpid.disttest.message.ParticipantResult;
import org.apache.qpid.disttest.message.ProducerParticipantResult;
-import org.apache.qpid.disttest.results.aggregation.AggregatedTestResult;
-import org.apache.qpid.disttest.results.aggregation.TestResultAggregator;
public class TestResultAggregatorTest extends TestCase
{
@@ -105,6 +104,55 @@ public class TestResultAggregatorTest ex
assertEquals(TestResultAggregator.AGGREGATED_ERROR_MESSAGE, aggregatedTestResult.getAllParticipantResult().getErrorMessage());
}
+ public void testAggregateResultsForConsumerWithLatencyResults() throws Exception
+ {
+ TestResult originalTestResult = createResultsFromTest();
+ List<ParticipantResult> results = originalTestResult.getParticipantResults();
+ for (ParticipantResult participantResult : results)
+ {
+ if (participantResult instanceof ConsumerParticipantResult)
+ {
+ ((ConsumerParticipantResult)participantResult).setMessageLatencies(SeriesStatisticsTest.SERIES);
+ break;
+ }
+ }
+
+ int numberOfOriginalParticipantResults = originalTestResult.getParticipantResults().size();
+ int expectedNumberOfResults = numberOfOriginalParticipantResults + EXPECTED_NUMBER_OF_AGGREGATED_RESULTS;
+
+ AggregatedTestResult aggregatedTestResult = _aggregator.aggregateTestResult(originalTestResult);
+
+ aggregatedTestResult.getAllConsumerParticipantResult().getTotalPayloadProcessed();
+ assertEquals(expectedNumberOfResults, aggregatedTestResult.getParticipantResults().size());
+
+ assertMinimalAggregatedResults(
+ aggregatedTestResult.getAllConsumerParticipantResult(),
+ TEST1_NAME, TEST1_ITERATION_NUMBER,
+ BATCH_SIZE, NUMBER_OF_MESSAGES_CONSUMED_IN_TOTAL, 2, 0);
+
+ assertLatencyAggregatedResults(aggregatedTestResult.getAllConsumerParticipantResult());
+
+ assertMinimalAggregatedResults(
+ aggregatedTestResult.getAllProducerParticipantResult(),
+ TEST1_NAME, TEST1_ITERATION_NUMBER,
+ BATCH_SIZE, NUMBER_OF_MESSAGES_PRODUCED, 0, 1);
+
+ assertMinimalAggregatedResults(
+ aggregatedTestResult.getAllParticipantResult(),
+ TEST1_NAME, TEST1_ITERATION_NUMBER,
+ BATCH_SIZE, NUMBER_OF_MESSAGES_CONSUMED_IN_TOTAL, 2, 1);
+ }
+
+ private void assertLatencyAggregatedResults(ParticipantResult allConsumerParticipantResult)
+ {
+ assertTrue("Unexpected result", allConsumerParticipantResult instanceof ConsumerParticipantResult);
+ ConsumerParticipantResult results = (ConsumerParticipantResult)allConsumerParticipantResult;
+ assertEquals("Unexpected average", 5.0, results.getAverageLatency(), 0.01);
+ assertEquals("Unexpected min", 2, results.getMinLatency());
+ assertEquals("Unexpected max", 9, results.getMaxLatency());
+ assertEquals("Unexpected standard deviation", 2.0, results.getLatencyStandardDeviation(), 0.01);
+ }
+
private void assertMinimalAggregatedResults(ParticipantResult result, String expectedTestName, int expectedIterationNumber, int expectedBatchSize, long expectedNumberOfMessagesProcessed, int expectedTotalNumberOfConsumers, int expectedTotalNumberOfProducers)
{
assertEquals("Unexpected test name in " + result.getParticipantName(), expectedTestName, result.getTestName());
Modified: qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/CSVFormaterTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/CSVFormaterTest.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/CSVFormaterTest.java (original)
+++ qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/CSVFormaterTest.java Fri Aug 3 12:13:32 2012
@@ -22,7 +22,7 @@ import static org.apache.qpid.disttest.m
import static org.apache.qpid.disttest.message.ParticipantAttribute.CONFIGURED_CLIENT_NAME;
import static org.apache.qpid.disttest.message.ParticipantAttribute.*;
import static org.apache.qpid.disttest.message.ParticipantAttribute.ERROR_MESSAGE;
-import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_BROWSIING_SUBSCRIPTION;
+import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_BROWSING_SUBSCRIPTION;
import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_DURABLE_SUBSCRIPTION;
import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_NO_LOCAL;
import static org.apache.qpid.disttest.message.ParticipantAttribute.IS_SELECTOR;
@@ -58,7 +58,6 @@ import org.apache.qpid.disttest.controll
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.qmf.QMFProperty.AccessCode;
public class CSVFormaterTest extends TestCase
{
@@ -109,7 +108,7 @@ public class CSVFormaterTest extends Tes
participantAttributes.put(PRODUCER_INTERVAL, 9);
participantAttributes.put(IS_TOPIC, true);
participantAttributes.put(IS_DURABLE_SUBSCRIPTION, false);
- participantAttributes.put(IS_BROWSIING_SUBSCRIPTION, true);
+ participantAttributes.put(IS_BROWSING_SUBSCRIPTION, true);
participantAttributes.put(IS_SELECTOR, false);
participantAttributes.put(IS_NO_LOCAL, true);
participantAttributes.put(IS_SYNCHRONOUS_CONSUMER, false);
@@ -119,7 +118,10 @@ public class CSVFormaterTest extends Tes
participantAttributes.put(THROUGHPUT, 2048);
participantAttributes.put(TIME_TAKEN, 1000);
participantAttributes.put(ERROR_MESSAGE, "error");
-
+ participantAttributes.put(MIN_LATENCY, 2l);
+ participantAttributes.put(MAX_LATENCY, 9l);
+ participantAttributes.put(AVERAGE_LATENCY, 5.0f);
+ participantAttributes.put(LATENCY_STANDARD_DEVIATION, 2.0f);
return participantAttributes;
}
Modified: qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/expectedOutput.csv
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/expectedOutput.csv?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/expectedOutput.csv (original)
+++ qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/disttest/results/formatting/expectedOutput.csv Fri Aug 3 12:13:32 2012
@@ -1,2 +1,2 @@
-testName,iterationNumber,clientName,participantName,numberOfMessages,payloadSizeB,priority,timeToLiveMs,acknowledgeMode,deliveryMode,batchSize,maximumDurationMs,producerStartDelayMs,producerIntervalMs,isTopic,isDurableSubscription,isBrowsingSubscription,isSelector,isNoLocal,isSynchronousConsumer,totalNumberOfConsumers,totalNumberOfProducers,totalPayloadProcessedB,throughputKbPerS,timeTakenMs,errorMessage
-TEST1,0,CONFIGURED_CLIENT1,PARTICIPANT,0,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
+testName,iterationNumber,clientName,participantName,numberOfMessages,payloadSizeB,priority,timeToLiveMs,acknowledgeMode,deliveryMode,batchSize,maximumDurationMs,producerStartDelayMs,producerIntervalMs,isTopic,isDurableSubscription,isBrowsingSubscription,isSelector,isNoLocal,isSynchronousConsumer,totalNumberOfConsumers,totalNumberOfProducers,totalPayloadProcessedB,throughputKbPerS,timeTakenMs,errorMessage,minLatency,maxLatency,averageLatency,latencyStandardDeviation
+TEST1,0,CONFIGURED_CLIENT1,PARTICIPANT,0,1,2,3,4,5,6,7,8,9,true,false,true,false,true,false,1,2,1024,2048,1000,error,2,9,5.0,2.0
Modified: qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/systest/disttest/clientonly/ControllerQueue.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/systest/disttest/clientonly/ControllerQueue.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/systest/disttest/clientonly/ControllerQueue.java (original)
+++ qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/systest/disttest/clientonly/ControllerQueue.java Fri Aug 3 12:13:32 2012
@@ -1,3 +1,23 @@
+/*
+ *
+ * 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.
+ *
+ */
package org.apache.qpid.systest.disttest.clientonly;
import java.util.Map;
@@ -66,7 +86,7 @@ public class ControllerQueue
public <T extends Command> T getNext(boolean assertMessageExists) throws JMSException
{
- final Message message = _controllerQueueMessageConsumer.receive(1000);
+ final Message message = _controllerQueueMessageConsumer.receive(2000);
if(assertMessageExists)
{
Assert.assertNotNull("No message received from control queue", message);
Modified: qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/systest/disttest/clientonly/DistributedClientTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/systest/disttest/clientonly/DistributedClientTest.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/systest/disttest/clientonly/DistributedClientTest.java (original)
+++ qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/systest/disttest/clientonly/DistributedClientTest.java Fri Aug 3 12:13:32 2012
@@ -32,6 +32,7 @@ import javax.jms.MessageProducer;
import javax.jms.Queue;
import javax.jms.Session;
+import org.apache.qpid.client.AMQSession;
import org.apache.qpid.disttest.client.Client;
import org.apache.qpid.disttest.client.ClientState;
import org.apache.qpid.disttest.jms.ClientJmsDelegate;
@@ -158,7 +159,7 @@ public class DistributedClientTest exten
assertState(_client, RUNNING_TEST);
}
- public void testParticipantsSendResults() throws JMSException
+ public void testParticipantsSendResults() throws Exception
{
createTestProducer(TEST_SESSION_NAME, TEST_PRODUCER_NAME, TEST_DESTINATION);
@@ -204,20 +205,21 @@ public class DistributedClientTest exten
assertState(_client, READY);
}
- private void sendCommandToClient(final Command command) throws JMSException
+ private void sendCommandToClient(final Command command) throws Exception
{
final Message message = JmsMessageAdaptor.commandToMessage(_session, command);
_clientQueueProducer.send(message);
+ ((AMQSession<?, ?>)_session).sync();
}
- private void sendCommandAndValidateResponse(final Command command, boolean shouldSucceed) throws JMSException
+ private void sendCommandAndValidateResponse(final Command command, boolean shouldSucceed) throws Exception
{
sendCommandToClient(command);
Response response = _controllerQueue.getNext();
validateResponse(command.getType(), response, shouldSucceed);
}
- private void sendCommandAndValidateResponse(final Command command) throws JMSException
+ private void sendCommandAndValidateResponse(final Command command) throws Exception
{
sendCommandAndValidateResponse(command, true);
}
@@ -258,7 +260,7 @@ public class DistributedClientTest exten
createTestSession(connectionName, sessionName, true);
}
- private void createTestProducer(String sessionName, String producerName, String destinationName, boolean shouldSucceed) throws JMSException
+ private void createTestProducer(String sessionName, String producerName, String destinationName, boolean shouldSucceed) throws Exception
{
final CreateProducerCommand createProducerCommand = new CreateProducerCommand();
createProducerCommand.setParticipantName(producerName);
@@ -269,12 +271,12 @@ public class DistributedClientTest exten
sendCommandAndValidateResponse(createProducerCommand, shouldSucceed);
}
- private void createTestProducer(String sessionName, String producerName, String destinationName) throws JMSException
+ private void createTestProducer(String sessionName, String producerName, String destinationName) throws Exception
{
createTestProducer(sessionName, producerName, destinationName, true);
}
- private void createTestConsumer(String sessionName, String consumerName, String destinationName, boolean shouldSucceed) throws JMSException
+ private void createTestConsumer(String sessionName, String consumerName, String destinationName, boolean shouldSucceed) throws Exception
{
final CreateConsumerCommand createConsumerCommand = new CreateConsumerCommand();
createConsumerCommand.setSessionName(sessionName);
@@ -285,7 +287,7 @@ public class DistributedClientTest exten
sendCommandAndValidateResponse(createConsumerCommand, shouldSucceed);
}
- private void createTestConsumer(String sessionName, String consumerName, String destinationName) throws JMSException
+ private void createTestConsumer(String sessionName, String consumerName, String destinationName) throws Exception
{
createTestConsumer(sessionName, consumerName, destinationName, true);
}
Modified: qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/systest/disttest/controllerandclient/ControllerAndClientTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/systest/disttest/controllerandclient/ControllerAndClientTest.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/systest/disttest/controllerandclient/ControllerAndClientTest.java (original)
+++ qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/systest/disttest/controllerandclient/ControllerAndClientTest.java Fri Aug 3 12:13:32 2012
@@ -23,6 +23,7 @@ import static org.apache.qpid.systest.di
import static org.apache.qpid.systest.disttest.SystemTestConstants.REGISTRATION_TIMEOUT;
import static org.apache.qpid.systest.disttest.SystemTestConstants.TEST_RESULT_TIMEOUT;
+import java.util.Collection;
import java.util.List;
import javax.jms.Message;
@@ -31,7 +32,7 @@ import javax.jms.Queue;
import javax.jms.Session;
import javax.naming.NamingException;
-import org.apache.qpid.disttest.ConfigFileHelper;
+import org.apache.qpid.disttest.ConfigFileTestHelper;
import org.apache.qpid.disttest.client.Client;
import org.apache.qpid.disttest.client.ClientState;
import org.apache.qpid.disttest.controller.Controller;
@@ -73,6 +74,19 @@ public class ControllerAndClientTest ext
List<ParticipantResult> test1ParticipantResults = testResult1.getParticipantResults();
assertEquals("Unexpected number of participant results for test 1", 2, test1ParticipantResults.size());
assertParticipantNames(test1ParticipantResults, "participantConsumer1", "participantProducer1");
+ ConsumerParticipantResult result = null;
+ for (ParticipantResult participantResult : test1ParticipantResults)
+ {
+ if (participantResult instanceof ConsumerParticipantResult)
+ {
+ result = (ConsumerParticipantResult)participantResult;
+ break;
+ }
+ }
+ assertNotNull("Consumer results not recived", result);
+ Collection<Long> latencies = result.getMessageLatencies();
+ assertNotNull("Latency results are not collected", latencies);
+ assertEquals("Unexpected latency results", 1, latencies.size());
}
public void testProducerClient() throws Exception
@@ -86,7 +100,7 @@ public class ControllerAndClientTest ext
// cleaning manually
while(consumer.receive(1000l) != null);
- final Config config = ConfigFileHelper.getConfigFromResource(getClass(), "produceClient.json");
+ final Config config = ConfigFileTestHelper.getConfigFromResource(getClass(), "produceClient.json");
_controller.setConfig(config);
final Client client1 = new Client(new ClientJmsDelegate(_context));
final Thread client1Thread = createBackgroundClientThread(client1);
@@ -151,7 +165,7 @@ public class ControllerAndClientTest ext
List<ParticipantResult> test1ParticipantResults = testResult.getParticipantResults();
assertEquals("Unexpected number of participant results for test", 2, test1ParticipantResults.size());
- ParticipantResult producer1 = (ParticipantResult) test1ParticipantResults.get(1);
+ ParticipantResult producer1 = test1ParticipantResults.get(1);
assertEquals(expectedMessageSize, producer1.getPayloadSize());
assertEquals(iterationNumber, producer1.getIterationNumber());
@@ -167,7 +181,7 @@ public class ControllerAndClientTest ext
private List<TestResult> runTestsForTwoClients(String jsonConfigFile, int expectedNumberOfTests) throws NamingException, InterruptedException
{
- final Config config = ConfigFileHelper.getConfigFromResource(getClass(), jsonConfigFile);
+ final Config config = ConfigFileTestHelper.getConfigFromResource(getClass(), jsonConfigFile);
_controller.setConfig(config);
final Client client1 = new Client(new ClientJmsDelegate(_context));
Modified: qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/systest/disttest/controllerandclient/producerAndConsumerInSeparateClients.json
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/systest/disttest/controllerandclient/producerAndConsumerInSeparateClients.json?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/systest/disttest/controllerandclient/producerAndConsumerInSeparateClients.json (original)
+++ qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/systest/disttest/controllerandclient/producerAndConsumerInSeparateClients.json Fri Aug 3 12:13:32 2012
@@ -42,7 +42,8 @@
{
"_name": "participantConsumer1",
"_destinationName": "direct://amq.direct//testQueue",
- "_numberOfMessages": 1
+ "_numberOfMessages": 1,
+ "_evaluateLatency": true
}
]
}
Modified: qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/systest/disttest/controlleronly/DistributedControllerTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/systest/disttest/controlleronly/DistributedControllerTest.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/systest/disttest/controlleronly/DistributedControllerTest.java (original)
+++ qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/systest/disttest/controlleronly/DistributedControllerTest.java Fri Aug 3 12:13:32 2012
@@ -38,7 +38,7 @@ import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TemporaryQueue;
-import org.apache.qpid.disttest.ConfigFileHelper;
+import org.apache.qpid.disttest.ConfigFileTestHelper;
import org.apache.qpid.disttest.controller.Controller;
import org.apache.qpid.disttest.controller.config.Config;
import org.apache.qpid.disttest.jms.ControllerJmsDelegate;
@@ -96,7 +96,7 @@ public class DistributedControllerTest e
public void testControllerSendsOneCommandToSingleClient() throws Exception
{
- Config config = ConfigFileHelper.getConfigFromResource(getClass(), "distributedControllerTest.json");
+ Config config = ConfigFileTestHelper.getConfigFromResource(getClass(), "distributedControllerTest.json");
_controller.setConfig(config);
sendRegistration(CLIENT1);
Modified: qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/systest/disttest/endtoend/EndToEndTest.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/systest/disttest/endtoend/EndToEndTest.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/systest/disttest/endtoend/EndToEndTest.java (original)
+++ qpid/branches/asyncstore/java/perftests/src/test/java/org/apache/qpid/systest/disttest/endtoend/EndToEndTest.java Fri Aug 3 12:13:32 2012
@@ -62,10 +62,10 @@ public class EndToEndTest extends QpidBr
assertEquals("Unexpected number of lines in CSV", numberOfExpectedRows, csvLines.length);
assertDataRowsHaveCorrectTestAndClientName("End To End 1", "producingClient", "participantProducer1", csvLines[1], 1);
- assertDataRowsHaveCorrectTestAndClientName("End To End 1", "consumingClient", "participantConsumer1", csvLines[2], 1);
+ assertDataRowsHaveCorrectTestAndClientName("End To End 1", "consumingClient", "participantConsumer1", csvLines[3], 1);
- assertDataRowsHaveCorrectTestAndClientName("End To End 1", "", TestResultAggregator.ALL_PARTICIPANTS_NAME, csvLines[3], 1);
- assertDataRowsHaveCorrectTestAndClientName("End To End 1", "", TestResultAggregator.ALL_CONSUMER_PARTICIPANTS_NAME, csvLines[4], 1);
+ assertDataRowsHaveCorrectTestAndClientName("End To End 1", "", TestResultAggregator.ALL_PARTICIPANTS_NAME, csvLines[4], 1);
+ assertDataRowsHaveCorrectTestAndClientName("End To End 1", "", TestResultAggregator.ALL_CONSUMER_PARTICIPANTS_NAME, csvLines[2], 1);
assertDataRowsHaveCorrectTestAndClientName("End To End 1", "", TestResultAggregator.ALL_PRODUCER_PARTICIPANTS_NAME, csvLines[5], 1);
}
Modified: qpid/branches/asyncstore/java/perftests/visualisation-jfc/build.xml
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/perftests/visualisation-jfc/build.xml?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/perftests/visualisation-jfc/build.xml (original)
+++ qpid/branches/asyncstore/java/perftests/visualisation-jfc/build.xml Fri Aug 3 12:13:32 2012
@@ -16,37 +16,59 @@
- specific language governing permissions and limitations
- under the License.
-->
-<project name="visualisation-jfc" default="build">
+<project name="visualisation-jfc" xmlns:ivy="antlib:org.apache.ivy.ant" default="build">
<property name="module.depends" value="common perftests" />
- <property name="module.test.depends" value="test" />
+ <property name="module.test.depends" value="test common/test" />
+
+ <property name="module.manifest" value="true" />
<import file="../../module.xml" />
+ <!-- Overridden to produce Manifest containing Main-Class and Class-Path -->
+ <target name="jar.manifest" depends="compile" if="module.manifest">
+ <path id="class.path">
+ <fileset dir="${build.lib}" >
+ <include name="*.jar"/>
+ <exclude name="${qpid.jar.name}"/>
+ </fileset>
+ </path>
+ <pathconvert property="qpid.jar.classpath" pathsep=" " dirsep="/">
+ <path refid="class.path"/>
+ <globmapper from="${build.lib}${file.separator}*" to="*"/>
+ </pathconvert>
+
+ <jar destfile="${module.jar}" basedir="${module.classes}">
+ <manifest>
+ <attribute name="Class-Path" value="${qpid.jar.classpath}"/>
+ <attribute name="Main-Class" value="org.apache.qpid.disttest.charting.ChartingUtil"/>
+ </manifest>
+ </jar>
+ </target>
<!-- JFreeChart and JFreeCommon -->
-
- <property name="jfree.lib.dir" value="${project.root}/lib/jfree" />
- <property name="jfreechart.version" value="1.0.13" />
- <property name="jfreecommon.version" value="1.0.16" />
- <property name="jfreechart.download.url" value="http://repo1.maven.org/maven2/jfree/jfreechart/${jfreechart.version}/jfreechart-${jfreechart.version}.jar" />
- <property name="jfreecommon.download.url" value="http://repo1.maven.org/maven2/jfree/jcommon/${jfreecommon.version}/jcommon-${jfreecommon.version}.jar" />
- <property name="jfreechart.jar.file" value="${jfree.lib.dir}/jfreechart-${jfreechart.version}.jar" />
- <property name="jfreecommon.jar.file" value="${jfree.lib.dir}/jfreecommon-${jfreecommon.version}.jar" />
+ <condition property="download.jfree.jars">
+ <or>
+ <istrue value="${download-jfree}"/>
+ <istrue value="${optional.dependencies}"/>
+ <istrue value="${optional}"/>
+ </or>
+ </condition>
<!-- CSVJDBC -->
-
- <property name="csvjdbc.lib.dir" value="${project.root}/lib/csvjdbc" />
- <property name="csvjdbc.version" value="1.0.8" />
- <property name="csvjdbc.download.url" value="http://csvjdbc.sourceforge.net/maven2/net/sourceforge/csvjdbc/csvjdbc/${csvjdbc.version}/csvjdbc-${csvjdbc.version}.jar" />
-
- <property name="csvjdbc.jar.file" value="${csvjdbc.lib.dir}/csvjdbc-${csvjdbc.version}.jar" />
+ <condition property="download.csvjdbc.jar">
+ <or>
+ <istrue value="${download-csvjdbc}"/>
+ <istrue value="${optional.dependencies}"/>
+ <istrue value="${optional}"/>
+ </or>
+ </condition>
<!--check whether the JFree jar is present, possibly after download-->
<target name="check-jfree-jars">
<condition property="jfree.available">
<and>
- <available file="${jfreechart.jar.file}"/>
- <available file="${jfreecommon.jar.file}"/>
+ <available file="${project.root}/${jfreechart.jar}"/>
+ <available file="${project.root}/${jcommon.jar}"/>
</and>
</condition>
</target>
@@ -81,12 +103,12 @@ http://www.gnu.org/licenses/lgpl.html
<target name="check-csvjdbc-jars">
<condition property="csvjdbc.available">
- <available file="${csvjdbc.jar.file}"/>
+ <available file="${project.root}/${csvjdbc.jar}"/>
</condition>
</target>
<!--check if an inline JFree download was requested with the build-->
- <target name="checkjfree-request-props" if="download-jfree">
+ <target name="checkjfree-request-props" if="download.jfree.jars">
<antcall target="download-jfree"/>
</target>
@@ -119,21 +141,22 @@ http://www.gnu.org/licenses/lgpl.html
</target>
<!--download JFree, with licencing note-->
- <target name="download-jfree" depends="jfree-licence-note">
- <mkdir dir="${jfree.lib.dir}"/>
- <echo>Downloading JFreeChart</echo>
- <get src="${jfreechart.download.url}" dest="${jfreechart.jar.file}" usetimestamp="true" />
- <get src="${jfreecommon.download.url}" dest="${jfreecommon.jar.file}" usetimestamp="true" />
+ <target name="download-jfree" depends="jfree-licence-note, load-ivy, configure-ivy" unless="${ivy.dont.retrieve}">
+ <echo message="Resolving and retrieving dependencies..."/>
+ <ivy:resolve type="jar" file="${project.root}/ivy.retrieve.xml" conf="jfree"/>
+ <ivy:retrieve type="jar" conf="jfree" sync="true"
+ pattern="${project.root}/lib/jfree/[artifact]-[revision].[ext]" />
</target>
- <target name="checkcsvjdbc-request-props" if="download-csvjdbc">
+ <target name="checkcsvjdbc-request-props" if="download.csvjdbc.jar">
<antcall target="download-csvjdbc"/>
</target>
- <target name="download-csvjdbc" depends="csvjdbc-licence-note">
- <mkdir dir="${csvjdbc.lib.dir}"/>
- <echo>Downloading csvjdbc</echo>
- <get src="${csvjdbc.download.url}" dest="${csvjdbc.jar.file}" usetimestamp="true" />
+ <target name="download-csvjdbc" depends="csvjdbc-licence-note, load-ivy, configure-ivy" unless="${ivy.dont.retrieve}">
+ <echo message="Resolving and retrieving dependencies..."/>
+ <ivy:resolve type="jar" file="${project.root}/ivy.retrieve.xml" conf="csvjdbc"/>
+ <ivy:retrieve type="jar" conf="csvjdbc" sync="true"
+ pattern="${project.root}/lib/csvjdbc/[artifact]-[revision].[ext]" />
</target>
<target name="build" depends="checkjfree-request-props, jfree-jar-required, checkcsvjdbc-request-props, csvjdbc-jar-required, module.build" />
Modified: qpid/branches/asyncstore/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/ChartType.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/ChartType.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/ChartType.java (original)
+++ qpid/branches/asyncstore/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/ChartType.java Fri Aug 3 12:13:32 2012
@@ -21,6 +21,5 @@ package org.apache.qpid.disttest.chartin
public enum ChartType
{
- LINE, BAR
-
+ LINE, LINE3D, BAR, BAR3D, XYLINE, STATISTICAL_BAR
}
Modified: qpid/branches/asyncstore/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/ChartingUtil.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/ChartingUtil.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/ChartingUtil.java (original)
+++ qpid/branches/asyncstore/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/ChartingUtil.java Fri Aug 3 12:13:32 2012
@@ -20,11 +20,7 @@
*/
package org.apache.qpid.disttest.charting;
-import java.io.BufferedOutputStream;
import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -34,11 +30,24 @@ import org.apache.qpid.disttest.charting
import org.apache.qpid.disttest.charting.chartbuilder.ChartBuilderFactory;
import org.apache.qpid.disttest.charting.definition.ChartingDefinition;
import org.apache.qpid.disttest.charting.definition.ChartingDefinitionCreator;
-import org.jfree.chart.ChartUtilities;
+import org.apache.qpid.disttest.charting.seriesbuilder.JdbcCsvSeriesBuilder;
+import org.apache.qpid.disttest.charting.seriesbuilder.SeriesBuilder;
+import org.apache.qpid.disttest.charting.writer.ChartWriter;
import org.jfree.chart.JFreeChart;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+/**
+ * Draws charts for data drawn from CSV datasources using rules described in
+ * charting definitions (.chartdef) files.
+ * <p>
+ * The following arguments are understood:
+ * </p>
+ * <ol>
+ * <li>chart-defs=<i>directory contain chartdef file(s)</i></li>
+ * <li>output-dir=<i>directory in which to produce the PNGs</i></li>
+ * </ol>
+ */
public class ChartingUtil
{
private static final Logger LOGGER = LoggerFactory.getLogger(ChartingUtil.class);
@@ -59,7 +68,7 @@ public class ChartingUtil
{
try
{
- LOGGER.debug("Starting charting");
+ LOGGER.info("Starting charting");
ChartingUtil chartingUtil = new ChartingUtil();
chartingUtil.parseArgumentsIntoConfig(args);
@@ -67,56 +76,32 @@ public class ChartingUtil
}
finally
{
- LOGGER.debug("Charting complete");
+ LOGGER.info("Charting complete");
}
}
private void produceAllCharts()
{
final String chartingDefsDir = _cliOptions.get(CHART_DEFINITIONS_PROP);
+ final File chartDirectory = new File(_cliOptions.get(OUTPUT_DIR_PROP));
+ LOGGER.info("Chart chartdef directory/file: {} output directory : {}", chartingDefsDir, chartDirectory);
+
List<ChartingDefinition> definitions = loadChartDefinitions(chartingDefsDir);
- LOGGER.debug("There are {} chart(s) to produce", definitions.size());
+ LOGGER.info("There are {} chart(s) to produce", definitions.size());
+
+ final ChartWriter writer = new ChartWriter();
+ writer.setOutputDirectory(chartDirectory);
+ final SeriesBuilder seriesBuilder = new JdbcCsvSeriesBuilder();
for (ChartingDefinition chartingDefinition : definitions)
{
- ChartBuilder chartBuilder = ChartBuilderFactory.createChartBuilder(chartingDefinition.getChartType());
+ ChartBuilder chartBuilder = ChartBuilderFactory.createChartBuilder(chartingDefinition.getChartType(), seriesBuilder);
JFreeChart chart = chartBuilder.buildChart(chartingDefinition);
- writeChartToFileSystem(chart, chartingDefinition.getChartStemName());
+ writer.writeChartToFileSystem(chart, chartingDefinition.getChartStemName());
}
- }
-
- private void writeChartToFileSystem(JFreeChart chart, String chartStemName)
- {
- OutputStream pngOutputStream = null;
- try
- {
-
- File pngFile = new File(chartStemName + ".png");
- pngOutputStream = new BufferedOutputStream(new FileOutputStream(pngFile));
- ChartUtilities.writeChartAsPNG(pngOutputStream, chart, 600, 400, true, 0);
- pngOutputStream.close();
- LOGGER.debug("Written {} chart", pngFile);
- }
- catch (IOException e)
- {
- throw new ChartingException("Failed to create chart", e);
- }
- finally
- {
- if (pngOutputStream != null)
- {
- try
- {
- pngOutputStream.close();
- }
- catch (IOException e)
- {
- throw new ChartingException("Failed to create chart", e);
- }
- }
- }
+ writer.writeHtmlSummaryToFileSystem();
}
private List<ChartingDefinition> loadChartDefinitions(String chartingDefsDir)
@@ -130,6 +115,4 @@ public class ChartingUtil
ArgumentParser argumentParser = new ArgumentParser();
argumentParser.parseArgumentsIntoConfig(_cliOptions, args);
}
-
-
}
Modified: qpid/branches/asyncstore/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/BarChartBuilder.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/BarChartBuilder.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/BarChartBuilder.java (original)
+++ qpid/branches/asyncstore/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/BarChartBuilder.java Fri Aug 3 12:13:32 2012
@@ -19,23 +19,30 @@
*/
package org.apache.qpid.disttest.charting.chartbuilder;
+import org.apache.qpid.disttest.charting.seriesbuilder.SeriesBuilder;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
-import org.jfree.data.category.DefaultCategoryDataset;
+import org.jfree.data.category.CategoryDataset;
+import org.jfree.data.general.Dataset;
-public class BarChartBuilder extends DataSetBasedChartBuilder
+public class BarChartBuilder extends CategoryDataSetBasedChartBuilder
{
+ public BarChartBuilder(SeriesBuilder seriesBuilder)
+ {
+ super(seriesBuilder);
+ }
+
@Override
public JFreeChart createChartImpl(String title, String xAxisTitle,
- String yAxisTitle, final DefaultCategoryDataset dataset, PlotOrientation plotOrientation,
+ String yAxisTitle, final Dataset dataset, PlotOrientation plotOrientation,
boolean showLegend, boolean showToolTips, boolean showUrls)
{
JFreeChart chart = ChartFactory.createBarChart(title,
xAxisTitle,
yAxisTitle,
- dataset,
+ (CategoryDataset) dataset,
plotOrientation,
showLegend,
showToolTips,
Modified: qpid/branches/asyncstore/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/ChartBuilder.java
URL: http://svn.apache.org/viewvc/qpid/branches/asyncstore/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/ChartBuilder.java?rev=1368910&r1=1368909&r2=1368910&view=diff
==============================================================================
--- qpid/branches/asyncstore/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/ChartBuilder.java (original)
+++ qpid/branches/asyncstore/java/perftests/visualisation-jfc/src/main/java/org/apache/qpid/disttest/charting/chartbuilder/ChartBuilder.java Fri Aug 3 12:13:32 2012
@@ -21,10 +21,14 @@ package org.apache.qpid.disttest.chartin
import org.apache.qpid.disttest.charting.definition.ChartingDefinition;
import org.jfree.chart.JFreeChart;
+import org.jfree.chart.plot.PlotOrientation;
public interface ChartBuilder
{
+ public static final boolean SHOW_URLS = false;
+ public static final boolean SHOW_TOOL_TIPS = false;
+ public static final boolean SHOW_LEGEND = true;
+ public static final PlotOrientation PLOT_ORIENTATION = PlotOrientation.VERTICAL;
public JFreeChart buildChart(ChartingDefinition chartingDefinition);
-
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org