use of org.apache.qpid.disttest.message.ParticipantResult 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.ParticipantResult in project qpid-broker-j by apache.
the class TestResultAggregatorTest method testAggregateResultsWhenParticipantErrored.
@Test
public void testAggregateResultsWhenParticipantErrored() {
ParticipantResult failedParticipantResult = new ParticipantResult();
failedParticipantResult.setParticipantName(PRODUCER_PARTICIPANT_NAME);
failedParticipantResult.setErrorMessage("error");
TestResult result = new TestResult(TEST1_NAME);
result.addParticipantResult(failedParticipantResult);
AggregatedTestResult aggregatedTestResult = _aggregator.aggregateTestResult(result);
assertEquals(TestResultAggregator.AGGREGATED_ERROR_MESSAGE, aggregatedTestResult.getAllParticipantResult().getErrorMessage());
}
use of org.apache.qpid.disttest.message.ParticipantResult 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.ParticipantResult in project qpid-broker-j by apache.
the class TestResultAggregator method aggregateTestResult.
public AggregatedTestResult aggregateTestResult(ITestResult originalTestResult) {
ParticipantResultAggregator consumerResultAggregator = new ParticipantResultAggregator(ConsumerParticipantResult.class, ALL_CONSUMER_PARTICIPANTS_NAME);
ParticipantResultAggregator producerResultAggregator = new ParticipantResultAggregator(ProducerParticipantResult.class, ALL_PRODUCER_PARTICIPANTS_NAME);
ParticipantResultAggregator aggregatedResultsAggregator = new ParticipantResultAggregator(ParticipantResult.class, ALL_PARTICIPANTS_NAME);
boolean hasError = aggregateOriginalResults(originalTestResult, consumerResultAggregator, producerResultAggregator);
ParticipantResult aggregatedProducerResult = producerResultAggregator.getAggregatedResult();
ParticipantResult aggregatedConsumerResult = consumerResultAggregator.getAggregatedResult();
ParticipantResult aggregatedAllResult = aggregateAggregatedResults(aggregatedResultsAggregator, aggregatedProducerResult, aggregatedConsumerResult);
applyNonAggregateablesToAll(aggregatedAllResult, aggregatedProducerResult, aggregatedConsumerResult);
AggregatedTestResult newTestResult = new AggregatedTestResult(originalTestResult);
newTestResult.setAllProducerParticipantResult(aggregatedProducerResult);
newTestResult.setAllConsumerParticipantResult(aggregatedConsumerResult);
newTestResult.setAllParticipantResult(aggregatedAllResult);
if (hasError) {
aggregatedAllResult.setErrorMessage(TestResultAggregator.AGGREGATED_ERROR_MESSAGE);
}
return newTestResult;
}
use of org.apache.qpid.disttest.message.ParticipantResult in project qpid-broker-j by apache.
the class ClientTest method testResults.
@Test
public void testResults() throws Exception {
ParticipantResult testResult = mock(ParticipantResult.class);
_client.reportResult(testResult);
verify(_delegate).sendResponseMessage(testResult);
}
Aggregations