From e39cab829b420b8cef6f221ecf92a616516ef6cc Mon Sep 17 00:00:00 2001 From: Tim Jacomb <21194782+timja@users.noreply.github.com> Date: Mon, 5 Jun 2023 00:32:01 +0100 Subject: [PATCH] Update htmlunit to 3.x (#2283) --- .../casc/permissions/PermissionsTest.java | 2 +- .../casc/yaml/MergeStrategyActionTest.java | 6 +++--- pom.xml | 2 +- .../plugins/casc/misc/RoundTripAbstractTest.java | 8 ++++---- .../plugins/casc/ConfigurationAsCodeTest.java | 16 ++++++++-------- .../jenkins/plugins/casc/Security1290Test.java | 4 ++-- .../io/jenkins/plugins/casc/YamlReaderTest.java | 6 +++--- 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/plugin/src/test/java/io/jenkins/plugins/casc/permissions/PermissionsTest.java b/plugin/src/test/java/io/jenkins/plugins/casc/permissions/PermissionsTest.java index 447167ac35..c44b7b1ef1 100644 --- a/plugin/src/test/java/io/jenkins/plugins/casc/permissions/PermissionsTest.java +++ b/plugin/src/test/java/io/jenkins/plugins/casc/permissions/PermissionsTest.java @@ -13,10 +13,10 @@ import static org.hamcrest.Matchers.not; import static org.junit.Assert.assertEquals; -import com.gargoylesoftware.htmlunit.html.HtmlPage; import com.google.common.collect.ImmutableMap; import java.util.Map; import jenkins.model.Jenkins; +import org.htmlunit.html.HtmlPage; import org.junit.Rule; import org.junit.Test; import org.jvnet.hudson.test.JenkinsRule; diff --git a/plugin/src/test/java/io/jenkins/plugins/casc/yaml/MergeStrategyActionTest.java b/plugin/src/test/java/io/jenkins/plugins/casc/yaml/MergeStrategyActionTest.java index 22633df12b..4c3753437c 100644 --- a/plugin/src/test/java/io/jenkins/plugins/casc/yaml/MergeStrategyActionTest.java +++ b/plugin/src/test/java/io/jenkins/plugins/casc/yaml/MergeStrategyActionTest.java @@ -1,15 +1,15 @@ package io.jenkins.plugins.casc.yaml; -import static com.gargoylesoftware.htmlunit.HttpMethod.GET; +import static org.htmlunit.HttpMethod.GET; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import com.gargoylesoftware.htmlunit.WebRequest; -import com.gargoylesoftware.htmlunit.WebResponse; import java.io.IOException; import java.net.URL; import java.text.MessageFormat; import net.sf.json.JSONObject; +import org.htmlunit.WebRequest; +import org.htmlunit.WebResponse; import org.junit.Rule; import org.junit.Test; import org.jvnet.hudson.test.JenkinsRule; diff --git a/pom.xml b/pom.xml index 3f778a8e22..b9a2cdebc7 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.jenkins-ci.plugins plugin - 4.64 + 4.66 diff --git a/test-harness/src/main/java/io/jenkins/plugins/casc/misc/RoundTripAbstractTest.java b/test-harness/src/main/java/io/jenkins/plugins/casc/misc/RoundTripAbstractTest.java index 2ae5aab91c..94382c89e1 100644 --- a/test-harness/src/main/java/io/jenkins/plugins/casc/misc/RoundTripAbstractTest.java +++ b/test-harness/src/main/java/io/jenkins/plugins/casc/misc/RoundTripAbstractTest.java @@ -1,15 +1,12 @@ package io.jenkins.plugins.casc.misc; -import static com.gargoylesoftware.htmlunit.HttpMethod.POST; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; +import static org.htmlunit.HttpMethod.POST; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; -import com.gargoylesoftware.htmlunit.WebRequest; -import com.gargoylesoftware.htmlunit.WebResponse; -import com.gargoylesoftware.htmlunit.util.NameValuePair; import io.jenkins.plugins.casc.ConfigurationAsCode; import io.jenkins.plugins.casc.ConfiguratorException; import java.io.File; @@ -20,6 +17,9 @@ import java.util.Collections; import java.util.logging.Level; import org.apache.commons.io.IOUtils; +import org.htmlunit.WebRequest; +import org.htmlunit.WebResponse; +import org.htmlunit.util.NameValuePair; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; diff --git a/test-harness/src/test/java/io/jenkins/plugins/casc/ConfigurationAsCodeTest.java b/test-harness/src/test/java/io/jenkins/plugins/casc/ConfigurationAsCodeTest.java index f28a263eda..8cd9f4a30f 100644 --- a/test-harness/src/test/java/io/jenkins/plugins/casc/ConfigurationAsCodeTest.java +++ b/test-harness/src/test/java/io/jenkins/plugins/casc/ConfigurationAsCodeTest.java @@ -1,6 +1,5 @@ package io.jenkins.plugins.casc; -import static com.gargoylesoftware.htmlunit.HttpMethod.POST; import static io.jenkins.plugins.casc.ConfigurationAsCode.CASC_JENKINS_CONFIG_PROPERTY; import static io.jenkins.plugins.casc.misc.Util.getJenkinsRoot; import static io.jenkins.plugins.casc.misc.Util.toYamlString; @@ -10,15 +9,11 @@ import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.is; +import static org.htmlunit.HttpMethod.POST; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; -import com.gargoylesoftware.htmlunit.WebRequest; -import com.gargoylesoftware.htmlunit.WebResponse; -import com.gargoylesoftware.htmlunit.html.HtmlForm; -import com.gargoylesoftware.htmlunit.html.HtmlInput; -import com.gargoylesoftware.htmlunit.html.HtmlPage; import hudson.Functions; import hudson.util.FormValidation; import io.jenkins.plugins.casc.misc.ConfiguredWithCode; @@ -36,6 +31,11 @@ import java.util.Arrays; import java.util.List; import java.util.Map; +import org.htmlunit.WebRequest; +import org.htmlunit.WebResponse; +import org.htmlunit.html.HtmlForm; +import org.htmlunit.html.HtmlInput; +import org.htmlunit.html.HtmlPage; import org.junit.Assume; import org.junit.Rule; import org.junit.Test; @@ -228,7 +228,7 @@ public void doReplace_should_trim_input() throws Exception { HtmlForm form = page.getFormByName("replace"); HtmlInput input = form.getInputByName("_.newSource"); String configUri = getClass().getResource("merge3.yml").toExternalForm(); - input.setValueAttribute(" " + configUri + " "); + input.setValue(" " + configUri + " "); HtmlPage resultPage = j.submit(form); j.assertGoodStatus(resultPage); @@ -246,7 +246,7 @@ public void doReplace_should_support_multiple_sources() throws Exception { " %s , %s ", getClass().getResource("JenkinsConfigTest.yml").toExternalForm(), getClass().getResource("folder/jenkins2.yml").toExternalForm()); - input.setValueAttribute(configUri); + input.setValue(configUri); HtmlPage resultPage = j.submit(form); j.assertGoodStatus(resultPage); diff --git a/test-harness/src/test/java/io/jenkins/plugins/casc/Security1290Test.java b/test-harness/src/test/java/io/jenkins/plugins/casc/Security1290Test.java index 33bb326a55..81e8a9895d 100644 --- a/test-harness/src/test/java/io/jenkins/plugins/casc/Security1290Test.java +++ b/test-harness/src/test/java/io/jenkins/plugins/casc/Security1290Test.java @@ -2,13 +2,13 @@ import static org.junit.Assert.assertEquals; -import com.gargoylesoftware.htmlunit.HttpMethod; -import com.gargoylesoftware.htmlunit.WebRequest; import io.jenkins.plugins.casc.misc.JenkinsConfiguredWithCodeRule; import java.io.IOException; import java.net.HttpURLConnection; import java.net.URL; import jenkins.model.Jenkins; +import org.htmlunit.HttpMethod; +import org.htmlunit.WebRequest; import org.junit.Rule; import org.junit.Test; import org.jvnet.hudson.test.JenkinsRule; diff --git a/test-harness/src/test/java/io/jenkins/plugins/casc/YamlReaderTest.java b/test-harness/src/test/java/io/jenkins/plugins/casc/YamlReaderTest.java index 44de44fb44..df8f92f16f 100644 --- a/test-harness/src/test/java/io/jenkins/plugins/casc/YamlReaderTest.java +++ b/test-harness/src/test/java/io/jenkins/plugins/casc/YamlReaderTest.java @@ -1,12 +1,10 @@ package io.jenkins.plugins.casc; -import static com.gargoylesoftware.htmlunit.HttpMethod.POST; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; +import static org.htmlunit.HttpMethod.POST; import static org.junit.Assert.assertEquals; -import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException; -import com.gargoylesoftware.htmlunit.WebRequest; import io.jenkins.plugins.casc.misc.JenkinsConfiguredWithCodeRule; import io.jenkins.plugins.casc.yaml.YamlSource; import io.jenkins.plugins.casc.yaml.YamlUtils; @@ -16,6 +14,8 @@ import java.nio.file.Paths; import java.text.MessageFormat; import jenkins.model.Jenkins; +import org.htmlunit.FailingHttpStatusCodeException; +import org.htmlunit.WebRequest; import org.junit.Rule; import org.junit.Test;