Search in sources :

Example 1 with ParticipantAttribute

use of org.apache.qpid.disttest.message.ParticipantAttribute in project qpid-broker-j by apache.

the class CSVFormatter method row.

/**
 * return a row, including a newline character at the end
 */
private String row(Map<ParticipantAttribute, Object> attributeValueMap) {
    List<Object> attributeValues = new ArrayList<Object>();
    for (ParticipantAttribute attribute : ParticipantAttribute.values()) {
        Object attributeValue = attributeValueMap.get(attribute);
        String attributeValueFormatted = attribute.format(attributeValue);
        attributeValues.add(attributeValueFormatted);
    }
    String row = Joiner.on(',').useForNull("").join(attributeValues.toArray());
    return row + "\n";
}
Also used : ParticipantAttribute(org.apache.qpid.disttest.message.ParticipantAttribute) ArrayList(java.util.ArrayList)

Example 2 with ParticipantAttribute

use of org.apache.qpid.disttest.message.ParticipantAttribute in project qpid-broker-j by apache.

the class CSVFormatter method header.

/**
 * return the header row, including a newline at the end
 */
private String header() {
    List<String> displayNames = new ArrayList<String>();
    for (ParticipantAttribute attribute : ParticipantAttribute.values()) {
        displayNames.add(attribute.getDisplayName());
    }
    String header = Joiner.on(',').useForNull("").join(displayNames.toArray());
    return header + "\n";
}
Also used : ParticipantAttribute(org.apache.qpid.disttest.message.ParticipantAttribute) ArrayList(java.util.ArrayList)

Example 3 with ParticipantAttribute

use of org.apache.qpid.disttest.message.ParticipantAttribute in project qpid-broker-j by apache.

the class ResultsTestFixture method createResultsForAllTests.

public ResultsForAllTests createResultsForAllTests() {
    ParticipantResult participantResult = mock(ParticipantResult.class);
    Map<ParticipantAttribute, Object> participantAttributes = getParticipantAttributes();
    when(participantResult.getAttributes()).thenReturn(participantAttributes);
    when(participantResult.getParticipantName()).thenReturn(PARTICIPANT);
    when(participantResult.getTestName()).thenReturn(TEST1);
    when(participantResult.getIterationNumber()).thenReturn(0);
    when(participantResult.getThroughput()).thenReturn(THROUGHPUT_VALUE);
    TestResult testResult = new TestResult(TEST1);
    testResult.addParticipantResult(participantResult);
    ResultsForAllTests resultsForAllTests = new ResultsForAllTests();
    resultsForAllTests.add(testResult);
    return resultsForAllTests;
}
Also used : ParticipantResult(org.apache.qpid.disttest.message.ParticipantResult) ParticipantAttribute(org.apache.qpid.disttest.message.ParticipantAttribute) ITestResult(org.apache.qpid.disttest.results.aggregation.ITestResult) TestResult(org.apache.qpid.disttest.controller.TestResult) ResultsForAllTests(org.apache.qpid.disttest.controller.ResultsForAllTests)

Example 4 with ParticipantAttribute

use of org.apache.qpid.disttest.message.ParticipantAttribute in project qpid-broker-j by apache.

the class CSVFormatter method format.

public String format(List<ITestResult> results) {
    StringBuilder builder = new StringBuilder();
    builder.append(header());
    for (ITestResult testResult : results) {
        List<ParticipantResult> participantResults = new ArrayList<ParticipantResult>(testResult.getParticipantResults());
        Collections.sort(participantResults, new CSVOrderParticipantResultComparator());
        for (ParticipantResult participantResult : participantResults) {
            Map<ParticipantAttribute, Object> attributes = participantResult.getAttributes();
            builder.append(row(attributes));
        }
    }
    return builder.toString();
}
Also used : ParticipantResult(org.apache.qpid.disttest.message.ParticipantResult) ITestResult(org.apache.qpid.disttest.results.aggregation.ITestResult) ParticipantAttribute(org.apache.qpid.disttest.message.ParticipantAttribute) ArrayList(java.util.ArrayList)

Aggregations

ParticipantAttribute (org.apache.qpid.disttest.message.ParticipantAttribute)4 ArrayList (java.util.ArrayList)3 ParticipantResult (org.apache.qpid.disttest.message.ParticipantResult)2 ITestResult (org.apache.qpid.disttest.results.aggregation.ITestResult)2 ResultsForAllTests (org.apache.qpid.disttest.controller.ResultsForAllTests)1 TestResult (org.apache.qpid.disttest.controller.TestResult)1