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 12e065443..ed0194fa4 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
@@ -92,8 +92,13 @@ public String currentbuildFailureAnalyzerDisplayedField() {
}
@SuppressWarnings("unused") // used in the configure-entries.jelly form
- public boolean isDisplayCommitters() {
- return currentConfig().shouldDisplayCommitters();
+ public boolean isDisplayCommittersOnBuildFailure() {
+ return currentConfig().shouldDisplayCommittersOnBuildFailure();
+ }
+
+ @SuppressWarnings("unused") // used in the configure-entries.jelly form
+ public boolean isDisplayCommittersOnFixedBuild() {
+ return currentConfig().shouldDisplayCommittersOnFixedBuild();
}
private static final BuildMonitorInstallation installation = new BuildMonitorInstallation();
@@ -119,9 +124,10 @@ protected void submit(StaplerRequest req) throws ServletException, IOException,
String requestedOrdering = req.getParameter("order");
title = req.getParameter("title");
- currentConfig().setDisplayCommitters(json.optBoolean("displayCommitters", true));
+ currentConfig().setDisplayCommittersOnBuildFailure(json.optBoolean("displayCommittersOnBuildFailure", true));
+ currentConfig().setDisplayCommittersOnFixedBuild(json.optBoolean("displayCommittersOnFixedBuild", true));
currentConfig().setBuildFailureAnalyzerDisplayedField(req.getParameter("buildFailureAnalyzerDisplayedField"));
-
+
try {
currentConfig().setOrder(orderIn(requestedOrdering));
} catch (Exception e) {
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 c10b3296f..6f69a0170 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
@@ -10,9 +10,10 @@
public class Config {
- private boolean displayCommitters;
+ private boolean displayCommittersOnBuildFailure;
+ private boolean displayCommittersOnFixedBuild;
private BuildFailureAnalyzerDisplayedField buildFailureAnalyzerDisplayedField;
-
+
public static Config defaultConfig() {
return new Config();
}
@@ -40,13 +41,21 @@ public BuildFailureAnalyzerDisplayedField getBuildFailureAnalyzerDisplayedField(
public void setBuildFailureAnalyzerDisplayedField(String buildFailureAnalyzerDisplayedField) {
this.buildFailureAnalyzerDisplayedField = BuildFailureAnalyzerDisplayedField.valueOf(buildFailureAnalyzerDisplayedField);
}
-
- public boolean shouldDisplayCommitters() {
- return getOrElse(displayCommitters, true);
+
+ public boolean shouldDisplayCommittersOnBuildFailure() {
+ return getOrElse(displayCommittersOnBuildFailure, true);
+ }
+
+ public void setDisplayCommittersOnBuildFailure(boolean flag) {
+ this.displayCommittersOnBuildFailure = flag;
+ }
+
+ public boolean shouldDisplayCommittersOnFixedBuild() {
+ return getOrElse(displayCommittersOnFixedBuild, false);
}
- public void setDisplayCommitters(boolean flag) {
- this.displayCommitters = flag;
+ public void setDisplayCommittersOnFixedBuild(boolean flag) {
+ this.displayCommittersOnFixedBuild = flag;
}
@Override
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 9b0c3accc..a5dd68d13 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
@@ -31,7 +31,7 @@ public JobView viewOf(Job, ?> job) {
List
- This feature works the other way around too! If someone fixes a broken build, - it's their identifier that gets to appear on the screen. -
Did you know that when a broken build is claimed, diff --git a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugin/assetbundler/PathToAssetTest.java b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugin/assetbundler/PathToAssetTest.java index 8e59235c8..297e9e1a7 100644 --- a/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugin/assetbundler/PathToAssetTest.java +++ b/build-monitor-plugin/src/test/java/com/smartcodeltd/jenkinsci/plugin/assetbundler/PathToAssetTest.java @@ -7,8 +7,7 @@ import java.net.MalformedURLException; import java.net.URL; -import static org.hamcrest.core.Is.is; -import static org.junit.Assert.assertThat; +import static junit.framework.TestCase.assertTrue; public class PathToAssetTest { @@ -17,8 +16,10 @@ public void combines_base_resource_url_given_by_jenkins_and_a_path_to_the_asset( URL base = baseResourceUrlGivenByJenkins("file:///opt/jenkins/plugins/build-monitor-plugin/"); PathToAsset path = new PathToAsset(base, "less/index.less"); - - assertThat(absolute(path), is("/opt/jenkins/plugins/build-monitor-plugin/less/index.less")); + //Tweaking it to be able to run on Windows + String actualValue = absolute(path).replace("\\", "/"); + String expectedValue = "/opt/jenkins/plugins/build-monitor-plugin/less/index.less"; + assertTrue("\nActual: " + actualValue + " \n does not contain expected value : " + expectedValue, actualValue.contains(expectedValue)); } @Test @@ -26,8 +27,10 @@ public void works_with_unc_paths_on_windows() throws Exception { URL base = baseResourceUrlGivenByJenkins("file://server/jenkins/plugins/build-monitor-plugin/"); PathToAsset path = new PathToAsset(base, "less/index.less"); - - assertThat(absolute(path), is("/server/jenkins/plugins/build-monitor-plugin/less/index.less")); + //Tweaking it to be able to run on Windows + String actualValue = absolute(path).replace("\\", "/"); + String expectedValue = "/server/jenkins/plugins/build-monitor-plugin/less/index.less"; + assertTrue("\nActual: " + actualValue + " \n does not contain expected value : " + expectedValue, actualValue.contains(expectedValue)); } @Rule public ExpectedException thrown = ExpectedException.none(); 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 f91bcde40..e974bc188 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 @@ -38,11 +38,11 @@ public void should_tell_if_a_build_was_aborted() throws Exception { // -- private Feature hasHeadlineThatShowsCommitters() { - return new HasHeadline(new HeadlineConfig(true)); + return new HasHeadline(new HeadlineConfig(true, false)); } private Feature hasHeadlineThatDoesNotShowCommitters() { - return new HasHeadline(new HeadlineConfig(false)); + return new HasHeadline(new HeadlineConfig(false, false)); } private String headlineOf(JobView job) { 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 805771852..3c93d2c5f 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 @@ -81,11 +81,11 @@ public void should_tell_the_number_of_broken_builds_since_the_last_build_broken_ // -- private Feature hasHeadlineThatShowsCommitters() { - return new HasHeadline(new HeadlineConfig(true)); + return new HasHeadline(new HeadlineConfig(true, false)); } private Feature hasHeadlineThatDoesNotShowCommitters() { - return new HasHeadline(new HeadlineConfig(false)); + return new HasHeadline(new HeadlineConfig(false, false)); } private String headlineOf(JobView job) { 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 0282930bf..dd1b9af29 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 @@ -37,7 +37,7 @@ public void should_congratulate_anonymously_if_broken_build_was_fixed_without_kn a(job().whereTheLast(build().succeededThanksTo()). andThePrevious(build().wasBrokenBy("Daniel", "Ben"))))); - assertThat(headlineOf(view), is("Back in the green!")); + assertThat(headlineOf(view), is("")); } @Test @@ -46,7 +46,7 @@ public void should_congratulate_anonymously_when_the_build_is_fixed_but_the_comm a(job().whereTheLast(build().succeededThanksTo("Adam")). andThePrevious(build().wasBrokenBy("Daniel", "Ben"))))); - assertThat(headlineOf(view), is("Back in the green!")); + assertThat(headlineOf(view), is("")); } @Test @@ -69,11 +69,11 @@ public void should_not_congratulate_if_no_failure_before() throws Exception { // -- private Feature hasHeadlineThatShowsCommitters() { - return new HasHeadline(new HeadlineConfig(true)); + return new HasHeadline(new HeadlineConfig(true, true)); } private Feature hasHeadlineThatDoesNotShowCommitters() { - return new HasHeadline(new HeadlineConfig(false)); + return new HasHeadline(new HeadlineConfig(false, false)); } private String headlineOf(JobView job) { 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 82ad4d68a..fd33377be 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 @@ -49,11 +49,11 @@ public void should_not_tell_whose_changes_are_being_built_if_commiters_are_not_t // -- private Feature hasHeadlineThatShowsCommitters() { - return new HasHeadline(new HeadlineConfig(true)); + return new HasHeadline(new HeadlineConfig(true, false)); } private Feature hasHeadlineThatDoesNotShowCommitters() { - return new HasHeadline(new HeadlineConfig(false)); + return new HasHeadline(new HeadlineConfig(false, false)); } private String headlineOf(JobView job) { 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 ca1876511..917d850af 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 @@ -22,7 +22,7 @@ public void should_say_nothing_if_no_builds_were_executed() throws Exception { // -- private Feature hasHeadlineThatShowsCommitters() { - return new HasHeadline(new HeadlineConfig(true)); + return new HasHeadline(new HeadlineConfig(true, false)); } private String headlineOf(JobView job) {