diff --git a/.mvn_exec_spotless b/.mvn_exec_spotless new file mode 100644 index 000000000..e69de29bb diff --git a/Jenkinsfile b/Jenkinsfile index 2adeff49b..0ee93f4bf 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,3 +1,3 @@ -buildPlugin(timeout: 90, useContainerAgent: true, configurations: [ +buildPlugin(timeout: 120, useContainerAgent: true, configurations: [ [platform: 'linux', jdk: 17], ]) diff --git a/build-monitor-acceptance/.mvn_exec_spotless b/build-monitor-acceptance/.mvn_exec_spotless new file mode 100644 index 000000000..e69de29bb diff --git a/build-monitor-acceptance/pom.xml b/build-monitor-acceptance/pom.xml index d79895ede..6055680f9 100644 --- a/build-monitor-acceptance/pom.xml +++ b/build-monitor-acceptance/pom.xml @@ -1,169 +1,162 @@ - - 4.0.0 - - org.jenkins-ci.plugins - build-monitor - ${revision}-${changelist} - + + 4.0.0 + + org.jenkins-ci.plugins + build-monitor + ${revision}-${changelist} + - build-monitor-acceptance - jar + build-monitor-acceptance + jar + Build Monitor Acceptance Tests - Build Monitor Acceptance Tests - - - 3.6.22 - 2.0.7 - - - - - - org.eclipse.jetty - jetty-bom - 11.0.14 - pom - import - - - com.google.code.gson - gson - 2.10.1 - - - com.google.inject - guice - 5.1.0 - - - com.thoughtworks.xstream - xstream - 1.4.20 - - - org.apache.httpcomponents - httpclient - 4.5.14 - - - org.objenesis - objenesis - 3.3 - - - org.slf4j - slf4j-api - ${slf4j.version} - - - + + 3.6.22 + 2.0.7 + + - - org.jenkins-ci.main - cli - ${jenkins.version} - - - - - net.serenity-bdd - serenity-core - ${serenity.version} - - - org.jetbrains - annotations - - - - - net.serenity-bdd - serenity-screenplay - ${serenity.version} - - - net.serenity-bdd - serenity-screenplay-webdriver - ${serenity.version} - - - net.serenity-bdd - serenity-junit - ${serenity.version} - test - - - - - org.jdeferred - jdeferred-core - 1.2.6 - - - - com.github.zafarkhaja - java-semver - 0.9.0 - - - org.slf4j - slf4j-simple - ${slf4j.version} - - - junit - junit - + + org.eclipse.jetty + jetty-bom + 11.0.14 + pom + import + + + com.google.code.gson + gson + 2.10.1 + + + com.google.inject + guice + 5.1.0 + + + com.thoughtworks.xstream + xstream + 1.4.20 + + + org.apache.httpcomponents + httpclient + 4.5.14 + + + org.objenesis + objenesis + 3.3 + + + org.slf4j + slf4j-api + ${slf4j.version} + + + + + + com.github.zafarkhaja + java-semver + 0.9.0 + + + junit + junit + + + net.serenity-bdd + serenity-core + ${serenity.version} + + + org.jetbrains + annotations + + + + + net.serenity-bdd + serenity-screenplay + ${serenity.version} + + + net.serenity-bdd + serenity-screenplay-webdriver + ${serenity.version} + + + org.jdeferred + jdeferred-core + 1.2.6 + + + org.jenkins-ci.main + cli + ${jenkins.version} + + + org.slf4j + slf4j-simple + ${slf4j.version} + + + net.serenity-bdd + serenity-junit + ${serenity.version} + test + + - - - - org.apache.maven.plugins - maven-surefire-plugin - - - **/*UnitTest.java - **/features/*Test.java - **/features/*Should*.java - - - ${jenkins.version} - ../ - ${settings.localRepository} - 110 - - - - - net.serenity-bdd.maven.plugins - serenity-maven-plugin - ${serenity.version} - - - serenity-reports - post-integration-test - - aggregate - - - true - target/site/serenity - target/site/serenity - - - - - - org.apache.maven.plugins - maven-deploy-plugin - - true - - - - + + + + org.apache.maven.plugins + maven-surefire-plugin + + + **/*UnitTest.java + **/features/*Test.java + **/features/*Should*.java + + + ${jenkins.version} + ../ + ${settings.localRepository} + 110 + + + + + net.serenity-bdd.maven.plugins + serenity-maven-plugin + ${serenity.version} + + + serenity-reports + + aggregate + + post-integration-test + + true + target/site/serenity + target/site/serenity + + + + + + org.apache.maven.plugins + maven-deploy-plugin + + true + + + + diff --git a/build-monitor-acceptance/src/main/java/com/cloudbees/hudson/plugins/folder/HaveAFolderCreated.java b/build-monitor-acceptance/src/main/java/com/cloudbees/hudson/plugins/folder/HaveAFolderCreated.java index 3910c689a..bdca42c6e 100644 --- a/build-monitor-acceptance/src/main/java/com/cloudbees/hudson/plugins/folder/HaveAFolderCreated.java +++ b/build-monitor-acceptance/src/main/java/com/cloudbees/hudson/plugins/folder/HaveAFolderCreated.java @@ -23,10 +23,7 @@ public Task andInsideIt(Task... createProjects) { @Step("{0} creates and configures the '#name' folder") @Override public void performAs(T actor) { - actor.attemptsTo( - CreateAFolder.called(name), - configurationTasks - ); + actor.attemptsTo(CreateAFolder.called(name), configurationTasks); } public HaveAFolderCreated(String name) { diff --git a/build-monitor-acceptance/src/main/java/com/cloudbees/hudson/plugins/folder/HaveANestedProjectCreated.java b/build-monitor-acceptance/src/main/java/com/cloudbees/hudson/plugins/folder/HaveANestedProjectCreated.java index f55df1ad7..1d90d5649 100644 --- a/build-monitor-acceptance/src/main/java/com/cloudbees/hudson/plugins/folder/HaveANestedProjectCreated.java +++ b/build-monitor-acceptance/src/main/java/com/cloudbees/hudson/plugins/folder/HaveANestedProjectCreated.java @@ -18,10 +18,7 @@ public static Task called(String name) { @Step("{0} creates the '#projectName' project") @Override public void performAs(T actor) { - actor.attemptsTo( - CreateAFreestyleProject.called(projectName), - Click.on(FolderDetailsPage.Up_Link) - ); + actor.attemptsTo(CreateAFreestyleProject.called(projectName), Click.on(FolderDetailsPage.Up_Link)); } public HaveANestedProjectCreated(String projectName) { diff --git a/build-monitor-acceptance/src/main/java/com/cloudbees/hudson/plugins/folder/tasks/CreateAFolder.java b/build-monitor-acceptance/src/main/java/com/cloudbees/hudson/plugins/folder/tasks/CreateAFolder.java index 90eef9480..58e645c68 100644 --- a/build-monitor-acceptance/src/main/java/com/cloudbees/hudson/plugins/folder/tasks/CreateAFolder.java +++ b/build-monitor-acceptance/src/main/java/com/cloudbees/hudson/plugins/folder/tasks/CreateAFolder.java @@ -25,13 +25,12 @@ public void performAs(T actor) { Click.on(SidePanel.New_Item_Link), Choose.the(NewJobPage.Folder), Enter.theValue(name).into(NewJobPage.Item_Name_Field).thenHit(Keys.ENTER), - Click.on(Buttons.Save) - ); + Click.on(Buttons.Save)); } public CreateAFolder(String jobName) { this.name = jobName; } - private final String name; -} \ No newline at end of file + private final String name; +} diff --git a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/model/ProjectInformation.java b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/model/ProjectInformation.java index 0deb15ff9..6f022032a 100644 --- a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/model/ProjectInformation.java +++ b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/model/ProjectInformation.java @@ -22,6 +22,8 @@ public List status() { @Override public String toString() { - return String.format("ProjectInformation{name=%s, status={%s}}", name, status.stream().map(Object::toString).collect(Collectors.joining(", "))); + return String.format( + "ProjectInformation{name=%s, status={%s}}", + name, status.stream().map(Object::toString).collect(Collectors.joining(", "))); } } diff --git a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/model/ProjectStatus.java b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/model/ProjectStatus.java index 2990a2cab..fc606cb01 100644 --- a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/model/ProjectStatus.java +++ b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/model/ProjectStatus.java @@ -21,10 +21,10 @@ public enum ProjectStatus { this.value = value; } - // ---- todo: extract - // todo: can I use https://github.com/serenity-bdd/serenity-web-todomvc-journey/blob/e092e3a90a280aa16b0c1458f0ac7d36fe833f52/src/main/java/net/serenitybdd/demos/todos/questions/CurrentFilter.java ? + // todo: can I use + // https://github.com/serenity-bdd/serenity-web-todomvc-journey/blob/e092e3a90a280aa16b0c1458f0ac7d36fe833f52/src/main/java/net/serenitybdd/demos/todos/questions/CurrentFilter.java ? // asEnum thingy public static List fromMultiple(String cssClasses) { @@ -48,7 +48,8 @@ public static ProjectStatus from(@NonNull String cssClass) { } } - throw new IllegalArgumentException(String.format("'%s' is not a recognised value of the ProjectStatus enum", cssClass)); + throw new IllegalArgumentException( + String.format("'%s' is not a recognised value of the ProjectStatus enum", cssClass)); } // todo: Java 8? @@ -66,12 +67,9 @@ private static Set setOf(List items) { } private static List stringRepresentationsOf(Collection items) { - return items.stream() - .map(Object::toString) - .collect(Collectors.toList()); + return items.stream().map(Object::toString).collect(Collectors.toList()); } - @Override public String toString() { return value; diff --git a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/questions/ProjectWidget.java b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/questions/ProjectWidget.java index 665328329..c4c41acae 100644 --- a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/questions/ProjectWidget.java +++ b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/questions/ProjectWidget.java @@ -17,7 +17,9 @@ public static ProjectWidget of(String projectOfInterest) { return new ProjectWidget(projectOfInterest); } - public Question executedBuilds() { return new ProjectWidgetBuilds(projectOfInterest); } + public Question executedBuilds() { + return new ProjectWidgetBuilds(projectOfInterest); + } public Question information() { return new ProjectWidgetInformation(projectOfInterest); diff --git a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/questions/project_widget/ProjectBadgesState.java b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/questions/project_widget/ProjectBadgesState.java index 524ad8ec8..6a07e292d 100644 --- a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/questions/project_widget/ProjectBadgesState.java +++ b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/questions/project_widget/ProjectBadgesState.java @@ -13,7 +13,7 @@ public class ProjectBadgesState implements Question { @Override public WebElementState answeredBy(Actor actor) { - Target widget = BuildMonitorDashboard.Project_Widget_Badges.of(projectName); + Target widget = BuildMonitorDashboard.Project_Widget_Badges.of(projectName); return WebElementQuestion.stateOf(widget).answeredBy(actor); } diff --git a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/questions/project_widget/ProjectWidgetBuilds.java b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/questions/project_widget/ProjectWidgetBuilds.java index 67a40ab5c..52089b4b8 100644 --- a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/questions/project_widget/ProjectWidgetBuilds.java +++ b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/questions/project_widget/ProjectWidgetBuilds.java @@ -12,7 +12,7 @@ public class ProjectWidgetBuilds implements Question { @Override public String answeredBy(Actor actor) { - Target builds = BuildMonitorDashboard.Project_Widget_Builds.of(projectName); + Target builds = BuildMonitorDashboard.Project_Widget_Builds.of(projectName); return Text.of(builds).answeredBy(actor); } diff --git a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/questions/project_widget/ProjectWidgetDetails.java b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/questions/project_widget/ProjectWidgetDetails.java index efd1993fd..d536112b5 100644 --- a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/questions/project_widget/ProjectWidgetDetails.java +++ b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/questions/project_widget/ProjectWidgetDetails.java @@ -12,7 +12,7 @@ public class ProjectWidgetDetails implements Question { @Override public String answeredBy(Actor actor) { - Target details = BuildMonitorDashboard.Project_Widget_Details.of(projectName); + Target details = BuildMonitorDashboard.Project_Widget_Details.of(projectName); return Text.of(details).answeredBy(actor); } diff --git a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/questions/project_widget/ProjectWidgetInformation.java b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/questions/project_widget/ProjectWidgetInformation.java index dfe4797f5..ee2fb0045 100644 --- a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/questions/project_widget/ProjectWidgetInformation.java +++ b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/questions/project_widget/ProjectWidgetInformation.java @@ -14,7 +14,7 @@ public class ProjectWidgetInformation implements Question { @Override public ProjectInformation answeredBy(Actor actor) { - Target widget = BuildMonitorDashboard.Project_Widget.of(projectName); + Target widget = BuildMonitorDashboard.Project_Widget.of(projectName); String cssClasses = Attribute.of(widget).named("class").answeredBy(actor); return new ProjectInformation(projectName, ProjectStatus.fromMultiple(cssClasses)); diff --git a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/questions/project_widget/ProjectWidgetState.java b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/questions/project_widget/ProjectWidgetState.java index 94d2ee05d..19463d054 100644 --- a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/questions/project_widget/ProjectWidgetState.java +++ b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/questions/project_widget/ProjectWidgetState.java @@ -13,7 +13,7 @@ public class ProjectWidgetState implements Question { @Override public WebElementState answeredBy(Actor actor) { - Target widget = BuildMonitorDashboard.Project_Widget.of(projectName); + Target widget = BuildMonitorDashboard.Project_Widget.of(projectName); return WebElementQuestion.stateOf(widget).answeredBy(actor); } diff --git a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/AddProjects.java b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/AddProjects.java index 0ae9a9ac8..92535a0cc 100644 --- a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/AddProjects.java +++ b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/AddProjects.java @@ -16,8 +16,6 @@ public static Task toAnEmptyBuildMonitor() { @Step("{0} decides to adds some projects to an empty Build Monitor") @Override public void performAs(T actor) { - actor.attemptsTo( - Click.on(BuildMonitorDashboard.Add_Some_Projects_link) - ); + actor.attemptsTo(Click.on(BuildMonitorDashboard.Add_Some_Projects_link)); } } diff --git a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/ConfigureEmptyBuildMonitorView.java b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/ConfigureEmptyBuildMonitorView.java index 45db90de2..cf65ef178 100644 --- a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/ConfigureEmptyBuildMonitorView.java +++ b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/ConfigureEmptyBuildMonitorView.java @@ -19,10 +19,7 @@ public static ConfigureEmptyBuildMonitorView to(Task... configurationTasks) { @Override @Step("{0} configures the Build Monitor View") public void performAs(T actor) { - actor.attemptsTo( - configureTheView, - SaveTheChangesToBuildMonitor.andExitTheConfigurationScreen() - ); + actor.attemptsTo(configureTheView, SaveTheChangesToBuildMonitor.andExitTheConfigurationScreen()); } public ConfigureEmptyBuildMonitorView(List actions) { diff --git a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/CreateABuildMonitorView.java b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/CreateABuildMonitorView.java index 71a71f8a6..5d1fb2305 100644 --- a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/CreateABuildMonitorView.java +++ b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/CreateABuildMonitorView.java @@ -33,14 +33,13 @@ public void performAs(T actor) { Click.on(NewViewPage.Build_Monitor_View), Click.on(Buttons.Create), configureBuildMonitor, - SaveTheChangesToBuildMonitor.andExitTheConfigurationScreen() - ); + SaveTheChangesToBuildMonitor.andExitTheConfigurationScreen()); } public CreateABuildMonitorView(String name) { this.buildMonitorName = name; } - private final String buildMonitorName; + private final String buildMonitorName; private final TodoList configureBuildMonitor = TodoList.empty(); } diff --git a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/HaveABuildMonitorViewCreated.java b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/HaveABuildMonitorViewCreated.java index aff83c8a7..a2bc07fd4 100644 --- a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/HaveABuildMonitorViewCreated.java +++ b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/HaveABuildMonitorViewCreated.java @@ -15,8 +15,7 @@ public static Task showingAllTheProjects() { @Step("{0} creates a 'Build Monitor View' showing all the projects") @Override public void performAs(T actor) { - actor.attemptsTo(CreateABuildMonitorView.called("Build Monitor").andConfigureItTo( - DisplayAllProjects.usingARegularExpression() - )); + actor.attemptsTo(CreateABuildMonitorView.called("Build Monitor") + .andConfigureItTo(DisplayAllProjects.usingARegularExpression())); } -} \ No newline at end of file +} diff --git a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/HideBadges.java b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/HideBadges.java index 3493e8371..58365678c 100644 --- a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/HideBadges.java +++ b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/HideBadges.java @@ -19,8 +19,7 @@ public static Task onTheDashboard() { @Override public void performAs(T actor) { actor.attemptsTo( - WaitUntil.the(BuildMonitorDashboard.Show_Badges, WebElementStateMatchers.isVisible()), - UncheckCheckbox.of(BuildMonitorDashboard.Show_Badges) - ); + WaitUntil.the(BuildMonitorDashboard.Show_Badges, WebElementStateMatchers.isVisible()), + UncheckCheckbox.of(BuildMonitorDashboard.Show_Badges)); } } diff --git a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/ModifyControlPanelOptions.java b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/ModifyControlPanelOptions.java index 1dded85b5..e45d75823 100644 --- a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/ModifyControlPanelOptions.java +++ b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/ModifyControlPanelOptions.java @@ -23,8 +23,7 @@ public void performAs(T actor) { actor.attemptsTo( Click.on(BuildMonitorDashboard.Control_Panel), configureTheView, - Click.on(BuildMonitorDashboard.Control_Panel) - ); + Click.on(BuildMonitorDashboard.Control_Panel)); } public ModifyControlPanelOptions(List actions) { diff --git a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/ShowBadges.java b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/ShowBadges.java index d6573609b..f12b7823d 100644 --- a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/ShowBadges.java +++ b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/ShowBadges.java @@ -19,8 +19,7 @@ public static Task onTheDashboard() { @Override public void performAs(T actor) { actor.attemptsTo( - WaitUntil.the(BuildMonitorDashboard.Show_Badges, WebElementStateMatchers.isVisible()), - CheckCheckbox.of(BuildMonitorDashboard.Show_Badges) - ); + WaitUntil.the(BuildMonitorDashboard.Show_Badges, WebElementStateMatchers.isVisible()), + CheckCheckbox.of(BuildMonitorDashboard.Show_Badges)); } } diff --git a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/Sleep.java b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/Sleep.java index 646a4962d..ffb83365b 100644 --- a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/Sleep.java +++ b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/Sleep.java @@ -6,15 +6,13 @@ public final class Sleep { public static Performable of(long duration, TimeUnit unit) { - return Task.where( - "Sleeps for " + duration + " " + unit.toString().toLowerCase(), - unused -> { - try { - long millis = TimeUnit.MILLISECONDS.convert(duration, unit); - Thread.sleep(millis); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } - }); + return Task.where("Sleeps for " + duration + " " + unit.toString().toLowerCase(), unused -> { + try { + long millis = TimeUnit.MILLISECONDS.convert(duration, unit); + Thread.sleep(millis); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + }); } } diff --git a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/configuration/ConfigureViewSettings.java b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/configuration/ConfigureViewSettings.java index 120a3e56e..175006c7c 100644 --- a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/configuration/ConfigureViewSettings.java +++ b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/configuration/ConfigureViewSettings.java @@ -22,10 +22,7 @@ public static Task toggleShowBadges() { @Override public void performAs(T actor) { actor.attemptsTo( - Sleep.of(1, TimeUnit.SECONDS), - Scroll.to(target), - Sleep.of(1, TimeUnit.SECONDS), - Click.on(target)); + Sleep.of(1, TimeUnit.SECONDS), Scroll.to(target), Sleep.of(1, TimeUnit.SECONDS), Click.on(target)); } public ConfigureViewSettings(Target target) { diff --git a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/configuration/DisplayAllProjects.java b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/configuration/DisplayAllProjects.java index fc6a3068b..04be42ba7 100644 --- a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/configuration/DisplayAllProjects.java +++ b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/configuration/DisplayAllProjects.java @@ -21,11 +21,10 @@ public static Task usingARegularExpression() { @Override public void performAs(T actor) { actor.attemptsTo( - Sleep.of(1, TimeUnit.SECONDS), - Scroll.to(ViewConfigurationPage.Use_Regular_Expression), - Sleep.of(1, TimeUnit.SECONDS), - Click.on(ViewConfigurationPage.Use_Regular_Expression), - Enter.theValue(".*").into(ViewConfigurationPage.Regular_Expression) - ); + Sleep.of(1, TimeUnit.SECONDS), + Scroll.to(ViewConfigurationPage.Use_Regular_Expression), + Sleep.of(1, TimeUnit.SECONDS), + Click.on(ViewConfigurationPage.Use_Regular_Expression), + Enter.theValue(".*").into(ViewConfigurationPage.Regular_Expression)); } } diff --git a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/configuration/DisplayBadges.java b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/configuration/DisplayBadges.java index 6b0ddcb8e..1ca738497 100644 --- a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/configuration/DisplayBadges.java +++ b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/configuration/DisplayBadges.java @@ -27,8 +27,7 @@ public static DisplayBadges never() { public void performAs(T actor) { actor.attemptsTo( Scroll.to(ViewConfigurationPage.Display_Badges), - SelectFromOptions.byVisibleText(text).from(ViewConfigurationPage.Display_Badges) - ); + SelectFromOptions.byVisibleText(text).from(ViewConfigurationPage.Display_Badges)); } public DisplayBadges(String text) { diff --git a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/configuration/DisplayBadgesFrom.java b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/configuration/DisplayBadgesFrom.java index 184f28761..a464c8caa 100644 --- a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/configuration/DisplayBadgesFrom.java +++ b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/configuration/DisplayBadgesFrom.java @@ -23,8 +23,7 @@ public static DisplayBadgesFrom theLastCompletedBuild() { public void performAs(T actor) { actor.attemptsTo( Scroll.to(ViewConfigurationPage.Display_Badges_From), - SelectFromOptions.byVisibleText(text).from(ViewConfigurationPage.Display_Badges_From) - ); + SelectFromOptions.byVisibleText(text).from(ViewConfigurationPage.Display_Badges_From)); } public DisplayBadgesFrom(String text) { diff --git a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/configuration/DisplayJunitRealtimeProgress.java b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/configuration/DisplayJunitRealtimeProgress.java index 97dac7762..dc964fbae 100644 --- a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/configuration/DisplayJunitRealtimeProgress.java +++ b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/configuration/DisplayJunitRealtimeProgress.java @@ -18,8 +18,7 @@ public static Task bars() { @Override public void performAs(T actor) { actor.attemptsTo( - Scroll.to(ViewConfigurationPage.Display_JUnit_Realtime_Progress), - CheckCheckbox.of(ViewConfigurationPage.Display_JUnit_Realtime_Progress) - ); + Scroll.to(ViewConfigurationPage.Display_JUnit_Realtime_Progress), + CheckCheckbox.of(ViewConfigurationPage.Display_JUnit_Realtime_Progress)); } } diff --git a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/configuration/DisplayNestedProjects.java b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/configuration/DisplayNestedProjects.java index 13db601f1..bdcda53df 100644 --- a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/configuration/DisplayNestedProjects.java +++ b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/tasks/configuration/DisplayNestedProjects.java @@ -18,8 +18,7 @@ public static Task fromSubfolders() { @Override public void performAs(T actor) { actor.attemptsTo( - Scroll.to(ViewConfigurationPage.Recurse_In_Subfolders), - Choose.the(ViewConfigurationPage.Recurse_In_Subfolders) - ); + Scroll.to(ViewConfigurationPage.Recurse_In_Subfolders), + Choose.the(ViewConfigurationPage.Recurse_In_Subfolders)); } } diff --git a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/user_interface/BuildMonitorDashboard.java b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/user_interface/BuildMonitorDashboard.java index f12485302..ec5611648 100644 --- a/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/user_interface/BuildMonitorDashboard.java +++ b/build-monitor-acceptance/src/main/java/com/smartcodeltd/jenkinsci/plugins/build_monitor/user_interface/BuildMonitorDashboard.java @@ -5,13 +5,19 @@ public class BuildMonitorDashboard { public static final Target Add_Some_Projects_link = Link.called("add some projects"); - public static final Target Project_Widget = Target.the("Project Widget").locatedBy("//li[header/h2[.='{0}']]"); - public static final Target Project_Widget_Builds = Target.the("Project Widget Builds").locatedBy("//li[header/h2[.='{0}']]//*[contains(@class, 'build-number')]"); - public static final Target Project_Widget_Details = Target.the("Project Widget Details").locatedBy("//li[header/h2[.='{0}']]//*[@class='details']"); - public static final Target Project_Widget_Badges = Target.the("Project Widget Badges").locatedBy("//li[header/h2[.='{0}']]//*[@class='badges']"); - public static final Target Project_Widget_Pipeline_Stages = Target.the("Project Widget Builds").locatedBy("//li[header/h2[.='{0}']]//*[contains(@class, 'build-stages')]"); - public static final Target Project_Widget_Progress_Bars = Target.the("Project Widget Progress Bars").locatedBy("//li[header/h2[.='{0}']]//*[@class='realtime-tests']"); + public static final Target Project_Widget = Target.the("Project Widget").locatedBy("//li[header/h2[.='{0}']]"); + public static final Target Project_Widget_Builds = Target.the("Project Widget Builds") + .locatedBy("//li[header/h2[.='{0}']]//*[contains(@class, 'build-number')]"); + public static final Target Project_Widget_Details = + Target.the("Project Widget Details").locatedBy("//li[header/h2[.='{0}']]//*[@class='details']"); + public static final Target Project_Widget_Badges = + Target.the("Project Widget Badges").locatedBy("//li[header/h2[.='{0}']]//*[@class='badges']"); + public static final Target Project_Widget_Pipeline_Stages = Target.the("Project Widget Builds") + .locatedBy("//li[header/h2[.='{0}']]//*[contains(@class, 'build-stages')]"); + public static final Target Project_Widget_Progress_Bars = Target.the("Project Widget Progress Bars") + .locatedBy("//li[header/h2[.='{0}']]//*[@class='realtime-tests']"); public static final Target Control_Panel = Target.the("Control Panel").locatedBy("//label[@for='settings-toggle']"); - public static final Target Show_Badges = Target.the("Show Badges Toggle").locatedBy("//input[@id='settings-show-badges']"); + public static final Target Show_Badges = + Target.the("Show Badges Toggle").locatedBy("//input[@id='settings-show-badges']"); } diff --git a/build-monitor-acceptance/src/main/java/com/sonyericsson/jenkins/plugins/bfa/DefineABuildLogIndicatedFailureCause.java b/build-monitor-acceptance/src/main/java/com/sonyericsson/jenkins/plugins/bfa/DefineABuildLogIndicatedFailureCause.java index 3d8ff2b42..a74a236d6 100644 --- a/build-monitor-acceptance/src/main/java/com/sonyericsson/jenkins/plugins/bfa/DefineABuildLogIndicatedFailureCause.java +++ b/build-monitor-acceptance/src/main/java/com/sonyericsson/jenkins/plugins/bfa/DefineABuildLogIndicatedFailureCause.java @@ -30,19 +30,17 @@ public DefineABuildLogIndicatedFailureCause matching(String regex) { @Step("{0} defines what constitutes a problem with '#name'") @Override public void performAs(T actor) { - actor.attemptsTo( - DefineAFailureCause.called(name).describedAs(Nulls.getOrElse(description, name)).indicatedBy( - LineInTheBuildLog.matching(regex) - ) - ); + actor.attemptsTo(DefineAFailureCause.called(name) + .describedAs(Nulls.getOrElse(description, name)) + .indicatedBy(LineInTheBuildLog.matching(regex))); } public DefineABuildLogIndicatedFailureCause(String name) { this.name = name; } - private String name = "Shell Script Failure"; - private String regex = "Build step 'Execute shell' marked build as failure"; + private String name = "Shell Script Failure"; + private String regex = "Build step 'Execute shell' marked build as failure"; private String description; } diff --git a/build-monitor-acceptance/src/main/java/com/sonyericsson/jenkins/plugins/bfa/HaveAShellScriptFailureCauseDefined.java b/build-monitor-acceptance/src/main/java/com/sonyericsson/jenkins/plugins/bfa/HaveAShellScriptFailureCauseDefined.java index a02609970..7682ead9d 100644 --- a/build-monitor-acceptance/src/main/java/com/sonyericsson/jenkins/plugins/bfa/HaveAShellScriptFailureCauseDefined.java +++ b/build-monitor-acceptance/src/main/java/com/sonyericsson/jenkins/plugins/bfa/HaveAShellScriptFailureCauseDefined.java @@ -19,13 +19,9 @@ public HaveAShellScriptFailureCauseDefined describedAs(String description) { @Override public void performAs(T actor) { - actor.attemptsTo( - UseFailureCauseManagement.to( - DefineABuildLogIndicatedFailureCause.called(name). - describedAs(description). - matching(Build_Log_Pattern) - ) - ); + actor.attemptsTo(UseFailureCauseManagement.to(DefineABuildLogIndicatedFailureCause.called(name) + .describedAs(description) + .matching(Build_Log_Pattern))); } public HaveAShellScriptFailureCauseDefined(String name) { diff --git a/build-monitor-acceptance/src/main/java/com/sonyericsson/jenkins/plugins/bfa/UseFailureCauseManagement.java b/build-monitor-acceptance/src/main/java/com/sonyericsson/jenkins/plugins/bfa/UseFailureCauseManagement.java index 323f63dbb..9a62e6f02 100644 --- a/build-monitor-acceptance/src/main/java/com/sonyericsson/jenkins/plugins/bfa/UseFailureCauseManagement.java +++ b/build-monitor-acceptance/src/main/java/com/sonyericsson/jenkins/plugins/bfa/UseFailureCauseManagement.java @@ -22,8 +22,7 @@ public void performAs(T actor) { actor.attemptsTo( Click.on(JenkinsHomePageWithBFA.Failure_Cause_Management_Link), defineFailureCauses, - Click.on(Breadcrumbs.Jenkins_Link) - ); + Click.on(Breadcrumbs.Jenkins_Link)); } private final TodoList defineFailureCauses = TodoList.empty(); diff --git a/build-monitor-acceptance/src/main/java/com/sonyericsson/jenkins/plugins/bfa/tasks/DefineAFailureCause.java b/build-monitor-acceptance/src/main/java/com/sonyericsson/jenkins/plugins/bfa/tasks/DefineAFailureCause.java index 6eaa9de5d..9a3476dde 100644 --- a/build-monitor-acceptance/src/main/java/com/sonyericsson/jenkins/plugins/bfa/tasks/DefineAFailureCause.java +++ b/build-monitor-acceptance/src/main/java/com/sonyericsson/jenkins/plugins/bfa/tasks/DefineAFailureCause.java @@ -33,8 +33,7 @@ public void performAs(T actor) { Enter.theValue(name).into(FailureCauseManagementPage.Name), Enter.theValue(description).into(FailureCauseManagementPage.Description), configureFailureCauseIndicators, - Click.on(FailureCauseManagementPage.Save) - ); + Click.on(FailureCauseManagementPage.Save)); } private final String name; diff --git a/build-monitor-acceptance/src/main/java/com/sonyericsson/jenkins/plugins/bfa/tasks/configuration/LineInTheBuildLog.java b/build-monitor-acceptance/src/main/java/com/sonyericsson/jenkins/plugins/bfa/tasks/configuration/LineInTheBuildLog.java index 1397745a8..4008991fd 100644 --- a/build-monitor-acceptance/src/main/java/com/sonyericsson/jenkins/plugins/bfa/tasks/configuration/LineInTheBuildLog.java +++ b/build-monitor-acceptance/src/main/java/com/sonyericsson/jenkins/plugins/bfa/tasks/configuration/LineInTheBuildLog.java @@ -23,10 +23,10 @@ public void performAs(T actor) { actor.attemptsTo( Scroll.to(FailureCauseManagementPage.Add_Indication), Click.on(FailureCauseManagementPage.Add_Indication), - WaitUntil.the(FailureCauseManagementPage.Build_Log_Indication_Link, WebElementStateMatchers.isVisible()), + WaitUntil.the( + FailureCauseManagementPage.Build_Log_Indication_Link, WebElementStateMatchers.isVisible()), Click.on(FailureCauseManagementPage.Build_Log_Indication_Link), - Enter.theValue(pattern).into(FailureCauseManagementPage.Pattern_Field) - ); + Enter.theValue(pattern).into(FailureCauseManagementPage.Pattern_Field)); } private final String pattern; diff --git a/build-monitor-acceptance/src/main/java/com/sonyericsson/jenkins/plugins/bfa/user_interface/FailureCauseManagementPage.java b/build-monitor-acceptance/src/main/java/com/sonyericsson/jenkins/plugins/bfa/user_interface/FailureCauseManagementPage.java index 64f2e9b58..68c7f9319 100644 --- a/build-monitor-acceptance/src/main/java/com/sonyericsson/jenkins/plugins/bfa/user_interface/FailureCauseManagementPage.java +++ b/build-monitor-acceptance/src/main/java/com/sonyericsson/jenkins/plugins/bfa/user_interface/FailureCauseManagementPage.java @@ -7,11 +7,12 @@ public class FailureCauseManagementPage { public static final Target Create_New_Link = Link.called("Create new"); - public static final Target Name = Input.named("_.name"); - public static final Target Description = Target.the("the description textarea").locatedBy("//textarea[@name='_.description']"); - public static final Target Add_Indication = Button.called("Add Indication"); + public static final Target Name = Input.named("_.name"); + public static final Target Description = + Target.the("the description textarea").locatedBy("//textarea[@name='_.description']"); + public static final Target Add_Indication = Button.called("Add Indication"); - public static final Target Build_Log_Indication_Link = Link.called("Build Log Indication"); + public static final Target Build_Log_Indication_Link = Link.called("Build Log Indication"); public static final Target Pattern_Field = Input.named("pattern"); public static final Target Save = Button.called("Save"); diff --git a/build-monitor-acceptance/src/main/java/hudson/plugins/claim/HaveAFailingClaimableProjectCreated.java b/build-monitor-acceptance/src/main/java/hudson/plugins/claim/HaveAFailingClaimableProjectCreated.java index 56eb0880d..add9dede4 100644 --- a/build-monitor-acceptance/src/main/java/hudson/plugins/claim/HaveAFailingClaimableProjectCreated.java +++ b/build-monitor-acceptance/src/main/java/hudson/plugins/claim/HaveAFailingClaimableProjectCreated.java @@ -20,12 +20,11 @@ public static Task called(String name) { @Override public void performAs(T actor) { actor.attemptsTo( - HaveAProjectCreated.called(projectName).andConfiguredTo( - ExecuteAShellScript.that(ShellScriptThat.Finishes_With_Error), - BrokenBuildClaiming.allow() - ), - ScheduleABuild.of(projectName) - ); + HaveAProjectCreated.called(projectName) + .andConfiguredTo( + ExecuteAShellScript.that(ShellScriptThat.Finishes_With_Error), + BrokenBuildClaiming.allow()), + ScheduleABuild.of(projectName)); } public HaveAFailingClaimableProjectCreated(String projectName) { diff --git a/build-monitor-acceptance/src/main/java/hudson/plugins/claim/tasks/Claim.java b/build-monitor-acceptance/src/main/java/hudson/plugins/claim/tasks/Claim.java index b539c5b68..70740c604 100644 --- a/build-monitor-acceptance/src/main/java/hudson/plugins/claim/tasks/Claim.java +++ b/build-monitor-acceptance/src/main/java/hudson/plugins/claim/tasks/Claim.java @@ -27,13 +27,12 @@ public Claim saying(String reason) { @Override public void performAs(T actor) { actor.attemptsTo( - Click.on(Link.called(project)), - Click.on(ProjectDetailsPage.Last_Failed_Build_Link), - Click.on(ClaimableBuildDetailsPage.Claim_It_Link), - Scroll.to(ClaimableBuildDetailsPage.Reason_Field), - Enter.theValue(reason).into(ClaimableBuildDetailsPage.Reason_Field), - Click.on(ClaimableBuildDetailsPage.Claim_Button) - ); + Click.on(Link.called(project)), + Click.on(ProjectDetailsPage.Last_Failed_Build_Link), + Click.on(ClaimableBuildDetailsPage.Claim_It_Link), + Scroll.to(ClaimableBuildDetailsPage.Reason_Field), + Enter.theValue(reason).into(ClaimableBuildDetailsPage.Reason_Field), + Click.on(ClaimableBuildDetailsPage.Claim_Button)); } private final String project; diff --git a/build-monitor-acceptance/src/main/java/hudson/plugins/claim/tasks/configuration/BrokenBuildClaiming.java b/build-monitor-acceptance/src/main/java/hudson/plugins/claim/tasks/configuration/BrokenBuildClaiming.java index f98587a02..d4a1c6b27 100644 --- a/build-monitor-acceptance/src/main/java/hudson/plugins/claim/tasks/configuration/BrokenBuildClaiming.java +++ b/build-monitor-acceptance/src/main/java/hudson/plugins/claim/tasks/configuration/BrokenBuildClaiming.java @@ -16,8 +16,6 @@ public static Task allow() { @Step("{0} allows for a broken build to be claimed") @Override public void performAs(T actor) { - actor.attemptsTo( - AddAPostBuildAction.called("Allow broken build claiming") - ); + actor.attemptsTo(AddAPostBuildAction.called("Allow broken build claiming")); } } diff --git a/build-monitor-acceptance/src/main/java/hudson/plugins/claim/user_interface/ClaimableBuildDetailsPage.java b/build-monitor-acceptance/src/main/java/hudson/plugins/claim/user_interface/ClaimableBuildDetailsPage.java index df8689ada..a4fbaf748 100644 --- a/build-monitor-acceptance/src/main/java/hudson/plugins/claim/user_interface/ClaimableBuildDetailsPage.java +++ b/build-monitor-acceptance/src/main/java/hudson/plugins/claim/user_interface/ClaimableBuildDetailsPage.java @@ -6,6 +6,6 @@ public class ClaimableBuildDetailsPage { public static final Target Claim_It_Link = Link.called("Claim it"); - public static final Target Claim_Button = Button.called("Claim"); - public static final Target Reason_Field = Target.the("the reason textarea").locatedBy("//textarea[@name='reason']"); + public static final Target Claim_Button = Button.called("Claim"); + public static final Target Reason_Field = Target.the("the reason textarea").locatedBy("//textarea[@name='reason']"); } diff --git a/build-monitor-acceptance/src/main/java/hudson/plugins/descriptionsetter/tasks/SetBuildDescription.java b/build-monitor-acceptance/src/main/java/hudson/plugins/descriptionsetter/tasks/SetBuildDescription.java index 20b44ab28..d726f105b 100644 --- a/build-monitor-acceptance/src/main/java/hudson/plugins/descriptionsetter/tasks/SetBuildDescription.java +++ b/build-monitor-acceptance/src/main/java/hudson/plugins/descriptionsetter/tasks/SetBuildDescription.java @@ -34,7 +34,6 @@ public void performAs(T actor) { actor.attemptsTo( AddABuildStep.called("Set build description"), Enter.theValue(regex).into(Input.named("_.regexp")), - Enter.theValue(description).into(Input.named("_.description")) - ); + Enter.theValue(description).into(Input.named("_.description"))); } } diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/JenkinsInstance.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/JenkinsInstance.java index 792ca2fd6..a4880b34c 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/JenkinsInstance.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/JenkinsInstance.java @@ -21,9 +21,9 @@ public class JenkinsInstance implements TestRule { private Path jenkinsHome = Paths.get(System.getProperty("java.io.tmpdir")); - private int portNumber = 8080; + private int portNumber = 8080; - private JenkinsClient client = null; // instantiated when the Jenkins server is up and running + private JenkinsClient client = null; // instantiated when the Jenkins server is up and running private List> customRulesToApplyBeforeStart = new ArrayList<>(); private List> defaultRules; @@ -64,11 +64,12 @@ public URL url() { try { return new URL(String.format("http://localhost:%d/", portNumber)); } catch (MalformedURLException e) { - throw new RuntimeException(String.format("Couldn't instantiate a URL as 'http://localhost:%d/'", portNumber)); + throw new RuntimeException( + String.format("Couldn't instantiate a URL as 'http://localhost:%d/'", portNumber)); } } - public int port() { + public int port() { return portNumber; } @@ -76,13 +77,15 @@ public void setPort(int portNumber) { this.portNumber = portNumber; } - public > JenkinsInstance beforeStartApply(List customRulesToBeApplied) { + public > JenkinsInstance beforeStartApply( + List customRulesToBeApplied) { this.customRulesToApplyBeforeStart = List.copyOf(customRulesToBeApplied); return this; } - public > JenkinsInstance afterStartApply(List customRulesToBeApplied) { + public > JenkinsInstance afterStartApply( + List customRulesToBeApplied) { this.customRulesToApplyAfterStart = List.copyOf(customRulesToBeApplied); return this; @@ -90,7 +93,8 @@ public > JenkinsInstance afterS @Override public Statement apply(final Statement base, final Description description) { - return chainOf(ListFunctions.concat(customRulesToApplyBeforeStart, defaultRules, customRulesToApplyAfterStart)).apply(base, description); + return chainOf(ListFunctions.concat(customRulesToApplyBeforeStart, defaultRules, customRulesToApplyAfterStart)) + .apply(base, description); } private > RuleChain chainOf(List rules) { diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/TestEnvironment.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/TestEnvironment.java index d68b4ac53..ce71bf672 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/TestEnvironment.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/TestEnvironment.java @@ -7,15 +7,15 @@ public class TestEnvironment { private final JenkinsInstance instance; private final List> rulesToBeAppliedBeforeJenkinsStart = new ArrayList<>(); - private final List> rulesToBeAppliedAfterJenkinsStart = new ArrayList<>(); + private final List> rulesToBeAppliedAfterJenkinsStart = new ArrayList<>(); public TestEnvironment(JenkinsInstance instance) { this.instance = instance; } - public JenkinsInstance create() { - return instance.beforeStartApply(rulesToBeAppliedBeforeJenkinsStart).afterStartApply(rulesToBeAppliedAfterJenkinsStart); + return instance.beforeStartApply(rulesToBeAppliedBeforeJenkinsStart) + .afterStartApply(rulesToBeAppliedAfterJenkinsStart); } public > TestEnvironment beforeStart(ATR... rules) { diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/client/JenkinsClient.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/client/JenkinsClient.java index 663cb35af..e7dc34ef0 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/client/JenkinsClient.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/client/JenkinsClient.java @@ -32,13 +32,15 @@ public JenkinsClient(URL jenkinsUrl, JenkinsProcess process) { // http://stackoverflow.com/questions/17716242/creating-user-in-jenkins-via-api public void registerAccount(String username, String password) { - logger.info("Enabling Jenkins Security and registering account for '{}', identified by '{}'", username, password); + logger.info( + "Enabling Jenkins Security and registering account for '{}', identified by '{}'", username, password); String endScriptMessage = String.format("Account for '%s' created", username); Promise promise = process.promiseWhen(endScriptMessage); try { - executeGroovy(promise, + executeGroovy( + promise, "def instance = jenkins.model.Jenkins.get()", "def usersCanRegister = true", "def realm = new hudson.security.HudsonPrivateSecurityRealm(usersCanRegister)", @@ -48,8 +50,7 @@ public void registerAccount(String username, String password) { "", "import java.util.logging.Logger", "Logger rootLogger = Logger.getLogger('')", - String.format("rootLogger.info(\"%s\")", endScriptMessage) - ); + String.format("rootLogger.info(\"%s\")", endScriptMessage)); logger.info(endScriptMessage); } catch (InterruptedException e) { throw new RuntimeException("Couldn't enable Jenkins Security", e); @@ -63,7 +64,8 @@ public void populateUpdateCenterCaches() { Promise promise = process.promiseWhen(endScriptMessage); try { - executeGroovy(promise, + executeGroovy( + promise, "def ucUrl = new URL('http://updates.jenkins-ci.org/update-center.json')", "def json = hudson.model.DownloadService.loadJSON(ucUrl)", "def site = jenkins.model.Jenkins.instance.updateCenter.getById('default')", @@ -71,8 +73,7 @@ public void populateUpdateCenterCaches() { "", "import java.util.logging.Logger", "Logger rootLogger = Logger.getLogger('')", - String.format("rootLogger.info(\"%s\")", endScriptMessage) - ); + String.format("rootLogger.info(\"%s\")", endScriptMessage)); logger.info(endScriptMessage); } catch (InterruptedException e) { throw new RuntimeException("Couldn't update the Update Center caches.", e); @@ -86,7 +87,6 @@ public void installPlugin(String pluginName) { process.waitUntil(JenkinsProcess.JENKINS_IS_FULLY_UP_AND_RUNNING); } - public void installPlugins(List plugins) { for (String pluginName : plugins) { executeCommand("install-plugin", pluginName); @@ -96,7 +96,7 @@ public void installPlugins(List plugins) { } private void restart() { - //Both Windows and WSL needs hard restart + // Both Windows and WSL needs hard restart if (OS.contains("win") || OS_VERSION.contains("microsoft")) { hardRestart(); } else { @@ -108,7 +108,7 @@ private void hardRestart() { try { safeShutdown(); process.start(); - //Note: Do NOT wait here for Jenkins startup as that is handled within process.start() + // Note: Do NOT wait here for Jenkins startup as that is handled within process.start() } catch (Exception e) { throw new RuntimeException(e); } @@ -133,40 +133,44 @@ private void safeRestart() { } public void setExternalBuildResult(String projectName, String result) { - executeCommand("set-external-build-result", - "--job", projectName, - "--result", result, - "--log", String.format("%s finished with %s", projectName, result) - ); + executeCommand( + "set-external-build-result", + "--job", + projectName, + "--result", + result, + "--log", + String.format("%s finished with %s", projectName, result)); } - private synchronized int executeGroovy(Promise promise, String... groovyScriptLines) throws InterruptedException { + private synchronized int executeGroovy(Promise promise, String... groovyScriptLines) + throws InterruptedException { String script = String.join(";\n", groovyScriptLines); - //TODO use RealJenkinsRule - //return executor.call("groovy", "=").execute(withInput(script), info(logger), error(logger)); - + // TODO use RealJenkinsRule + // return executor.call("groovy", "=").execute(withInput(script), info(logger), error(logger)); + InputStream stdIn = System.in; try { - System.setIn(withInput(script)); - int result = executeCommand("groovy", "="); - - promise.waitSafely(Max_Wait_Time); - - return result; + System.setIn(withInput(script)); + int result = executeCommand("groovy", "="); + + promise.waitSafely(Max_Wait_Time); + + return result; } finally { - System.setIn(stdIn); + System.setIn(stdIn); } } private int executeCommand(String... args) { - //TODO use RealJenkinsRule - //return executor.call(args).execute(noManualInput(), info(logger), error(logger)); + // TODO use RealJenkinsRule + // return executor.call(args).execute(noManualInput(), info(logger), error(logger)); try { - List cliArgs = new ArrayList<>(List.of("-s", jenkinsUrl.toString(), "-http")); - cliArgs.addAll(List.of(args)); - - return CLI._main(cliArgs.toArray(new String[0])); + List cliArgs = new ArrayList<>(List.of("-s", jenkinsUrl.toString(), "-http")); + cliArgs.addAll(List.of(args)); + + return CLI._main(cliArgs.toArray(new String[0])); } catch (Exception e) { throw new RuntimeException(String.format("Couldn't connect to Jenkins at '%s'", jenkinsUrl), e); } diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/environment/PluginDescription.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/environment/PluginDescription.java index 26a37dba3..589e2f026 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/environment/PluginDescription.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/environment/PluginDescription.java @@ -22,25 +22,26 @@ public static PluginDescription of(@NonNull Path pluginAtPath) { pluginAtPath, attrs.getValue("Long-Name"), attrs.getValue("Plugin-Version"), - attrs.getValue("Jenkins-Version") - ); - } - catch (IOException e) { - throw new RuntimeException(String.format("Couldn't read the manifest file of '%s'.", pluginAtPath.toAbsolutePath()), e); - } - finally { - if (jarFile != null){ + attrs.getValue("Jenkins-Version")); + } catch (IOException e) { + throw new RuntimeException( + String.format("Couldn't read the manifest file of '%s'.", pluginAtPath.toAbsolutePath()), e); + } finally { + if (jarFile != null) { try { jarFile.close(); } catch (IOException e) { - Log.error("error closing jarFile",e); + Log.error("error closing jarFile", e); } - } } } - public PluginDescription(@NonNull Path pathToPluginUnderTest, @NonNull String fullName, @NonNull String version, @NonNull String requiredJenkinsVersion) { + public PluginDescription( + @NonNull Path pathToPluginUnderTest, + @NonNull String fullName, + @NonNull String version, + @NonNull String requiredJenkinsVersion) { this.path = pathToPluginUnderTest; this.fullName = fullName; this.version = version; diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/environment/UpdateCenter.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/environment/UpdateCenter.java index bf1dddfa4..293d0e579 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/environment/UpdateCenter.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/environment/UpdateCenter.java @@ -24,21 +24,19 @@ public class UpdateCenter { private final Path tempDir; private List jenkinsLTSVersions = List.of( - Version.valueOf("2.375.4"), - Version.valueOf("2.375.3"), - Version.valueOf("2.375.2"), - Version.valueOf("2.375.1"), - Version.valueOf("2.361.4"), - Version.valueOf("2.361.3"), - Version.valueOf("2.361.2"), - Version.valueOf("2.361.1"), - Version.valueOf("2.346.3"), - Version.valueOf("2.346.2"), - Version.valueOf("2.346.1") - ); - - - public UpdateCenter() { + Version.valueOf("2.375.4"), + Version.valueOf("2.375.3"), + Version.valueOf("2.375.2"), + Version.valueOf("2.375.1"), + Version.valueOf("2.361.4"), + Version.valueOf("2.361.3"), + Version.valueOf("2.361.2"), + Version.valueOf("2.361.1"), + Version.valueOf("2.346.3"), + Version.valueOf("2.346.2"), + Version.valueOf("2.346.1")); + + public UpdateCenter() { this(Directories.Default_Temp_Dir); } @@ -59,7 +57,6 @@ private URL updateCenterJSONPFor(String jenkinsVersion) throws MalformedURLExcep URL url = url(Update_Center_URL_Template, versionToUse); Log.info("Jenkins update URL is {}", url); return url; - } String getUpdateVersionToUse(String jenkinsVersionString) { @@ -75,7 +72,9 @@ String getUpdateVersionToUse(String jenkinsVersionString) { break; } } - assert versionToUse != null; //versionToUse should never be null since we already made sure jenkinsVersion isn't lower than the lowest LTS. + assert versionToUse + != null; // versionToUse should never be null since we already made sure jenkinsVersion isn't lower than + // the lowest LTS. return versionToUse.getNormalVersion(); } @@ -90,7 +89,8 @@ private Path download(URL link) throws IOException { ReadableByteChannel rbc = Channels.newChannel(link.openStream()); - try (FileOutputStream fos = new FileOutputStream(destination.toAbsolutePath().toFile())) { + try (FileOutputStream fos = + new FileOutputStream(destination.toAbsolutePath().toFile())) { fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); return destination; diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/environment/rules/FindFreePort.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/environment/rules/FindFreePort.java index 923a575a8..e4da9be1d 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/environment/rules/FindFreePort.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/environment/rules/FindFreePort.java @@ -13,7 +13,7 @@ public class FindFreePort implements ApplicativeTestRule { private static final Logger Log = LoggerFactory.getLogger(FindFreePort.class); private static final int Dynamic_Range_Start = 49152; - private static final int Dynamic_Range_End = 65535; + private static final int Dynamic_Range_End = 65535; private final int rangeStart; private final int rangeEnd; @@ -28,7 +28,9 @@ public static FindFreePort useFreePortFromTheFollowingRange(int rangeStart, int public FindFreePort(int rangeStart, int rangeEnd) { if (rangeStart > rangeEnd) { - throw new IllegalArgumentException(String.format("Start of the port range (%d) should be lower than the end of the range (%d)", rangeStart, rangeEnd)); + throw new IllegalArgumentException(String.format( + "Start of the port range (%d) should be lower than the end of the range (%d)", + rangeStart, rangeEnd)); } this.rangeStart = rangeStart; @@ -49,23 +51,22 @@ protected void starting(Description description) { }; } - private int anyFreeLocalPortInRange(int from, int to){ - while(true){ + private int anyFreeLocalPortInRange(int from, int to) { + while (true) { int candidate = (int) ((Math.random() * (to - from)) + from); - if(isFree(candidate)){ + if (isFree(candidate)) { return candidate; } } } - private boolean isFree(int port){ + private boolean isFree(int port) { try { ServerSocket ss = new ServerSocket(port); ss.close(); return true; - } - catch (IOException ex) { + } catch (IOException ex) { return false; } } diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/environment/rules/InstallPluginsFromDisk.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/environment/rules/InstallPluginsFromDisk.java index d13b2774c..9b14b7656 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/environment/rules/InstallPluginsFromDisk.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/environment/rules/InstallPluginsFromDisk.java @@ -31,7 +31,10 @@ public TestRule applyTo(final JenkinsInstance jenkins) { @Override protected void starting(Description description) { Path pluginsDir = jenkins.home().resolve("plugins"); - Log.info("Installing {} into {}", pluginsToInstall.stream().map(Object::toString).collect(Collectors.joining(", ")), pluginsDir); + Log.info( + "Installing {} into {}", + pluginsToInstall.stream().map(Object::toString).collect(Collectors.joining(", ")), + pluginsDir); copyPlugins(pluginsToInstall, pluginsDir); } @@ -41,16 +44,22 @@ protected void copyPlugins(List plugins, Path pluginsDir) { Files.createDirectories(pluginsDir); for (Path plugin : plugins) { - Files.copy(existing(plugin), pluginsDir.resolve(plugin.getFileName().toString().replace(".hpi", ".jpi")), StandardCopyOption.REPLACE_EXISTING); + Files.copy( + existing(plugin), + pluginsDir.resolve( + plugin.getFileName().toString().replace(".hpi", ".jpi")), + StandardCopyOption.REPLACE_EXISTING); } } catch (IOException e) { - throw new RuntimeException(String.format("Couldn't install '%s' under '%s'", plugins, pluginsDir.toAbsolutePath())); + throw new RuntimeException( + String.format("Couldn't install '%s' under '%s'", plugins, pluginsDir.toAbsolutePath())); } } private Path existing(Path plugin) { if (!Files.exists(plugin)) { - throw new IllegalArgumentException(String.format("Plugin file '%s' doesn't exist and couldn't be installed.", plugin)); + throw new IllegalArgumentException( + String.format("Plugin file '%s' doesn't exist and couldn't be installed.", plugin)); } return plugin; diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/environment/rules/ManageJenkinsServer.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/environment/rules/ManageJenkinsServer.java index 57fb5ca0c..f15069500 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/environment/rules/ManageJenkinsServer.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/environment/rules/ManageJenkinsServer.java @@ -44,7 +44,7 @@ protected void starting(Description description) { @Override protected void finished(Description description) { - client.shutdown(); + client.shutdown(); } }; } @@ -60,7 +60,7 @@ private Path warFileOf(JenkinsInstance jenkins) { } private JenkinsProcess jenkinsProcessFor(JenkinsInstance jenkins, Path war) { - Path java = CommandLineTools.java(); + Path java = CommandLineTools.java(); return new JenkinsProcess(java, war, jenkins.port(), jenkins.home()); } diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/environment/rules/SandboxJenkinsHome.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/environment/rules/SandboxJenkinsHome.java index 2f09940a3..a1bdadeae 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/environment/rules/SandboxJenkinsHome.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/environment/rules/SandboxJenkinsHome.java @@ -40,20 +40,15 @@ protected void starting(Description test) { private Path temporaryJenkinsHomeFor(Description test) { try { - return Files.createTempDirectory( - Files.createDirectories(rootDirectory), - fileSystemSafeNameOf(test) + "_" - ); + return Files.createTempDirectory(Files.createDirectories(rootDirectory), fileSystemSafeNameOf(test) + "_"); } catch (IOException e) { - throw new RuntimeException(String.format("Couldn't create a temporary directory for '%s' at '%s'.", test, rootDirectory), e); + throw new RuntimeException( + String.format("Couldn't create a temporary directory for '%s' at '%s'.", test, rootDirectory), e); } } private String fileSystemSafeNameOf(Description description) { - return String.format("%s_%s", - simplified(description.getClassName()), - description.getMethodName() - ); + return String.format("%s_%s", simplified(description.getClassName()), description.getMethodName()); } private String simplified(String className) { diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/logging/Witness.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/logging/Witness.java index 7fee1fe7f..16775f04a 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/logging/Witness.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/logging/Witness.java @@ -2,8 +2,12 @@ public interface Witness { void note(String msg); + void note(String format, Object arg); + void note(String format, Object arg1, Object arg2); + void note(String format, Object... arguments); + void note(String msg, Throwable t); } diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/process/JenkinsLogWatcher.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/process/JenkinsLogWatcher.java index 074681781..d186b8c83 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/process/JenkinsLogWatcher.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/process/JenkinsLogWatcher.java @@ -54,10 +54,11 @@ public void run() { } } catch (IOException e) { if (stop && "Stream closed".equals(e.getMessage())) { - Log.debug("Jenkins OutputStream was closed, but that was expected since we're stopping the log watcher."); + Log.debug( + "Jenkins OutputStream was closed, but that was expected since we're stopping the log watcher."); } else { throw new RuntimeException("Jenkins output stream is already closed", e); } } } -} \ No newline at end of file +} diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/process/JenkinsProcess.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/process/JenkinsProcess.java index a0588effa..6774fa657 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/process/JenkinsProcess.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/jenkins/process/JenkinsProcess.java @@ -19,8 +19,8 @@ public class JenkinsProcess { private final ProcessBuilder process; private final int port; - private Process jenkinsProcess; - private final Thread shutdownHook = new Thread() { + private Process jenkinsProcess; + private final Thread shutdownHook = new Thread() { @Override public void run() { if (jenkinsProcess.isAlive()) { @@ -39,7 +39,9 @@ public void run() { private JenkinsLogWatcher jenkinsLogWatcher; private Thread jenkinsLogWatcherThread; - @SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE", justification = "FindBugs does not like the JAVA_HOME resolve") + @SuppressFBWarnings( + value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE", + justification = "FindBugs does not like the JAVA_HOME resolve") public JenkinsProcess(@NonNull Path java, @NonNull Path jenkinsWar, @NonNull int port, @NonNull Path jenkinsHome) { Log.debug("jenkins.war: {}", jenkinsWar.toAbsolutePath()); Log.debug("JENKINS_HOME: {}", jenkinsHome.toAbsolutePath()); @@ -50,43 +52,48 @@ public JenkinsProcess(@NonNull Path java, @NonNull Path jenkinsWar, @NonNull int "JENKINS_HOME", jenkinsHome.toAbsolutePath().toString(), "JAVA_HOME", java.getParent().getParent().toAbsolutePath().toString()); - process = process(java, - "-Duser.language=en", - "-Dhudson.Main.development=true", - "-Dorg.slf4j.simpleLogger.defaultLogLevel=debug", - "-Djava.util.logging=DEBUG", - "-Dhudson.DNSMultiCast.disabled=true", - "-jar", jenkinsWar.toString(), - "--httpPort=" + port - ).directory(jenkinsHome.toFile()); + process = process( + java, + "-Duser.language=en", + "-Dhudson.Main.development=true", + "-Dorg.slf4j.simpleLogger.defaultLogLevel=debug", + "-Djava.util.logging=DEBUG", + "-Dhudson.DNSMultiCast.disabled=true", + "-jar", + jenkinsWar.toString(), + "--httpPort=" + port) + .directory(jenkinsHome.toFile()); process.environment().putAll(env); process.redirectErrorStream(true); } public void start() throws IOException { - jenkinsProcess = start(process); - jenkinsLogWatcher = new JenkinsLogWatcher(jenkinsProcess.getInputStream()); + jenkinsProcess = start(process); + jenkinsLogWatcher = new JenkinsLogWatcher(jenkinsProcess.getInputStream()); jenkinsLogWatcherThread = new Thread(jenkinsLogWatcher, "jenkins"); jenkinsLogWatcherThread.start(); Runtime.getRuntime().addShutdownHook(shutdownHook); - Promise portConflictDetected = jenkinsLogWatcher.watchFor("java.net.BindException: Address already in use"); - Promise jenkinsStarted = jenkinsLogWatcher.watchFor(JENKINS_IS_FULLY_UP_AND_RUNNING); + Promise portConflictDetected = + jenkinsLogWatcher.watchFor("java.net.BindException: Address already in use"); + Promise jenkinsStarted = jenkinsLogWatcher.watchFor(JENKINS_IS_FULLY_UP_AND_RUNNING); try { jenkinsStarted.waitSafely(Startup_Timeout); - if (! jenkinsStarted.isResolved()) { - throw new RuntimeException(String.format("Jenkins failed to start within %s seconds, aborting the test.", Startup_Timeout)); + if (!jenkinsStarted.isResolved()) { + throw new RuntimeException(String.format( + "Jenkins failed to start within %s seconds, aborting the test.", Startup_Timeout)); } Log.info("Jenkins is now available at http://localhost:{}", port); } catch (InterruptedException e) { throw portConflictDetected.isResolved() - ? new RuntimeException(String.format("Couldn't start Jenkins on port '%s', the port is already in use", port), e) + ? new RuntimeException( + String.format("Couldn't start Jenkins on port '%s', the port is already in use", port), e) : new RuntimeException("Couldn't start Jenkins", e); } } @@ -99,7 +106,8 @@ public void waitUntil(String logLine) { try { jenkinsLogWatcher.watchFor(logLine).waitSafely(Startup_Timeout); } catch (InterruptedException e) { - throw new RuntimeException(String.format("Did not see '%s' in the Jenkins log within %s ms", logLine, Startup_Timeout), e); + throw new RuntimeException( + String.format("Did not see '%s' in the Jenkins log within %s ms", logLine, Startup_Timeout), e); } } @@ -130,9 +138,7 @@ private Process start(ProcessBuilder jenkinsProcessBuilder) throws IOException { private static String OS = System.getProperty("os.name").toLowerCase(); private List windowsOrUnix(Path command) { - return OS.contains("win") - ? List.of("cmd.exe", "/C", command.toString()) - : List.of(command.toString()); + return OS.contains("win") ? List.of("cmd.exe", "/C", command.toString()) : List.of(command.toString()); } public JenkinsLogWatcher getJenkinsLogWatcher() { diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/utils/CommandLineTools.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/utils/CommandLineTools.java index f075dd84a..310d2e3e5 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/utils/CommandLineTools.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/utils/CommandLineTools.java @@ -6,23 +6,26 @@ public class CommandLineTools { public static Path java() { - String javaHomeString = Nulls.coalesce(System.getenv("JENKINS_JAVA_HOME"), System.getenv("JAVA_HOME"), - System.getProperty("java.home")); + String javaHomeString = Nulls.coalesce( + System.getenv("JENKINS_JAVA_HOME"), System.getenv("JAVA_HOME"), System.getProperty("java.home")); if (javaHomeString == null) { - throw new RuntimeException("'java' executable not found. Please set the JAVA_HOME env variable to point to your Java home directory."); + throw new RuntimeException( + "'java' executable not found. Please set the JAVA_HOME env variable to point to your Java home directory."); } Path javaHome = Paths.get(javaHomeString); Path javaBin; if (Files.exists(javaHome.resolve("bin/java"))) { - javaBin = javaHome.resolve("bin/java"); + javaBin = javaHome.resolve("bin/java"); } else if (Files.exists(javaHome.resolve("bin/java.exe"))) { - javaBin = javaHome.resolve("bin/java.exe"); + javaBin = javaHome.resolve("bin/java.exe"); } else { - throw new RuntimeException("'java' executable not found. Please set the JAVA_HOME env variable to point to your Java home directory."); + throw new RuntimeException( + "'java' executable not found. Please set the JAVA_HOME env variable to point to your Java home directory."); } if (!Files.isExecutable(javaBin)) { - throw new RuntimeException("'java' executable not found. Please set the JAVA_HOME env variable to point to your Java home directory."); + throw new RuntimeException( + "'java' executable not found. Please set the JAVA_HOME env variable to point to your Java home directory."); } return javaBin; } diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/utils/Nulls.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/utils/Nulls.java index 2dca8a98c..4839a5190 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/utils/Nulls.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/utils/Nulls.java @@ -4,7 +4,11 @@ public class Nulls { public static T coalesce(T... items) { - for(T i : items) if(i != null) return i; + for (T i : items) { + if (i != null) { + return i; + } + } return null; } diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/utils/RuleChains.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/utils/RuleChains.java index 4f45c29e2..a38c59d6b 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/utils/RuleChains.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/integration/utils/RuleChains.java @@ -13,7 +13,6 @@ private static RuleChain from(List testRules) { return chained(testRules); } - public static RuleChain chained(List customRules) { return chained(RuleChain.emptyRuleChain(), customRules); } diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/readability/Typograph.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/readability/Typograph.java index e4765b12c..b840dee40 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/readability/Typograph.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/readability/Typograph.java @@ -3,13 +3,9 @@ public class Typograph { public static String deCamelCase(String camelCasedString) { return camelCasedString.replaceAll( - String.format("%s|%s|%s", - "(?<=[A-Z])(?=[A-Z][a-z])", - "(?<=[^A-Z])(?=[A-Z])", - "(?<=[A-Za-z])(?=[^A-Za-z])" - ), - " " - ); + String.format( + "%s|%s|%s", "(?<=[A-Z])(?=[A-Z][a-z])", "(?<=[^A-Z])(?=[A-Z])", "(?<=[A-Za-z])(?=[^A-Za-z])"), + " "); } public static String de_snake_case(String snake_cased_string) { diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/interacting_with_jenkins_api/abilities/InteractWithJenkinsAPI.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/interacting_with_jenkins_api/abilities/InteractWithJenkinsAPI.java index a791a438b..6dd7e24d8 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/interacting_with_jenkins_api/abilities/InteractWithJenkinsAPI.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/interacting_with_jenkins_api/abilities/InteractWithJenkinsAPI.java @@ -14,7 +14,7 @@ public static Ability using(JenkinsClient client) { } public static InteractWithJenkinsAPI as(Actor actor) { - if(actor.abilityTo(InteractWithJenkinsAPI.class) == null) { + if (actor.abilityTo(InteractWithJenkinsAPI.class) == null) { throw new ActorCannotInteractWithJenkinsApi(actor.getName()); } diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/interacting_with_jenkins_api/interactions/NotifyOfExternalProjectSuccess.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/interacting_with_jenkins_api/interactions/NotifyOfExternalProjectSuccess.java index bce9c15e4..61946ccf2 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/interacting_with_jenkins_api/interactions/NotifyOfExternalProjectSuccess.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/interacting_with_jenkins_api/interactions/NotifyOfExternalProjectSuccess.java @@ -17,4 +17,4 @@ public NotifyOfExternalProjectSuccess(String project) { } private final String project; -} \ No newline at end of file +} diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/HaveAFailingProjectCreated.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/HaveAFailingProjectCreated.java index e8dc4357e..9b28d0ac0 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/HaveAFailingProjectCreated.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/HaveAFailingProjectCreated.java @@ -19,11 +19,9 @@ public static Task called(String name) { @Override public void performAs(T actor) { actor.attemptsTo( - HaveAProjectCreated.called(projectName).andConfiguredTo( - ExecuteAShellScript.that(ShellScriptThat.Finishes_With_Error) - ), - ScheduleABuild.of(projectName) - ); + HaveAProjectCreated.called(projectName) + .andConfiguredTo(ExecuteAShellScript.that(ShellScriptThat.Finishes_With_Error)), + ScheduleABuild.of(projectName)); } public HaveAFailingProjectCreated(String projectName) { diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/HaveAPipelineProjectCreated.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/HaveAPipelineProjectCreated.java index 983c99594..9f06b2e1f 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/HaveAPipelineProjectCreated.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/HaveAPipelineProjectCreated.java @@ -27,8 +27,7 @@ public Task andConfiguredTo(Task... configurationTasks) { public void performAs(T actor) { actor.attemptsTo( CreateAPipelineProject.called(projectName).andConfigureItTo(requiredConfiguration), - Click.on(SidePanel.Back_to_Dashboard) - ); + Click.on(SidePanel.Back_to_Dashboard)); } public HaveAPipelineProjectCreated(String projectName) { diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/HaveAProjectCreated.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/HaveAProjectCreated.java index 900383948..2a48e81c4 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/HaveAProjectCreated.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/HaveAProjectCreated.java @@ -27,8 +27,7 @@ public Task andConfiguredTo(Task... configurationTasks) { public void performAs(T actor) { actor.attemptsTo( CreateAFreestyleProject.called(projectName).andConfigureItTo(requiredConfiguration), - Click.on(SidePanel.Back_to_Dashboard) - ); + Click.on(SidePanel.Back_to_Dashboard)); } public HaveAProjectCreated(String projectName) { diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/HaveASuccessfulProjectCreated.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/HaveASuccessfulProjectCreated.java index 2480c2087..b1b3531b4 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/HaveASuccessfulProjectCreated.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/HaveASuccessfulProjectCreated.java @@ -19,11 +19,9 @@ public static Task called(String name) { @Override public void performAs(T actor) { actor.attemptsTo( - HaveAProjectCreated.called(projectName).andConfiguredTo( - ExecuteAShellScript.that(ShellScriptThat.Finishes_With_Success) - ), - ScheduleABuild.of(projectName) - ); + HaveAProjectCreated.called(projectName) + .andConfiguredTo(ExecuteAShellScript.that(ShellScriptThat.Finishes_With_Success)), + ScheduleABuild.of(projectName)); } public HaveASuccessfulProjectCreated(String projectName) { diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/HaveAnExternalProjectCreated.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/HaveAnExternalProjectCreated.java index 184483dea..7c96fe316 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/HaveAnExternalProjectCreated.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/HaveAnExternalProjectCreated.java @@ -18,10 +18,7 @@ public static HaveAnExternalProjectCreated called(String name) { @Step("{0} creates the '#projectName' external project") @Override public void performAs(T actor) { - actor.attemptsTo( - CreateAnExternalProject.called(projectName), - Click.on(SidePanel.Back_to_Dashboard) - ); + actor.attemptsTo(CreateAnExternalProject.called(projectName), Click.on(SidePanel.Back_to_Dashboard)); } public HaveAnExternalProjectCreated(String projectName) { diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/actions/EnterCode.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/actions/EnterCode.java index 71f35fd88..2e652c669 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/actions/EnterCode.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/actions/EnterCode.java @@ -16,7 +16,8 @@ public static EnterCode asFollows(String... lines) { } public Interaction intoTheCodeMirror(Target editorField) { - return instrumented(EnterCodeIntoCodeMirrorEditor.class, editorField, String.join(System.lineSeparator(), lines)); + return instrumented( + EnterCodeIntoCodeMirrorEditor.class, editorField, String.join(System.lineSeparator(), lines)); } public Interaction intoThePipelineEditor(Target editorField) { @@ -36,29 +37,24 @@ public static class EnterCodeIntoCodeMirrorEditor implements Interaction { public EnterCodeIntoCodeMirrorEditor(Target target, String code) { this.target = target; - this.code = code; + this.code = code; } @Override @Step("{0} enters '#code' into the code editor field") public void performAs(T actor) { actor.attemptsTo( - Click.on(target), - Evaluate.javascript( - setCodeMirrorValueTo(code), - target.resolveFor(actor) - )); + Click.on(target), Evaluate.javascript(setCodeMirrorValueTo(code), target.resolveFor(actor))); } private String setCodeMirrorValueTo(String code) { return String.format( - "var code_mirror = arguments[0].CodeMirror;" + - "if (code_mirror != null) { " + - " code_mirror.setValue('%s');" + - " code_mirror.save();" + - "} else { " + - " console.error('CodeMirror object is not present on the', arguments[0], 'element'); " + - "}", + "var code_mirror = arguments[0].CodeMirror;" + "if (code_mirror != null) { " + + " code_mirror.setValue('%s');" + + " code_mirror.save();" + + "} else { " + + " console.error('CodeMirror object is not present on the', arguments[0], 'element'); " + + "}", escapeNewLineCharacters(code)); } @@ -74,7 +70,7 @@ private static class EnterCodeIntoPipelineEditor implements Interaction { public EnterCodeIntoPipelineEditor(Target target, String code) { this.target = target; - this.code = code; + this.code = code; } @Override @@ -82,6 +78,5 @@ public EnterCodeIntoPipelineEditor(Target target, String code) { public void performAs(T actor) { target.resolveFor(actor).type(code); } - } } diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/targets/Button.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/targets/Button.java index 3c3c26d1f..cf01ebb9c 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/targets/Button.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/targets/Button.java @@ -8,4 +8,4 @@ public static Target called(String text) { .locatedBy("//button[contains(.,'{0}')]") .of(text); } -} \ No newline at end of file +} diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/targets/Link.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/targets/Link.java index eb8195ea2..e6176ccc1 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/targets/Link.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/targets/Link.java @@ -12,4 +12,4 @@ public static Target to(String text) { .locatedBy("//a[contains(., '{0}')]") .of(text); } -} \ No newline at end of file +} diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/CreateAFreestyleProject.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/CreateAFreestyleProject.java index cab915b16..20b070971 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/CreateAFreestyleProject.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/CreateAFreestyleProject.java @@ -22,17 +22,15 @@ public CreateAFreestyleProject andConfigureItTo(Task configurationTask) { @Override @Step("{0} creates a 'Freestyle Project' called '#name'") public void performAs(T actor) { - actor.attemptsTo( - CreateAProject.called(name) - .ofType(NewJobPage.Freestyle_Project) - .andConfigureItTo(this.configureTheProject) - ); + actor.attemptsTo(CreateAProject.called(name) + .ofType(NewJobPage.Freestyle_Project) + .andConfigureItTo(this.configureTheProject)); } public CreateAFreestyleProject(String jobName) { this.name = jobName; } - private final String name; + private final String name; private final TodoList configureTheProject = TodoList.empty(); -} \ No newline at end of file +} diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/CreateAPipelineProject.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/CreateAPipelineProject.java index 895359ce8..5ec29fc85 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/CreateAPipelineProject.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/CreateAPipelineProject.java @@ -23,16 +23,13 @@ public CreateAPipelineProject andConfigureItTo(Task configurationTask) { @Step("{0} creates a 'Pipeline Project' called '#name'") public void performAs(T actor) { actor.attemptsTo( - CreateAProject.called(name) - .ofType(NewJobPage.Pipeline) - .andConfigureItTo(this.configureTheProject) - ); + CreateAProject.called(name).ofType(NewJobPage.Pipeline).andConfigureItTo(this.configureTheProject)); } public CreateAPipelineProject(String jobName) { this.name = jobName; } - private final String name; + private final String name; private final TodoList configureTheProject = TodoList.empty(); -} \ No newline at end of file +} diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/CreateAProject.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/CreateAProject.java index b676ec0fa..414fc61ad 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/CreateAProject.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/CreateAProject.java @@ -42,15 +42,14 @@ public void performAs(T actor) { Scroll.to(Buttons.OK), Click.on(Buttons.OK), configureTheProject, - Click.on(Buttons.Save) - ); + Click.on(Buttons.Save)); } public CreateAProject(String jobName) { this.name = jobName; } - private final String name; + private final String name; private final TodoList configureTheProject = TodoList.empty(); - private Target projectType; -} \ No newline at end of file + private Target projectType; +} diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/CreateAnExternalProject.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/CreateAnExternalProject.java index f26063e65..7c4e352e6 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/CreateAnExternalProject.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/CreateAnExternalProject.java @@ -15,15 +15,12 @@ public static CreateAnExternalProject called(String name) { @Override @Step("{0} creates a 'Freestyle Project' called '#name'") public void performAs(T actor) { - actor.attemptsTo( - CreateAProject.called(name) - .ofType(NewJobPage.External_Project) - ); + actor.attemptsTo(CreateAProject.called(name).ofType(NewJobPage.External_Project)); } public CreateAnExternalProject(String jobName) { this.name = jobName; } - private final String name; + private final String name; } diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/LogIn.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/LogIn.java index 73f1c2885..63d74f518 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/LogIn.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/LogIn.java @@ -23,8 +23,7 @@ public void performAs(T actor) { Click.on(JenkinsHomePage.Log_In_Link), Enter.theValue(actor.getName()).into(LogInForm.Username_Field), Enter.theValue(passwordOf(actor)).into(LogInForm.Password_Field), - Click.on(LogInForm.Log_In_Buttton) - ); + Click.on(LogInForm.Log_In_Buttton)); } private String passwordOf(Actor actor) { diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/ScheduleABuild.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/ScheduleABuild.java index a3fd12171..b28b49788 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/ScheduleABuild.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/ScheduleABuild.java @@ -13,14 +13,13 @@ public static Task of(String project) { return instrumented(ScheduleABuild.class, project); } - @Override @Step("{0} schedules a build of the '#project' project ") public void performAs(T actor) { actor.attemptsTo( Click.on(JenkinsHomePage.Schedule_A_Build.of(project)) // todo: should wait for the build to finish - ); + ); } public ScheduleABuild(String project) { diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/AddABuildStep.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/AddABuildStep.java index 180abfd9b..f3cc4bbd7 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/AddABuildStep.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/AddABuildStep.java @@ -22,8 +22,7 @@ public void performAs(final T actor) { Click.on(ProjectConfigurationPage.Build_Steps), Sleep.of(1, TimeUnit.SECONDS), Click.on(ProjectConfigurationPage.Add_Build_Step), - Click.on(Link.called(buildStepName)) - ); + Click.on(Link.called(buildStepName))); } public AddABuildStep(String buildStepName) { diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/AddAGroovyPostbuildScript.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/AddAGroovyPostbuildScript.java index 82b210e5d..3ffc319d5 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/AddAGroovyPostbuildScript.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/AddAGroovyPostbuildScript.java @@ -18,9 +18,8 @@ public static Task that(GroovyScript expectedOutcome) { @Override public void performAs(T actor) { actor.attemptsTo( - AddAPostBuildAction.called("Groovy Postbuild"), - Enter.theValue(scriptOutcome.code()).into(GroovyPostBuildStep.Editor) - ); + AddAPostBuildAction.called("Groovy Postbuild"), + Enter.theValue(scriptOutcome.code()).into(GroovyPostBuildStep.Editor)); } public AddAGroovyPostbuildScript(GroovyScript script) { diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/AddAPostBuildAction.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/AddAPostBuildAction.java index 8778eeaa7..91cf8e948 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/AddAPostBuildAction.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/AddAPostBuildAction.java @@ -24,8 +24,7 @@ public void performAs(T actor) { Sleep.of(1, TimeUnit.SECONDS), Click.on(ProjectConfigurationPage.Add_Post_Build_Action), Sleep.of(1, TimeUnit.SECONDS), - Click.on(Link.called(postBuildActionName)) - ); + Click.on(Link.called(postBuildActionName))); } public AddAPostBuildAction(String postBuildActionName) { diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/DisableExecutingConcurrentBuilds.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/DisableExecutingConcurrentBuilds.java index 0fc90fd1d..772d6a054 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/DisableExecutingConcurrentBuilds.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/DisableExecutingConcurrentBuilds.java @@ -14,7 +14,6 @@ public class DisableExecutingConcurrentBuilds implements Task { public void performAs(T actor) { actor.attemptsTo( Scroll.to(ProjectConfigurationPage.Do_Not_Allow_Concurrent_Builds), - Click.on(ProjectConfigurationPage.Do_Not_Allow_Concurrent_Builds) - ); + Click.on(ProjectConfigurationPage.Do_Not_Allow_Concurrent_Builds)); } } diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/EnableExecutingConcurrentBuilds.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/EnableExecutingConcurrentBuilds.java index f9ad42bb2..3b634ebc2 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/EnableExecutingConcurrentBuilds.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/EnableExecutingConcurrentBuilds.java @@ -11,8 +11,6 @@ public class EnableExecutingConcurrentBuilds implements Task { @Step("{0} enables executing concurrent builds") @Override public void performAs(T actor) { - actor.attemptsTo( - Click.on(ProjectConfigurationPage.Execute_Concurrent_Builds) - ); + actor.attemptsTo(Click.on(ProjectConfigurationPage.Execute_Concurrent_Builds)); } } diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/ExecuteAShellScript.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/ExecuteAShellScript.java index 14c0d97b4..ffae3989a 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/ExecuteAShellScript.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/ExecuteAShellScript.java @@ -18,9 +18,8 @@ public static Task that(ShellScript expectedOutcome) { @Override public void performAs(T actor) { actor.attemptsTo( - AddABuildStep.called("Execute shell"), - EnterCode.asFollows(scriptOutcome.code()).intoTheCodeMirror(ShellBuildStep.Editor) - ); + AddABuildStep.called("Execute shell"), + EnterCode.asFollows(scriptOutcome.code()).intoTheCodeMirror(ShellBuildStep.Editor)); } public ExecuteAShellScript(ShellScript script) { diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/GroovyScript.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/GroovyScript.java index 82066dead..2ce76efcf 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/GroovyScript.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/GroovyScript.java @@ -27,7 +27,9 @@ public GroovyScript definedAs(List lines) { } public GroovyScript andOutputs(String... lines) { - return definedAs(Stream.of(lines).map(line -> String.format("echo \"%s\";", line)).collect(Collectors.toList())); + return definedAs(Stream.of(lines) + .map(line -> String.format("echo \"%s\";", line)) + .collect(Collectors.toList())); } public String code() { diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/GroovyScriptThat.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/GroovyScriptThat.java index d7fa1803c..d2294de3f 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/GroovyScriptThat.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/GroovyScriptThat.java @@ -2,34 +2,35 @@ public class GroovyScriptThat { public static final GroovyScript Adds_A_Badge = GroovyScript.that("Adds a badge") - .definedAs("addShortText(text:'Coverage', color:'black', background:'repeating-linear-gradient(45deg, yellow, yellow 10px, Orange 10px, Orange 20px)', border: 0, borderColor:'white')"); + .definedAs( + "addShortText(text:'Coverage', color:'black', background:'repeating-linear-gradient(45deg, yellow, yellow 10px, Orange 10px, Orange 20px)', border: 0, borderColor:'white')"); public static final GroovyScript Pause_In_Middle_Of_Tests = GroovyScript.that("Pause in the middle of tests") .separatedBy("") - .definedAs("node {", - " parallel firstBranch: {", - " stage('stage1') {", - " realtimeJUnit('a*.xml') {", - " writeFile text: '''''', file: 'aa.xml';", - " if (currentBuild.number > 1) {", - " sleep 300;", - " };", - " writeFile text: '''''', file: 'ab.xml';", - " }", - " }", - " }, secondBranch: {", - " stage('stage2') {", - " realtimeJUnit('b*.xml') {", - " writeFile text: '''ba2 failed''', file: 'ba.xml';", - " if (currentBuild.number > 1) {", - " sleep 300;", - " };", - " writeFile text: '''bb2 failed''', file: 'bb.xml';", - " }", - " }", - " },", + .definedAs( + "node {", + " parallel firstBranch: {", + " stage('stage1') {", + " realtimeJUnit('a*.xml') {", + " writeFile text: '''''', file: 'aa.xml';", + " if (currentBuild.number > 1) {", + " sleep 300;", + " };", + " writeFile text: '''''', file: 'ab.xml';", + " }", + " }", + " }, secondBranch: {", + " stage('stage2') {", + " realtimeJUnit('b*.xml') {", + " writeFile text: '''ba2 failed''', file: 'ba.xml';", + " if (currentBuild.number > 1) {", + " sleep 300;", + " };", + " writeFile text: '''bb2 failed''', file: 'bb.xml';", + " }", + " }", + " },", " failFast: true;", " deleteDir();", "}"); - -} \ No newline at end of file +} diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/SetPipelineDefinition.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/SetPipelineDefinition.java index 507ae5a0a..c00f8f36e 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/SetPipelineDefinition.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/SetPipelineDefinition.java @@ -17,9 +17,7 @@ public static Task asFollows(String pipelineDefintion) { @Step("{0} configures the Pipeline Defintion to execute '#pipelineDefintion'") @Override public void performAs(T actor) { - actor.attemptsTo( - EnterCode.asFollows(pipelineDefintion).intoThePipelineEditor(PipelineDefinition.Editor) - ); + actor.attemptsTo(EnterCode.asFollows(pipelineDefintion).intoThePipelineEditor(PipelineDefinition.Editor)); } public SetPipelineDefinition(String pipelineDefintion) { @@ -27,5 +25,4 @@ public SetPipelineDefinition(String pipelineDefintion) { } private final String pipelineDefintion; - } diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/ShellScript.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/ShellScript.java index c66b8f152..038e8cca9 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/ShellScript.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/ShellScript.java @@ -21,7 +21,9 @@ public ShellScript definedAs(List lines) { } public ShellScript andOutputs(String... lines) { - return definedAs(Stream.of(lines).map(line -> String.format("echo \"%s\";", line)).collect(Collectors.toList())); + return definedAs(Stream.of(lines) + .map(line -> String.format("echo \"%s\";", line)) + .collect(Collectors.toList())); } public String code() { diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/ShellScriptThat.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/ShellScriptThat.java index 8d8f0efd5..42d1d1e84 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/ShellScriptThat.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/tasks/configuration/build_steps/ShellScriptThat.java @@ -1,6 +1,8 @@ package net.serenitybdd.screenplay.jenkins.tasks.configuration.build_steps; public class ShellScriptThat { - public static final ShellScript Finishes_With_Success = ShellScript.that("Finishes with success").definedAs("exit 0;"); - public static final ShellScript Finishes_With_Error = ShellScript.that("Finishes with error").definedAs("exit 1;"); -} \ No newline at end of file + public static final ShellScript Finishes_With_Success = + ShellScript.that("Finishes with success").definedAs("exit 0;"); + public static final ShellScript Finishes_With_Error = + ShellScript.that("Finishes with error").definedAs("exit 1;"); +} diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/JenkinsHomePage.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/JenkinsHomePage.java index b973464e7..06a55423d 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/JenkinsHomePage.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/JenkinsHomePage.java @@ -4,7 +4,8 @@ import net.serenitybdd.screenplay.targets.Target; public class JenkinsHomePage { - public static final Target New_View_link = Target.the("the 'New View' link").locatedBy("//a[@title='New View']"); - public static final Target Schedule_A_Build = Target.the("the 'build now' link").locatedBy("//a[@title='Schedule a Build for {0}']"); - public static final Target Log_In_Link = Link.called("log in"); -} \ No newline at end of file + public static final Target New_View_link = Target.the("the 'New View' link").locatedBy("//a[@title='New View']"); + public static final Target Schedule_A_Build = + Target.the("the 'build now' link").locatedBy("//a[@title='Schedule a Build for {0}']"); + public static final Target Log_In_Link = Link.called("log in"); +} diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/LogInForm.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/LogInForm.java index 0294b3a31..c9aae2c11 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/LogInForm.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/LogInForm.java @@ -6,5 +6,6 @@ public class LogInForm { public static final Target Username_Field = Input.named("j_username"); public static final Target Password_Field = Input.named("j_password"); - public static final Target Log_In_Buttton = Target.the("the 'Sign In' button").locatedBy("//button[@type='submit']"); + public static final Target Log_In_Buttton = + Target.the("the 'Sign In' button").locatedBy("//button[@type='submit']"); } diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/NewJobPage.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/NewJobPage.java index 74a8a7e52..43adeb0be 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/NewJobPage.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/NewJobPage.java @@ -6,9 +6,17 @@ @DefaultUrl("/newJob") public class NewJobPage extends PageObject { - public static final Target Item_Name_Field = Target.the("Item name").locatedBy("//*[@id='name']"); - public static final Target Freestyle_Project = Target.the("Freestyle project").locatedBy("//*[@id=\"j-add-item-type-standalone-projects\"]/ul/li[label/input[@value='hudson.model.FreeStyleProject']]"); - public static final Target Pipeline = Target.the("Pipeline").locatedBy("//*[@id=\"j-add-item-type-standalone-projects\"]/ul/li[label/input[@value='org.jenkinsci.plugins.workflow.job.WorkflowJob']]"); - public static final Target Folder = Target.the("Folder").locatedBy("//*[@id=\"j-add-item-type-nested-projects\"]/ul/li[label/input[@value='com.cloudbees.hudson.plugins.folder.Folder']]"); - public static final Target External_Project = Target.the("External Job").locatedBy("//*[@id=\"j-add-item-type-standalone-projects\"]/ul/li[label/input[@value='hudson.model.ExternalJob']]"); -} \ No newline at end of file + public static final Target Item_Name_Field = Target.the("Item name").locatedBy("//*[@id='name']"); + public static final Target Freestyle_Project = Target.the("Freestyle project") + .locatedBy( + "//*[@id=\"j-add-item-type-standalone-projects\"]/ul/li[label/input[@value='hudson.model.FreeStyleProject']]"); + public static final Target Pipeline = Target.the("Pipeline") + .locatedBy( + "//*[@id=\"j-add-item-type-standalone-projects\"]/ul/li[label/input[@value='org.jenkinsci.plugins.workflow.job.WorkflowJob']]"); + public static final Target Folder = Target.the("Folder") + .locatedBy( + "//*[@id=\"j-add-item-type-nested-projects\"]/ul/li[label/input[@value='com.cloudbees.hudson.plugins.folder.Folder']]"); + public static final Target External_Project = Target.the("External Job") + .locatedBy( + "//*[@id=\"j-add-item-type-standalone-projects\"]/ul/li[label/input[@value='hudson.model.ExternalJob']]"); +} diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/NewViewPage.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/NewViewPage.java index a2c162742..f5c32cb01 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/NewViewPage.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/NewViewPage.java @@ -6,6 +6,7 @@ @DefaultUrl("/newView") public class NewViewPage extends PageObject { - public static final Target View_Name = Target.the("View name").locatedBy("//*[@id='name']"); - public static final Target Build_Monitor_View = Target.the("the 'Build Monitor View' label").locatedBy("//label[@for='com.smartcodeltd.jenkinsci.plugins.buildmonitor.BuildMonitorView']"); -} \ No newline at end of file + public static final Target View_Name = Target.the("View name").locatedBy("//*[@id='name']"); + public static final Target Build_Monitor_View = Target.the("the 'Build Monitor View' label") + .locatedBy("//label[@for='com.smartcodeltd.jenkinsci.plugins.buildmonitor.BuildMonitorView']"); +} diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/ProjectConfigurationPage.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/ProjectConfigurationPage.java index f432fdf5a..6c32bb123 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/ProjectConfigurationPage.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/ProjectConfigurationPage.java @@ -7,7 +7,8 @@ public class ProjectConfigurationPage { public static final Target Execute_Concurrent_Builds = Label.called("Execute concurrent builds if necessary"); public static final Target Do_Not_Allow_Concurrent_Builds = Label.called("Do not allow concurrent builds"); - public static final Target Build_Steps = Target.the("the 'Build Steps' span").locatedBy("//span[contains(.,'Build Steps')]"); + public static final Target Build_Steps = + Target.the("the 'Build Steps' span").locatedBy("//span[contains(.,'Build Steps')]"); public static final Target Add_Build_Step = Button.called("Add build step"); public static final Target Add_Post_Build_Action = Button.called("Add post-build action"); } diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/ViewConfigurationPage.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/ViewConfigurationPage.java index 5eefacd8f..5822e8956 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/ViewConfigurationPage.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/ViewConfigurationPage.java @@ -5,11 +5,16 @@ import net.serenitybdd.screenplay.targets.Target; public class ViewConfigurationPage { - public static final Target Recurse_In_Subfolders = Label.called("Recurse in subfolders"); - public static final Target Use_Regular_Expression = Label.called("Use a regular expression to include jobs into the view"); - public static final Target Regular_Expression = Target.the("the 'Regular expression' field").located(By.name("includeRegex")); - public static final Target Enable_Show_Badges = Label.called("Enable Show badges"); - public static final Target Display_Badges = Target.the("the 'Display badges' field").located(By.name("displayBadges")); - public static final Target Display_Badges_From = Target.the("the 'Display badges from' field").located(By.name("displayBadgesFrom")); - public static final Target Display_JUnit_Realtime_Progress = Target.the("the 'Display JUnit Realtime progress' option").locatedBy("#displayJUnitProgress"); -} \ No newline at end of file + public static final Target Recurse_In_Subfolders = Label.called("Recurse in subfolders"); + public static final Target Use_Regular_Expression = + Label.called("Use a regular expression to include jobs into the view"); + public static final Target Regular_Expression = + Target.the("the 'Regular expression' field").located(By.name("includeRegex")); + public static final Target Enable_Show_Badges = Label.called("Enable Show badges"); + public static final Target Display_Badges = + Target.the("the 'Display badges' field").located(By.name("displayBadges")); + public static final Target Display_Badges_From = + Target.the("the 'Display badges from' field").located(By.name("displayBadgesFrom")); + public static final Target Display_JUnit_Realtime_Progress = + Target.the("the 'Display JUnit Realtime progress' option").locatedBy("#displayJUnitProgress"); +} diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/navigation/Breadcrumbs.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/navigation/Breadcrumbs.java index 2e473a04d..2fed8c86d 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/navigation/Breadcrumbs.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/navigation/Breadcrumbs.java @@ -4,7 +4,8 @@ public class Breadcrumbs { // Breadcrumb has been renamed Dashboard in newer Jenkins - public static final Target Jenkins_Link = Target.the("the 'Jenkins' link").locatedBy("//a[./text()='Jenkins' or ./text()='Dashboard']"); + public static final Target Jenkins_Link = + Target.the("the 'Jenkins' link").locatedBy("//a[./text()='Jenkins' or ./text()='Dashboard']"); public static Target linkTo(String name) { return Target.the(String.format("the '%s' breadcrumb link", name)) diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/navigation/Buttons.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/navigation/Buttons.java index 3ae54c699..41fcb7eda 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/navigation/Buttons.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/navigation/Buttons.java @@ -4,7 +4,8 @@ import net.serenitybdd.screenplay.targets.Target; public class Buttons { - public static final Target Create = Target.the("the 'Create' button").locatedBy("//input[@name='Submit' and @value='Create']"); + public static final Target Create = + Target.the("the 'Create' button").locatedBy("//input[@name='Submit' and @value='Create']"); public static final Target Save = Button.called("Save"); - public static final Target OK = Button.called("OK"); -} \ No newline at end of file + public static final Target OK = Button.called("OK"); +} diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/navigation/SidePanel.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/navigation/SidePanel.java index d0ff6835b..6a067b47c 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/navigation/SidePanel.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/navigation/SidePanel.java @@ -5,5 +5,6 @@ public class SidePanel { public static final Target New_Item_Link = Link.to("New Item"); - public static final Target Back_to_Dashboard = Target.the("Back to Dashboard").locatedBy("//*[@id=\"breadcrumbs\"]//a[@href='/']"); -} \ No newline at end of file + public static final Target Back_to_Dashboard = + Target.the("Back to Dashboard").locatedBy("//*[@id=\"breadcrumbs\"]//a[@href='/']"); +} diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/project_configuration/build_steps/GroovyPostBuildStep.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/project_configuration/build_steps/GroovyPostBuildStep.java index 4282fcd5d..47a0dc479 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/project_configuration/build_steps/GroovyPostBuildStep.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/project_configuration/build_steps/GroovyPostBuildStep.java @@ -3,5 +3,7 @@ import net.serenitybdd.screenplay.targets.Target; public class GroovyPostBuildStep { - public static final Target Editor = Target.the("code editor").locatedBy("(//div[@descriptorid='org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder']//textarea)[last()]"); + public static final Target Editor = Target.the("code editor") + .locatedBy( + "(//div[@descriptorid='org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder']//textarea)[last()]"); } diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/project_configuration/build_steps/PipelineDefinition.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/project_configuration/build_steps/PipelineDefinition.java index 91565d7ca..ec91ba5d7 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/project_configuration/build_steps/PipelineDefinition.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplay/jenkins/user_interface/project_configuration/build_steps/PipelineDefinition.java @@ -3,5 +3,6 @@ import net.serenitybdd.screenplay.targets.Target; public class PipelineDefinition { - public static final Target Editor = Target.the("code editor").locatedBy("(//div[@id='workflow-editor-1']//textarea)[last()]"); + public static final Target Editor = + Target.the("code editor").locatedBy("(//div[@id='workflow-editor-1']//textarea)[last()]"); } diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplayx/actions/Evaluate.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplayx/actions/Evaluate.java index 326db8d61..5b64bdf96 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplayx/actions/Evaluate.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplayx/actions/Evaluate.java @@ -6,7 +6,8 @@ import net.serenitybdd.screenplay.abilities.BrowseTheWeb; import org.openqa.selenium.JavascriptExecutor; -// the original implementation has a side-effect of injecting the jQuery library, which conflicts with Jenkins' prototype.js +// the original implementation has a side-effect of injecting the jQuery library, which conflicts with Jenkins' +// prototype.js public class Evaluate implements Interaction { private final String expression; @@ -21,6 +22,7 @@ public Evaluate withParameters(Object... parameters) { return this; } + @Override public void performAs(T theUser) { ((JavascriptExecutor) BrowseTheWeb.as(theUser).getDriver()).executeScript(expression, parameters); } diff --git a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplayx/actions/ScrollToTarget.java b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplayx/actions/ScrollToTarget.java index a58f690ce..88b1f91b6 100644 --- a/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplayx/actions/ScrollToTarget.java +++ b/build-monitor-acceptance/src/main/java/net/serenitybdd/screenplayx/actions/ScrollToTarget.java @@ -8,16 +8,16 @@ import org.openqa.selenium.WebElement; public class ScrollToTarget implements Interaction { - + private static final Map centerAlignOptions; - + static { centerAlignOptions = new HashMap<>(); centerAlignOptions.put("behavior", "auto"); centerAlignOptions.put("block", "center"); centerAlignOptions.put("inline", "center"); } - + private final Target target; private String alignTo = "middle"; @@ -43,25 +43,25 @@ public ScrollToTarget andAlignInMiddle() { return this; } + @Override public void performAs(T actor) { - actor.attemptsTo(scrollTo(target.resolveFor(actor), alignTo) - ); + actor.attemptsTo(scrollTo(target.resolveFor(actor), alignTo)); } private Evaluate scrollTo(WebElement element, String alignTo) { Object args; switch (alignTo) { - case "top": - args = Boolean.TRUE; - break; - case "bottom": - args = Boolean.FALSE; - break; - default: - args = centerAlignOptions; - break; + case "top": + args = Boolean.TRUE; + break; + case "bottom": + args = Boolean.FALSE; + break; + default: + args = centerAlignOptions; + break; } - + return Evaluate.javascript("arguments[0].scrollIntoView(arguments[1]);", element, args); } } diff --git a/build-monitor-acceptance/src/test/java/environment/JenkinsSandbox.java b/build-monitor-acceptance/src/test/java/environment/JenkinsSandbox.java index dd91949b9..b25821504 100644 --- a/build-monitor-acceptance/src/test/java/environment/JenkinsSandbox.java +++ b/build-monitor-acceptance/src/test/java/environment/JenkinsSandbox.java @@ -19,13 +19,9 @@ public static TestEnvironment configure() { CWD cwd = CWD.or(System.getProperty("project.root")); List descriptions = new ArrayList<>(); - descriptions.add( - PluginDescription.of( - cwd.resolve("build-monitor-plugin/target/build-monitor-plugin.hpi"))); + descriptions.add(PluginDescription.of(cwd.resolve("build-monitor-plugin/target/build-monitor-plugin.hpi"))); try (Stream stream = - Files.list( - cwd.resolve( - "build-monitor-plugin/target/test-classes/test-dependencies"))) { + Files.list(cwd.resolve("build-monitor-plugin/target/test-classes/test-dependencies"))) { stream.filter(Files::isRegularFile) .filter(p -> p.getFileName().toString().endsWith(".hpi")) .map(PluginDescription::of) @@ -36,7 +32,7 @@ public static TestEnvironment configure() { return new TestEnvironment(new JenkinsInstance(descriptions)) .beforeStart( FindFreePort.useFreePortFromDynamicRange(), - SandboxJenkinsHome.useATemporaryDirectoryUnder(cwd.resolve("build-monitor-acceptance/target/jenkins")) - ); + SandboxJenkinsHome.useATemporaryDirectoryUnder( + cwd.resolve("build-monitor-acceptance/target/jenkins"))); } } diff --git a/build-monitor-acceptance/src/test/java/features/BuildMonitorAcceptanceTest.java b/build-monitor-acceptance/src/test/java/features/BuildMonitorAcceptanceTest.java index dd54821ec..55a051619 100644 --- a/build-monitor-acceptance/src/test/java/features/BuildMonitorAcceptanceTest.java +++ b/build-monitor-acceptance/src/test/java/features/BuildMonitorAcceptanceTest.java @@ -13,17 +13,19 @@ @RunWith(SerenityRunner.class) public abstract class BuildMonitorAcceptanceTest { - @Managed public WebDriver browser; + @Managed + public WebDriver browser; - @Rule public JenkinsInstance jenkins = JenkinsSandbox.configure() + @Rule + public JenkinsInstance jenkins = JenkinsSandbox.configure() .beforeStart(jenkinsBeforeStartRules()) .afterStart(jenkinsAfterStartRules()) .create(); - + protected List> jenkinsBeforeStartRules() { return List.of(); } - + protected List> jenkinsAfterStartRules() { return List.of(); } diff --git a/build-monitor-acceptance/src/test/java/features/BuildMonitorShouldBeEasyToSetUp.java b/build-monitor-acceptance/src/test/java/features/BuildMonitorShouldBeEasyToSetUp.java index 2c4623c00..02457e9a4 100644 --- a/build-monitor-acceptance/src/test/java/features/BuildMonitorShouldBeEasyToSetUp.java +++ b/build-monitor-acceptance/src/test/java/features/BuildMonitorShouldBeEasyToSetUp.java @@ -29,13 +29,12 @@ public void actorCanBrowseTheWeb() { @Title("Adding a project to an empty Build Monitor") public void adding_project_to_an_empty_build_monitor() { - givenThat(anna).wasAbleTo( - Navigate.to(jenkins.url()), - HaveAProjectCreated.called("My Awesome App") - ); + givenThat(anna).wasAbleTo(Navigate.to(jenkins.url()), HaveAProjectCreated.called("My Awesome App")); when(anna).attemptsTo(HaveABuildMonitorViewCreated.showingAllTheProjects()); - then(anna).should(seeThat(ProjectWidget.of("My Awesome App").state(), WebElementStateMatchers.isCurrentlyVisible())); + then(anna) + .should(seeThat( + ProjectWidget.of("My Awesome App").state(), WebElementStateMatchers.isCurrentlyVisible())); } } diff --git a/build-monitor-acceptance/src/test/java/features/ProjectStatusShouldBeEasyToDetermine.java b/build-monitor-acceptance/src/test/java/features/ProjectStatusShouldBeEasyToDetermine.java index 084fbb451..74a864b32 100644 --- a/build-monitor-acceptance/src/test/java/features/ProjectStatusShouldBeEasyToDetermine.java +++ b/build-monitor-acceptance/src/test/java/features/ProjectStatusShouldBeEasyToDetermine.java @@ -29,30 +29,26 @@ public void actorCanBrowseTheWeb() { @Test public void visualising_a_successful_project() { - givenThat(anna).wasAbleTo( - Navigate.to(jenkins.url()), - HaveASuccessfulProjectCreated.called("My App") - ); + givenThat(anna).wasAbleTo(Navigate.to(jenkins.url()), HaveASuccessfulProjectCreated.called("My App")); when(anna).attemptsTo(HaveABuildMonitorViewCreated.showingAllTheProjects()); - then(anna).should(seeThat(ProjectWidget.of("My App").information(), - ProjectInformationMatchers.displaysProjectStatusAs(ProjectStatus.Successful) - )); + then(anna) + .should(seeThat( + ProjectWidget.of("My App").information(), + ProjectInformationMatchers.displaysProjectStatusAs(ProjectStatus.Successful))); } @Test public void visualising_a_failing_project() { - givenThat(anna).wasAbleTo( - Navigate.to(jenkins.url()), - HaveAFailingProjectCreated.called("My App") - ); + givenThat(anna).wasAbleTo(Navigate.to(jenkins.url()), HaveAFailingProjectCreated.called("My App")); when(anna).attemptsTo(HaveABuildMonitorViewCreated.showingAllTheProjects()); - then(anna).should(seeThat(ProjectWidget.of("My App").information(), - ProjectInformationMatchers.displaysProjectStatusAs(ProjectStatus.Failing) - )); + then(anna) + .should(seeThat( + ProjectWidget.of("My App").information(), + ProjectInformationMatchers.displaysProjectStatusAs(ProjectStatus.Failing))); } } diff --git a/build-monitor-acceptance/src/test/java/features/ShouldDescribeEachProject.java b/build-monitor-acceptance/src/test/java/features/ShouldDescribeEachProject.java index 2bf01e808..688c28502 100644 --- a/build-monitor-acceptance/src/test/java/features/ShouldDescribeEachProject.java +++ b/build-monitor-acceptance/src/test/java/features/ShouldDescribeEachProject.java @@ -30,14 +30,15 @@ public void actorCanBrowseTheWeb() { @Test public void displaying_a_custom_build_description() { - givenThat(dave).wasAbleTo( - Navigate.to(jenkins.url()), - HaveAProjectCreated.called("Example Github Project").andConfiguredTo( - ExecuteAShellScript.that(outputsGithubProjectLog()), - SetBuildDescription.to("Revision: \\1").basedOnLogLineMatching("Checking out Revision ([\\w]{6})") - ), - ScheduleABuild.of("Example Github Project") - ); + givenThat(dave) + .wasAbleTo( + Navigate.to(jenkins.url()), + HaveAProjectCreated.called("Example Github Project") + .andConfiguredTo( + ExecuteAShellScript.that(outputsGithubProjectLog()), + SetBuildDescription.to("Revision: \\1") + .basedOnLogLineMatching("Checking out Revision ([\\w]{6})")), + ScheduleABuild.of("Example Github Project")); when(dave).attemptsTo(HaveABuildMonitorViewCreated.showingAllTheProjects()); @@ -45,27 +46,27 @@ public void displaying_a_custom_build_description() { } private ShellScript outputsGithubProjectLog() { - return ShellScript.that("simulates checking out a project from github").andOutputs( - "Started by an SCM change", - "[EnvInject] - Loading node environment variables.", - "Building remotely on 6479ff42 (lxc-fedora17 m1.small small) in workspace /scratch/jenkins/workspace/metricsd", - "Cloning the remote Git repository", - "Cloning repository git@github.com:jan-molak/metricsd.git", - " > git init /scratch/jenkins/workspace/metricsd # timeout=10", - "Fetching upstream changes from git@github.com:jan-molak/metricsd.git", - " > git --version # timeout=10", - " > git -c core.askpass=true fetch --tags --progress git@github.com:jan-molak/metricsd.git +refs/heads/*:refs/remotes/origin/*", - " > git config remote.origin.url git@github.com:jan-molak/metricsd.git # timeout=10", - " > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10", - " > git config remote.origin.url git@github.com:jan-molak/metricsd.git # timeout=10", - "Fetching upstream changes from git@github.com:jan-molak/metricsd.git", - " > git -c core.askpass=true fetch --tags --progress git@github.com:jan-molak/metricsd.git +refs/heads/*:refs/remotes/origin/*", - " > git rev-parse refs/remotes/origin/master^{commit} # timeout=10", - " > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10", - "Checking out Revision 67f4b364e14e4282115d8e518cfe75d86e9d3f2f (refs/remotes/origin/master)", - " > git config core.sparsecheckout # timeout=10", - " > git checkout -f 67f4b364e14e4282115d8e518cfe75d86e9d3f2f", - " > git rev-list be0d664d303bfe3f66e58be1e3f3e723308f5108 # timeout=10" - ); + return ShellScript.that("simulates checking out a project from github") + .andOutputs( + "Started by an SCM change", + "[EnvInject] - Loading node environment variables.", + "Building remotely on 6479ff42 (lxc-fedora17 m1.small small) in workspace /scratch/jenkins/workspace/metricsd", + "Cloning the remote Git repository", + "Cloning repository git@github.com:jan-molak/metricsd.git", + " > git init /scratch/jenkins/workspace/metricsd # timeout=10", + "Fetching upstream changes from git@github.com:jan-molak/metricsd.git", + " > git --version # timeout=10", + " > git -c core.askpass=true fetch --tags --progress git@github.com:jan-molak/metricsd.git +refs/heads/*:refs/remotes/origin/*", + " > git config remote.origin.url git@github.com:jan-molak/metricsd.git # timeout=10", + " > git config --add remote.origin.fetch +refs/heads/*:refs/remotes/origin/* # timeout=10", + " > git config remote.origin.url git@github.com:jan-molak/metricsd.git # timeout=10", + "Fetching upstream changes from git@github.com:jan-molak/metricsd.git", + " > git -c core.askpass=true fetch --tags --progress git@github.com:jan-molak/metricsd.git +refs/heads/*:refs/remotes/origin/*", + " > git rev-parse refs/remotes/origin/master^{commit} # timeout=10", + " > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10", + "Checking out Revision 67f4b364e14e4282115d8e518cfe75d86e9d3f2f (refs/remotes/origin/master)", + " > git config core.sparsecheckout # timeout=10", + " > git checkout -f 67f4b364e14e4282115d8e518cfe75d86e9d3f2f", + " > git rev-list be0d664d303bfe3f66e58be1e3f3e723308f5108 # timeout=10"); } -} \ No newline at end of file +} diff --git a/build-monitor-acceptance/src/test/java/features/ShouldDisplayBadges.java b/build-monitor-acceptance/src/test/java/features/ShouldDisplayBadges.java index 04d409b9f..ad240763b 100644 --- a/build-monitor-acceptance/src/test/java/features/ShouldDisplayBadges.java +++ b/build-monitor-acceptance/src/test/java/features/ShouldDisplayBadges.java @@ -36,69 +36,60 @@ public void actorCanBrowseTheWeb() { @Test public void user_displaying_build_badges() { - givenThat(paul).wasAbleTo( - Navigate.to(jenkins.url()), - HaveAPipelineProjectCreated.called("My App").andConfiguredTo( - SetPipelineDefinition.asFollows(GroovyScriptThat.Adds_A_Badge.code()) - ), - - ScheduleABuild.of("My App"), - CreateABuildMonitorView.called("Build Monitor").andConfigureItTo( - DisplayAllProjects.usingARegularExpression(), - DisplayBadges.asAUserSetting(), - DisplayBadgesFrom.theLastBuild() - ) - ); + givenThat(paul) + .wasAbleTo( + Navigate.to(jenkins.url()), + HaveAPipelineProjectCreated.called("My App") + .andConfiguredTo(SetPipelineDefinition.asFollows(GroovyScriptThat.Adds_A_Badge.code())), + ScheduleABuild.of("My App"), + CreateABuildMonitorView.called("Build Monitor") + .andConfigureItTo( + DisplayAllProjects.usingARegularExpression(), + DisplayBadges.asAUserSetting(), + DisplayBadgesFrom.theLastBuild())); when(paul).attemptsTo(ModifyControlPanelOptions.to(ShowBadges.onTheDashboard())); - then(paul).should(seeThat(ProjectWidget.of("My App").badges(), - WebElementStateMatchers.isCurrentlyVisible() - )); + then(paul).should(seeThat(ProjectWidget.of("My App").badges(), WebElementStateMatchers.isCurrentlyVisible())); } @Test public void always_displaying_build_badges() { - givenThat(paul).wasAbleTo( - Navigate.to(jenkins.url()), - HaveAPipelineProjectCreated.called("My App").andConfiguredTo( - SetPipelineDefinition.asFollows(GroovyScriptThat.Adds_A_Badge.code()) - ), - ScheduleABuild.of("My App"), - CreateABuildMonitorView.called("Build Monitor").andConfigureItTo( - DisplayAllProjects.usingARegularExpression(), - ConfigureViewSettings.toggleShowBadges(), - DisplayBadges.always(), - DisplayBadgesFrom.theLastBuild() - ) - ); + givenThat(paul) + .wasAbleTo( + Navigate.to(jenkins.url()), + HaveAPipelineProjectCreated.called("My App") + .andConfiguredTo(SetPipelineDefinition.asFollows(GroovyScriptThat.Adds_A_Badge.code())), + ScheduleABuild.of("My App"), + CreateABuildMonitorView.called("Build Monitor") + .andConfigureItTo( + DisplayAllProjects.usingARegularExpression(), + ConfigureViewSettings.toggleShowBadges(), + DisplayBadges.always(), + DisplayBadgesFrom.theLastBuild())); when(paul).attemptsTo(ModifyControlPanelOptions.to(HideBadges.onTheDashboard())); - then(paul).should(seeThat(ProjectWidget.of("My App").badges(), - WebElementStateMatchers.isCurrentlyVisible() - )); + then(paul).should(seeThat(ProjectWidget.of("My App").badges(), WebElementStateMatchers.isCurrentlyVisible())); } @Test public void never_displaying_build_badges() { - givenThat(paul).wasAbleTo( - Navigate.to(jenkins.url()), - HaveAPipelineProjectCreated.called("My App").andConfiguredTo( - SetPipelineDefinition.asFollows(GroovyScriptThat.Adds_A_Badge.code()) - ), - ScheduleABuild.of("My App"), - CreateABuildMonitorView.called("Build Monitor").andConfigureItTo( - DisplayAllProjects.usingARegularExpression(), - DisplayBadges.never(), - DisplayBadgesFrom.theLastBuild() - ) - ); + givenThat(paul) + .wasAbleTo( + Navigate.to(jenkins.url()), + HaveAPipelineProjectCreated.called("My App") + .andConfiguredTo(SetPipelineDefinition.asFollows(GroovyScriptThat.Adds_A_Badge.code())), + ScheduleABuild.of("My App"), + CreateABuildMonitorView.called("Build Monitor") + .andConfigureItTo( + DisplayAllProjects.usingARegularExpression(), + DisplayBadges.never(), + DisplayBadgesFrom.theLastBuild())); when(paul).attemptsTo(ModifyControlPanelOptions.to(ShowBadges.onTheDashboard())); - then(paul).should(seeThat(ProjectWidget.of("My App").badges(), - WebElementStateMatchers.isNotCurrentlyVisible() - )); + then(paul) + .should(seeThat(ProjectWidget.of("My App").badges(), WebElementStateMatchers.isNotCurrentlyVisible())); } } diff --git a/build-monitor-acceptance/src/test/java/features/ShouldDisplayConcurrentBuilds.java b/build-monitor-acceptance/src/test/java/features/ShouldDisplayConcurrentBuilds.java index b14993535..31abd18cc 100644 --- a/build-monitor-acceptance/src/test/java/features/ShouldDisplayConcurrentBuilds.java +++ b/build-monitor-acceptance/src/test/java/features/ShouldDisplayConcurrentBuilds.java @@ -31,16 +31,15 @@ public void actorCanBrowseTheWeb() { @Test public void displaying_concurrent_builds() { - givenThat(dave).wasAbleTo( - Navigate.to(jenkins.url()), - HaveAProjectCreated.called(My_App).andConfiguredTo( - Enable.executingConcurrentBuilds(), - ExecuteAShellScript.that(sleepsFor(300)) - ), - ScheduleABuild.of(My_App), - Navigate.to(jenkins.url()), - ScheduleABuild.of(My_App) - ); + givenThat(dave) + .wasAbleTo( + Navigate.to(jenkins.url()), + HaveAProjectCreated.called(My_App) + .andConfiguredTo( + Enable.executingConcurrentBuilds(), ExecuteAShellScript.that(sleepsFor(300))), + ScheduleABuild.of(My_App), + Navigate.to(jenkins.url()), + ScheduleABuild.of(My_App)); when(dave).attemptsTo(HaveABuildMonitorViewCreated.showingAllTheProjects()); @@ -48,8 +47,6 @@ public void displaying_concurrent_builds() { } private ShellScript sleepsFor(int seconds) { - return ShellScript.that("simulates executing a build").definedAs( - String.format("sleep %d;", seconds) - ); + return ShellScript.that("simulates executing a build").definedAs(String.format("sleep %d;", seconds)); } -} \ No newline at end of file +} diff --git a/build-monitor-acceptance/src/test/java/features/ShouldDisplayPipelineStage.java b/build-monitor-acceptance/src/test/java/features/ShouldDisplayPipelineStage.java index 8029c50d9..5afb77e95 100644 --- a/build-monitor-acceptance/src/test/java/features/ShouldDisplayPipelineStage.java +++ b/build-monitor-acceptance/src/test/java/features/ShouldDisplayPipelineStage.java @@ -28,20 +28,15 @@ public void actorCanBrowseTheWeb() { @Test public void displaying_current_pipeline_stage() { - givenThat(donald).wasAbleTo( - Navigate.to(jenkins.url()), - HaveAPipelineProjectCreated.called("My Pipeline").andConfiguredTo( - SetPipelineDefinition.asFollows("stage('Compile') { sleep 50 }") - ), - - ScheduleABuild.of("My Pipeline") - ); + givenThat(donald) + .wasAbleTo( + Navigate.to(jenkins.url()), + HaveAPipelineProjectCreated.called("My Pipeline") + .andConfiguredTo(SetPipelineDefinition.asFollows("stage('Compile') { sleep 50 }")), + ScheduleABuild.of("My Pipeline")); when(donald).attemptsTo(HaveABuildMonitorViewCreated.showingAllTheProjects()); - then(donald).should(seeThat(ProjectWidget.of("My Pipeline").pipelineStages(), - containsString("[Compile]") - )); + then(donald).should(seeThat(ProjectWidget.of("My Pipeline").pipelineStages(), containsString("[Compile]"))); } - } diff --git a/build-monitor-acceptance/src/test/java/features/ShouldDisplayTestProgress.java b/build-monitor-acceptance/src/test/java/features/ShouldDisplayTestProgress.java index 733a29786..508e38fe7 100644 --- a/build-monitor-acceptance/src/test/java/features/ShouldDisplayTestProgress.java +++ b/build-monitor-acceptance/src/test/java/features/ShouldDisplayTestProgress.java @@ -32,27 +32,26 @@ public void actorCanBrowseTheWeb() { @Test public void display_tests_progress_bar() { - givenThat(richard).wasAbleTo( - Navigate.to(jenkins.url()), - HaveAPipelineProjectCreated.called("My Pipeline").andConfiguredTo( - SetPipelineDefinition.asFollows(GroovyScriptThat.Pause_In_Middle_Of_Tests.code()), - Disable.executingConcurrentBuilds() - ), - - ScheduleABuild.of("My Pipeline"), - Navigate.to(jenkins.url()), - ScheduleABuild.of("My Pipeline") - ); - - when(richard).attemptsTo(CreateABuildMonitorView.called("Build Monitor").andConfigureItTo( - DisplayAllProjects.usingARegularExpression(), - DisplayJunitRealtimeProgress.bars() - )); - - - then(richard).should(seeThat(ProjectWidget.of("My Pipeline").testProgressBars(), - WebElementStateMatchers.isCurrentlyVisible() - )); + givenThat(richard) + .wasAbleTo( + Navigate.to(jenkins.url()), + HaveAPipelineProjectCreated.called("My Pipeline") + .andConfiguredTo( + SetPipelineDefinition.asFollows( + GroovyScriptThat.Pause_In_Middle_Of_Tests.code()), + Disable.executingConcurrentBuilds()), + ScheduleABuild.of("My Pipeline"), + Navigate.to(jenkins.url()), + ScheduleABuild.of("My Pipeline")); + + when(richard) + .attemptsTo(CreateABuildMonitorView.called("Build Monitor") + .andConfigureItTo( + DisplayAllProjects.usingARegularExpression(), DisplayJunitRealtimeProgress.bars())); + + then(richard) + .should(seeThat( + ProjectWidget.of("My Pipeline").testProgressBars(), + WebElementStateMatchers.isCurrentlyVisible())); } - } diff --git a/build-monitor-acceptance/src/test/java/features/ShouldSupportCloudBeesFolders.java b/build-monitor-acceptance/src/test/java/features/ShouldSupportCloudBeesFolders.java index 85b611bf1..417287c8e 100644 --- a/build-monitor-acceptance/src/test/java/features/ShouldSupportCloudBeesFolders.java +++ b/build-monitor-acceptance/src/test/java/features/ShouldSupportCloudBeesFolders.java @@ -30,25 +30,28 @@ public void actorCanBrowseTheWeb() { @Test public void visualising_projects_nested_in_folders() { - givenThat(anna).wasAbleTo( - Navigate.to(jenkins.url()), - HaveAFolderCreated.called("Search Services").andInsideIt( - HaveANestedProjectCreated.called("Librarian"), - HaveAFolderCreated.called("Contracts").andInsideIt( - HaveANestedProjectCreated.called("Third Party System") - ) - ), - Navigate.to(jenkins.url()) - ); - - when(anna).attemptsTo( - CreateABuildMonitorView.called("Build Monitor").andConfigureItTo( - DisplayAllProjects.usingARegularExpression(), - DisplayNestedProjects.fromSubfolders() - ) - ); - - then(anna).should(seeThat(ProjectWidget.of("Search Services » Librarian").state(), WebElementStateMatchers.isVisible())); - then(anna).should(seeThat(ProjectWidget.of("Search Services » Contracts » Third Party System").state(), WebElementStateMatchers.isVisible())); + givenThat(anna) + .wasAbleTo( + Navigate.to(jenkins.url()), + HaveAFolderCreated.called("Search Services") + .andInsideIt( + HaveANestedProjectCreated.called("Librarian"), + HaveAFolderCreated.called("Contracts") + .andInsideIt(HaveANestedProjectCreated.called("Third Party System"))), + Navigate.to(jenkins.url())); + + when(anna) + .attemptsTo(CreateABuildMonitorView.called("Build Monitor") + .andConfigureItTo( + DisplayAllProjects.usingARegularExpression(), DisplayNestedProjects.fromSubfolders())); + + then(anna) + .should(seeThat( + ProjectWidget.of("Search Services » Librarian").state(), WebElementStateMatchers.isVisible())); + then(anna) + .should(seeThat( + ProjectWidget.of("Search Services » Contracts » Third Party System") + .state(), + WebElementStateMatchers.isVisible())); } } diff --git a/build-monitor-acceptance/src/test/java/features/ShouldSupportExternalProjects.java b/build-monitor-acceptance/src/test/java/features/ShouldSupportExternalProjects.java index b36a2a13f..a4d91716a 100644 --- a/build-monitor-acceptance/src/test/java/features/ShouldSupportExternalProjects.java +++ b/build-monitor-acceptance/src/test/java/features/ShouldSupportExternalProjects.java @@ -24,25 +24,23 @@ public class ShouldSupportExternalProjects extends BuildMonitorAcceptanceTest { @Before public void actorCanBrowseTheWeb() { - maggie.can(BrowseTheWeb.with(browser)) - .can(InteractWithJenkinsAPI.using(jenkins.client())); + maggie.can(BrowseTheWeb.with(browser)).can(InteractWithJenkinsAPI.using(jenkins.client())); } @Test public void visualising_an_external_project() { - givenThat(maggie).wasAbleTo( - Navigate.to(jenkins.url()), - HaveAnExternalProjectCreated.called("external-project") - ); + givenThat(maggie) + .wasAbleTo(Navigate.to(jenkins.url()), HaveAnExternalProjectCreated.called("external-project")); - when(maggie).attemptsTo( - NotifyOfExternalProject.successOf("external-project"), - HaveABuildMonitorViewCreated.showingAllTheProjects() - ); + when(maggie) + .attemptsTo( + NotifyOfExternalProject.successOf("external-project"), + HaveABuildMonitorViewCreated.showingAllTheProjects()); - then(maggie).should(seeThat(ProjectWidget.of("external-project").information(), - ProjectInformationMatchers.displaysProjectStatusAs(ProjectStatus.Successful) - )); + then(maggie) + .should(seeThat( + ProjectWidget.of("external-project").information(), + ProjectInformationMatchers.displaysProjectStatusAs(ProjectStatus.Successful))); } } diff --git a/build-monitor-acceptance/src/test/java/features/ShouldTellWhatBrokeTheBuild.java b/build-monitor-acceptance/src/test/java/features/ShouldTellWhatBrokeTheBuild.java index 8df4ccb9a..97c5566cd 100644 --- a/build-monitor-acceptance/src/test/java/features/ShouldTellWhatBrokeTheBuild.java +++ b/build-monitor-acceptance/src/test/java/features/ShouldTellWhatBrokeTheBuild.java @@ -27,16 +27,16 @@ public void actorCanBrowseTheWeb() { @Test public void displaying_potential_failure_cause() { - givenThat(dave).wasAbleTo( - Navigate.to(jenkins.url()), - HaveAShellScriptFailureCauseDefined.called("Rogue AI").describedAs("Pod bay doors didn't open"), - HaveAFailingProjectCreated.called("Discovery One") - ); + givenThat(dave) + .wasAbleTo( + Navigate.to(jenkins.url()), + HaveAShellScriptFailureCauseDefined.called("Rogue AI").describedAs("Pod bay doors didn't open"), + HaveAFailingProjectCreated.called("Discovery One")); when(dave).attemptsTo(HaveABuildMonitorViewCreated.showingAllTheProjects()); - then(dave).should(seeThat(ProjectWidget.of("Discovery One").details(), - containsString("Identified problem: Rogue AI") - )); + then(dave) + .should(seeThat( + ProjectWidget.of("Discovery One").details(), containsString("Identified problem: Rogue AI"))); } } diff --git a/build-monitor-acceptance/src/test/java/features/ShouldTellWhoIsFixingTheBrokenBuild.java b/build-monitor-acceptance/src/test/java/features/ShouldTellWhoIsFixingTheBrokenBuild.java index 21adc9878..7899b5285 100644 --- a/build-monitor-acceptance/src/test/java/features/ShouldTellWhoIsFixingTheBrokenBuild.java +++ b/build-monitor-acceptance/src/test/java/features/ShouldTellWhoIsFixingTheBrokenBuild.java @@ -28,6 +28,7 @@ public class ShouldTellWhoIsFixingTheBrokenBuild extends BuildMonitorAcceptanceT JenkinsUser ben; + @Override protected List> jenkinsAfterStartRules() { ben = JenkinsUser.named("Ben"); return List.of(RegisterUserAccount.of(ben)); @@ -40,19 +41,24 @@ public void actorCanBrowseTheWeb() { @Test public void claiming_a_broken_build() { - givenThat(ben).wasAbleTo( - Navigate.to(jenkins.url()), - LogIn.as(ben), - HaveAFailingClaimableProjectCreated.called("Responsibly Developed") - ); - - when(ben).attemptsTo( - HaveABuildMonitorViewCreated.showingAllTheProjects(), - Claim.lastBrokenBuildOf("Responsibly Developed").saying("My bad, fixing now"), - GoBack.to("Build Monitor") - ); - - then(ben).should(seeThat(ProjectWidget.of("Responsibly Developed").information(), ProjectInformationMatchers.displaysProjectStatusAs(ProjectStatus.Claimed))); - then(ben).should(seeThat(ProjectWidget.of("Responsibly Developed").details(), is("Claimed by Ben: My bad, fixing now"))); + givenThat(ben) + .wasAbleTo( + Navigate.to(jenkins.url()), + LogIn.as(ben), + HaveAFailingClaimableProjectCreated.called("Responsibly Developed")); + + when(ben) + .attemptsTo( + HaveABuildMonitorViewCreated.showingAllTheProjects(), + Claim.lastBrokenBuildOf("Responsibly Developed").saying("My bad, fixing now"), + GoBack.to("Build Monitor")); + + then(ben) + .should(seeThat( + ProjectWidget.of("Responsibly Developed").information(), + ProjectInformationMatchers.displaysProjectStatusAs(ProjectStatus.Claimed))); + then(ben) + .should(seeThat( + ProjectWidget.of("Responsibly Developed").details(), is("Claimed by Ben: My bad, fixing now"))); } } diff --git a/build-monitor-acceptance/src/test/java/net/serenitybdd/integration/jenkins/environment/UpdateCenterUnitTest.java b/build-monitor-acceptance/src/test/java/net/serenitybdd/integration/jenkins/environment/UpdateCenterUnitTest.java index 816a1a7b9..8f56f1abb 100644 --- a/build-monitor-acceptance/src/test/java/net/serenitybdd/integration/jenkins/environment/UpdateCenterUnitTest.java +++ b/build-monitor-acceptance/src/test/java/net/serenitybdd/integration/jenkins/environment/UpdateCenterUnitTest.java @@ -1,26 +1,26 @@ -package net.serenitybdd.integration.jenkins.environment; - -import org.junit.Assert; -import org.junit.Test; - -public class UpdateCenterUnitTest { - - private UpdateCenter updateCenter = new UpdateCenter(); - - @Test(expected = RuntimeException.class) - public void getUpdateVersionToUseTooLow() { - String versionToUse = updateCenter.getUpdateVersionToUse("2.280"); - } - - @Test - public void getUpdateVersionToUse() { - // Exact version - Assert.assertEquals("2.346.2", updateCenter.getUpdateVersionToUse("2.346.2")); - // Higher patch - Assert.assertEquals("2.346.3", updateCenter.getUpdateVersionToUse("2.346.9999")); - // Higher minor - Assert.assertEquals("2.361.4", updateCenter.getUpdateVersionToUse("2.362.0")); - // Higher major - Assert.assertEquals("2.375.4", updateCenter.getUpdateVersionToUse("3.1.0")); - } -} \ No newline at end of file +package net.serenitybdd.integration.jenkins.environment; + +import org.junit.Assert; +import org.junit.Test; + +public class UpdateCenterUnitTest { + + private UpdateCenter updateCenter = new UpdateCenter(); + + @Test(expected = RuntimeException.class) + public void getUpdateVersionToUseTooLow() { + String versionToUse = updateCenter.getUpdateVersionToUse("2.280"); + } + + @Test + public void getUpdateVersionToUse() { + // Exact version + Assert.assertEquals("2.346.2", updateCenter.getUpdateVersionToUse("2.346.2")); + // Higher patch + Assert.assertEquals("2.346.3", updateCenter.getUpdateVersionToUse("2.346.9999")); + // Higher minor + Assert.assertEquals("2.361.4", updateCenter.getUpdateVersionToUse("2.362.0")); + // Higher major + Assert.assertEquals("2.375.4", updateCenter.getUpdateVersionToUse("3.1.0")); + } +} diff --git a/build-monitor-plugin/.mvn_exec_spotless b/build-monitor-plugin/.mvn_exec_spotless new file mode 100644 index 000000000..e69de29bb diff --git a/build-monitor-plugin/pom.xml b/build-monitor-plugin/pom.xml index 29ec3d867..56b41f294 100644 --- a/build-monitor-plugin/pom.xml +++ b/build-monitor-plugin/pom.xml @@ -1,231 +1,212 @@ - - 4.0.0 - - org.jenkins-ci.plugins - build-monitor - ${revision}-${changelist} - - - build-monitor-plugin - hpi - - Build Monitor View - - Provides a highly visible view of the status of selected Jenkins jobs. - It easily accommodates different computer screen sizes and is ideal as an Extreme Feedback Device to be - displayed on a screen on your office wall. - - - - - MIT license - All source code is under the MIT license. - - - - https://github.com/jenkinsci/build-monitor-plugin - - - - jan-molak - Jan Molak - jan.molak+build.monitor@smartcodeltd.co.uk - smartcode ltd - http://smartcodeltd.co.uk - Europe/London - - - - - - - - - - 18.14.2 - 9.5.0 - 2.43.0 - DEV - - - - - - repo.jenkins-ci.org - https://repo.jenkins-ci.org/public/ - - - - - - repo.jenkins-ci.org - https://repo.jenkins-ci.org/public/ - - - - - - maven.jenkins-ci.org - https://repo.jenkins-ci.org/releases/ - - - - - - - io.jenkins.tools.bom - bom-2.361.x - 1981.v17df70e84a_a_1 - import - pom - - - - + + 4.0.0 + + org.jenkins-ci.plugins + build-monitor + ${revision}-${changelist} + + + build-monitor-plugin + hpi + Build Monitor View + Provides a highly visible view of the status of selected Jenkins jobs. It easily accommodates different computer screen sizes and is ideal as an Extreme Feedback Device to be displayed on a screen on your office wall. + https://github.com/jenkinsci/build-monitor-plugin + + + + MIT license + All source code is under the MIT license. + + + + + + jan-molak + Jan Molak + jan.molak+build.monitor@smartcodeltd.co.uk + smartcode ltd + http://smartcodeltd.co.uk + Europe/London + + + + + + maven.jenkins-ci.org + https://repo.jenkins-ci.org/releases/ + + + + + 18.14.2 + 9.5.0 + 2.43.0 + DEV + + + - - org.jenkins-ci.plugins - jackson2-api - - - - org.jenkins-ci.modules - instance-identity - - - - - org.jenkins-ci.plugins - cloudbees-folder - true - - - org.jenkins-ci.plugins - credentials - true - - - com.sonyericsson.jenkins.plugins.bfa - build-failure-analyzer - 2.4.1 - true - - - org.jenkins-ci.plugins - claim - 516.v36293563731d - true - - - org.jenkins-ci.plugins - view-job-filters - 2.3 - true - - - org.jenkins-ci.plugins - badge - 1.9.1 - true - - - org.jenkins-ci.plugins.workflow - workflow-cps - true - - - org.jenkins-ci.plugins.workflow - workflow-job - true - - - org.jenkins-ci.plugins.workflow - workflow-step-api - true - - - org.jenkins-ci.plugins - pipeline-stage-step - true - - - org.jenkins-ci.plugins - scm-api - test - - - org.jenkins-ci.plugins - structs - test - - - org.jenkins-ci.plugins - script-security - test - - - org.jenkins-ci.plugins - junit-realtime-test-reporter - 90.v7dc2c937f9a_8 - true - - - - org.jenkins-ci.plugins - description-setter - 1.10 - test - - - org.jenkins-ci.plugins - external-monitor-job - 203.v683c09d993b_9 - test - - - org.jenkins-ci.plugins.workflow - workflow-basic-steps - test - - - io.jenkins - configuration-as-code - test - - - io.jenkins.configuration-as-code - test-harness - test - - - - - org.mockito - mockito-inline - test - + + io.jenkins.tools.bom + bom-2.361.x + 1981.v17df70e84a_a_1 + pom + import + - - - - - com.github.klieber - phantomjs-maven-plugin - 0.7 - - - process-test-resources - - install - - - - - 1.9.7 - - - - + + + + + com.sonyericsson.jenkins.plugins.bfa + build-failure-analyzer + 2.4.1 + true + + + org.jenkins-ci.modules + instance-identity + + + org.jenkins-ci.plugins + badge + 1.9.1 + true + + + org.jenkins-ci.plugins + claim + 516.v36293563731d + true + + + org.jenkins-ci.plugins + cloudbees-folder + true + + + org.jenkins-ci.plugins + credentials + true + + + org.jenkins-ci.plugins + jackson2-api + + + org.jenkins-ci.plugins + junit-realtime-test-reporter + 90.v7dc2c937f9a_8 + true + + + org.jenkins-ci.plugins + pipeline-stage-step + true + + + org.jenkins-ci.plugins + view-job-filters + 2.3 + true + + + org.jenkins-ci.plugins.workflow + workflow-cps + true + + + org.jenkins-ci.plugins.workflow + workflow-job + true + + + org.jenkins-ci.plugins.workflow + workflow-step-api + true + + + io.jenkins + configuration-as-code + test + + + io.jenkins.configuration-as-code + test-harness + test + + + org.jenkins-ci.plugins + description-setter + 1.10 + test + + + org.jenkins-ci.plugins + external-monitor-job + 203.v683c09d993b_9 + test + + + org.jenkins-ci.plugins + scm-api + test + + + org.jenkins-ci.plugins + script-security + test + + + org.jenkins-ci.plugins + structs + test + + + org.jenkins-ci.plugins.workflow + workflow-basic-steps + test + + + org.mockito + mockito-inline + test + + + + + + repo.jenkins-ci.org + https://repo.jenkins-ci.org/public/ + + + + + + repo.jenkins-ci.org + https://repo.jenkins-ci.org/public/ + + + + + + + com.github.klieber + phantomjs-maven-plugin + 0.7 + + 1.9.7 + + + + + install + + process-test-resources + + + + + diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/BuildMonitorLogger.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/BuildMonitorLogger.java index 80dcb6652..a1446b589 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/BuildMonitorLogger.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/BuildMonitorLogger.java @@ -24,7 +24,6 @@ public void warning(String sourceMethod, String template, Object... arguments) { public void error(String sourceMethod, String template, Object... arguments) { log(Level.SEVERE, sourceMethod, template, arguments); - } // -- diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/BuildMonitorView.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/BuildMonitorView.java index ee8a8a930..3877a5ad4 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/BuildMonitorView.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/BuildMonitorView.java @@ -85,7 +85,7 @@ public String getCsrfCrumbFieldName() { public String currentOrder() { return currentConfig().getOrder().getClass().getSimpleName(); } - + @SuppressWarnings("unused") // used in the configure-entries.jelly form public String currentbuildFailureAnalyzerDisplayedField() { return currentConfig().getBuildFailureAnalyzerDisplayedField().getValue(); @@ -152,10 +152,9 @@ public BuildMonitorInstallation getInstallation() { public boolean collectAnonymousUsageStatistics() { return descriptor.getPermissionToCollectAnonymousUsageStatistics(); } - + @Override - protected void initColumns() { - } + protected void initColumns() {} @Override protected void submit(StaplerRequest req) throws ServletException, IOException, FormException { @@ -164,21 +163,21 @@ protected void submit(StaplerRequest req) throws ServletException, IOException, JSONObject json = req.getSubmittedForm(); synchronized (this) { - String requestedOrdering = req.getParameter("order"); String displayBadgesFrom = req.getParameter("displayBadgesFrom"); - title = req.getParameter("title"); - String maxColumns = req.getParameter("maxColumns"); - String textScale = req.getParameter("textScale"); + title = req.getParameter("title"); + String maxColumns = req.getParameter("maxColumns"); + String textScale = req.getParameter("textScale"); currentConfig().setColourBlindMode(json.optBoolean("colourBlindMode", false)); currentConfig().setReduceMotion(json.optBoolean("reduceMotion", false)); currentConfig().setShowBadges(json.optBoolean("showBadges", true)); currentConfig().setDisplayBadges(req.getParameter("displayBadges")); currentConfig().setDisplayCommitters(json.optBoolean("displayCommitters", true)); - currentConfig().setBuildFailureAnalyzerDisplayedField(req.getParameter("buildFailureAnalyzerDisplayedField")); + currentConfig() + .setBuildFailureAnalyzerDisplayedField(req.getParameter("buildFailureAnalyzerDisplayedField")); currentConfig().setDisplayJUnitProgress(json.optBoolean("displayJUnitProgress", true)); - + try { currentConfig().setOrder(orderIn(requestedOrdering)); } catch (Exception e) { @@ -188,13 +187,16 @@ protected void submit(StaplerRequest req) throws ServletException, IOException, try { currentConfig().setMaxColumns(Integer.parseInt(maxColumns)); } catch (Exception e) { - throw new FormException("Invalid value of 'Maximum number of columns': '" + maxColumns + "' (should be double).", maxColumns); + throw new FormException( + "Invalid value of 'Maximum number of columns': '" + maxColumns + "' (should be double).", + maxColumns); } try { currentConfig().setTextScale(Double.parseDouble(textScale)); } catch (Exception e) { - throw new FormException("Invalid value of 'Text scale': '" + textScale + "' (should be double).", textScale); + throw new FormException( + "Invalid value of 'Text scale': '" + textScale + "' (should be double).", textScale); } try { @@ -218,14 +220,14 @@ public JSONObject fetchJobViews() throws Exception { // -- private boolean isGiven(String value) { - return ! (value == null || "".equals(value)); + return !(value == null || "".equals(value)); } private List jobViews() { JobViews views = new JobViews(new StaticJenkinsAPIs(), currentConfig()); - //A little bit of evil to make the type system happy. - @SuppressWarnings({ "unchecked", "rawtypes" }) + // A little bit of evil to make the type system happy. + @SuppressWarnings({"unchecked", "rawtypes"}) List> projects = new ArrayList(Util.filter(super.getItems(), Job.class)); List jobs = new ArrayList<>(); @@ -255,8 +257,7 @@ private List jobViews() { private Config currentConfig() { if (creatingAFreshView()) { config = Config.defaultConfig(); - } - else if (deserailisingFromAnOlderFormat()) { + } else if (deserailisingFromAnOlderFormat()) { migrateFromOldToNewConfigFormat(); } @@ -285,17 +286,22 @@ private void migrateFromOldToNewConfigFormat() { private Comparator> orderIn(String requestedOrdering) throws ReflectiveOperationException { String packageName = this.getClass().getPackage().getName() + ".order."; - return (Comparator>) Class.forName(packageName + requestedOrdering).getDeclaredConstructor().newInstance(); + return (Comparator>) Class.forName(packageName + requestedOrdering) + .getDeclaredConstructor() + .newInstance(); } private GetBuildViewModel getBuildViewModelIn(String requestedBuild) throws ReflectiveOperationException { String packageName = this.getClass().getPackage().getName() + ".build."; - return (GetBuildViewModel) Class.forName(packageName + requestedBuild).getDeclaredConstructor().newInstance(); + return (GetBuildViewModel) Class.forName(packageName + requestedBuild) + .getDeclaredConstructor() + .newInstance(); } private Config config; @Deprecated // use Config instead - private Comparator> order; // note: this field can be removed when people stop using versions prior to 1.6+build.150 + private Comparator> + order; // note: this field can be removed when people stop using versions prior to 1.6+build.150 } diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/Config.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/Config.java index de2546228..3e7cb4a40 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/Config.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/Config.java @@ -19,7 +19,7 @@ public class Config { private GetBuildViewModel displayBadgesFrom; private BuildFailureAnalyzerDisplayedField buildFailureAnalyzerDisplayedField; private Boolean displayJUnitProgress; - + public static Config defaultConfig() { return new Config(); } @@ -39,13 +39,14 @@ public static Config defaultConfig() { public void setOrder(Comparator> order) { this.order = order; } - + public BuildFailureAnalyzerDisplayedField getBuildFailureAnalyzerDisplayedField() { return Optional.ofNullable(buildFailureAnalyzerDisplayedField).orElse(BuildFailureAnalyzerDisplayedField.Name); } - + public void setBuildFailureAnalyzerDisplayedField(String buildFailureAnalyzerDisplayedField) { - this.buildFailureAnalyzerDisplayedField = BuildFailureAnalyzerDisplayedField.valueOf(buildFailureAnalyzerDisplayedField); + this.buildFailureAnalyzerDisplayedField = + BuildFailureAnalyzerDisplayedField.valueOf(buildFailureAnalyzerDisplayedField); } public boolean colourBlindMode() { @@ -55,7 +56,7 @@ public boolean colourBlindMode() { public void setColourBlindMode(boolean flag) { this.colourBlindMode = flag; } - + public boolean shouldDisplayCommitters() { return Optional.ofNullable(displayCommitters).orElse(true); } @@ -79,7 +80,7 @@ public boolean showBadges() { public void setShowBadges(boolean flag) { this.showBadges = flag; } - + public DisplayOptions getDisplayBadges() { return Optional.ofNullable(displayBadges).orElse(DisplayOptions.UserSetting); } @@ -87,7 +88,7 @@ public DisplayOptions getDisplayBadges() { public void setDisplayBadges(String option) { this.displayBadges = DisplayOptions.valueOf(option); } - + public GetBuildViewModel getDisplayBadgesFrom() { return Optional.ofNullable(displayBadgesFrom).orElse(new GetLastBuild()); } @@ -131,20 +132,27 @@ public enum BuildFailureAnalyzerDisplayedField { Name("name"), Description("description"), None("none"); - + private final String value; + BuildFailureAnalyzerDisplayedField(String value) { this.value = value; } - - public String getValue() { return value; } - + + public String getValue() { + return value; + } + @Override - public String toString() { return value; } + public String toString() { + return value; + } } - + public enum DisplayOptions { - Always, Never, UserSetting + Always, + Never, + UserSetting } private Comparator> order; diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/build/GetLastBuild.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/build/GetLastBuild.java index 4a4e92523..f4e5f5e1e 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/build/GetLastBuild.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/build/GetLastBuild.java @@ -9,5 +9,4 @@ public class GetLastBuild implements GetBuildViewModel { public BuildViewModel from(JobView job) { return job.lastBuild(); } - } diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/build/GetLastCompletedBuild.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/build/GetLastCompletedBuild.java index 8ad3eaadd..62218940b 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/build/GetLastCompletedBuild.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/build/GetLastCompletedBuild.java @@ -9,5 +9,4 @@ public class GetLastCompletedBuild implements GetBuildViewModel { public BuildViewModel from(JobView job) { return job.lastCompletedBuild(); } - } diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/culprits/BuildCulpritsAbstractBuild.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/culprits/BuildCulpritsAbstractBuild.java index 432dd69bb..76d6d4d26 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/culprits/BuildCulpritsAbstractBuild.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/culprits/BuildCulpritsAbstractBuild.java @@ -22,7 +22,6 @@ public Set getCulprits(Run run) { .collect(Collectors.toCollection(TreeSet::new)); } - @Override @SuppressFBWarnings("RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE") protected Set getCommittersForRun(Run run) { diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/culprits/BuildCulpritsNotImplemented.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/culprits/BuildCulpritsNotImplemented.java index 723f1177a..3854580f0 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/culprits/BuildCulpritsNotImplemented.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/culprits/BuildCulpritsNotImplemented.java @@ -5,7 +5,7 @@ public class BuildCulpritsNotImplemented extends BuildCulpritsRetriever { - BuildCulpritsNotImplemented() { } + BuildCulpritsNotImplemented() {} @Override public Set getCulprits(Run run) { diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/culprits/BuildCulpritsRetriever.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/culprits/BuildCulpritsRetriever.java index 6ac43e0de..2f84eb7d2 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/culprits/BuildCulpritsRetriever.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/culprits/BuildCulpritsRetriever.java @@ -28,7 +28,7 @@ public static BuildCulpritsRetriever getInstanceForRun(Run run, StaticJenk public Set getCommitters(Run run) { Set committers = getCommittersForRun(run); - //If no committers were found, recursively get upstream committers: + // If no committers were found, recursively get upstream committers: if (committers.isEmpty()) { Cause.UpstreamCause upstreamCause = run.getCause(Cause.UpstreamCause.class); if (upstreamCause != null) { diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/culprits/BuildCulpritsWorkflowRun.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/culprits/BuildCulpritsWorkflowRun.java index 0d11c83ca..9a740eed6 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/culprits/BuildCulpritsWorkflowRun.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/culprits/BuildCulpritsWorkflowRun.java @@ -17,10 +17,10 @@ class BuildCulpritsWorkflowRun extends BuildCulpritsRetriever { public Set getCulprits(Run run) { WorkflowRun workflowRun = (WorkflowRun) run; Set culprits = new TreeSet<>(); - //Workaround while waiting for https://issues.jenkins-ci.org/browse/JENKINS-24141 + // Workaround while waiting for https://issues.jenkins-ci.org/browse/JENKINS-24141 WorkflowRun previous = workflowRun.getPreviousCompletedBuild(); if (workflowRun.isBuilding()) { - //We are currently building so add culprits from previous build (if any) + // We are currently building so add culprits from previous build (if any) if (previous != null) { Result previousResult = previous.getResult(); if (previousResult != null && previousResult.isWorseThan(Result.SUCCESS)) { @@ -30,7 +30,7 @@ public Set getCulprits(Run run) { } culprits.addAll(getCommitters(workflowRun)); - //Get culprits from earlier builds + // Get culprits from earlier builds if (previous != null && previous.getPreviousNotFailedBuild() != null) { culprits.addAll(getCulpritsForRun(previous.getPreviousNotFailedBuild(), previous)); } diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/facade/RelativeLocation.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/facade/RelativeLocation.java index 6c2cf88bb..a2b1b9877 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/facade/RelativeLocation.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/facade/RelativeLocation.java @@ -20,8 +20,8 @@ public String name() { ItemGroup ig = null; StaplerRequest request = Stapler.getCurrentRequest(); - for( Ancestor a : request.getAncestors() ) { - if(a.getObject() instanceof BuildMonitorView) { + for (Ancestor a : request.getAncestors()) { + if (a.getObject() instanceof BuildMonitorView) { ig = ((View) a.getObject()).getOwner().getItemGroup(); } } @@ -33,7 +33,6 @@ public String url() { return Functions.getRelativeLinkTo(job); } - private RelativeLocation(Job job) { this.job = job; } diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/facade/StaticJenkinsAPIs.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/facade/StaticJenkinsAPIs.java index 351bd9e5b..85559fdb3 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/facade/StaticJenkinsAPIs.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/facade/StaticJenkinsAPIs.java @@ -14,9 +14,14 @@ public boolean isDevelopmentMode() { return Main.isUnitTest || Main.isDevelopmentMode; } - @SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE", justification = "PageDecoratorImpl is part of Jenkins core and should never be null") + @SuppressFBWarnings( + value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE", + justification = "PageDecoratorImpl is part of Jenkins core and should never be null") public String encodedPublicKey() { - return Jenkins.get().getExtensionList(PageDecorator.class).get(PageDecoratorImpl.class).getEncodedPublicKey(); + return Jenkins.get() + .getExtensionList(PageDecorator.class) + .get(PageDecoratorImpl.class) + .getEncodedPublicKey(); } public int numberOfUsers() { @@ -28,8 +33,8 @@ public String crumbFieldName() { Jenkins instance = Jenkins.get(); if (instance.isUseCrumbs()) { - CrumbIssuer crumbIssuer = instance.getCrumbIssuer(); - if (crumbIssuer == null) { + CrumbIssuer crumbIssuer = instance.getCrumbIssuer(); + if (crumbIssuer == null) { throw new RuntimeException("No CrumbIssuer found"); } return crumbIssuer.getCrumbRequestField(); diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/installation/Audience.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/installation/Audience.java index 45a30a429..f1de11788 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/installation/Audience.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/installation/Audience.java @@ -5,12 +5,17 @@ public enum Audience { EndUsers("users"); private final String name; + Audience(String name) { this.name = name; } - public String getValue() { return name; } + public String getValue() { + return name; + } @Override - public String toString() { return name; } -} \ No newline at end of file + public String toString() { + return name; + } +} diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/installation/BuildMonitorInstallation.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/installation/BuildMonitorInstallation.java index 6bffa2b40..5cab7260d 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/installation/BuildMonitorInstallation.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/installation/BuildMonitorInstallation.java @@ -14,7 +14,7 @@ public BuildMonitorInstallation() { } public BuildMonitorInstallation(StaticJenkinsAPIs jenkinsAPIs) { - this.jenkins = jenkinsAPIs; + this.jenkins = jenkinsAPIs; } /** @@ -36,7 +36,7 @@ public int size() { } public Audience audience() { - return (jenkins.isDevelopmentMode() || buildMonitorVersion().contains("SNAPSHOT")) + return jenkins.isDevelopmentMode() || buildMonitorVersion().contains("SNAPSHOT") ? Audience.BuildMonitorDevelopers : Audience.EndUsers; } @@ -44,4 +44,4 @@ public Audience audience() { public String buildMonitorVersion() { return jenkins.getPluginVersion("build-monitor-plugin"); } -} \ No newline at end of file +} diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/order/ByEstimatedDuration.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/order/ByEstimatedDuration.java index 9892d72cc..8e60c37c0 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/order/ByEstimatedDuration.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/order/ByEstimatedDuration.java @@ -8,7 +8,7 @@ public class ByEstimatedDuration implements Comparator>, Serializable { @Override - public int compare(AbstractProject a, AbstractProject b) { + public int compare(AbstractProject a, AbstractProject b) { return compareEstimatedDuration(a, b); } @@ -20,7 +20,7 @@ public int compare(AbstractProject a, AbstractProject b) { private long getTotalEstimatedDuration(AbstractProject project) { long time = project.getEstimatedDuration(); - if(!project.getUpstreamProjects().isEmpty()) { + if (!project.getUpstreamProjects().isEmpty()) { List upStreamProjects = project.getUpstreamProjects(); for (AbstractProject upStreamProject : upStreamProjects) { time += getTotalEstimatedDuration((AbstractProject) upStreamProject); @@ -31,6 +31,5 @@ private long getTotalEstimatedDuration(AbstractProject project) { private int compareEstimatedDuration(AbstractProject a, AbstractProject b) { return Long.compare(getTotalEstimatedDuration(a), getTotalEstimatedDuration(b)); - } } diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/order/ByLastBuildTime.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/order/ByLastBuildTime.java index 333e5f6cb..34375222b 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/order/ByLastBuildTime.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/order/ByLastBuildTime.java @@ -13,22 +13,22 @@ public class ByLastBuildTime implements Comparator>, Serializable { @Override public int compare(Job a, Job b) { - // none of them executed - if (a.getLastBuild() == null && b.getLastBuild() == null) { - return 0; - } + // none of them executed + if (a.getLastBuild() == null && b.getLastBuild() == null) { + return 0; + } - // only job B executed, so job A is older than job B - if (a.getLastBuild() == null && b.getLastBuild() != null) { - return 1; - } + // only job B executed, so job A is older than job B + if (a.getLastBuild() == null && b.getLastBuild() != null) { + return 1; + } - // only job A executed, so job A is newer than Job B - if (a.getLastBuild() != null && b.getLastBuild() == null) { - return -1; - } + // only job A executed, so job A is newer than Job B + if (a.getLastBuild() != null && b.getLastBuild() == null) { + return -1; + } - // "New is always better" - B. Stinson ;-) + // "New is always better" - B. Stinson ;-) return b.getLastBuild().getTimestamp().compareTo(a.getLastBuild().getTimestamp()); } -} \ No newline at end of file +} diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/order/ByName.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/order/ByName.java index a0ac94846..34c8e1e43 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/order/ByName.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/order/ByName.java @@ -6,7 +6,7 @@ public class ByName implements Comparator>, Serializable { @Override - public int compare(Job a, Job b) { + public int compare(Job a, Job b) { return a.getName().compareToIgnoreCase(b.getName()); } } diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/order/ByStatus.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/order/ByStatus.java index 95b904cef..592895b03 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/order/ByStatus.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/order/ByStatus.java @@ -9,9 +9,7 @@ public class ByStatus implements Comparator>, Serializable { @Override public int compare(Job a, Job b) { - return bothProjectsHaveBuildHistory(a, b) - ? compareRecentlyCompletedBuilds(a, b) - : compareProjects(a, b); + return bothProjectsHaveBuildHistory(a, b) ? compareRecentlyCompletedBuilds(a, b) : compareProjects(a, b); } // -- @@ -51,4 +49,4 @@ private int compareRecentlyCompletedBuilds(Job a, Job b) { return 0; } } -} \ No newline at end of file +} diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/pipeline/BreadthFirstNodeTraversal.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/pipeline/BreadthFirstNodeTraversal.java index 3f3a99e9b..eb868bcb8 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/pipeline/BreadthFirstNodeTraversal.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/pipeline/BreadthFirstNodeTraversal.java @@ -39,4 +39,4 @@ public void start(List nodes) { public List getStages() { return new ArrayList<>(stages); } -} \ No newline at end of file +} diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/pipeline/PipelineHelper.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/pipeline/PipelineHelper.java index f9ff37874..9ac265b1f 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/pipeline/PipelineHelper.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/pipeline/PipelineHelper.java @@ -16,7 +16,7 @@ public class PipelineHelper { private PipelineHelper() {} public static boolean isWorkflowRun(Run build, StaticJenkinsAPIs staticJenkinsAPIs) { - //Cache class lookup + // Cache class lookup if (hasWorkflowClass == null) { if (!staticJenkinsAPIs.hasPlugin(PIPELINE_PLUGIN)) { hasWorkflowClass = false; diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/pipeline/WorkflowNodeTraversal.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/pipeline/WorkflowNodeTraversal.java index 3e062777a..50a611de9 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/pipeline/WorkflowNodeTraversal.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/pipeline/WorkflowNodeTraversal.java @@ -9,7 +9,9 @@ public class WorkflowNodeTraversal extends BreadthFirstNodeTraversal { @Override - @SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE", justification = "Descriptor should never be null") + @SuppressFBWarnings( + value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE", + justification = "Descriptor should never be null") protected boolean isStageStep(FlowNode node) { return node instanceof StepStartNode && ((StepStartNode) node).getDescriptor().isSubTypeOf(StageStep.class); diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/readability/Lister.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/readability/Lister.java index d5ac794e6..e0d7aac30 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/readability/Lister.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/readability/Lister.java @@ -13,11 +13,15 @@ public static String describe(String noItemsTemplate, String pluralTemplate, return describe(noItemsTemplate, pluralTemplate, pluralTemplate, items); } - public static String describe(String noItemsTemplate, String singularTemplate, String pluralTemplate, List items) { + public static String describe( + String noItemsTemplate, String singularTemplate, String pluralTemplate, List items) { switch (items.size()) { - case 0: return formatted(noItemsTemplate, items); - case 1: return formatted(singularTemplate, items); - default: return formatted(pluralTemplate, items); + case 0: + return formatted(noItemsTemplate, items); + case 1: + return formatted(singularTemplate, items); + default: + return formatted(pluralTemplate, items); } } @@ -32,10 +36,13 @@ private static String formatted(String template, List items) { } private static String asString(String acc, List tail) { - switch(tail.size()) { - case 0: return acc; - case 1: return and(acc, headOf(tail)); - default: return asString(comma(acc, headOf(tail)), restOf(tail)); + switch (tail.size()) { + case 0: + return acc; + case 1: + return and(acc, headOf(tail)); + default: + return asString(comma(acc, headOf(tail)), restOf(tail)); } } diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/readability/Pluraliser.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/readability/Pluraliser.java index 0d0c8e568..9ae8b28a0 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/readability/Pluraliser.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/readability/Pluraliser.java @@ -6,14 +6,11 @@ public static String pluralise(String template, int count) { } public static String pluralise(String singularTemplate, String pluralTemplate, int count) { - return count == 1 - ? pluralise(singularTemplate, count) - : pluralise(pluralTemplate, count); + return count == 1 ? pluralise(singularTemplate, count) : pluralise(pluralTemplate, count); } - public static String pluralise(String zeroCountTemplate, String singularTemplate, String pluralTemplate, int count) { - return count == 0 - ? pluralise(zeroCountTemplate, count) - : pluralise(singularTemplate, pluralTemplate, count); + public static String pluralise( + String zeroCountTemplate, String singularTemplate, String pluralTemplate, int count) { + return count == 0 ? pluralise(zeroCountTemplate, count) : pluralise(singularTemplate, pluralTemplate, count); } } diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/BuildView.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/BuildView.java index 480fa2262..bfb7a50cc 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/BuildView.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/BuildView.java @@ -17,7 +17,7 @@ public class BuildView implements BuildViewModel { - private final Run build; + private final Run build; private final boolean isPipeline; private final RelativeLocation parentJobLocation; private final Date systemTime; @@ -28,7 +28,8 @@ static BuildView of(Run build) { return new BuildView(build, false, RelativeLocation.of(build.getParent()), new Date()); } - public static BuildView of(Run build, boolean isPipeline, RelativeLocation parentJobLocation, Date systemTime) { + public static BuildView of( + Run build, boolean isPipeline, RelativeLocation parentJobLocation, Date systemTime) { return new BuildView(build, isPipeline, parentJobLocation, systemTime); } @@ -79,7 +80,7 @@ public Duration estimatedDuration() { @Override public int progress() { - if (! isRunning()) { + if (!isRunning()) { return 0; } @@ -87,8 +88,7 @@ public int progress() { return 100; } - long elapsedTime = now() - whenTheBuildStarted(), - estimatedDuration = build.getEstimatedDuration(); + long elapsedTime = now() - whenTheBuildStarted(), estimatedDuration = build.getEstimatedDuration(); if (estimatedDuration > 0) { return (int) ((float) elapsedTime / (float) estimatedDuration * 100); @@ -143,7 +143,7 @@ public Set committers() { public Optional detailsOf(Class jenkinsAction) { return Optional.ofNullable(build.getAction(jenkinsAction)); } - + @Override public List allDetailsOf(Class jenkinsAction) { return build.getActions(jenkinsAction); @@ -162,7 +162,6 @@ private long whenTheBuildStarted() { return build.getTimestamp().getTimeInMillis(); } - private BuildView(Run build, boolean isPipeline, RelativeLocation parentJobLocation, Date systemTime) { this.build = build; this.isPipeline = isPipeline; diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/BuildViewModel.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/BuildViewModel.java index ccba3ec9c..2189a4218 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/BuildViewModel.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/BuildViewModel.java @@ -9,26 +9,38 @@ public interface BuildViewModel { String name(); + String url(); + Result result(); boolean isRunning(); + Duration elapsedTime(); + Duration timeElapsedSince(); + Duration duration(); + Duration estimatedDuration(); + int progress(); + String description(); boolean isPipeline(); + List pipelineStages(); boolean hasPreviousBuild(); + BuildViewModel previousBuild(); Set culprits(); + Set committers(); Optional detailsOf(Class jenkinsAction); + List allDetailsOf(Class jenkinsAction); } diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/BuildingPredicate.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/BuildingPredicate.java index 34ed61997..5b4dc8b95 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/BuildingPredicate.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/BuildingPredicate.java @@ -6,17 +6,15 @@ public final class BuildingPredicate implements Predicate> { - public static final BuildingPredicate INSTANCE = new BuildingPredicate(); - - private BuildingPredicate() { - } - - @Override - public boolean test(@Nullable Run run) { - if (run == null) { - throw new RuntimeException("Run was null"); - } - return run.isBuilding(); - } + public static final BuildingPredicate INSTANCE = new BuildingPredicate(); + private BuildingPredicate() {} + + @Override + public boolean test(@Nullable Run run) { + if (run == null) { + throw new RuntimeException("Run was null"); + } + return run.isBuilding(); + } } diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/JobView.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/JobView.java index 6a86e41d4..6e2698a89 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/JobView.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/JobView.java @@ -29,11 +29,12 @@ public static JobView of(Job job, List features, boolean isPipeli return new JobView(job, features, isPipelineJob, RelativeLocation.of(job), new Date()); } - public JobView(Job job, List features, boolean isPipelineJob, RelativeLocation relative, Date systemTime) { - this.job = job; + public JobView( + Job job, List features, boolean isPipelineJob, RelativeLocation relative, Date systemTime) { + this.job = job; this.isPipelineJob = isPipelineJob; - this.relative = relative; - this.systemTime = systemTime; + this.relative = relative; + this.systemTime = systemTime; for (Feature feature : features) { this.features.add(feature.of(this)); @@ -51,7 +52,8 @@ public F which(Class requestedFeature) { } } - throw new RuntimeException(String.format("%s is not a feature of this project: '%s'", requestedFeature.getSimpleName(), job.getName())); + throw new RuntimeException(String.format( + "%s is not a feature of this project: '%s'", requestedFeature.getSimpleName(), job.getName())); } public String name() { @@ -75,9 +77,7 @@ public String timeElapsedSinceLastBuild() { } private String formatted(Duration duration) { - return null != duration - ? duration.value() - : ""; + return null != duration ? duration.value() : ""; } public int progress() { @@ -85,7 +85,7 @@ public int progress() { } public boolean isDisabled() { - return ! (isJobBuildable() || isJobExternal()); + return !(isJobBuildable() || isJobExternal()); } private boolean isJobBuildable() { @@ -105,6 +105,7 @@ public Result lastResult() { } // todo track by job.hashCode messes up the animation + @Override public int hashCode() { return Objects.hashCode(job.hashCode()); } @@ -122,15 +123,15 @@ public String toString() { // -- @SuppressWarnings("unchecked") - public List currentBuilds() { - List currentBuilds = new ArrayList<>(); - - RunList> runList = ((RunList>)job.getNewBuilds()).filter(BuildingPredicate.INSTANCE); - - for (Run run : runList) { - currentBuilds.add(buildViewOf(run)); - } - + public List currentBuilds() { + List currentBuilds = new ArrayList<>(); + + RunList> runList = ((RunList>) job.getNewBuilds()).filter(BuildingPredicate.INSTANCE); + + for (Run run : runList) { + currentBuilds.add(buildViewOf(run)); + } + return currentBuilds; } @@ -154,4 +155,4 @@ private BuildViewModel buildViewOf(Run build) { return BuildView.of(build, isPipelineJob, relative, systemTime); } -} \ No newline at end of file +} diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/JobViewSerialiser.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/JobViewSerialiser.java index 6ded4b459..3284af0cf 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/JobViewSerialiser.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/JobViewSerialiser.java @@ -13,12 +13,12 @@ public class JobViewSerialiser extends JsonSerializer { @Override public void serialize(JobView job, JsonGenerator jgen, SerializerProvider provider) throws IOException { jgen.writeStartObject(); - jgen.writeObjectField("name", job.name()); - jgen.writeObjectField("url", job.url()); - jgen.writeObjectField("status", job.status()); - jgen.writeObjectField("hashCode", job.hashCode()); - jgen.writeObjectField("progress", job.progress()); - jgen.writeObjectField("estimatedDuration", job.estimatedDuration()); + jgen.writeObjectField("name", job.name()); + jgen.writeObjectField("url", job.url()); + jgen.writeObjectField("status", job.status()); + jgen.writeObjectField("hashCode", job.hashCode()); + jgen.writeObjectField("progress", job.progress()); + jgen.writeObjectField("estimatedDuration", job.estimatedDuration()); for (Feature feature : job.features()) { Object serialised = feature.asJson(); diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/JobViews.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/JobViews.java index a8704b7ca..a09659926 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/JobViews.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/JobViews.java @@ -21,18 +21,18 @@ * @author Jan Molak */ public class JobViews { - private static final String Claim = "claim"; - private static final String Build_Failure_Analyzer = "build-failure-analyzer"; - private static final String Badge_Plugin = "badge"; - private static final String Pipeline = "workflow-job"; - private static final String Junit_Realtime = "junit-realtime-test-reporter"; + private static final String Claim = "claim"; + private static final String Build_Failure_Analyzer = "build-failure-analyzer"; + private static final String Badge_Plugin = "badge"; + private static final String Pipeline = "workflow-job"; + private static final String Junit_Realtime = "junit-realtime-test-reporter"; private final StaticJenkinsAPIs jenkins; private final com.smartcodeltd.jenkinsci.plugins.buildmonitor.Config config; public JobViews(StaticJenkinsAPIs jenkins, com.smartcodeltd.jenkinsci.plugins.buildmonitor.Config config) { this.jenkins = jenkins; - this.config = config; + this.config = config; } public JobView viewOf(Job job) { diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/NullBuildView.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/NullBuildView.java index 390ce48f7..2f10a79b8 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/NullBuildView.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/NullBuildView.java @@ -96,8 +96,8 @@ public Optional detailsOf(Class jenkinsAction) { return Optional.empty(); } - @Override - public List allDetailsOf(Class jenkinsAction) { - return new ArrayList<>(); - } + @Override + public List allDetailsOf(Class jenkinsAction) { + return new ArrayList<>(); + } } diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/duration/Duration.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/duration/Duration.java index 53c4b8d90..bdb6c7dff 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/duration/Duration.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/duration/Duration.java @@ -8,7 +8,7 @@ public Duration(long milliseconds) { this.duration = milliseconds; } - abstract public String value(); + public abstract String value(); public boolean greaterThan(Duration otherDuration) { return duration > otherDuration.toLong(); @@ -17,4 +17,4 @@ public boolean greaterThan(Duration otherDuration) { private long toLong() { return duration; } -} \ No newline at end of file +} diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/duration/HumanReadableDuration.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/duration/HumanReadableDuration.java index 3f4b8768a..9193e5743 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/duration/HumanReadableDuration.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/duration/HumanReadableDuration.java @@ -1,6 +1,7 @@ package com.smartcodeltd.jenkinsci.plugins.buildmonitor.viewmodel.duration; -// todo: is this still needed? backend could pass the duration in milliseconds to the frontend, which in turn could make it human-readable +// todo: is this still needed? backend could pass the duration in milliseconds to the frontend, which in turn could make +// it human-readable public class HumanReadableDuration extends Duration { private static final long MILLISECOND = 1; private static final long SECONDS = 1000 * MILLISECOND; @@ -27,7 +28,7 @@ private long seconds() { public String value() { String formatted; - formatted = hours() > 0 ? hours() + "h " : ""; + formatted = hours() > 0 ? hours() + "h " : ""; formatted += minutes() > 0 ? minutes() + "m " : ""; formatted += seconds() + "s"; diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/CanBeClaimed.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/CanBeClaimed.java index 4f061972a..92c5a2849 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/CanBeClaimed.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/CanBeClaimed.java @@ -20,7 +20,6 @@ public Claim asJson() { Optional details = job.lastCompletedBuild().detailsOf(ClaimBuildAction.class); return details.map(Claim::new).orElse(null); // `null` because we don't want to serialise an empty object - } public static class Claim { diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/CanBeDiagnosedForProblems.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/CanBeDiagnosedForProblems.java index c450f0e30..06645b34f 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/CanBeDiagnosedForProblems.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/CanBeDiagnosedForProblems.java @@ -12,11 +12,11 @@ public class CanBeDiagnosedForProblems implements Feature { private JobView job; private BuildFailureAnalyzerDisplayedField displayedField; - + public CanBeDiagnosedForProblems(BuildFailureAnalyzerDisplayedField displayedField) { this.displayedField = displayedField; } - + @Override public CanBeDiagnosedForProblems of(JobView jobView) { this.job = jobView; @@ -28,9 +28,10 @@ public CanBeDiagnosedForProblems of(JobView jobView) { public Problems asJson() { Optional details = job.lastCompletedBuild().detailsOf(FailureCauseBuildAction.class); - return details.map(failureCauseBuildAction -> new Problems(failureCauseBuildAction, displayedField)).orElse(null); // `null` because we don't want to serialise an empty object + return details.map(failureCauseBuildAction -> new Problems(failureCauseBuildAction, displayedField)) + .orElse(null); // `null` because we don't want to serialise an empty object } - + public static class Problems { private final List failures = new ArrayList<>(); @@ -38,7 +39,9 @@ public static class Problems { public Problems(FailureCauseBuildAction action, BuildFailureAnalyzerDisplayedField displayedField) { if (displayedField != BuildFailureAnalyzerDisplayedField.None) { for (FoundFailureCause failure : action.getFoundFailureCauses()) { - String str = displayedField == BuildFailureAnalyzerDisplayedField.Description ? failure.getDescription() : failure.getName(); + String str = displayedField == BuildFailureAnalyzerDisplayedField.Description + ? failure.getDescription() + : failure.getName(); if (str != null) { failures.add(str); } diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasBadgesBadgePlugin.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasBadgesBadgePlugin.java index 8b7b3ed80..0901868f0 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasBadgesBadgePlugin.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasBadgesBadgePlugin.java @@ -31,11 +31,13 @@ public HasBadgesBadgePlugin of(JobView jobView) { @Override public Badges asJson() { - Iterator badges = config.getDisplayBadgesFrom().from(job).allDetailsOf(BadgeAction.class).stream().filter(filter).iterator(); + Iterator badges = config.getDisplayBadgesFrom().from(job).allDetailsOf(BadgeAction.class).stream() + .filter(filter) + .iterator(); return badges.hasNext() - ? new Badges(badges) - : null; // `null` because we don't want to serialise an empty object + ? new Badges(badges) + : null; // `null` because we don't want to serialise an empty object } public static class Badges { @@ -92,5 +94,4 @@ public boolean test(BadgeAction action) { return action.getIconPath() == null; } } - } diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasConfig.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasConfig.java index 593d6d41a..832f7d08e 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasConfig.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasConfig.java @@ -32,5 +32,4 @@ public final String displayBadges() { return config.getDisplayBadges().name(); } } - } diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasHeadline.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasHeadline.java index aeee8e06a..7c5003026 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasHeadline.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasHeadline.java @@ -39,12 +39,12 @@ public Headline asJson() { private CandidateHeadline headlineOf(final JobView job) { List availableHeadlines = new ArrayList<>(); - Collections.addAll(availableHeadlines, + Collections.addAll( + availableHeadlines, new HeadlineOfExecuting(job, config), new HeadlineOfAborted(job, config), new HeadlineOfFixed(job, config), - new HeadlineOfFailing(job, config) - ); + new HeadlineOfFailing(job, config)); return availableHeadlines.stream() .filter(candidateHeadline -> candidateHeadline.isApplicableTo(job)) diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasJunitRealtime.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasJunitRealtime.java index 2632bb7ef..8e0b2fa05 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasJunitRealtime.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasJunitRealtime.java @@ -18,8 +18,7 @@ public class HasJunitRealtime implements Feature private ActionFilter filter = new ActionFilter(); private JobView job; - public HasJunitRealtime() { - } + public HasJunitRealtime() {} @Override public HasJunitRealtime of(JobView jobView) { @@ -37,10 +36,12 @@ public RealtimeTests asJson() { BuildViewModel build = builds.get(0); Iterator details = - build.allDetailsOf(AbstractRealtimeTestResultAction.class).stream().filter(filter).iterator(); + build.allDetailsOf(AbstractRealtimeTestResultAction.class).stream() + .filter(filter) + .iterator(); return details.hasNext() ? new RealtimeTests(details) : null; // `null` because we don't want to serialise an - // empty object + // empty object } public static class RealtimeTests { @@ -75,10 +76,12 @@ public String getEstimatedRemainingTime() { @JsonProperty public int[] getCompletedPercentages() { - int value1 = Math.min(testProgress.getCompletedTestsPercentage(), testProgress.getCompletedTimePercentage()); - int value2 = Math.max(testProgress.getCompletedTestsPercentage(), testProgress.getCompletedTimePercentage()); + int value1 = + Math.min(testProgress.getCompletedTestsPercentage(), testProgress.getCompletedTimePercentage()); + int value2 = + Math.max(testProgress.getCompletedTestsPercentage(), testProgress.getCompletedTimePercentage()); - return new int[] { value1, value2 - value1}; + return new int[] {value1, value2 - value1}; } @JsonProperty @@ -109,5 +112,4 @@ public boolean test(AbstractRealtimeTestResultAction action) { return action.getTestProgress() != null; } } - } diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/KnowsCurrentBuildsDetails.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/KnowsCurrentBuildsDetails.java index beb848dce..9b891e72b 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/KnowsCurrentBuildsDetails.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/KnowsCurrentBuildsDetails.java @@ -14,8 +14,7 @@ public class KnowsCurrentBuildsDetails implements Feature { private JobView job; - public KnowsCurrentBuildsDetails(/* config */) { - } + public KnowsCurrentBuildsDetails(/* config */ ) {} @Override public KnowsCurrentBuildsDetails of(JobView jobView) { @@ -30,9 +29,7 @@ public CurrentBuilds asJson() { } private static String formattedDuration(Duration duration) { - return null != duration - ? duration.value() - : ""; + return null != duration ? duration.value() : ""; } private static String formattedStages(List stages) { @@ -51,10 +48,10 @@ public CurrentBuilds(List currentBuilds) { } } - @JsonValue - public List value() { - return List.copyOf(builds); - } + @JsonValue + public List value() { + return List.copyOf(builds); + } } public static class CurrentBuild { diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/KnowsLastCompletedBuildDetails.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/KnowsLastCompletedBuildDetails.java index 014562602..08e0da39e 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/KnowsLastCompletedBuildDetails.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/KnowsLastCompletedBuildDetails.java @@ -11,8 +11,7 @@ public class KnowsLastCompletedBuildDetails implements Feature { private JobView job; - public KnowsLastCompletedBuildDetails(/* config */) { - } + public KnowsLastCompletedBuildDetails(/* config */ ) {} @Override public KnowsLastCompletedBuildDetails of(JobView jobView) { @@ -27,9 +26,7 @@ public LastCompletedBuild asJson() { } private static String formatted(Duration duration) { - return null != duration - ? duration.value() - : ""; + return null != duration ? duration.value() : ""; } public static class LastCompletedBuild { diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/headline/HeadlineOfExecuting.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/headline/HeadlineOfExecuting.java index 0f04de614..595714010 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/headline/HeadlineOfExecuting.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/headline/HeadlineOfExecuting.java @@ -27,16 +27,10 @@ public Headline asJson() { } private String text(BuildViewModel build) { - return Lister.describe( - "", - "Building %s's changes", - new ArrayList<>(committersOf(build)) - ); + return Lister.describe("", "Building %s's changes", new ArrayList<>(committersOf(build))); } private Set committersOf(BuildViewModel build) { - return config.displayCommitters - ? build.committers() - : new HashSet<>(); + return config.displayCommitters ? build.committers() : new HashSet<>(); } } diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/headline/HeadlineOfFailing.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/headline/HeadlineOfFailing.java index a2b54e392..8ccac9b22 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/headline/HeadlineOfFailing.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/headline/HeadlineOfFailing.java @@ -24,7 +24,8 @@ public HeadlineOfFailing(JobView job, HeadlineConfig config) { @Override public boolean isApplicableTo(JobView job) { - return Result.FAILURE.equals(job.lastCompletedBuild().result()) || Result.UNSTABLE.equals(job.lastCompletedBuild().result()); + return Result.FAILURE.equals(job.lastCompletedBuild().result()) + || Result.UNSTABLE.equals(job.lastCompletedBuild().result()); } @Override @@ -35,21 +36,16 @@ public Headline asJson() { private String text(BuildViewModel lastBuild) { List failedBuildsNewestToOldest = failedBuildsSince(lastBuild); - String buildsFailedSoFar = Pluraliser.pluralise( - "%s build has failed", - "%s builds have failed", - failedBuildsNewestToOldest.size() - ); + String buildsFailedSoFar = + Pluraliser.pluralise("%s build has failed", "%s builds have failed", failedBuildsNewestToOldest.size()); - BuildViewModel firstFailedBuild = failedBuildsNewestToOldest.isEmpty() - ? lastBuild - : getLast(failedBuildsNewestToOldest); + BuildViewModel firstFailedBuild = + failedBuildsNewestToOldest.isEmpty() ? lastBuild : getLast(failedBuildsNewestToOldest); return Lister.describe( buildsFailedSoFar, buildsFailedSoFar + " since %s committed their changes", - new LinkedList<>(responsibleFor(firstFailedBuild)) - ); + new LinkedList<>(responsibleFor(firstFailedBuild))); } private static T getLast(List list) { @@ -64,13 +60,13 @@ private List failedBuildsSince(BuildViewModel build) { List failedBuilds = new ArrayList<>(); - while (! Result.SUCCESS.equals(currentBuild.result())) { + while (!Result.SUCCESS.equals(currentBuild.result())) { - if (! currentBuild.isRunning()) { + if (!currentBuild.isRunning()) { failedBuilds.add(currentBuild); } - if (! currentBuild.hasPreviousBuild()) { + if (!currentBuild.hasPreviousBuild()) { break; } @@ -81,8 +77,6 @@ private List failedBuildsSince(BuildViewModel build) { } private Set responsibleFor(BuildViewModel build) { - return config.displayCommitters - ? build.culprits() - : new HashSet<>(); + return config.displayCommitters ? build.culprits() : new HashSet<>(); } } diff --git a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/headline/HeadlineOfFixed.java b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/headline/HeadlineOfFixed.java index 881b7163d..f8e98469e 100644 --- a/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/headline/HeadlineOfFixed.java +++ b/build-monitor-plugin/src/main/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/headline/HeadlineOfFixed.java @@ -33,8 +33,7 @@ private String textFor(BuildViewModel lastBuild) { return Lister.describe( "Back in the green!", "Fixed after %s committed their changes :-)", - new LinkedList<>(committersOf(lastBuild)) - ); + new LinkedList<>(committersOf(lastBuild))); } private boolean didTheJobJustGetFixedWith(BuildViewModel build) { @@ -42,13 +41,13 @@ private boolean didTheJobJustGetFixedWith(BuildViewModel build) { } private boolean previousFailed(BuildViewModel build) { - return build.hasPreviousBuild() && - (Result.FAILURE.equals(build.previousBuild().result()) || Result.UNSTABLE.equals(build.previousBuild().result()) || Result.ABORTED.equals(build.previousBuild().result())); + return build.hasPreviousBuild() + && (Result.FAILURE.equals(build.previousBuild().result()) + || Result.UNSTABLE.equals(build.previousBuild().result()) + || Result.ABORTED.equals(build.previousBuild().result())); } private Set committersOf(BuildViewModel build) { - return config.displayCommitters - ? build.committers() - : new HashSet<>(); + return config.displayCommitters ? build.committers() : new HashSet<>(); } } diff --git a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/BuildMonitorDescriptorTest.java b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/BuildMonitorDescriptorTest.java index 738b59e5e..6cab3ca10 100644 --- a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/BuildMonitorDescriptorTest.java +++ b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/BuildMonitorDescriptorTest.java @@ -16,7 +16,8 @@ public class BuildMonitorDescriptorTest { private BuildMonitorDescriptor validator; - @Rule public final JenkinsRule jenkins = new JenkinsRule(); + @Rule + public final JenkinsRule jenkins = new JenkinsRule(); @Before public void setUp() { @@ -45,4 +46,4 @@ private String htmlDecoded(String message) { private String itShouldAllow(String regex) { return "should allow " + regex; } -} \ No newline at end of file +} diff --git a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/installation/BuildMonitorInstallationTest.java b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/installation/BuildMonitorInstallationTest.java index e76745ad5..d7830d68e 100644 --- a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/installation/BuildMonitorInstallationTest.java +++ b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/installation/BuildMonitorInstallationTest.java @@ -12,14 +12,15 @@ import org.junit.Test; public class BuildMonitorInstallationTest { - public static final String PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlEPjwjG6Q3ILlr91qlSxvvys046hUrhFmc8ibz9WvWEJKVs5dS/mCnRV4QFg4w3qoCH2lzuoSNHB7tWBYQXj1ZtbDiwjnFNYw1TyZBL43m2bRYQGjpcvHAUB6u07C7mmoehpaYoFkpJbLEYEGXsKV/0bY22n00cZHwoTGl5biGVX8gvNKq604pK97jdVuBNZeXiOMXS00Yrwv8tgWeRDIUhUCO8T4rj0bBULh1Pyg/aJBsts7z5RydB+Nb5OZfAfaklVTpFld+ZHMjt0Q7VYhkMkbBD+ZFRkHvRNqg2q7wdQFScGGx7G2RstUtcIPv5Ga36fj1okDU6c2vyPHErTuwIDAQAB"; + public static final String PUBLIC_KEY = + "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlEPjwjG6Q3ILlr91qlSxvvys046hUrhFmc8ibz9WvWEJKVs5dS/mCnRV4QFg4w3qoCH2lzuoSNHB7tWBYQXj1ZtbDiwjnFNYw1TyZBL43m2bRYQGjpcvHAUB6u07C7mmoehpaYoFkpJbLEYEGXsKV/0bY22n00cZHwoTGl5biGVX8gvNKq604pK97jdVuBNZeXiOMXS00Yrwv8tgWeRDIUhUCO8T4rj0bBULh1Pyg/aJBsts7z5RydB+Nb5OZfAfaklVTpFld+ZHMjt0Q7VYhkMkbBD+ZFRkHvRNqg2q7wdQFScGGx7G2RstUtcIPv5Ga36fj1okDU6c2vyPHErTuwIDAQAB"; @Test public void helps_to_avoid_duplicated_stats_and_keep_jenkins_instance_anonymous() { BuildMonitorInstallation installation = new BuildMonitorInstallation(withPublicKey(PUBLIC_KEY)); assertThat(installation.anonymousCorrelationId(), is(not(PUBLIC_KEY))); - assertThat(installation.anonymousCorrelationId().length(), is(64)); // sha 256 + assertThat(installation.anonymousCorrelationId().length(), is(64)); // sha 256 } @Test @@ -42,4 +43,4 @@ private StaticJenkinsAPIs withPublicKey(String publicKey) { return jenkins; } -} \ No newline at end of file +} diff --git a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/pipeline/BreadthFirstNodeTraversalTest.java b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/pipeline/BreadthFirstNodeTraversalTest.java index 719b48d05..b066e72e2 100644 --- a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/pipeline/BreadthFirstNodeTraversalTest.java +++ b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/pipeline/BreadthFirstNodeTraversalTest.java @@ -11,13 +11,10 @@ public class BreadthFirstNodeTraversalTest { @Test public void traversal_should_identify_the_stage_nodes() { - TestNode head = normalNode("A1", - withParent(stageNode("B1", - withParent(normalNode("C1")), - withParent(normalNode("C2")))), - withParent(stageNode("B2", - withParent(normalNode("C3")), - withParent(normalNode("C4")))), + TestNode head = normalNode( + "A1", + withParent(stageNode("B1", withParent(normalNode("C1")), withParent(normalNode("C2")))), + withParent(stageNode("B2", withParent(normalNode("C3")), withParent(normalNode("C4")))), withParent(normalNode("B3"))); List stages = findStages(head); @@ -27,9 +24,7 @@ public void traversal_should_identify_the_stage_nodes() { @Test public void stages_should_not_be_repeated() { - TestNode head = normalNode("A1", - withParent(stageNode("B1")), - withParent(stageNode("B1"))); + TestNode head = normalNode("A1", withParent(stageNode("B1")), withParent(stageNode("B1"))); List stages = findStages(head); @@ -43,7 +38,8 @@ private List findStages(TestNode head) { } private enum Type { - STAGE, NORMAL + STAGE, + NORMAL } private static class TestNode { @@ -98,4 +94,4 @@ private static TestNode normalNode(String displayName, TestNode... parents) { private static TestNode withParent(TestNode testNode) { return testNode; } -} \ No newline at end of file +} diff --git a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/BuildViewTest.java b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/BuildViewTest.java index 189858159..999de36de 100644 --- a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/BuildViewTest.java +++ b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/BuildViewTest.java @@ -32,4 +32,4 @@ private Jenkins createMockJenkins(MockedStatic mockedJenkins) { mockedJenkins.when(Jenkins::get).thenReturn(jenkins); return jenkins; } -} \ No newline at end of file +} diff --git a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/JobViewTest.java b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/JobViewTest.java index 59545ea98..783e6fb21 100644 --- a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/JobViewTest.java +++ b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/JobViewTest.java @@ -59,9 +59,7 @@ public void tearDown() { public void delegates_the_process_of_determining_the_relative_job_name() { when(relativeLocation.name()).thenReturn(theName); - view = a(jobView().of( - a(job().withName(theName)) - ).with(relativeLocation)); + view = a(jobView().of(a(job().withName(theName))).with(relativeLocation)); assertThat(view.name(), is(theName)); assertThat(view.toString(), is(theName)); @@ -73,8 +71,8 @@ public void delegates_the_process_of_determining_the_relative_url() { String expectedUrl = "job/" + theName; when(relativeLocation.url()).thenReturn(expectedUrl); - view = a(jobView().of( - a(job().withName(theName).withDisplayName(displayName))) + view = a(jobView() + .of(a(job().withName(theName).withDisplayName(displayName))) .with(relativeLocation)); assertThat(view.url(), is(expectedUrl)); @@ -94,16 +92,18 @@ public void progress_of_a_not_started_job_should_be_zero() { @Test public void progress_of_a_finished_job_should_be_zero() { - view = a(jobView().of( - a(job().whereTheLast(build().finishedWith(Result.SUCCESS))))); + view = a(jobView().of(a(job().whereTheLast(build().finishedWith(Result.SUCCESS))))); assertThat(view.progress(), is(0)); } @Test public void progress_of_a_nearly_finished_job_should_be_100() throws Exception { - view = a(jobView().of( - a(job().whereTheLast(build().isStillBuilding().startedAt("12:00:00").and().usuallyTakes(0)))) + view = a(jobView() + .of(a(job().whereTheLast(build().isStillBuilding() + .startedAt("12:00:00") + .and() + .usuallyTakes(0)))) .assuming(currentTime().is("12:00:00"))); assertThat(view.progress(), is(100)); @@ -112,7 +112,10 @@ public void progress_of_a_nearly_finished_job_should_be_100() throws Exception { @Test public void progress_of_a_job_thats_taking_longer_than_expected_should_be_100() throws Exception { view = a(jobView() - .of(a(job().whereTheLast(build().isStillBuilding().startedAt("12:00:00").and().usuallyTakes(5)))) + .of(a(job().whereTheLast(build().isStillBuilding() + .startedAt("12:00:00") + .and() + .usuallyTakes(5)))) .assuming(currentTime().is("12:20:00"))); assertThat(view.progress(), is(100)); @@ -120,8 +123,11 @@ public void progress_of_a_job_thats_taking_longer_than_expected_should_be_100() @Test public void should_calculate_the_progress_of_a_running_job() throws Exception { - view = a(jobView().of( - a(job().whereTheLast(build().isStillBuilding().startedAt("13:10:00").and().usuallyTakes(5)))) + view = a(jobView() + .of(a(job().whereTheLast(build().isStillBuilding() + .startedAt("13:10:00") + .and() + .usuallyTakes(5)))) .assuming(currentTime().is("13:11:00"))); assertThat(view.progress(), is(20)); @@ -129,8 +135,9 @@ public void should_calculate_the_progress_of_a_running_job() throws Exception { @Test public void should_know_how_long_the_next_build_is_supposed_to_take() { - view = a(jobView().of( - a(job().whereTheLast(build().finishedWith(Result.SUCCESS).and().usuallyTakes(5))))); + view = a(jobView() + .of(a(job().whereTheLast( + build().finishedWith(Result.SUCCESS).and().usuallyTakes(5))))); assertThat(view.estimatedDuration(), is("5m 0s")); } @@ -148,32 +155,28 @@ public void should_not_say_anything_if_it_doesnt_know_how_long_the_next_build_is @Test public void should_describe_the_job_as_successful_if_the_last_build_succeeded() { - view = a(jobView().of( - a(job().whereTheLast(build().finishedWith(Result.SUCCESS))))); + view = a(jobView().of(a(job().whereTheLast(build().finishedWith(Result.SUCCESS))))); assertThat(view.status(), containsString("successful")); } @Test public void should_describe_the_job_as_failing_if_the_last_build_failed() { - view = a(jobView().of( - a(job().whereTheLast(build().finishedWith(Result.FAILURE))))); + view = a(jobView().of(a(job().whereTheLast(build().finishedWith(Result.FAILURE))))); assertThat(view.status(), containsString("failing")); } @Test public void should_describe_the_job_as_aborted_if_the_last_build_was_aborted() { - view = a(jobView().of( - a(job().whereTheLast(build().finishedWith(Result.ABORTED))))); + view = a(jobView().of(a(job().whereTheLast(build().finishedWith(Result.ABORTED))))); assertThat(view.status(), containsString("aborted")); } @Test public void should_describe_the_job_as_unstable_if_the_last_build_is_unstable() { - view = a(jobView().of( - a(job().whereTheLast(build().finishedWith(Result.UNSTABLE))))); + view = a(jobView().of(a(job().whereTheLast(build().finishedWith(Result.UNSTABLE))))); assertThat(view.status(), containsString("unstable")); } @@ -222,9 +225,15 @@ public void should_describe_the_job_as_disabled_and_failing_if_the_last_build_fa @Test public void should_describe_the_job_as_running_and_successful_if_it_is_running_and_the_previous_build_succeeded() { List views = asFollows( - a(jobView().of(a(job().whereTheLast(build().hasntStartedYet()).andThePrevious(build().finishedWith(Result.SUCCESS))))), - a(jobView().of(a(job().whereTheLast(build().isStillBuilding()).andThePrevious(build().finishedWith(Result.SUCCESS))))), - a(jobView().of(a(job().whereTheLast(build().isStillUpdatingTheLog()).andThePrevious(build().finishedWith(Result.SUCCESS)))))); + a(jobView() + .of(a(job().whereTheLast(build().hasntStartedYet()) + .andThePrevious(build().finishedWith(Result.SUCCESS))))), + a(jobView() + .of(a(job().whereTheLast(build().isStillBuilding()) + .andThePrevious(build().finishedWith(Result.SUCCESS))))), + a(jobView() + .of(a(job().whereTheLast(build().isStillUpdatingTheLog()) + .andThePrevious(build().finishedWith(Result.SUCCESS)))))); // I could do this instead of having two assertions: // assertThat(view.status(), both(containsString("successful")).and(containsString("running"))); @@ -239,16 +248,15 @@ public void should_describe_the_job_as_running_and_successful_if_it_is_running_a @Test public void should_describe_the_job_as_running_and_failing_if_it_is_running_and_the_previous_build_failed() { List views = asFollows( - a(jobView().of(a(job(). - whereTheLast(build().hasntStartedYet()). - andThePrevious(build().finishedWith(Result.FAILURE))))), - a(jobView().of(a(job(). - whereTheLast(build().isStillBuilding()). - andThePrevious(build().finishedWith(Result.FAILURE))))), - a(jobView().of(a(job(). - whereTheLast(build().isStillUpdatingTheLog()). - andThePrevious(build().finishedWith(Result.FAILURE))))) - ); + a(jobView() + .of(a(job().whereTheLast(build().hasntStartedYet()) + .andThePrevious(build().finishedWith(Result.FAILURE))))), + a(jobView() + .of(a(job().whereTheLast(build().isStillBuilding()) + .andThePrevious(build().finishedWith(Result.FAILURE))))), + a(jobView() + .of(a(job().whereTheLast(build().isStillUpdatingTheLog()) + .andThePrevious(build().finishedWith(Result.FAILURE)))))); for (JobView jobView : views) { assertThat(jobView.status(), containsString("failing")); @@ -261,29 +269,30 @@ public void should_describe_the_job_as_running_and_failing_if_it_is_running_and_ */ @Test - public void should_describe_the_job_as_successful_when_there_are_several_builds_running_in_parallel_and_the_last_completed_was_successful() { - view = a(jobView().of( - a(job().whereTheLast(build().isStillBuilding()). - andThePrevious(build().isStillBuilding()). - andThePrevious(build().finishedWith(Result.SUCCESS))))); + public void + should_describe_the_job_as_successful_when_there_are_several_builds_running_in_parallel_and_the_last_completed_was_successful() { + view = a(jobView() + .of(a(job().whereTheLast(build().isStillBuilding()) + .andThePrevious(build().isStillBuilding()) + .andThePrevious(build().finishedWith(Result.SUCCESS))))); assertThat(view.status(), containsString("successful")); } @Test - public void should_describe_the_job_as_failing_when_there_are_several_builds_running_in_parallel_and_the_last_completed_failed() { - view = a(jobView().of( - a(job().whereTheLast(build().isStillBuilding()). - andThePrevious(build().isStillBuilding()). - andThePrevious(build().finishedWith(Result.FAILURE))))); + public void + should_describe_the_job_as_failing_when_there_are_several_builds_running_in_parallel_and_the_last_completed_failed() { + view = a(jobView() + .of(a(job().whereTheLast(build().isStillBuilding()) + .andThePrevious(build().isStillBuilding()) + .andThePrevious(build().finishedWith(Result.FAILURE))))); assertThat(view.status(), containsString("failing")); } @Test public void public_api_should_return_reasonable_defaults_for_jobs_that_never_run() { - view = a(jobView().of( - a(job().thatHasNeverRun()))); + view = a(jobView().of(a(job().thatHasNeverRun()))); assertThat(view.estimatedDuration(), is("")); assertThat(view.progress(), is(0)); diff --git a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/CanBeClaimedTest.java b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/CanBeClaimedTest.java index 78db580c1..6c755cf05 100644 --- a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/CanBeClaimedTest.java +++ b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/CanBeClaimedTest.java @@ -54,16 +54,14 @@ public void should_know_if_a_failing_build_has_been_claimed() { @Test public void should_know_if_a_failing_build_has_not_been_claimed() { - job = a(jobView().which(new CanBeClaimed()).of( - a(job().whereTheLast(build().finishedWith(Result.FAILURE))))); + job = a(jobView().which(new CanBeClaimed()).of(a(job().whereTheLast(build().finishedWith(Result.FAILURE))))); assertThat(serialisedClaimOf(job), is(nullValue())); } @Test public void should_complain_if_the_build_was_not_claimable() { - job = a(jobView().of( - a(job().withName("my-project").whereTheLast(build().finishedWith(Result.FAILURE))))); + job = a(jobView().of(a(job().withName("my-project").whereTheLast(build().finishedWith(Result.FAILURE))))); RuntimeException thrown = assertThrows(RuntimeException.class, () -> job.which(CanBeClaimed.class)); assertEquals("CanBeClaimed is not a feature of this project: 'my-project'", thrown.getMessage()); diff --git a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/CanBeDiagnosedForProblemsTest.java b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/CanBeDiagnosedForProblemsTest.java index 827229e78..0eda37a81 100644 --- a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/CanBeDiagnosedForProblemsTest.java +++ b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/CanBeDiagnosedForProblemsTest.java @@ -40,8 +40,10 @@ public void tearDown() { public void should_describe_known_problems() { String rogueAi = "Pod bay doors didn't open"; - job = a(jobView().which(new CanBeDiagnosedForProblems(BuildFailureAnalyzerDisplayedField.Name)).of( - a(job().whereTheLast(build().finishedWith(Result.FAILURE).and().knownProblems(rogueAi))))); + job = a(jobView() + .which(new CanBeDiagnosedForProblems(BuildFailureAnalyzerDisplayedField.Name)) + .of(a(job().whereTheLast( + build().finishedWith(Result.FAILURE).and().knownProblems(rogueAi))))); assertThat(diagnosedFailuresOf(job).value(), hasItem(rogueAi)); } diff --git a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasBadgesBadgePluginTest.java b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasBadgesBadgePluginTest.java index cccafd319..5ef95e2e3 100644 --- a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasBadgesBadgePluginTest.java +++ b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasBadgesBadgePluginTest.java @@ -24,7 +24,7 @@ public class HasBadgesBadgePluginTest { private JobView job; - + private MockedStatic mockedJenkins; private Jenkins jenkins; @@ -49,37 +49,48 @@ public void should_support_job_without_badges() { @Test public void should_convert_badges_to_json() { - job = a(jobView().which(hasBadgePluginBadges(withDefaultConfig())).of(a(job().whereTheLast( - build().hasBadges(badgePluginBadge().withText("badge1"), badgePluginBadge().withText("badge2")))))); + job = a(jobView() + .which(hasBadgePluginBadges(withDefaultConfig())) + .of(a(job().whereTheLast(build().hasBadges( + badgePluginBadge().withText("badge1"), + badgePluginBadge().withText("badge2")))))); assertThat(serialisedBadgesDetailsOf(job).value(), hasSize(2)); } @Test public void should_ignore_badges_with_icon() { - job = a(jobView().which(hasBadgePluginBadges(withDefaultConfig())) - .of(a(job().whereTheLast(build().hasBadges(badgePluginBadge().withIcon("icon.gif", "badge1"), - badgePluginBadge().withText("badge2")))))); + job = a(jobView() + .which(hasBadgePluginBadges(withDefaultConfig())) + .of(a(job().whereTheLast(build().hasBadges( + badgePluginBadge().withIcon("icon.gif", "badge1"), + badgePluginBadge().withText("badge2")))))); assertThat(serialisedBadgesDetailsOf(job).value(), hasSize(1)); } @Test public void should_report_badges_from_latest_build() { - job = a(jobView().which(hasBadgePluginBadges(withDefaultConfig())) - .of(a(job().whereTheLast(build().isStillBuilding().hasBadges(badgePluginBadge().withText("badge1"))) - .andThePrevious(build().hasBadges(badgePluginBadge().withText("badge1"), - badgePluginBadge().withText("badge2")))))); + job = a(jobView() + .which(hasBadgePluginBadges(withDefaultConfig())) + .of(a(job().whereTheLast(build().isStillBuilding() + .hasBadges(badgePluginBadge().withText("badge1"))) + .andThePrevious(build().hasBadges( + badgePluginBadge().withText("badge1"), + badgePluginBadge().withText("badge2")))))); assertThat(serialisedBadgesDetailsOf(job).value(), hasSize(1)); } @Test public void should_report_badges_from_last_completed_build() { - job = a(jobView().which(hasBadgePluginBadges(withConfig().withBadgesFromLastCompletedBuild())) - .of(a(job().whereTheLast(build().isStillBuilding().hasBadges(badgePluginBadge().withText("badge1"))) - .andThePrevious(build().hasBadges(badgePluginBadge().withText("badge1"), - badgePluginBadge().withText("badge2")))))); + job = a(jobView() + .which(hasBadgePluginBadges(withConfig().withBadgesFromLastCompletedBuild())) + .of(a(job().whereTheLast(build().isStillBuilding() + .hasBadges(badgePluginBadge().withText("badge1"))) + .andThePrevious(build().hasBadges( + badgePluginBadge().withText("badge1"), + badgePluginBadge().withText("badge2")))))); assertThat(serialisedBadgesDetailsOf(job).value(), hasSize(2)); } diff --git a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasHeadlineShowingAbortedBuildDetails.java b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasHeadlineShowingAbortedBuildDetails.java index cb84e5c87..aad2fb94e 100644 --- a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasHeadlineShowingAbortedBuildDetails.java +++ b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasHeadlineShowingAbortedBuildDetails.java @@ -40,8 +40,9 @@ public void tearDown() { @Test public void should_tell_who_aborted_the_build() { try (MockedStatic mockedUser = mockStatic(User.class)) { - view = a(jobView().which(hasHeadlineThatShowsCommitters()).of( - a(job().whereTheLast(build().wasAbortedBy("Abe", mockedUser))))); + view = a(jobView() + .which(hasHeadlineThatShowsCommitters()) + .of(a(job().whereTheLast(build().wasAbortedBy("Abe", mockedUser))))); assertThat(headlineOf(view), is("Execution aborted by Abe")); } @@ -49,8 +50,9 @@ public void should_tell_who_aborted_the_build() { @Test public void should_tell_if_a_build_was_aborted() { - view = a(jobView().which(hasHeadlineThatDoesNotShowCommitters()).of( - a(job().whereTheLast(build().wasAbortedBy("Abe", null))))); + view = a(jobView() + .which(hasHeadlineThatDoesNotShowCommitters()) + .of(a(job().whereTheLast(build().wasAbortedBy("Abe", null))))); assertThat(headlineOf(view), is("Execution aborted")); } diff --git a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasHeadlineShowingFailedBuildDetailsTest.java b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasHeadlineShowingFailedBuildDetailsTest.java index ecc6f0e17..9783cb4cc 100644 --- a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasHeadlineShowingFailedBuildDetailsTest.java +++ b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasHeadlineShowingFailedBuildDetailsTest.java @@ -38,66 +38,75 @@ public void tearDown() { @Test public void should_tell_who_broke_the_build() { - view = a(jobView().which(hasHeadlineThatShowsCommitters()).of( - a(job().whereTheLast(build().wasBrokenBy("Adam"))))); + view = a(jobView() + .which(hasHeadlineThatShowsCommitters()) + .of(a(job().whereTheLast(build().wasBrokenBy("Adam"))))); assertThat(headlineOf(view), is("1 build has failed since Adam committed their changes")); } @Test public void should_list_committers_who_broke_the_build_in_alphabetical_order() { - view = a(jobView().which(hasHeadlineThatShowsCommitters()).of( - a(job().whereTheLast(build().wasBrokenBy("Adam", "Ben"))))); + view = a(jobView() + .which(hasHeadlineThatShowsCommitters()) + .of(a(job().whereTheLast(build().wasBrokenBy("Adam", "Ben"))))); assertThat(headlineOf(view), is("1 build has failed since Adam and Ben committed their changes")); } @Test - public void should_tell_the_number_of_broken_builds_since_the_last_broken_build_and_the_author_of_the_first_offending_commit() { - view = a(jobView().which(hasHeadlineThatShowsCommitters()).of( - a(job().whereTheLast(build().wasBrokenBy("Adam")). - andThePrevious(build().wasBrokenBy("Ben", "Connor")). - andThePrevious(build().wasBrokenBy("Daniel")). - andThePrevious(build().succeededThanksTo("Errol"))))); + public void + should_tell_the_number_of_broken_builds_since_the_last_broken_build_and_the_author_of_the_first_offending_commit() { + view = a(jobView() + .which(hasHeadlineThatShowsCommitters()) + .of(a(job().whereTheLast(build().wasBrokenBy("Adam")) + .andThePrevious(build().wasBrokenBy("Ben", "Connor")) + .andThePrevious(build().wasBrokenBy("Daniel")) + .andThePrevious(build().succeededThanksTo("Errol"))))); assertThat(headlineOf(view), is("3 builds have failed since Daniel committed their changes")); } @Test public void should_tell_the_number_of_broken_builds_since_the_last_build_broken_by_multiple_committers() { - view = a(jobView().which(hasHeadlineThatShowsCommitters()).of( - a(job().whereTheLast(build().wasBrokenBy("Adam")). - andThePrevious(build().wasBrokenBy("Daniel", "Ben", "Connor")). - andThePrevious(build().succeededThanksTo("Errol"))))); + view = a(jobView() + .which(hasHeadlineThatShowsCommitters()) + .of(a(job().whereTheLast(build().wasBrokenBy("Adam")) + .andThePrevious(build().wasBrokenBy("Daniel", "Ben", "Connor")) + .andThePrevious(build().succeededThanksTo("Errol"))))); assertThat(headlineOf(view), is("2 builds have failed since Ben, Connor and Daniel committed their changes")); } @Test public void should_tell_how_many_builds_have_failed_but_not_who_broke_them_if_configured_as_such() { - view = a(jobView().which(hasHeadlineThatDoesNotShowCommitters()).of( - a(job().whereTheLast(build().wasBrokenBy("Adam"))))); + view = a(jobView() + .which(hasHeadlineThatDoesNotShowCommitters()) + .of(a(job().whereTheLast(build().wasBrokenBy("Adam"))))); assertThat(headlineOf(view), is("1 build has failed")); } @Test public void should_tell_the_number_of_broken_builds_since_the_last_broken_build() { - view = a(jobView().which(hasHeadlineThatDoesNotShowCommitters()).of( - a(job().whereTheLast(build().wasBrokenBy("Adam")). - andThePrevious(build().wasBrokenBy("Ben", "Connor")). - andThePrevious(build().wasBrokenBy("Daniel")). - andThePrevious(build().succeededThanksTo("Errol"))))); + view = a(jobView() + .which(hasHeadlineThatDoesNotShowCommitters()) + .of(a(job().whereTheLast(build().wasBrokenBy("Adam")) + .andThePrevious(build().wasBrokenBy("Ben", "Connor")) + .andThePrevious(build().wasBrokenBy("Daniel")) + .andThePrevious(build().succeededThanksTo("Errol"))))); assertThat(headlineOf(view), is("3 builds have failed")); } @Test - public void should_tell_the_number_of_broken_builds_since_the_last_build_broken_when_multiple_committers_are_involver() { - view = a(jobView().which(hasHeadlineThatDoesNotShowCommitters()).of( - a(job().whereTheLast(build().wasBrokenBy("Adam")). - andThePrevious(build().wasBrokenBy("Daniel", "Ben", "Connor")). - andThePrevious(build().succeededThanksTo("Errol"))))); + public void + should_tell_the_number_of_broken_builds_since_the_last_build_broken_when_multiple_committers_are_involver() { + view = a(jobView() + .which(hasHeadlineThatDoesNotShowCommitters()) + .of(a(job().whereTheLast(build().wasBrokenBy("Adam")) + .andThePrevious(build().wasBrokenBy("Daniel", "Ben", "Connor")) + .andThePrevious(build().succeededThanksTo("Errol"))))); assertThat(headlineOf(view), is("2 builds have failed")); } diff --git a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasHeadlineShowingFixedBuildDetailsTest.java b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasHeadlineShowingFixedBuildDetailsTest.java index f118bc8aa..39b4dd378 100644 --- a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasHeadlineShowingFixedBuildDetailsTest.java +++ b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasHeadlineShowingFixedBuildDetailsTest.java @@ -39,53 +39,59 @@ public void tearDown() { @Test public void should_tell_who_fixed_the_broken_build() { - view = a(jobView().which(hasHeadlineThatShowsCommitters()).of( - a(job().whereTheLast(build().succeededThanksTo("Adam")). - andThePrevious(build().wasBrokenBy("Daniel", "Ben"))))); + view = a(jobView() + .which(hasHeadlineThatShowsCommitters()) + .of(a(job().whereTheLast(build().succeededThanksTo("Adam")) + .andThePrevious(build().wasBrokenBy("Daniel", "Ben"))))); assertThat(headlineOf(view), is("Fixed after Adam committed their changes :-)")); } @Test public void should_list_committers_who_fixed_the_broken_build() { - view = a(jobView().which(hasHeadlineThatShowsCommitters()).of( - a(job().whereTheLast(build().succeededThanksTo("Adam", "Connor")). - andThePrevious(build().wasBrokenBy("Daniel", "Ben"))))); + view = a(jobView() + .which(hasHeadlineThatShowsCommitters()) + .of(a(job().whereTheLast(build().succeededThanksTo("Adam", "Connor")) + .andThePrevious(build().wasBrokenBy("Daniel", "Ben"))))); assertThat(headlineOf(view), is("Fixed after Adam and Connor committed their changes :-)")); } @Test public void should_congratulate_anonymously_if_broken_build_was_fixed_without_known_committers() { - view = a(jobView().which(hasHeadlineThatShowsCommitters()).of( - a(job().whereTheLast(build().succeededThanksTo()). - andThePrevious(build().wasBrokenBy("Daniel", "Ben"))))); + view = a(jobView() + .which(hasHeadlineThatShowsCommitters()) + .of(a(job().whereTheLast(build().succeededThanksTo()) + .andThePrevious(build().wasBrokenBy("Daniel", "Ben"))))); assertThat(headlineOf(view), is("Back in the green!")); } @Test public void should_congratulate_anonymously_when_the_build_is_fixed_but_the_committers_should_not_be_displayed() { - view = a(jobView().which(hasHeadlineThatDoesNotShowCommitters()).of( - a(job().whereTheLast(build().succeededThanksTo("Adam")). - andThePrevious(build().wasBrokenBy("Daniel", "Ben"))))); + view = a(jobView() + .which(hasHeadlineThatDoesNotShowCommitters()) + .of(a(job().whereTheLast(build().succeededThanksTo("Adam")) + .andThePrevious(build().wasBrokenBy("Daniel", "Ben"))))); assertThat(headlineOf(view), is("Back in the green!")); } @Test public void should_not_congratulate_if_previous_succeeded() { - view = a(jobView().which(hasHeadlineThatShowsCommitters()).of( - a(job().whereTheLast(build().succeededThanksTo("Adam")). - andThePrevious(build().succeededThanksTo("Ben"))))); + view = a(jobView() + .which(hasHeadlineThatShowsCommitters()) + .of(a(job().whereTheLast(build().succeededThanksTo("Adam")) + .andThePrevious(build().succeededThanksTo("Ben"))))); assertThat(headlineOf(view), is(emptyString())); } @Test public void should_not_congratulate_if_no_failure_before() { - view = a(jobView().which(hasHeadlineThatShowsCommitters()).of( - a(job().whereTheLast(build().succeededThanksTo("Adam"))))); + view = a(jobView() + .which(hasHeadlineThatShowsCommitters()) + .of(a(job().whereTheLast(build().succeededThanksTo("Adam"))))); assertThat(headlineOf(view), is(emptyString())); } diff --git a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasHeadlineShowingRunningBuildDetailsTest.java b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasHeadlineShowingRunningBuildDetailsTest.java index 59fee0074..6e889be71 100644 --- a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasHeadlineShowingRunningBuildDetailsTest.java +++ b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasHeadlineShowingRunningBuildDetailsTest.java @@ -39,37 +39,39 @@ public void tearDown() { @Test public void should_say_nothing_if_no_builds_were_executed_and_one_is_running_now() { - view = a(jobView().which(hasHeadlineThatShowsCommitters()).of( - a(job().whereTheLast(build().isStillBuilding())))); + view = a( + jobView().which(hasHeadlineThatShowsCommitters()).of(a(job().whereTheLast(build().isStillBuilding())))); assertThat(headlineOf(view), is(emptyString())); } @Test public void should_tell_whose_changes_are_being_built() { - view = a(jobView().which(hasHeadlineThatShowsCommitters()).of( - a(job().whereTheLast(build().isStillBuilding().withChangesFrom("Adam"))))); + view = a(jobView() + .which(hasHeadlineThatShowsCommitters()) + .of(a(job().whereTheLast(build().isStillBuilding().withChangesFrom("Adam"))))); assertThat(headlineOf(view), is("Building Adam's changes")); } @Test public void should_tell_whose_changes_are_being_built_when_there_are_multiple_committers() { - view = a(jobView().which(hasHeadlineThatShowsCommitters()).of( - a(job().whereTheLast(build().isStillBuilding().withChangesFrom("Ben", "Adam"))))); + view = a(jobView() + .which(hasHeadlineThatShowsCommitters()) + .of(a(job().whereTheLast(build().isStillBuilding().withChangesFrom("Ben", "Adam"))))); assertThat(headlineOf(view), is("Building Adam and Ben's changes")); } @Test public void should_not_tell_whose_changes_are_being_built_if_commiters_are_not_to_be_displayed() { - view = a(jobView().which(hasHeadlineThatDoesNotShowCommitters()).of( - a(job().whereTheLast(build().isStillBuilding().withChangesFrom("Adam"))))); + view = a(jobView() + .which(hasHeadlineThatDoesNotShowCommitters()) + .of(a(job().whereTheLast(build().isStillBuilding().withChangesFrom("Adam"))))); assertThat(headlineOf(view), is(emptyString())); } - // -- private Feature hasHeadlineThatShowsCommitters() { diff --git a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasHeadlineWhichShowsNothingTest.java b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasHeadlineWhichShowsNothingTest.java index a4481dd49..2173163c6 100644 --- a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasHeadlineWhichShowsNothingTest.java +++ b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasHeadlineWhichShowsNothingTest.java @@ -16,8 +16,7 @@ public class HasHeadlineWhichShowsNothingTest { @Test public void should_say_nothing_if_no_builds_were_executed() { - view = a(jobView().which(hasHeadlineThatShowsCommitters()).of( - a(job().thatHasNeverRun()))); + view = a(jobView().which(hasHeadlineThatShowsCommitters()).of(a(job().thatHasNeverRun()))); assertThat(headlineOf(view), is(emptyString())); } diff --git a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasJunitRealtimeTest.java b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasJunitRealtimeTest.java index 5c2b17310..58c9311ba 100644 --- a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasJunitRealtimeTest.java +++ b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/HasJunitRealtimeTest.java @@ -47,27 +47,33 @@ public void should_support_jobs_without_realtime_test_actions() { @Test public void should_ignore_actions_without_test_progress() { - job = a(jobView().which(hasJunitRealtime()).of(a( - job().whereTheLast(build().isStillBuilding().hasRealtimeTests(realtimeTest().withoutTestProgress()))))); + job = a(jobView() + .which(hasJunitRealtime()) + .of(a(job().whereTheLast(build().isStillBuilding() + .hasRealtimeTests(realtimeTest().withoutTestProgress()))))); assertThat(serialisedRealtimeTestsDetailsOf(job), is(nullValue())); } @Test public void should_show_progress_during_build() { - job = a(jobView().which(hasJunitRealtime()).of(a(job().whereTheLast(build().isStillBuilding() - .hasRealtimeTests(realtimeTest().withTestProgress(10, 6, 20, 8, "Remaining time text")))))); + job = a(jobView() + .which(hasJunitRealtime()) + .of(a(job().whereTheLast(build().isStillBuilding() + .hasRealtimeTests(realtimeTest().withTestProgress(10, 6, 20, 8, "Remaining time text")))))); assertThat(serialisedRealtimeTestsDetailsOf(job).value(), hasSize(1)); } @Test public void should_support_multiple_test_actions() { - job = a(jobView().which(hasJunitRealtime()) - .of(a(job().whereTheLast(build().isStillBuilding().hasRealtimeTests( - realtimeTest().withTestProgress(10, 6, 20, 8, "Remaining time text"), - realtimeTest().withTestProgress(10, 6, 20, 8, "Remaining time text"), - realtimeTest().withTestProgress(10, 6, 20, 8, "Remaining time text")))))); + job = a(jobView() + .which(hasJunitRealtime()) + .of(a(job().whereTheLast(build().isStillBuilding() + .hasRealtimeTests( + realtimeTest().withTestProgress(10, 6, 20, 8, "Remaining time text"), + realtimeTest().withTestProgress(10, 6, 20, 8, "Remaining time text"), + realtimeTest().withTestProgress(10, 6, 20, 8, "Remaining time text")))))); assertThat(serialisedRealtimeTestsDetailsOf(job).value(), hasSize(3)); } @@ -75,5 +81,4 @@ public void should_support_multiple_test_actions() { private HasJunitRealtime.RealtimeTests serialisedRealtimeTestsDetailsOf(JobView job) { return job.which(HasJunitRealtime.class).asJson(); } - } diff --git a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/KnowsCurrentBuildsDetailsTest.java b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/KnowsCurrentBuildsDetailsTest.java index a83b68ba5..42c5845ec 100644 --- a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/KnowsCurrentBuildsDetailsTest.java +++ b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/KnowsCurrentBuildsDetailsTest.java @@ -42,24 +42,27 @@ public void tearDown() { @Test public void should_know_current_build_number() { - view = a(jobView().which(new KnowsCurrentBuildsDetails()).of( - a(job().whereTheLast(build().isStillBuilding().and().hasNumber(5))))); + view = a(jobView() + .which(new KnowsCurrentBuildsDetails()) + .of(a(job().whereTheLast(build().isStillBuilding().and().hasNumber(5))))); assertThat(currentBuildsOf(view).get(0).name(), is("#5")); } @Test public void should_use_build_name_if_its_known() { - view = a(jobView().which(new KnowsCurrentBuildsDetails()).of( - a(job().whereTheLast(build().isStillBuilding().and().hasName("1.3.4+build.15"))))); + view = a(jobView() + .which(new KnowsCurrentBuildsDetails()) + .of(a(job().whereTheLast(build().isStillBuilding().and().hasName("1.3.4+build.15"))))); assertThat(currentBuildsOf(view).get(0).name(), is("1.3.4+build.15")); } @Test public void should_know_the_url_of_the_last_build() { - view = a(jobView().which(new KnowsCurrentBuildsDetails()).of( - a(job().whereTheLast(build().isStillBuilding().and().hasNumber(22)))) + view = a(jobView() + .which(new KnowsCurrentBuildsDetails()) + .of(a(job().whereTheLast(build().isStillBuilding().and().hasNumber(22)))) .with(locatedAt("job/project-name"))); assertThat(currentBuildsOf(view).get(0).url(), is("job/project-name/22/")); @@ -78,12 +81,13 @@ public void should_know_how_long_a_build_has_been_running_for() throws Exception anHourAndHalfLater = "14:40:00"; Date currentTime = currentTime().is(startTime); - view = a(jobView().which(new KnowsCurrentBuildsDetails()).of( - a(job().whereTheLast(build().startedAt(startTime).isStillBuilding()))) + view = a(jobView() + .which(new KnowsCurrentBuildsDetails()) + .of(a(job().whereTheLast(build().startedAt(startTime).isStillBuilding()))) .assuming(currentTime)); - + CurrentBuild currentBuild = currentBuildsOf(view).get(0); - + assumeThat(currentTime).is(sixSecondsLater); assertThat(currentBuild.duration(), is("6s")); diff --git a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/KnowsLastCompletedBuildDetailsTest.java b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/KnowsLastCompletedBuildDetailsTest.java index afbbc5f88..14c4e58b0 100644 --- a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/KnowsLastCompletedBuildDetailsTest.java +++ b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/features/KnowsLastCompletedBuildDetailsTest.java @@ -39,24 +39,25 @@ public void tearDown() { @Test public void should_know_current_build_number() { - view = a(jobView().which(new KnowsLastCompletedBuildDetails()).of( - a(job().whereTheLast(build().hasNumber(5))))); + view = a(jobView().which(new KnowsLastCompletedBuildDetails()).of(a(job().whereTheLast(build().hasNumber(5))))); assertThat(lastCompletedBuildOf(view).name(), is("#5")); } @Test public void should_use_build_name_if_its_known() { - view = a(jobView().which(new KnowsLastCompletedBuildDetails()).of( - a(job().whereTheLast(build().hasName("1.3.4+build.15"))))); + view = a(jobView() + .which(new KnowsLastCompletedBuildDetails()) + .of(a(job().whereTheLast(build().hasName("1.3.4+build.15"))))); assertThat(lastCompletedBuildOf(view).name(), is("1.3.4+build.15")); } @Test public void should_know_the_url_of_the_last_build() { - view = a(jobView().which(new KnowsLastCompletedBuildDetails()).of( - a(job().whereTheLast(build().hasNumber(22)))) + view = a(jobView() + .which(new KnowsLastCompletedBuildDetails()) + .of(a(job().whereTheLast(build().hasNumber(22)))) .with(locatedAt("job/project-name"))); assertThat(lastCompletedBuildOf(view).url(), is("job/project-name/22/")); @@ -68,8 +69,10 @@ public void should_know_the_url_of_the_last_build() { @Test public void should_know_how_long_the_last_build_took_once_its_finished() { - view = a(jobView().which(new KnowsLastCompletedBuildDetails()).of( - a(job().whereTheLast(build().finishedWith(Result.SUCCESS).and().took(3))))); + view = a(jobView() + .which(new KnowsLastCompletedBuildDetails()) + .of(a(job().whereTheLast( + build().finishedWith(Result.SUCCESS).and().took(3))))); assertThat(lastCompletedBuildOf(view).duration(), is("3m 0s")); } @@ -81,8 +84,9 @@ public void should_know_how_long_the_last_build_took_once_its_finished() { public void should_know_how_long_since_the_last_build_happened() throws Exception { String tenMinutesInMilliseconds = String.format("%d", 10 * 60 * 1000); - view = a(jobView().which(new KnowsLastCompletedBuildDetails()).of( - a(job().whereTheLast(build().startedAt("18:05:00").and().took(5)))) + view = a(jobView() + .which(new KnowsLastCompletedBuildDetails()) + .of(a(job().whereTheLast(build().startedAt("18:05:00").and().took(5)))) .assuming(currentTime().is("18:20:00"))); assertThat(lastCompletedBuildOf(view).timeElapsedSince(), is(tenMinutesInMilliseconds)); diff --git a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/readability/ListerTest.java b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/readability/ListerTest.java index ea9bccb3d..5ccfff674 100644 --- a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/readability/ListerTest.java +++ b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/readability/ListerTest.java @@ -36,7 +36,9 @@ public void should_use_an_optional_template_to_describe_a_list_with_multiple_ite @Test public void should_say_when_the_list_has_no_items() { - assertThat(Lister.describe("No fruit for you today :-(", "Fruits: %s", listOf()), is("No fruit for you today :-(")); + assertThat( + Lister.describe("No fruit for you today :-(", "Fruits: %s", listOf()), + is("No fruit for you today :-(")); } @Test @@ -47,4 +49,4 @@ public void should_allow_to_use_a_different_template_to_describe_a_list_with_one private List listOf(T... items) { return List.of(items); } -} \ No newline at end of file +} diff --git a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/syntacticsugar/BuildStateRecipe.java b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/syntacticsugar/BuildStateRecipe.java index 9e63a4725..7e2c3bd73 100644 --- a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/syntacticsugar/BuildStateRecipe.java +++ b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/syntacticsugar/BuildStateRecipe.java @@ -68,7 +68,7 @@ public BuildStateRecipe withChangesFrom(String... authors) { build.getClass().getMethod("shouldCalculateCulprits"); newJenkins = true; } catch (NoSuchMethodException ignore) { - //If old Jenkins, variable "newJenkins" will still be false + // If old Jenkins, variable "newJenkins" will still be false } return newJenkins ? withChangesFromForJenkins2_107AndNewer(authors) : withChangesFromForJenkins2_46(authors); } @@ -84,7 +84,7 @@ private BuildStateRecipe withChangesFromForJenkins2_46(String... authors) { return this; } - //Mockito reflective call to handle methods not available in Jenkins 2.46 which is used as dependency + // Mockito reflective call to handle methods not available in Jenkins 2.46 which is used as dependency private BuildStateRecipe withChangesFromForJenkins2_107AndNewer(String... authors) { ChangeLogSet changeSet = changeSetBasedOn(entriesBy(authors)); when(build.getChangeSet()).thenReturn(changeSet); @@ -178,7 +178,9 @@ public BuildStateRecipe wasAbortedBy(String username, MockedStatic mockedU User user = userCalled(username); if (mockedUser != null) { - mockedUser.when(() -> User.get(Mockito.eq(user.getId()), Mockito.eq(false), Mockito.anyMap())).thenReturn(user); // For newer Jenkins versions + mockedUser + .when(() -> User.get(Mockito.eq(user.getId()), Mockito.eq(false), Mockito.anyMap())) + .thenReturn(user); // For newer Jenkins versions } final InterruptedBuildAction action = interruptedBuildAction(user); @@ -209,7 +211,7 @@ public BuildStateRecipe knownProblems(String... failures) { private FailureCauseBuildAction failureCauseBuildAction(String... FailureNames) { FailureCauseBuildAction action = mock(FailureCauseBuildAction.class); List items = new ArrayList<>(); - for( String name : FailureNames ) { + for (String name : FailureNames) { items.add(failure(name)); } when(action.getFoundFailureCauses()).thenReturn(items); @@ -242,7 +244,7 @@ public BuildStateRecipe hasRealtimeTests(RealtimeTestPluginRecipe... realtimeTes return this; } - + public BuildStateRecipe and() { return this; } diff --git a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/syntacticsugar/JobStateRecipe.java b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/syntacticsugar/JobStateRecipe.java index c26fde434..0c8ba9c64 100644 --- a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/syntacticsugar/JobStateRecipe.java +++ b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/syntacticsugar/JobStateRecipe.java @@ -18,7 +18,7 @@ /** * @author Jan Molak */ -public class JobStateRecipe implements Supplier> { +public class JobStateRecipe implements Supplier> { private Job job; private RunList runList; private Stack buildHistory = new Stack<>(); @@ -90,7 +90,7 @@ public JobStateRecipe andThePrevious(BuildStateRecipe recipe) { // link "previous" builds ... while (buildHistory.size() > 1) { earliestBuild = buildHistory.pop(); - earlierBuild = buildHistory.peek(); + earlierBuild = buildHistory.peek(); lenient().when(earlierBuild.getPreviousBuild()).thenReturn(earliestBuild); } @@ -99,7 +99,7 @@ public JobStateRecipe andThePrevious(BuildStateRecipe recipe) { if (buildHistory.size() == 1) { lenient().doReturn(buildHistory.pop()).when(job).getLastBuild(); } - + // mock the necessary methods to get the currentBuilds // it will return the full list so make sure it contains only building builds lenient().doReturn(runList).when(job).getNewBuilds(); diff --git a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/syntacticsugar/JobViewRecipe.java b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/syntacticsugar/JobViewRecipe.java index a2965a3de..a20678625 100644 --- a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/syntacticsugar/JobViewRecipe.java +++ b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/syntacticsugar/JobViewRecipe.java @@ -47,4 +47,4 @@ public JobViewRecipe assuming(Date systemTime) { public JobView get() { return new JobView(job, features, isPipeline, relative, systemTime); } -} \ No newline at end of file +} diff --git a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/syntacticsugar/Loops.java b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/syntacticsugar/Loops.java index 7fcfba1fa..d4f28d759 100644 --- a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/syntacticsugar/Loops.java +++ b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/syntacticsugar/Loops.java @@ -18,5 +18,4 @@ public static List asFollows(T... examples) { public static List asFollows(Supplier... examples) { return Stream.of(examples).map(Supplier::get).collect(Collectors.toList()); } - } diff --git a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/syntacticsugar/RealtimeTestPluginRecipe.java b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/syntacticsugar/RealtimeTestPluginRecipe.java index 922f206e0..65601d61f 100644 --- a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/syntacticsugar/RealtimeTestPluginRecipe.java +++ b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/syntacticsugar/RealtimeTestPluginRecipe.java @@ -22,10 +22,12 @@ public RealtimeTestPluginRecipe withoutTestProgress() { return this; } - public RealtimeTestPluginRecipe withTestProgress(int expected, int completed, float expectedTime, float completedTime, String estimatedTime) { + public RealtimeTestPluginRecipe withTestProgress( + int expected, int completed, float expectedTime, float completedTime, String estimatedTime) { int completedPercent = Math.min((int) Math.floor((double) completed / (double) expected * 100d), 100); - int completedTimePercent = Math.min((int) Math.floor((double) completedTime / (double) expectedTime * 100d), 100); - + int completedTimePercent = + Math.min((int) Math.floor((double) completedTime / (double) expectedTime * 100d), 100); + TestProgress testProgress = mock(TestProgress.class); when(testProgress.getCompletedTests()).thenReturn(completed); when(testProgress.getCompletedTestsPercentage()).thenReturn(completedPercent); @@ -36,7 +38,7 @@ public RealtimeTestPluginRecipe withTestProgress(int expected, int completed, fl when(testProgress.getExpectedTime()).thenReturn(expectedTime); when(testProgress.getTestsLeftPercentage()).thenReturn(100 - completedPercent); when(testProgress.getTimeLeftPercentage()).thenReturn(100 - completedTimePercent); - + when(realtimeTest.getTestProgress()).thenReturn(testProgress); return this; } diff --git a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/syntacticsugar/TimeMachine.java b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/syntacticsugar/TimeMachine.java index a7567824d..6f30eedfc 100644 --- a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/syntacticsugar/TimeMachine.java +++ b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugins/buildmonitor/viewmodel/syntacticsugar/TimeMachine.java @@ -29,7 +29,6 @@ public Date is(String currentTime) throws ParseException { return this.systemTime; } - private TimeMachine(Date currentTime) { this.systemTime = currentTime; } diff --git a/pom.xml b/pom.xml index 3f479da73..286ace35e 100644 --- a/pom.xml +++ b/pom.xml @@ -1,58 +1,57 @@ - - 4.0.0 - - - 1.14 - 999999-SNAPSHOT - 2.361.4 - jenkinsci/build-monitor-plugin - - - - org.jenkins-ci.plugins - plugin - 4.58 - - - - build-monitor - ${revision}-${changelist} - pom - - Build Monitor - https://github.com/jenkinsci/build-monitor-plugin - - - scm:git:https://github.com/${gitHubRepo}.git - scm:git:git@github.com:${gitHubRepo}.git - ${scmTag} - https://github.com/${gitHubRepo} - - - - - repo.jenkins-ci.org - https://repo.jenkins-ci.org/public/ - - - - - repo.jenkins-ci.org - https://repo.jenkins-ci.org/public/ - - - - - - repo.jenkins-ci.org - https://repo.jenkins-ci.org/releases - - - - - build-monitor-plugin - build-monitor-acceptance - + + 4.0.0 + + + org.jenkins-ci.plugins + plugin + 4.59 + + + + build-monitor + ${revision}-${changelist} + pom + Build Monitor + https://github.com/jenkinsci/build-monitor-plugin + + + build-monitor-plugin + build-monitor-acceptance + + + + scm:git:https://github.com/${gitHubRepo}.git + scm:git:git@github.com:${gitHubRepo}.git + ${scmTag} + https://github.com/${gitHubRepo} + + + + + repo.jenkins-ci.org + https://repo.jenkins-ci.org/releases + + + + + 1.14 + 999999-SNAPSHOT + 2.361.4 + jenkinsci/build-monitor-plugin + + + + + repo.jenkins-ci.org + https://repo.jenkins-ci.org/public/ + + + + + + repo.jenkins-ci.org + https://repo.jenkins-ci.org/public/ + +