1 package org.codehaus.mojo.dashboard.report.plugin.chart;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 import java.awt.Paint;
20 import java.util.ResourceBundle;
21
22 import org.codehaus.mojo.dashboard.report.plugin.beans.IDashBoardReportBean;
23 import org.codehaus.mojo.dashboard.report.plugin.beans.SurefireReportBean;
24 import org.jfree.chart.ChartColor;
25
26
27
28
29
30
31 public class SurefirePieChartStrategy extends AbstractPieChartStrategy
32 {
33
34
35
36
37
38
39
40
41 public SurefirePieChartStrategy( ResourceBundle bundle, String title, IDashBoardReportBean dashboardReport )
42 {
43 super( bundle, title, dashboardReport );
44 }
45
46
47
48
49
50
51 public void fillDataset()
52 {
53 if ( mDashboardReport != null )
54 {
55 SurefireReportBean fireReportBean = (SurefireReportBean) mDashboardReport;
56
57 int total = fireReportBean.getNbTests();
58 int error = fireReportBean.getNbErrors();
59 int fail = fireReportBean.getNbFailures();
60 int skip = fireReportBean.getNbSkipped();
61 int success = total - error - fail - skip;
62 defaultdataset.setValue( this.bundle.getString( "report.surefire.label.success" )
63 + " = " + ( success ), ( success ) );
64
65 defaultdataset.setValue( this.bundle.getString( "report.surefire.label.errors" )
66 + " = " + error, error );
67
68 defaultdataset.setValue( this.bundle.getString( "report.surefire.label.failures" )
69 + " = " + fail, fail );
70
71 defaultdataset.setValue( this.bundle.getString( "report.surefire.label.skipped" )
72 + " = " + skip, skip );
73 }
74 }
75
76
77
78
79 public Paint[] getPaintColor()
80 {
81 return new Paint[] { ChartColor.GREEN, ChartColor.RED, ChartColor.ORANGE, ChartColor.LIGHT_GRAY };
82 }
83
84 }