Search in sources :

Example 16 with ParticipantResult

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;
}
Also used : ConsumerParticipantResult(org.apache.qpid.disttest.message.ConsumerParticipantResult) ParticipantResult(org.apache.qpid.disttest.message.ParticipantResult) ProducerParticipantResult(org.apache.qpid.disttest.message.ProducerParticipantResult) ProducerParticipantResult(org.apache.qpid.disttest.message.ProducerParticipantResult) TestResult(org.apache.qpid.disttest.controller.TestResult) ConsumerParticipantResult(org.apache.qpid.disttest.message.ConsumerParticipantResult)

Example 17 with ParticipantResult

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());
}
Also used : ConsumerParticipantResult(org.apache.qpid.disttest.message.ConsumerParticipantResult) ParticipantResult(org.apache.qpid.disttest.message.ParticipantResult) ProducerParticipantResult(org.apache.qpid.disttest.message.ProducerParticipantResult) TestResult(org.apache.qpid.disttest.controller.TestResult) Test(org.junit.Test)

Example 18 with ParticipantResult

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());
}
Also used : ConsumerParticipantResult(org.apache.qpid.disttest.message.ConsumerParticipantResult) ParticipantResult(org.apache.qpid.disttest.message.ParticipantResult) ProducerParticipantResult(org.apache.qpid.disttest.message.ProducerParticipantResult) TestResult(org.apache.qpid.disttest.controller.TestResult) ConsumerParticipantResult(org.apache.qpid.disttest.message.ConsumerParticipantResult) Test(org.junit.Test)

Example 19 with ParticipantResult

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;
}
Also used : ConsumerParticipantResult(org.apache.qpid.disttest.message.ConsumerParticipantResult) ParticipantResult(org.apache.qpid.disttest.message.ParticipantResult) ProducerParticipantResult(org.apache.qpid.disttest.message.ProducerParticipantResult)

Example 20 with ParticipantResult

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);
}
Also used : ParticipantResult(org.apache.qpid.disttest.message.ParticipantResult) Test(org.junit.Test)

Aggregations

ParticipantResult (org.apache.qpid.disttest.message.ParticipantResult)38 Test (org.junit.Test)25 ConsumerParticipantResult (org.apache.qpid.disttest.message.ConsumerParticipantResult)9 ProducerParticipantResult (org.apache.qpid.disttest.message.ProducerParticipantResult)9 ITestResult (org.apache.qpid.disttest.results.aggregation.ITestResult)6 Date (java.util.Date)5 TestResult (org.apache.qpid.disttest.controller.TestResult)4 ResultsForAllTests (org.apache.qpid.disttest.controller.ResultsForAllTests)3 File (java.io.File)2 ArrayList (java.util.ArrayList)2 Message (javax.jms.Message)2 ParticipantAttribute (org.apache.qpid.disttest.message.ParticipantAttribute)2 TreeSet (java.util.TreeSet)1 MessageListener (javax.jms.MessageListener)1 Context (javax.naming.Context)1 DocumentBuilder (javax.xml.parsers.DocumentBuilder)1 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1 Transformer (javax.xml.transform.Transformer)1 TransformerException (javax.xml.transform.TransformerException)1 DOMSource (javax.xml.transform.dom.DOMSource)1