From d51d78a7f4554a163b4254aa25cb1fed4fe30460 Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Tue, 14 Dec 2021 19:06:03 -0800 Subject: [PATCH] Clean up build --- core/pom.xml | 34 ++++++-------- .../org/kohsuke/stapler/DispatcherTest.java | 18 +++---- .../org/kohsuke/stapler/Stapler2Test.java | 13 ++--- .../stapler/bind/JavaScriptProxyTest.java | 6 +++ .../interceptor/JsonOutputFilterTest.java | 6 +++ .../kohsuke/stapler/json/JsonBodyTest.java | 4 +- .../stapler/json/SubmittedFormTest.java | 2 +- groovy/pom.xml | 2 + jelly/pom.xml | 15 +++--- .../stapler/jelly/BindTagJQueryTest.java | 2 + .../kohsuke/stapler/jelly/BindTagTest.java | 2 + jrebel/pom.xml | 1 + jruby/pom.xml | 7 ++- jsp/pom.xml | 1 + pom.xml | 47 ++++++++++++------- 15 files changed, 96 insertions(+), 64 deletions(-) diff --git a/core/pom.xml b/core/pom.xml index 6e341723aa..6aab0b44a2 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -1,3 +1,4 @@ + 4.0.0 @@ -51,11 +52,6 @@ commons-io 2.11.0 - - commons-logging - commons-logging - 1.2 - commons-codec commons-codec @@ -111,6 +107,12 @@ 20110809 true + + commons-httpclient + commons-httpclient + 3.1 + test + junit junit @@ -119,6 +121,7 @@ org.mockito mockito-core + test org.kohsuke.metainf-services @@ -128,22 +131,27 @@ org.eclipse.jetty jetty-server + test org.eclipse.jetty jetty-util + test org.eclipse.jetty jetty-servlet + test org.eclipse.jetty jetty-webapp + test - org.jvnet.hudson - htmlunit + org.jenkins-ci.main + jenkins-test-harness-htmlunit + test com.jolira @@ -165,25 +173,13 @@ org.jenkins-ci test-annotations - 1.4 test org.hamcrest hamcrest - 2.2 test - - com.github.spotbugs - spotbugs-annotations - - - com.google.code.findbugs - jsr305 - - - diff --git a/core/src/test/java/org/kohsuke/stapler/DispatcherTest.java b/core/src/test/java/org/kohsuke/stapler/DispatcherTest.java index 17eee2e76e..e5740f09c6 100644 --- a/core/src/test/java/org/kohsuke/stapler/DispatcherTest.java +++ b/core/src/test/java/org/kohsuke/stapler/DispatcherTest.java @@ -5,7 +5,7 @@ import com.gargoylesoftware.htmlunit.Page; import com.gargoylesoftware.htmlunit.TextPage; import com.gargoylesoftware.htmlunit.WebClient; -import com.gargoylesoftware.htmlunit.WebRequestSettings; +import com.gargoylesoftware.htmlunit.WebRequest; import org.apache.commons.io.IOUtils; import org.kohsuke.stapler.interceptor.RequirePOST; import org.kohsuke.stapler.json.JsonBody; @@ -84,7 +84,7 @@ public void testVerbMatch() throws Exception { } private void check(WebClient wc, HttpMethod m) throws java.io.IOException { - TextPage p = wc.getPage(new WebRequestSettings(new URL(url, "verbMatch/"), m)); + TextPage p = wc.getPage(new WebRequest(new URL(url, "verbMatch/"), m)); assertEquals("Got " + m.name(), p.getContent()); } @@ -146,7 +146,7 @@ public void testInterceptorStage() throws Exception { assertEquals(404, e.getStatusCode()); } - WebRequestSettings req = new WebRequestSettings(new URL(url, "interceptorStage/foo"), HttpMethod.POST); + WebRequest req = new WebRequest(new URL(url, "interceptorStage/foo"), HttpMethod.POST); req.setAdditionalHeader("Content-Type","application/json"); req.setRequestBody("{x:3,y:5}"); TextPage p = wc.getPage(req); @@ -163,7 +163,7 @@ public void testInterceptorStageContentTypeWithCharset() throws Exception { assertEquals(404, e.getStatusCode()); } - WebRequestSettings req = new WebRequestSettings(new URL(url, "interceptorStage/foo"), HttpMethod.POST); + WebRequest req = new WebRequest(new URL(url, "interceptorStage/foo"), HttpMethod.POST); req.setAdditionalHeader("Content-Type","application/json; charset=utf-8"); req.setRequestBody("{x:3,y:5}"); TextPage p = wc.getPage(req); @@ -227,7 +227,7 @@ public void testPutInheritance() throws Exception { WebClient wc = new WebClient(); // the request should get to the overriding method and it should still see all the annotations in the base type - WebRequestSettings wrs = new WebRequestSettings(new URL(url, "putInheritance/foo"), HttpMethod.PUT); + WebRequest wrs = new WebRequest(new URL(url, "putInheritance/foo"), HttpMethod.PUT); wrs.setRequestBody("Hello"); TextPage p = wc.getPage(wrs); assertEquals("Hello World!", p.getContent()); @@ -241,7 +241,7 @@ public void testPutInheritance() throws Exception { } //Invoke Post as well - wrs = new WebRequestSettings(new URL(url, "putInheritance/acme"), HttpMethod.POST); + wrs = new WebRequest(new URL(url, "putInheritance/acme"), HttpMethod.POST); wrs.setRequestBody("Hello"); p = wc.getPage(wrs); assertEquals("POST: Hello", p.getContent()); @@ -255,14 +255,14 @@ public void testInterfaceMethods() throws Exception { } catch (FailingHttpStatusCodeException x) { assertEquals(HttpServletResponse.SC_METHOD_NOT_ALLOWED, x.getStatusCode()); } - assertEquals("default", wc.getPage(new WebRequestSettings(new URL(url, "usesInterfaceMethods/foo"), HttpMethod.POST)).getWebResponse().getContentAsString().trim()); + assertEquals("default", wc.getPage(new WebRequest(new URL(url, "usesInterfaceMethods/foo"), HttpMethod.POST)).getWebResponse().getContentAsString().trim()); try { wc.getPage(new URL(url, "overridesInterfaceMethods/foo")); fail(); } catch (FailingHttpStatusCodeException x) { assertEquals(HttpServletResponse.SC_METHOD_NOT_ALLOWED, x.getStatusCode()); } - assertEquals("due to UnionAnnotatedElement it is even inherited", "overridden", wc.getPage(new WebRequestSettings(new URL(url, "overridesInterfaceMethods/foo"), HttpMethod.POST)).getWebResponse().getContentAsString().trim()); + assertEquals("due to UnionAnnotatedElement it is even inherited", "overridden", wc.getPage(new WebRequest(new URL(url, "overridesInterfaceMethods/foo"), HttpMethod.POST)).getWebResponse().getContentAsString().trim()); } public interface InterfaceWithWebMethods { @RequirePOST @@ -309,7 +309,7 @@ public void testRequirePostOnBase() throws Exception { } // POST should succeed - wc.getPage(new WebRequestSettings(url, HttpMethod.POST)); + wc.getPage(new WebRequest(url, HttpMethod.POST)); assertEquals(1, requirePostOnBase.hit); } diff --git a/core/src/test/java/org/kohsuke/stapler/Stapler2Test.java b/core/src/test/java/org/kohsuke/stapler/Stapler2Test.java index ec621775f4..472e2cb8ba 100644 --- a/core/src/test/java/org/kohsuke/stapler/Stapler2Test.java +++ b/core/src/test/java/org/kohsuke/stapler/Stapler2Test.java @@ -26,8 +26,10 @@ package org.kohsuke.stapler; +import static org.junit.Assert.assertThrows; + +import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException; import com.gargoylesoftware.htmlunit.WebClient; -import com.gargoylesoftware.htmlunit.WebResponse; import java.net.URL; import javax.servlet.http.HttpServletResponse; import org.jvnet.hudson.test.For; @@ -40,16 +42,15 @@ public class Stapler2Test extends JettyTestCase { @Issue("SECURITY-390") public void testTraceXSS() throws Exception { WebClient wc = new WebClient(); - wc.setThrowExceptionOnFailingStatusCode(false); - WebResponse rsp; + FailingHttpStatusCodeException exc; Dispatcher.TRACE = true; try { - rsp = wc.getPage(new URL(this.url, "thing/