hudson.util.Graph Java Examples
The following examples show how to use
hudson.util.Graph.
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: AWSDeviceFarmProjectAction.java From aws-device-farm-jenkins-plugin with Apache License 2.0 | 6 votes |
/** * Return trend graph of all AWS Device Farm results for this project. * * @param request The request object. * @param response The response object. * @throws IOException */ @SuppressWarnings("unused") public void doGraph(StaplerRequest request, StaplerResponse response) throws IOException { // Abort if having Java AWT issues. if (ChartUtil.awtProblemCause != null) { response.sendRedirect2(String.format("%s/images/headless.png", request.getContextPath())); return; } // Get previous AWS Device Farm build and results. AWSDeviceFarmTestResultAction prev = getLastBuildAction(); if (prev == null) { return; } AWSDeviceFarmTestResult result = prev.getResult(); if (result == null) { return; } // Create new graph for the AWS Device Farm results of all runs in this project. Graph graph = AWSDeviceFarmGraph.createResultTrendGraph(prev.getOwner(), false, result.getPreviousResults()); graph.doPng(request, response); }
Example #3
Source File: AWSDeviceFarmTestResult.java From aws-device-farm-jenkins-plugin with Apache License 2.0 | 6 votes |
/** * Create the graph image for the number of pass/warn/fail results in a test run, for the previous three Jenkins runs. * * @param request * @param response * @throws IOException */ @SuppressWarnings("unused") public void doGraph(StaplerRequest request, StaplerResponse response) throws IOException { // Abort if having Java AWT issues. if (ChartUtil.awtProblemCause != null) { response.sendRedirect2(String.format("%s/images/headless.png", request.getContextPath())); return; } // Check the "If-Modified-Since" header and abort if we don't need re-create the graph. if (isCompleted()) { Calendar timestamp = getOwner().getTimestamp(); if (request.checkIfModified(timestamp, response)) { return; } } // Create new graph for this AWS Device Farm result. Graph graph = AWSDeviceFarmGraph.createResultTrendGraph(build, isCompleted(), getPreviousResults(DefaultTrendGraphSize)); graph.doPng(request, response); }
Example #4
Source File: AWSDeviceFarmTestResult.java From aws-device-farm-jenkins-plugin with Apache License 2.0 | 6 votes |
/** * Create the graph image for the number of device minutes used in a test run, for the previous three Jenkins runs. * * @param request * @param response * @throws IOException */ @SuppressWarnings("unused") public void doDurationGraph(StaplerRequest request, StaplerResponse response) throws IOException { // Abort if having Java AWT issues. if (ChartUtil.awtProblemCause != null) { response.sendRedirect2(String.format("%s/images/headless.png", request.getContextPath())); return; } // Check the "If-Modified-Since" header and abort if we don't need re-create the graph. if (isCompleted()) { Calendar timestamp = getOwner().getTimestamp(); if (request.checkIfModified(timestamp, response)) { return; } } // Create new duration graph for this AWS Device Farm result. Graph graph = AWSDeviceFarmGraph.createDurationTrendGraph(build, isCompleted(), getPreviousResults(DefaultTrendGraphSize)); graph.doPng(request, response); }
Example #5
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 #6
Source File: AnchoreProjectAction.java From anchore-container-scanner-plugin with Apache License 2.0 | 5 votes |
/** * Generates the Anchore trend graph * @return graph object */ public Graph getTrendGraph() { final AnchoreAction a = getLastAnchoreAction(); if (a != null) { return new AnchoreTrendGraph(a, getRelPath(Stapler.getCurrentRequest())); }else{ Stapler.getCurrentResponse().setStatus(HttpServletResponse.SC_NOT_FOUND); return null; } }
Example #7
Source File: AWSDeviceFarmGraph.java From aws-device-farm-jenkins-plugin with Apache License 2.0 | 5 votes |
/** * Generate a results (pass/warn/fail) trend graph 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 result trend graph. */ public static Graph createResultTrendGraph(AbstractBuild<?, ?> owner, Boolean isCompleted, List<AWSDeviceFarmTestResult> results) { List<String> rows = new ArrayList<String>(); List<Number> vals = new ArrayList<Number>(); List<NumberOnlyBuildLabel> cols = new ArrayList<NumberOnlyBuildLabel>(); for (AWSDeviceFarmTestResult result : results) { Run<?, ?> build = result.getOwner(); // Create label for this result using its Jenkins build number. NumberOnlyBuildLabel label = new NumberOnlyBuildLabel(build); // Add 'pass' results rows.add("Pass"); cols.add(label); vals.add(result.getPassCount()); // Add 'warn' results rows.add("Warn"); cols.add(label); vals.add(result.getWarnCount()); // Add 'fail' results. rows.add("Fail"); cols.add(label); vals.add(result.getFailCount()); } CategoryDataset dataset = createDataset(vals, rows, cols); Color[] colors = new Color[]{AWSDeviceFarmGraph.PassColor, AWSDeviceFarmGraph.WarnColor, AWSDeviceFarmGraph.FailColor}; return new AWSDeviceFarmGraph(owner, isCompleted, getGraphSize(), dataset, "Build #", "# of tests", colors); }
Example #8
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 #9
Source File: TestFlakyStatsOverRevision.java From flaky-test-handler-plugin with Apache License 2.0 | 5 votes |
public Graph getStatsGraph() { return new Graph(-1, 900, 360) { protected JFreeChart createGraph() { return createChart(buildDataSet()); } }; }