sink.close();
}
private void constructSummarySection( List<? extends BuildJob> buildJobs, Locale locale )
{
Sink sink = getSink();
sink.section2();
sink.sectionTitle2();
sink.text( getText( locale, "report.invoker.summary.title" ) );
sink.sectionTitle2_();
sink.section2_();
// ------------------------------------------------------------------------
// Building a table with
// it number | succes nb | failed nb | Success rate | total time | avg time
// ------------------------------------------------------------------------
sink.table();
sink.tableRow();
sinkTableHeader( sink, getText( locale, "report.invoker.summary.number" ) );
sinkTableHeader( sink, getText( locale, "report.invoker.summary.success" ) );
sinkTableHeader( sink, getText( locale, "report.invoker.summary.failed" ) );
sinkTableHeader( sink, getText( locale, "report.invoker.summary.skipped" ) );
sinkTableHeader( sink, getText( locale, "report.invoker.summary.success.rate" ) );
sinkTableHeader( sink, getText( locale, "report.invoker.summary.time.total" ) );
sinkTableHeader( sink, getText( locale, "report.invoker.summary.time.avg" ) );
int number = buildJobs.size();
int success = 0;
int failed = 0;
int skipped = 0;
double totalTime = 0;
for ( BuildJob buildJob : buildJobs )
{
if ( BuildJob.Result.SUCCESS.equals( buildJob.getResult() ) )
{
success++;
}
else if ( BuildJob.Result.SKIPPED.equals( buildJob.getResult() ) )
{
skipped++;
}
else
{
failed++;
}
totalTime += buildJob.getTime();
}
sink.tableRow_();
sink.tableRow();
sinkCell( sink, Integer.toString( number ) );
sinkCell( sink, Integer.toString( success ) );
sinkCell( sink, Integer.toString( failed ) );
sinkCell( sink, Integer.toString( skipped ) );
if ( success + failed > 0 )
{
sinkCell( sink, percentFormat.format( (double) success / ( success + failed ) ) );
}
else
{
sinkCell( sink, "" );
}
sinkCell( sink, secondsFormat.format( totalTime ) );
sinkCell( sink, secondsFormat.format( totalTime / number ) );
sink.tableRow_();
sink.table_();
}