From ce29cc9ca14e499e1e7a77692f00d5b310a151a2 Mon Sep 17 00:00:00 2001 From: Allan Burdajewicz Date: Wed, 16 Oct 2024 12:59:34 +1000 Subject: [PATCH 1/2] [JENKINS-73930] Put back the disabled warning --- .../AbstractFolder/view-index-top.jelly | 3 +++ .../folder/computed/ComputedFolderTest.java | 25 ++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/main/resources/com/cloudbees/hudson/plugins/folder/AbstractFolder/view-index-top.jelly b/src/main/resources/com/cloudbees/hudson/plugins/folder/AbstractFolder/view-index-top.jelly index ea9408ac..736c1c6d 100644 --- a/src/main/resources/com/cloudbees/hudson/plugins/folder/AbstractFolder/view-index-top.jelly +++ b/src/main/resources/com/cloudbees/hudson/plugins/folder/AbstractFolder/view-index-top.jelly @@ -53,6 +53,9 @@ THE SOFTWARE. + +
${%disabled(it.pronoun)}
+
diff --git a/src/test/java/com/cloudbees/hudson/plugins/folder/computed/ComputedFolderTest.java b/src/test/java/com/cloudbees/hudson/plugins/folder/computed/ComputedFolderTest.java index 19cf5afe..04c2d049 100644 --- a/src/test/java/com/cloudbees/hudson/plugins/folder/computed/ComputedFolderTest.java +++ b/src/test/java/com/cloudbees/hudson/plugins/folder/computed/ComputedFolderTest.java @@ -33,6 +33,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -40,7 +41,6 @@ import com.cloudbees.hudson.plugins.folder.Folder; import com.cloudbees.hudson.plugins.folder.views.AbstractFolderViewHolder; import org.htmlunit.html.DomElement; -import org.htmlunit.html.HtmlForm; import org.htmlunit.html.HtmlPage; import edu.umd.cs.findbugs.annotations.CheckForNull; import edu.umd.cs.findbugs.annotations.NonNull; @@ -625,6 +625,29 @@ public void failAllDeletedOnes() throws Exception { d.assertItemNames(2, "A"); } + @Issue("JENKINS-73930") + @Test + public void disabledWarningFromUiViews() throws Exception { + LockedDownSampleComputedFolder folder = r.jenkins.createProject(LockedDownSampleComputedFolder.class, "d"); + assertFalse("by default, a folder is disabled", folder.isDisabled()); + folder.getViews().forEach(view -> { + try { + assertNull(r.createWebClient().goTo(view.getViewUrl()).getElementById("disabled-message")); + } catch (Exception e) { + Assert.fail(); + } + }); + folder.setDisabled(true); + folder.save(); + folder.getViews().forEach(view -> { + try { + assertNotNull(r.createWebClient().goTo(view.getViewUrl()).getElementById("disabled-message")); + } catch (Exception e) { + Assert.fail(); + } + }); + } + /** * Waits until Hudson finishes building everything, including those in the queue, or fail the test * if the specified timeout milliseconds is From fcc2359a069a0161e3ddcf30849340378fcb8eac Mon Sep 17 00:00:00 2001 From: Allan Burdajewicz Date: Mon, 9 Dec 2024 17:15:12 +1000 Subject: [PATCH 2/2] [JENKINS-73930] Use for loop --- .../folder/computed/ComputedFolderTest.java | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/test/java/com/cloudbees/hudson/plugins/folder/computed/ComputedFolderTest.java b/src/test/java/com/cloudbees/hudson/plugins/folder/computed/ComputedFolderTest.java index 04c2d049..80ddcb6b 100644 --- a/src/test/java/com/cloudbees/hudson/plugins/folder/computed/ComputedFolderTest.java +++ b/src/test/java/com/cloudbees/hudson/plugins/folder/computed/ComputedFolderTest.java @@ -630,22 +630,14 @@ public void failAllDeletedOnes() throws Exception { public void disabledWarningFromUiViews() throws Exception { LockedDownSampleComputedFolder folder = r.jenkins.createProject(LockedDownSampleComputedFolder.class, "d"); assertFalse("by default, a folder is disabled", folder.isDisabled()); - folder.getViews().forEach(view -> { - try { - assertNull(r.createWebClient().goTo(view.getViewUrl()).getElementById("disabled-message")); - } catch (Exception e) { - Assert.fail(); - } - }); + for(View view : folder.getViews()){ + assertNull(r.createWebClient().goTo(view.getViewUrl()).getElementById("disabled-message")); + } folder.setDisabled(true); folder.save(); - folder.getViews().forEach(view -> { - try { - assertNotNull(r.createWebClient().goTo(view.getViewUrl()).getElementById("disabled-message")); - } catch (Exception e) { - Assert.fail(); - } - }); + for(View view : folder.getViews()){ + assertNotNull(r.createWebClient().goTo(view.getViewUrl()).getElementById("disabled-message")); + } } /**