Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfixes and style improvements v1.0.2 #2

Merged
merged 28 commits into from
Jan 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
5e4cd78
updated Pom dependencies
Lehmann-Fabian Jan 10, 2021
985b696
updated used javascript's versions
Lehmann-Fabian Jan 10, 2021
c6f6005
wording and spelling
Lehmann-Fabian Jan 10, 2021
0ae36e8
moved used image into code
Lehmann-Fabian Jan 10, 2021
d18c50b
fixed bug, required div was renamed
Lehmann-Fabian Jan 10, 2021
4d5b54d
removed space between search div and go to right button
Lehmann-Fabian Jan 10, 2021
7671c80
Fixed bug: plugin tries to load data from backend but uses its develo…
Lehmann-Fabian Jan 10, 2021
7b368f9
Removed unused code
Lehmann-Fabian Jan 10, 2021
f98c4bf
use svg to create trash bins
Lehmann-Fabian Jan 10, 2021
fb7fa97
add popup: x is now well placed and red
Lehmann-Fabian Jan 10, 2021
458b6b0
all items in one row, and backgroudn white
Lehmann-Fabian Jan 10, 2021
3543ce8
replaced deprecated getWorkspace method
Lehmann-Fabian Jan 10, 2021
edfa2ff
replace deprecated getlogs
Lehmann-Fabian Jan 10, 2021
1a199e2
use thread.sleep in a static way
Lehmann-Fabian Jan 10, 2021
316911b
Removed unused imports
Lehmann-Fabian Jan 10, 2021
0b89754
use jsonParser.parse in a static way
Lehmann-Fabian Jan 10, 2021
9eb8b9d
removed unused variable
Lehmann-Fabian Jan 10, 2021
413e7b3
Fixed Bug: Newer Java versions do not support changes for final modifier
Lehmann-Fabian Jan 10, 2021
d78200f
More logs while testing
Lehmann-Fabian Jan 10, 2021
5d56eb4
Log if config is created
Lehmann-Fabian Jan 10, 2021
22d283c
removed unused imports
Lehmann-Fabian Jan 10, 2021
87d803d
Try to resolve issue, config was not found
Lehmann-Fabian Jan 10, 2021
c9e6d60
Warning if config is not found
Lehmann-Fabian Jan 10, 2021
1c92e64
Log where config ist created
Lehmann-Fabian Jan 10, 2021
a7bb176
Create meaningful exception
Lehmann-Fabian Jan 10, 2021
acb3f05
removed change workspace to jobs
Lehmann-Fabian Jan 10, 2021
4e1161f
receive config directly from builder
Lehmann-Fabian Jan 10, 2021
20bdbc1
deleted test logs
Lehmann-Fabian Jan 10, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 18 additions & 16 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>3.4</version>
<version>4.15</version>
<relativePath />
</parent>
<groupId>io.jenkins.plugins</groupId>
<artifactId>benchmark-evaluator</artifactId>
<version>1.0.1-SNAPSHOT</version>
<version>1.0.2</version>
<packaging>hpi</packaging>
<properties>
<!-- Baseline Jenkins version you use to build the plugin. Users must have this version or newer to run. -->
<jenkins.version>2.7.3</jenkins.version>
<jenkins.version>2.263</jenkins.version>
<java.level>8</java.level>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<!-- Other properties you may want to use:
~ jenkins-test-harness.version: Jenkins Test Harness version you use to test the plugin. For Jenkins version >= 1.580.1 use JTH 2.0 or higher.
~ hpi-plugin.version: The HPI Maven Plugin version used by the plugin..
Expand All @@ -34,24 +36,24 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>structs</artifactId>
<version>1.7</version>
<version>1.10</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-step-api</artifactId>
<version>2.12</version>
<version>2.13</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-cps</artifactId>
<version>2.39</version>
<version>2.41</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-job</artifactId>
<version>2.11.2</version>
<version>2.15</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -63,30 +65,30 @@
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-durable-task-step</artifactId>
<version>2.13</version>
<version>2.17</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-api</artifactId>
<version>2.20</version>
<version>2.23.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-support</artifactId>
<version>2.14</version>
<version>2.16</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
<version>2.8.6</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20180130</version>
<version>20201115</version>
</dependency>
</dependencies>

