From 2a76ad5826c24d27f4d6fcd3764ed6ab4a21d34e Mon Sep 17 00:00:00 2001 From: Microscotch Date: Mon, 23 Jan 2023 09:00:20 +0100 Subject: [PATCH 1/7] Add missing markup formater for CredentialParameterDefinition --- .../credentials/CredentialsParameterDefinition/config.jelly | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/com/cloudbees/plugins/credentials/CredentialsParameterDefinition/config.jelly b/src/main/resources/com/cloudbees/plugins/credentials/CredentialsParameterDefinition/config.jelly index 31a659d44..c3d91d5d4 100644 --- a/src/main/resources/com/cloudbees/plugins/credentials/CredentialsParameterDefinition/config.jelly +++ b/src/main/resources/com/cloudbees/plugins/credentials/CredentialsParameterDefinition/config.jelly @@ -39,7 +39,7 @@ - - + + From e49e6ca5a3cd126eef69614a101d562a0ced662d Mon Sep 17 00:00:00 2001 From: Microscotch Date: Tue, 24 Jan 2023 08:31:01 +0000 Subject: [PATCH 2/7] Add validation test --- .../CredentialsParameterDefinitionTest.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/test/java/com/cloudbees/plugins/credentials/CredentialsParameterDefinitionTest.java b/src/test/java/com/cloudbees/plugins/credentials/CredentialsParameterDefinitionTest.java index d8df68a79..5e27dfa91 100644 --- a/src/test/java/com/cloudbees/plugins/credentials/CredentialsParameterDefinitionTest.java +++ b/src/test/java/com/cloudbees/plugins/credentials/CredentialsParameterDefinitionTest.java @@ -157,6 +157,21 @@ public void escapeAndMarkupFormatAreDoneCorrectly() throws Exception { collector.checkThat("parameters page should not leave param name unescaped", text, not(containsString(""))); collector.checkThat("parameters page should mark up param description", text, containsString("[param description]")); collector.checkThat("parameters page should not leave param description unescaped", text, not(containsString(""))); + + page = wc.getPage(p, "configure"); + form = page.getFormByName("config"); + HtmlTextArea value = form.getTextAreaByName("parameter.description"); + value.setText(""); + r.submit(form); + r.waitUntilNoActivity(); + page = wc.getPage(p, "build?delay=0sec"); + collector.checkThat(page.getWebResponse().getStatusCode(), is(HttpURLConnection.HTTP_BAD_METHOD)); // 405 to dissuade scripts from thinking this triggered the build + text = page.getWebResponse().getContentAsString(); + collector.checkThat("build page should escape param name", text, containsString("<param name>")); + collector.checkThat("build page should not leave param name unescaped", text, not(containsString(""))); + collector.checkThat("build page should mark up param description", text, containsString("[markup description]")); + collector.checkThat("build page should not leave param description unescaped", text, not(containsString(""))); + } static class MyMarkupFormatter extends MarkupFormatter { From dd01fcc3f4a2d2d077e06ea1abaadf43b72c1b2c Mon Sep 17 00:00:00 2001 From: Microscotch Date: Tue, 24 Jan 2023 10:22:07 +0100 Subject: [PATCH 3/7] Update textarea name for description --- .../credentials/CredentialsParameterDefinition/config.jelly | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/com/cloudbees/plugins/credentials/CredentialsParameterDefinition/config.jelly b/src/main/resources/com/cloudbees/plugins/credentials/CredentialsParameterDefinition/config.jelly index c3d91d5d4..947d40817 100644 --- a/src/main/resources/com/cloudbees/plugins/credentials/CredentialsParameterDefinition/config.jelly +++ b/src/main/resources/com/cloudbees/plugins/credentials/CredentialsParameterDefinition/config.jelly @@ -40,6 +40,6 @@ - + From 984594ce7bb828b5c88d2eb826a3b9f1f67ba186 Mon Sep 17 00:00:00 2001 From: Microscotch Date: Tue, 24 Jan 2023 10:27:21 +0100 Subject: [PATCH 4/7] Update tests Reflect description name attribute update --- .../plugins/credentials/CredentialsParameterDefinitionTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/cloudbees/plugins/credentials/CredentialsParameterDefinitionTest.java b/src/test/java/com/cloudbees/plugins/credentials/CredentialsParameterDefinitionTest.java index 5e27dfa91..1c4447146 100644 --- a/src/test/java/com/cloudbees/plugins/credentials/CredentialsParameterDefinitionTest.java +++ b/src/test/java/com/cloudbees/plugins/credentials/CredentialsParameterDefinitionTest.java @@ -160,7 +160,7 @@ public void escapeAndMarkupFormatAreDoneCorrectly() throws Exception { page = wc.getPage(p, "configure"); form = page.getFormByName("config"); - HtmlTextArea value = form.getTextAreaByName("parameter.description"); + HtmlTextArea value = form.getTextAreaByName(param.name+".description"); value.setText(""); r.submit(form); r.waitUntilNoActivity(); From 9181f67fb398ec149a95b40ff7dcdae043ae9a7b Mon Sep 17 00:00:00 2001 From: Microscotch Date: Tue, 31 Jan 2023 00:04:54 +0100 Subject: [PATCH 5/7] Update src/main/resources/com/cloudbees/plugins/credentials/CredentialsParameterDefinition/config.jelly Apply suggestion Co-authored-by: Daniel Beck <1831569+daniel-beck@users.noreply.github.com> --- .../credentials/CredentialsParameterDefinition/config.jelly | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/com/cloudbees/plugins/credentials/CredentialsParameterDefinition/config.jelly b/src/main/resources/com/cloudbees/plugins/credentials/CredentialsParameterDefinition/config.jelly index c3d91d5d4..67348f58a 100644 --- a/src/main/resources/com/cloudbees/plugins/credentials/CredentialsParameterDefinition/config.jelly +++ b/src/main/resources/com/cloudbees/plugins/credentials/CredentialsParameterDefinition/config.jelly @@ -39,7 +39,7 @@ - - + + From 3f5fc93b91b4d13da349c1c80148147e4aa3a266 Mon Sep 17 00:00:00 2001 From: Microscotch Date: Tue, 7 Feb 2023 00:42:15 +0000 Subject: [PATCH 6/7] Remove useless test --- .../CredentialsParameterDefinitionTest.java | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/src/test/java/com/cloudbees/plugins/credentials/CredentialsParameterDefinitionTest.java b/src/test/java/com/cloudbees/plugins/credentials/CredentialsParameterDefinitionTest.java index 1c4447146..288cbbe5c 100644 --- a/src/test/java/com/cloudbees/plugins/credentials/CredentialsParameterDefinitionTest.java +++ b/src/test/java/com/cloudbees/plugins/credentials/CredentialsParameterDefinitionTest.java @@ -156,22 +156,7 @@ public void escapeAndMarkupFormatAreDoneCorrectly() throws Exception { collector.checkThat("parameters page should escape param name", text, containsString("<param name>")); collector.checkThat("parameters page should not leave param name unescaped", text, not(containsString(""))); collector.checkThat("parameters page should mark up param description", text, containsString("[param description]")); - collector.checkThat("parameters page should not leave param description unescaped", text, not(containsString(""))); - - page = wc.getPage(p, "configure"); - form = page.getFormByName("config"); - HtmlTextArea value = form.getTextAreaByName(param.name+".description"); - value.setText(""); - r.submit(form); - r.waitUntilNoActivity(); - page = wc.getPage(p, "build?delay=0sec"); - collector.checkThat(page.getWebResponse().getStatusCode(), is(HttpURLConnection.HTTP_BAD_METHOD)); // 405 to dissuade scripts from thinking this triggered the build - text = page.getWebResponse().getContentAsString(); - collector.checkThat("build page should escape param name", text, containsString("<param name>")); - collector.checkThat("build page should not leave param name unescaped", text, not(containsString(""))); - collector.checkThat("build page should mark up param description", text, containsString("[markup description]")); - collector.checkThat("build page should not leave param description unescaped", text, not(containsString(""))); - + collector.checkThat("parameters page should not leave param description unescaped", text, not(containsString(""))); } static class MyMarkupFormatter extends MarkupFormatter { From 1089350c73175857abe7b900916808c46090ab09 Mon Sep 17 00:00:00 2001 From: Microscotch Date: Tue, 7 Feb 2023 09:04:01 +0000 Subject: [PATCH 7/7] Trim trailing white spaces --- .../plugins/credentials/CredentialsParameterDefinitionTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/cloudbees/plugins/credentials/CredentialsParameterDefinitionTest.java b/src/test/java/com/cloudbees/plugins/credentials/CredentialsParameterDefinitionTest.java index 288cbbe5c..d8df68a79 100644 --- a/src/test/java/com/cloudbees/plugins/credentials/CredentialsParameterDefinitionTest.java +++ b/src/test/java/com/cloudbees/plugins/credentials/CredentialsParameterDefinitionTest.java @@ -156,7 +156,7 @@ public void escapeAndMarkupFormatAreDoneCorrectly() throws Exception { collector.checkThat("parameters page should escape param name", text, containsString("<param name>")); collector.checkThat("parameters page should not leave param name unescaped", text, not(containsString(""))); collector.checkThat("parameters page should mark up param description", text, containsString("[param description]")); - collector.checkThat("parameters page should not leave param description unescaped", text, not(containsString(""))); + collector.checkThat("parameters page should not leave param description unescaped", text, not(containsString(""))); } static class MyMarkupFormatter extends MarkupFormatter {