Search in sources :

Example 6 with DataSetBuilder

use of hudson.util.DataSetBuilder in project hudson-2.x by hudson.

the class History method getDurationGraph.

/**
 * Graph of duration of tests over time.
 */
public Graph getDurationGraph() {
    return new GraphImpl("seconds") {

        protected DataSetBuilder<String, ChartLabel> createDataSet() {
            DataSetBuilder<String, ChartLabel> data = new DataSetBuilder<String, ChartLabel>();
            List<TestResult> list;
            try {
                list = getList(Integer.parseInt(Stapler.getCurrentRequest().getParameter("start")), Integer.parseInt(Stapler.getCurrentRequest().getParameter("end")));
            } catch (NumberFormatException e) {
                list = getList();
            }
            for (hudson.tasks.test.TestResult o : list) {
                data.add(((double) o.getDuration()) / (1000), "", new ChartLabel(o) {

                    @Override
                    public Color getColor() {
                        if (o.getFailCount() > 0)
                            return ColorPalette.RED;
                        else if (o.getSkipCount() > 0)
                            return ColorPalette.YELLOW;
                        else
                            return ColorPalette.BLUE;
                    }
                });
            }
            return data;
        }
    };
}
Also used : Color(java.awt.Color) DataSetBuilder(hudson.util.DataSetBuilder) TestResult(hudson.tasks.test.TestResult) TestResult(hudson.tasks.test.TestResult)

Example 7 with DataSetBuilder

use of hudson.util.DataSetBuilder in project violations-plugin by jenkinsci.

the class SeverityTypeDataSet method buildDataSet.

/**
 * Build the data set.
 *
 * @return the dataset.
 */
public CategoryDataset buildDataSet() {
    DataSetBuilder<Row, NumberOnlyBuildLabel> builder = new DataSetBuilder<Row, NumberOnlyBuildLabel>();
    for (ViolationsReport r = report; r != null; r = r.previous()) {
        if (r.getTypeSummaries() == null) {
            continue;
        }
        TypeSummary t = r.getTypeSummaries().get(type);
        if (t == null) {
            // Old report
            continue;
        }
        if (t.getSeverityArray() == null || t.getSeverityArray().length != Severity.NUMBER_SEVERITIES) {
            // Old report
            continue;
        }
        int[] nums = t.getSeverityArray();
        builder.add(nums[Severity.MEDIUM_VALUE] + nums[Severity.MEDIUM_HIGH_VALUE] + nums[Severity.MEDIUM_LOW_VALUE], MEDIUM_ROW, new NumberOnlyBuildLabel((Run) r.getBuild()));
        builder.add(nums[Severity.HIGH_VALUE], HIGH_ROW, new NumberOnlyBuildLabel((Run) r.getBuild()));
        builder.add(nums[Severity.LOW_VALUE], LOW_ROW, new NumberOnlyBuildLabel((Run) r.getBuild()));
    }
    return builder.build();
}
Also used : NumberOnlyBuildLabel(hudson.util.ChartUtil.NumberOnlyBuildLabel) DataSetBuilder(hudson.util.DataSetBuilder) ViolationsReport(hudson.plugins.violations.ViolationsReport) Run(hudson.model.Run) TypeSummary(hudson.plugins.violations.TypeSummary)

Example 8 with DataSetBuilder

use of hudson.util.DataSetBuilder in project evosuite by EvoSuite.

the class CoveragePlot method doStats.

private CategoryDataset doStats() {
    DataSetBuilder<String, ChartUtil.NumberOnlyBuildLabel> coverageDataSetBuilder = new DataSetBuilder<String, ChartUtil.NumberOnlyBuildLabel>();
    for (Run<?, ?> build : this.project.getProject().getBuilds()) {
        final BuildAction build_action = build.getAction(BuildAction.class);
        if (build_action == null) {
            // no build action is associated with this build, so skip it
            continue;
        }
        Set<String> criteria = build_action.getProjectAction().getCriteria();
        for (String criterion : criteria) {
            double coverage = build_action.getProjectAction().getCriterionCoverage(criterion);
            coverageDataSetBuilder.add(coverage, criterion, new ChartUtil.NumberOnlyBuildLabel(build));
        }
    }
    return coverageDataSetBuilder.build();
}
Also used : ChartUtil(hudson.util.ChartUtil) DataSetBuilder(hudson.util.DataSetBuilder) BuildAction(org.evosuite.jenkins.actions.BuildAction)

Aggregations

DataSetBuilder (hudson.util.DataSetBuilder)8 ChartUtil (hudson.util.ChartUtil)3 Run (hudson.model.Run)2 ViolationsReport (hudson.plugins.violations.ViolationsReport)2 TestResult (hudson.tasks.test.TestResult)2 BuildAction (org.evosuite.jenkins.actions.BuildAction)2 JFreeChart (org.jfree.chart.JFreeChart)2 TypeSummary (hudson.plugins.violations.TypeSummary)1 SeverityTypeDataSet (hudson.plugins.violations.graph.SeverityTypeDataSet)1 NumberOnlyBuildLabel (hudson.util.ChartUtil.NumberOnlyBuildLabel)1 Graph (hudson.util.Graph)1 ShiftedCategoryAxis (hudson.util.ShiftedCategoryAxis)1 StackedAreaRenderer2 (hudson.util.StackedAreaRenderer2)1 Color (java.awt.Color)1 JSONObject (net.sf.json.JSONObject)1 CategoryAxis (org.jfree.chart.axis.CategoryAxis)1 NumberAxis (org.jfree.chart.axis.NumberAxis)1 CategoryPlot (org.jfree.chart.plot.CategoryPlot)1 ValueMarker (org.jfree.chart.plot.ValueMarker)1 StackedAreaRenderer (org.jfree.chart.renderer.category.StackedAreaRenderer)1