Expand All @@ -103,8 +105,8 @@
<connection>scm:git:git://github.com/jenkinsci/${project.artifactId}-plugin.git</connection>
<developerConnection>scm:git:[email protected]:jenkinsci/${project.artifactId}-plugin.git</developerConnection>
<url>https://github.com/jenkinsci/${project.artifactId}-plugin</url>
<tag>benchmark-evaluator-0.0.1</tag>
</scm>
<tag>benchmark-evaluator-0.0.1</tag>
</scm>
<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
Expand Down
12 changes: 8 additions & 4 deletions src/main/java/io/jenkins/plugins/benchmark/BenchmarkBuilder.java
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
package io.jenkins.plugins.benchmark;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
import java.util.Random;
import java.util.Map.Entry;
import java.util.Set;

import javax.servlet.ServletException;

import org.jenkinsci.Symbol;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.QueryParameter;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.Extension;
import hudson.FilePath;
Expand Down Expand Up @@ -107,14 +109,16 @@ public void perform(Run<?, ?> run, FilePath workspace, Launcher launcher, TaskLi
private transient BenchmarkConfiguration bc;

public BenchmarkConfiguration getConfig(Run<?, ?> run){
if(bc==null)
if(bc==null) {
return (bc = BenchmarkConfiguration.getConfig(getCurrentWorkspace(run)+"config"+getID()+".config"));
}
else return bc;
}

public BenchmarkConfiguration getConfig(AbstractProject<?, ?> project){
if(bc==null)
if(bc==null) {
return (bc = BenchmarkConfiguration.getConfig(project.getRootDir().getAbsolutePath()+File.separator+"config"+getID()+".config"));
}
else return bc;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void load() throws FileNotFoundException{
if(out!=null)
out.close();
else
throw new FileNotFoundException();
throw new FileNotFoundException("Could not create config: " + f);
}
return;
}
Expand Down Expand Up @@ -141,7 +141,7 @@ public SaveRunnable(String path, Map<String, ConfigEntry> config, AtomicBoolean
,"DM_DEFAULT_ENCODING","JLM_JSR166_UTILCONCURRENT_MONITORENTER"})
public void run() {
try {
Thread.currentThread().sleep(100);
Thread.sleep(100);
} catch (InterruptedException e1) {}
File f = new File(path + ".tmp");
PrintWriter out = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public static BenchmarkConfiguration getConfig(String path){
try {
bc.load();
} catch (FileNotFoundException e) {
System.out.println("Could not find configuration file: " + path);
e.printStackTrace();
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ public class BenchmarkResults {
private final String path;

@SuppressFBWarnings("MS_MUTABLE_ARRAY")
public final static String[] endings = {"csv", "ycsb"};
//Not final for testing
public static String[] endings = {"csv", "ycsb"};

private final Reader reader;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<st:include page="sidepanel.jelly" it="${it.run}" optional="true" />
</l:side-panel>
<l:main-panel>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"></link>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"></link>
<style>
.myspan {
text-align: center;
Expand Down Expand Up @@ -68,8 +68,8 @@
</script>


<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>

<script>
var jQ = jQuery.noConflict(true);
Expand All @@ -86,7 +86,7 @@
return parseFloat(x.innerHTML.toLowerCase().split('%')[0]);
}
</script>
<script src="${rootURL}/plugin/Benchmark_PlugIn/sort.js"></script>
<script src="${rootURL}/plugin/benchmark-evaluator/sort.js"></script>
<div id="main_div" style="background-color:white;position:relative">
<j:if test="${it.wasCurrentActionSuccesfull()}">
<span style="background-color: #5cb85c;" class="myspan">
Expand Down Expand Up @@ -115,8 +115,8 @@
</tbody>
</table>
</div>
<script src="${rootURL}/plugin/Benchmark_PlugIn/resetAutoRefresh.js"></script>
<script src="${rootURL}/plugin/Benchmark_PlugIn/showBenchmark.js"></script>
<script src="${rootURL}/plugin/benchmark-evaluator/resetAutoRefresh.js"></script>
<script src="${rootURL}/plugin/benchmark-evaluator/showBenchmark.js"></script>
</j:if>


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
readError=There was an error importing the file\: {0}.
sinceStable=Percentage change since the last successful build
successMessage=Import was successfull.
successMessage=Import was successful.
warningMessage=Attention\: Some metrics didn''t match the desired performance.
metrik=Metrik
value=Value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<l:main-panel>

<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"></link>
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"></link>
<script type="text/javascript"
src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script type="text/javascript"
src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<script>
var jQ = jQuery.noConflict(true);
var backend =
Expand Down Expand Up @@ -89,12 +89,18 @@
<td name="delete">
<j:if test="${conf.getValue().getBuildNr()==-1}">
<button type="button" class="btn btn-danger btn-sm" onclick="deleteMetric('${conf.getKey()}')">
<span class="glyphicon glyphicon-trash" style="color:white"></span>
<svg width="16" height="16" fill="currentColor" class="bi bi-trash" viewBox="0 0 16 16">
<path d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V6z"/>
<path fill-rule="evenodd" d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1v1zM4.118 4L4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4H4.118zM2.5 3V2h11v1h-11z"/>
</svg>
</button>
</j:if>
<j:if test="${conf.getValue().getBuildNr()!=-1}">
<button type="button" class="btn btn-danger btn-sm" onclick="deleteMetric('${conf.getKey()}')" disabled="true">
<span class="glyphicon glyphicon-trash" style="color:white"></span>
<svg width="16" height="16" fill="currentColor" class="bi bi-trash" viewBox="0 0 16 16">
<path d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5zm3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0V6z"/>
<path fill-rule="evenodd" d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1v1zM4.118 4L4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4H4.118zM2.5 3V2h11v1h-11z"/>
</svg>
</button>
</j:if>

Expand All @@ -106,16 +112,16 @@
<button type="button" class="btn btn-info" data-toggle="modal" data-target="#myModal">${%add}</button>
</div>

<script src="${rootURL}/plugin/Benchmark_PlugIn/sort.js"></script>
<script src="${rootURL}/plugin/Benchmark_PlugIn/resetAutoRefresh.js"></script>
<script src="${rootURL}/plugin/Benchmark_PlugIn/configuration.js"></script>
<script src="${rootURL}/plugin/benchmark-evaluator/sort.js"></script>
<script src="${rootURL}/plugin/benchmark-evaluator/resetAutoRefresh.js"></script>
<script src="${rootURL}/plugin/benchmark-evaluator/configuration.js"></script>

<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog">
<!-- Modal content -->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">x</button>
<div type="button" style="color:red" data-dismiss="modal">x</div>
<h4 class="modal-title">${%newMetric}</h4>
</div>
<div class="modal-body">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ minPercent=Minimum percentage change
maxPercent=Maximum percentage change
listed_since=Metric listed since build no\:
save=Save
newMetric=Creates a new metric configuration
newMetric=Create a new metric configuration
unit=Unit
add=ADD
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ minValue=Untere Grenze
maxValue=Obere Grenze
minPercent=Minimale \u00C4nderung in Prozent
maxPercent=Maximale \u00C4nderung in Prozent
listed_since=Metrik gelistet seit Buildnr\:
listed_since=Metrik gelistet seit Buildnr.\:
save=Speichern
newMetric=Erstellt eine neue Metrikkonfiguration
unit=Einheit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
<j:jelly xmlns:j="jelly:core" xmlns:l="/lib/layout" xmlns:st="jelly:stapler">
<l:layout title="Benchmark">
<l:main-panel>
<script src="${rootURL}/plugin/Benchmark_PlugIn/resetAutoRefresh.js"></script>
<!-- <script src="https://ajax.googleapis.com/ajax/libs/prototype/1.7.3.0/prototype.js"></script> -->
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"></link>
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"></link>
<script type="text/javascript"
src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script type="text/javascript"
src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.2/Chart.bundle.min.js"></script>-->
src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<script type="text/javascript" src="${rootURL}/plugin/benchmark-evaluator/resetAutoRefresh.js"></script>
<script>
var jQ = jQuery.noConflict(true);
var backend =
Expand All @@ -26,20 +24,19 @@
}

</script>
<script src="${rootURL}/plugin/Benchmark_PlugIn/sort.js"></script>
<script src="${rootURL}/plugin/benchmark-evaluator/sort.js"></script>
<style> div.google-visualization-tooltip { border-width:0px; background-color: transparent;}</style>
<link rel="stylesheet" href="${rootURL}/plugin/Benchmark_PlugIn/style/checkbox.css"/>
<link rel="stylesheet" href="${rootURL}/plugin/benchmark-evaluator/style/checkbox.css"/>
<div id="main_div" style="width:100%;">
<div id="controller" style="position: fixed;z-index: 1;width:100%;">
<div style="margin-top:2px;">
<div style="padding-top:2px;background-color:white">
<button id="leftButton" type="button" class="btn btn-default" style="margin-left:2px;" onclick="go(-1)">&lt;&lt;</button>
<button id="zoomInButton" type="button" class="btn btn-default" onclick="zoom()">+</button>
<button id="zoomOutButton" type="button" class="btn btn-default" onclick="zoom(false)">-</button>
<input id="searchField" type="text" class="form-control" style="width:10%;display:initial;" placeholder="${%search}..." onkeyup="filter()"></input>
<button id="rightButton" type="button" class="btn btn-default" onclick="go(+1)">&gt;&gt;</button>
<!-- <label id="onlySuccesLabel" style="padding-left:5px"><input id="onlySucces" type="checkbox" class="css-checkbox" value="" onclick="onlySuccesClicked()"></input> ${%onlySucces}</label> -->
<input id="searchField" type="text" class="form-control" style="width:10%;display:initial;vertical-align: middle;" placeholder="${%search}..." onkeyup="filter()"></input>
<button id="rightButton" type="button" class="btn btn-default" onclick="go(+1)" style = "margin-right : 20px">&gt;&gt;</button>
<input type="checkbox" id="onlySucces" class="css-checkbox lrg" style="padding-left:5px" onclick="onlySuccesClicked()"/>
<label id="onlySuccesLabel" for="onlySucces" name="onlySuccesLabel" class="css-label lrg vlad">${%onlySucces}</label>
<label id="onlySuccesLabel" for="onlySucces" name="onlySuccesLabel" class="css-label lrg" style = "background-image: url(http://csscheckbox.com/checkboxes/vlad.png)">${%onlySucces}</label>
</div>
</div>
<table id="charts" style="width:100%;">
Expand All @@ -49,7 +46,7 @@
</div>

<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script src="${rootURL}/plugin/Benchmark_PlugIn/drawChart.js"></script>
<script src="${rootURL}/plugin/benchmark-evaluator/drawChart.js"></script>
<script type="text/javascript">

</script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
benchmark=Geschwindikeitsmessung
benchmark=Geschwindigkeitsmessung
benchmarkResults=Geschwindigkeitsmessungsergebnisse
benchmarkConfig=Geschwindigkeitsmessung Einstellungen
fileIsDir=Die Datei kann kein Ordner sein.
fileIsNotPresent=Achtung\: Die Datei existiert noch nicht.
wrongFormat=Format nicht erlaubt. Erlaubte Formate\: {0}.
and=und
noFile=Das ist keine valide Dateipfad Angabe.
noFile=Das ist keine valider Dateipfad.
noFileName=Kein Dateinamen gefunden.
benchmark_result=Geschwindikeitsmessungsergebnis
read_error=Die Datei {0} kann nicht gelesen werden. �berpr�fen Sie bitte, ob die Pfadangaben richtig sind und ob die Datei existiert.
Expand Down
Loading