use of org.apache.qpid.disttest.message.ConsumerParticipantResult in project qpid-broker-j by apache.
the class TestResultAggregatorTest method createResultsFromTest.
private TestResult createResultsFromTest() {
TestResult testResult = new TestResult(TEST1_NAME);
ConsumerParticipantResult consumerResult1 = new ConsumerParticipantResult();
setPropertiesOn(consumerResult1, TEST1_NAME, TEST1_ITERATION_NUMBER, CONSUMER_PARTICIPANT_NAME1, NUMBER_OF_MESSAGES_PROCESSED_PER_CONSUMER, BATCH_SIZE, PAYLOAD_SIZE, TOTAL_PAYLOAD_PROCESSED_PER_CONSUMER, CONSUMER1_STARTDATE, CONSUMER1_ENDDATE, 1, 0, PROVIDER_VERSION, PROTOCOL_VERSION);
testResult.addParticipantResult(consumerResult1);
ConsumerParticipantResult consumerResult2 = new ConsumerParticipantResult();
setPropertiesOn(consumerResult2, TEST1_NAME, TEST1_ITERATION_NUMBER, CONSUMER_PARTICIPANT_NAME2, NUMBER_OF_MESSAGES_PROCESSED_PER_CONSUMER, BATCH_SIZE, PAYLOAD_SIZE, TOTAL_PAYLOAD_PROCESSED_PER_CONSUMER, CONSUMER2_STARTDATE, CONSUMER2_ENDDATE, 1, 0, PROVIDER_VERSION, PROTOCOL_VERSION);
testResult.addParticipantResult(consumerResult2);
ParticipantResult producerResult = new ProducerParticipantResult();
setPropertiesOn(producerResult, TEST1_NAME, TEST1_ITERATION_NUMBER, PRODUCER_PARTICIPANT_NAME, NUMBER_OF_MESSAGES_PRODUCED, BATCH_SIZE, PAYLOAD_SIZE, TOTAL_PAYLOAD_PRODUCED_IN_TOTAL, PRODUCER_STARTDATE, PRODUCER_ENDDATE, 0, 1, PROVIDER_VERSION, PROTOCOL_VERSION);
testResult.addParticipantResult(producerResult);
return testResult;
}
use of org.apache.qpid.disttest.message.ConsumerParticipantResult in project qpid-broker-j by apache.
the class TestResultAggregatorTest method assertLatencyAggregatedResults.
private void assertLatencyAggregatedResults(ParticipantResult allConsumerParticipantResult) {
final boolean condition = allConsumerParticipantResult instanceof ConsumerParticipantResult;
assertTrue("Unexpected result", condition);
ConsumerParticipantResult results = (ConsumerParticipantResult) allConsumerParticipantResult;
assertEquals("Unexpected average", 5.0, results.getAverageLatency(), 0.01);
assertEquals("Unexpected min", (long) 2, results.getMinLatency());
assertEquals("Unexpected max", (long) 9, results.getMaxLatency());
assertEquals("Unexpected standard deviation", 2.0, results.getLatencyStandardDeviation(), 0.01);
}
use of org.apache.qpid.disttest.message.ConsumerParticipantResult in project qpid-broker-j by apache.
the class TestResultAggregatorTest method testAggregateResultsForConsumerWithLatencyResults.
@Test
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((long) expectedNumberOfResults, (long) aggregatedTestResult.getParticipantResults().size());
assertMinimalAggregatedResults(aggregatedTestResult.getAllConsumerParticipantResult(), TEST1_NAME, TEST1_ITERATION_NUMBER, BATCH_SIZE, NUMBER_OF_MESSAGES_CONSUMED_IN_TOTAL, 2, 0, PROVIDER_VERSION, PROTOCOL_VERSION);
assertLatencyAggregatedResults(aggregatedTestResult.getAllConsumerParticipantResult());
assertMinimalAggregatedResults(aggregatedTestResult.getAllProducerParticipantResult(), TEST1_NAME, TEST1_ITERATION_NUMBER, BATCH_SIZE, NUMBER_OF_MESSAGES_PRODUCED, 0, 1, PROVIDER_VERSION, PROTOCOL_VERSION);
assertMinimalAggregatedResults(aggregatedTestResult.getAllParticipantResult(), TEST1_NAME, TEST1_ITERATION_NUMBER, BATCH_SIZE, NUMBER_OF_MESSAGES_CONSUMED_IN_TOTAL, 2, 1, PROVIDER_VERSION, PROTOCOL_VERSION);
int expectedThroughtput = (int) Math.round(NUMBER_OF_MESSAGES_PRODUCED * 1000.0d / (CONSUMER2_ENDDATE - PRODUCER_STARTDATE));
ParticipantResult result = aggregatedTestResult.getAllParticipantResult();
assertEquals("Unexpected message throughput", (long) expectedThroughtput, (long) result.getMessageThroughput());
}
use of org.apache.qpid.disttest.message.ConsumerParticipantResult in project qpid-broker-j by apache.
the class ParticipantResultAggregator method getAggregatedResult.
public ParticipantResult getAggregatedResult() {
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);
return aggregatedResult;
}
use of org.apache.qpid.disttest.message.ConsumerParticipantResult in project qpid-broker-j by apache.
the class ParticipantResultFactory method createForConsumer.
public ConsumerParticipantResult createForConsumer(String participantName, String clientRegisteredName, CreateConsumerCommand command, int acknowledgeMode, int numberOfMessagesReceived, int payloadSize, long totalPayloadReceived, Date start, Date end, Collection<Long> messageLatencies, String providerVersion, String protocolVersion) {
ConsumerParticipantResult consumerParticipantResult = new ConsumerParticipantResult();
consumerParticipantResult.setMessageLatencies(messageLatencies);
setTestProperties(consumerParticipantResult, command, participantName, clientRegisteredName, acknowledgeMode);
setTestResultProperties(consumerParticipantResult, numberOfMessagesReceived, payloadSize, totalPayloadReceived, start, end);
consumerParticipantResult.setTopic(command.isTopic());
consumerParticipantResult.setDurableSubscription(command.isDurableSubscription());
consumerParticipantResult.setBrowsingSubscription(command.isBrowsingSubscription());
consumerParticipantResult.setSelector(command.getSelector() != null);
consumerParticipantResult.setNoLocal(command.isNoLocal());
consumerParticipantResult.setSynchronousConsumer(command.isSynchronous());
consumerParticipantResult.setTotalNumberOfConsumers(1);
consumerParticipantResult.setTotalNumberOfProducers(0);
SeriesStatistics statistics = new SeriesStatistics(messageLatencies);
consumerParticipantResult.setAverageLatency(statistics.getAverage());
consumerParticipantResult.setMinLatency(statistics.getMinimum());
consumerParticipantResult.setMaxLatency(statistics.getMaximum());
consumerParticipantResult.setLatencyStandardDeviation(statistics.getStandardDeviation());
consumerParticipantResult.setProviderVersion(providerVersion);
consumerParticipantResult.setProtocolVersion(protocolVersion);
return consumerParticipantResult;
}
Aggregations