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";
}
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";
}
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;
}
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();
}
Aggregations