Java Code Examples for hudson.util.DataSetBuilder#add()
The following examples show how to use
hudson.util.DataSetBuilder#add() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AWSDeviceFarmGraph.java From aws-device-farm-jenkins-plugin with Apache License 2.0 | 6 votes |
/** * Generate a duration trend graph for device minutes used for recent results. * * @param owner The build which owns the latest result. * @param isCompleted The flag to denote if the result is completed which determines our caching. * @param results The list of previous to latest results which generate the trend. * @return The duration trend graph. */ public static Graph createDurationTrendGraph(AbstractBuild<?, ?> owner, Boolean isCompleted, List<AWSDeviceFarmTestResult> results) { DataSetBuilder<String, NumberOnlyBuildLabel> builder = new DataSetBuilder<String, NumberOnlyBuildLabel>(); for (AWSDeviceFarmTestResult result : results) { // Create label for this result using its Jenkins build number. Run<?, ?> build = result.getOwner(); NumberOnlyBuildLabel label = new NumberOnlyBuildLabel(build); // Attach duration value for all results in our trend. builder.add(result.getDuration(), "Minutes", label); } CategoryDataset dataset = builder.build(); Color[] colors = new Color[]{AWSDeviceFarmGraph.DurationColor}; return new AWSDeviceFarmGraph(owner, isCompleted, getGraphSize(), dataset, "Build #", "Device Minutes Used", colors); }
Example 2
Source File: History.java From junit-plugin with MIT License | 6 votes |
/** * Graph of # of tests over time. * * @return a graph of number of tests over time. */ public Graph getCountGraph() { return new GraphImpl("") { 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 (TestResult o: list) { data.add(o.getPassCount(), "2Passed", new ChartLabel(o)); data.add(o.getFailCount(), "1Failed", new ChartLabel(o)); data.add(o.getSkipCount(), "0Skipped", new ChartLabel(o)); } return data; } }; }
Example 3
Source File: AnchoreProjectAction.java From anchore-container-scanner-plugin with Apache License 2.0 | 5 votes |
private CategoryDataset buildDataSet() { DataSetBuilder<String, NumberOnlyBuildLabel> dsb = new DataSetBuilder<>(); int cap = Integer.getInteger(AnchoreAction.class.getName() + ".anchore.trend.max", AnchoreTrendGraph.MAX_HISTORY_DEFAULT); int count = 0; for (AnchoreAction a = this.base; a != null; a = a.getPreviousResult()) { if (++count > cap) { break; } dsb.add(a.getGoActionCount(), "0_go", new NumberOnlyBuildLabel(a.getBuild())); dsb.add(a.getWarnActionCount(), "1_warn", new NumberOnlyBuildLabel(a.getBuild())); dsb.add(a.getStopActionCount(), "2_stop", new NumberOnlyBuildLabel(a.getBuild())); } return dsb.build(); }
Example 4
Source File: History.java From junit-plugin with MIT License | 5 votes |
/** * Graph of duration of tests over time. * * @return a 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()), "", 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; } }; }
Example 5
Source File: TestFlakyStatsOverRevision.java From flaky-test-handler-plugin with Apache License 2.0 | 5 votes |
private CategoryDataset buildDataSet() { DataSetBuilder<String, RevisionLabel> dsb = new DataSetBuilder<String, RevisionLabel>(); int number = 1; for (Map.Entry<String, SingleTestFlakyStats> entry : flakyStatsRevisionMap.entrySet()) { dsb.add(entry.getValue().fail, "failed", new RevisionLabel(number, entry.getKey())); dsb.add(entry.getValue().pass, "passed", new RevisionLabel(number, entry.getKey())); number++; } return dsb.build(); }