Skip to content

Commit d51d78a

Browse files
committed
Clean up build
1 parent fc8f8f7 commit d51d78a

File tree

15 files changed

+96
-64
lines changed

15 files changed

+96
-64
lines changed

core/pom.xml

+15-19
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
12
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
23
<modelVersion>4.0.0</modelVersion>
34
<parent>
@@ -51,11 +52,6 @@
5152
<artifactId>commons-io</artifactId>
5253
<version>2.11.0</version>
5354
</dependency>
54-
<dependency>
55-
<groupId>commons-logging</groupId>
56-
<artifactId>commons-logging</artifactId>
57-
<version>1.2</version>
58-
</dependency>
5955
<dependency>
6056
<groupId>commons-codec</groupId>
6157
<artifactId>commons-codec</artifactId>
@@ -111,6 +107,12 @@
111107
<version>20110809</version>
112108
<optional>true</optional>
113109
</dependency>
110+
<dependency>
111+
<groupId>commons-httpclient</groupId>
112+
<artifactId>commons-httpclient</artifactId>
113+
<version>3.1</version>
114+
<scope>test</scope>
115+
</dependency>
114116
<dependency>
115117
<groupId>junit</groupId>
116118
<artifactId>junit</artifactId>
@@ -119,6 +121,7 @@
119121
<dependency>
120122
<groupId>org.mockito</groupId>
121123
<artifactId>mockito-core</artifactId>
124+
<scope>test</scope>
122125
</dependency>
123126
<dependency>
124127
<groupId>org.kohsuke.metainf-services</groupId>
@@ -128,22 +131,27 @@
128131
<dependency>
129132
<groupId>org.eclipse.jetty</groupId>
130133
<artifactId>jetty-server</artifactId>
134+
<scope>test</scope>
131135
</dependency>
132136
<dependency>
133137
<groupId>org.eclipse.jetty</groupId>
134138
<artifactId>jetty-util</artifactId>
139+
<scope>test</scope>
135140
</dependency>
136141
<dependency>
137142
<groupId>org.eclipse.jetty</groupId>
138143
<artifactId>jetty-servlet</artifactId>
144+
<scope>test</scope>
139145
</dependency>
140146
<dependency>
141147
<groupId>org.eclipse.jetty</groupId>
142148
<artifactId>jetty-webapp</artifactId>
149+
<scope>test</scope>
143150
</dependency>
144151
<dependency>
145-
<groupId>org.jvnet.hudson</groupId>
146-
<artifactId>htmlunit</artifactId>
152+
<groupId>org.jenkins-ci.main</groupId>
153+
<artifactId>jenkins-test-harness-htmlunit</artifactId>
154+
<scope>test</scope>
147155
</dependency>
148156
<dependency>
149157
<groupId>com.jolira</groupId>
@@ -165,25 +173,13 @@
165173
<dependency>
166174
<groupId>org.jenkins-ci</groupId>
167175
<artifactId>test-annotations</artifactId>
168-
<version>1.4</version>
169176
<scope>test</scope>
170177
</dependency>
171178
<dependency>
172179
<groupId>org.hamcrest</groupId>
173180
<artifactId>hamcrest</artifactId>
174-
<version>2.2</version>
175181
<scope>test</scope>
176182
</dependency>
177-
<dependency>
178-
<groupId>com.github.spotbugs</groupId>
179-
<artifactId>spotbugs-annotations</artifactId>
180-
<exclusions>
181-
<exclusion>
182-
<groupId>com.google.code.findbugs</groupId>
183-
<artifactId>jsr305</artifactId>
184-
</exclusion>
185-
</exclusions>
186-
</dependency>
187183
</dependencies>
188184
</project>
189185

core/src/test/java/org/kohsuke/stapler/DispatcherTest.java

+9-9
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import com.gargoylesoftware.htmlunit.Page;
66
import com.gargoylesoftware.htmlunit.TextPage;
77
import com.gargoylesoftware.htmlunit.WebClient;
8-
import com.gargoylesoftware.htmlunit.WebRequestSettings;
8+
import com.gargoylesoftware.htmlunit.WebRequest;
99
import org.apache.commons.io.IOUtils;
1010
import org.kohsuke.stapler.interceptor.RequirePOST;
1111
import org.kohsuke.stapler.json.JsonBody;
@@ -84,7 +84,7 @@ public void testVerbMatch() throws Exception {
8484
}
8585

8686
private void check(WebClient wc, HttpMethod m) throws java.io.IOException {
87-
TextPage p = wc.getPage(new WebRequestSettings(new URL(url, "verbMatch/"), m));
87+
TextPage p = wc.getPage(new WebRequest(new URL(url, "verbMatch/"), m));
8888
assertEquals("Got " + m.name(), p.getContent());
8989
}
9090

@@ -146,7 +146,7 @@ public void testInterceptorStage() throws Exception {
146146
assertEquals(404, e.getStatusCode());
147147
}
148148

149-
WebRequestSettings req = new WebRequestSettings(new URL(url, "interceptorStage/foo"), HttpMethod.POST);
149+
WebRequest req = new WebRequest(new URL(url, "interceptorStage/foo"), HttpMethod.POST);
150150
req.setAdditionalHeader("Content-Type","application/json");
151151
req.setRequestBody("{x:3,y:5}");
152152
TextPage p = wc.getPage(req);
@@ -163,7 +163,7 @@ public void testInterceptorStageContentTypeWithCharset() throws Exception {
163163
assertEquals(404, e.getStatusCode());
164164
}
165165

166-
WebRequestSettings req = new WebRequestSettings(new URL(url, "interceptorStage/foo"), HttpMethod.POST);
166+
WebRequest req = new WebRequest(new URL(url, "interceptorStage/foo"), HttpMethod.POST);
167167
req.setAdditionalHeader("Content-Type","application/json; charset=utf-8");
168168
req.setRequestBody("{x:3,y:5}");
169169
TextPage p = wc.getPage(req);
@@ -227,7 +227,7 @@ public void testPutInheritance() throws Exception {
227227
WebClient wc = new WebClient();
228228

229229
// the request should get to the overriding method and it should still see all the annotations in the base type
230-
WebRequestSettings wrs = new WebRequestSettings(new URL(url, "putInheritance/foo"), HttpMethod.PUT);
230+
WebRequest wrs = new WebRequest(new URL(url, "putInheritance/foo"), HttpMethod.PUT);
231231
wrs.setRequestBody("Hello");
232232
TextPage p = wc.getPage(wrs);
233233
assertEquals("Hello World!", p.getContent());
@@ -241,7 +241,7 @@ public void testPutInheritance() throws Exception {
241241
}
242242

243243
//Invoke Post as well
244-
wrs = new WebRequestSettings(new URL(url, "putInheritance/acme"), HttpMethod.POST);
244+
wrs = new WebRequest(new URL(url, "putInheritance/acme"), HttpMethod.POST);
245245
wrs.setRequestBody("Hello");
246246
p = wc.getPage(wrs);
247247
assertEquals("POST: Hello", p.getContent());
@@ -255,14 +255,14 @@ public void testInterfaceMethods() throws Exception {
255255
} catch (FailingHttpStatusCodeException x) {
256256
assertEquals(HttpServletResponse.SC_METHOD_NOT_ALLOWED, x.getStatusCode());
257257
}
258-
assertEquals("default", wc.getPage(new WebRequestSettings(new URL(url, "usesInterfaceMethods/foo"), HttpMethod.POST)).getWebResponse().getContentAsString().trim());
258+
assertEquals("default", wc.getPage(new WebRequest(new URL(url, "usesInterfaceMethods/foo"), HttpMethod.POST)).getWebResponse().getContentAsString().trim());
259259
try {
260260
wc.getPage(new URL(url, "overridesInterfaceMethods/foo"));
261261
fail();
262262
} catch (FailingHttpStatusCodeException x) {
263263
assertEquals(HttpServletResponse.SC_METHOD_NOT_ALLOWED, x.getStatusCode());
264264
}
265-
assertEquals("due to UnionAnnotatedElement it is even inherited", "overridden", wc.getPage(new WebRequestSettings(new URL(url, "overridesInterfaceMethods/foo"), HttpMethod.POST)).getWebResponse().getContentAsString().trim());
265+
assertEquals("due to UnionAnnotatedElement it is even inherited", "overridden", wc.getPage(new WebRequest(new URL(url, "overridesInterfaceMethods/foo"), HttpMethod.POST)).getWebResponse().getContentAsString().trim());
266266
}
267267
public interface InterfaceWithWebMethods {
268268
@RequirePOST
@@ -309,7 +309,7 @@ public void testRequirePostOnBase() throws Exception {
309309
}
310310

311311
// POST should succeed
312-
wc.getPage(new WebRequestSettings(url, HttpMethod.POST));
312+
wc.getPage(new WebRequest(url, HttpMethod.POST));
313313
assertEquals(1, requirePostOnBase.hit);
314314
}
315315

core/src/test/java/org/kohsuke/stapler/Stapler2Test.java

+7-6
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@
2626

2727
package org.kohsuke.stapler;
2828

29+
import static org.junit.Assert.assertThrows;
30+
31+
import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
2932
import com.gargoylesoftware.htmlunit.WebClient;
30-
import com.gargoylesoftware.htmlunit.WebResponse;
3133
import java.net.URL;
3234
import javax.servlet.http.HttpServletResponse;
3335
import org.jvnet.hudson.test.For;
@@ -40,16 +42,15 @@ public class Stapler2Test extends JettyTestCase {
4042
@Issue("SECURITY-390")
4143
public void testTraceXSS() throws Exception {
4244
WebClient wc = new WebClient();
43-
wc.setThrowExceptionOnFailingStatusCode(false);
44-
WebResponse rsp;
45+
FailingHttpStatusCodeException exc;
4546
Dispatcher.TRACE = true;
4647
try {
47-
rsp = wc.getPage(new URL(this.url, "thing/<button>/x")).getWebResponse();
48+
exc = assertThrows(FailingHttpStatusCodeException.class, () -> wc.getPage(new URL(this.url, "thing/<button>/x")).getWebResponse());
4849
} finally {
4950
Dispatcher.TRACE = false;
5051
}
51-
assertEquals(HttpServletResponse.SC_NOT_FOUND, rsp.getStatusCode());
52-
String html = rsp.getContentAsString();
52+
assertEquals(HttpServletResponse.SC_NOT_FOUND, exc.getStatusCode());
53+
String html = exc.getResponse().getContentAsString();
5354
assertTrue(html, html.contains("&lt;button&gt;"));
5455
assertFalse(html, html.contains("<button>"));
5556
}

core/src/test/java/org/kohsuke/stapler/bind/JavaScriptProxyTest.java

+6
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,15 @@ public void handleAlert(Page page, String message) {
4242
HtmlPage page = wc.getPage(new URL(url, "/"));
4343

4444
page.executeJavaScript("v.foo(3,'test',callback);");
45+
wc.getJavaScriptEngine().processPostponedActions();
46+
wc.waitForBackgroundJavaScript(10000);
4547
assertEquals("string:test3",msg[0]);
4648
msg[0] = null;
4749

4850
// test null unmarshalling and marshalling
4951
page.executeJavaScript("v.foo(0,null,callback);");
52+
wc.getJavaScriptEngine().processPostponedActions();
53+
wc.waitForBackgroundJavaScript(10000);
5054
assertEquals("object:null",msg[0]);
5155
}
5256

@@ -57,6 +61,8 @@ public void testAnonymousBind() throws Exception {
5761
WebClient wc = new WebClient();
5862
HtmlPage page = wc.getPage(new URL(url, "/bindAnonymous"));
5963
page.executeJavaScript("v.xyz('hello');");
64+
wc.getJavaScriptEngine().processPostponedActions();
65+
wc.waitForBackgroundJavaScript(10000);
6066
assertEquals("hello",anonymousValue);
6167
}
6268

core/src/test/java/org/kohsuke/stapler/interceptor/JsonOutputFilterTest.java

+6
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ public void handleAlert(Page page, String message) {
3838
HtmlPage page = wc.getPage(new URL(url, "/"));
3939

4040
page.executeJavaScript("v.getSomeExcludedData(callback);");
41+
wc.getJavaScriptEngine().processPostponedActions();
42+
wc.waitForBackgroundJavaScript(10000);
4143

4244
Map json = (Map)JSON.parse(msg[0]);
4345
assertTrue(json.containsKey("name"));
@@ -57,6 +59,8 @@ public void handleAlert(Page page, String message) {
5759
HtmlPage page = wc.getPage(new URL(url, "/"));
5860

5961
page.executeJavaScript("v.getSomeIncludedData(callback);");
62+
wc.getJavaScriptEngine().processPostponedActions();
63+
wc.waitForBackgroundJavaScript(10000);
6064

6165
Map json = (Map)JSON.parse(msg[0]);
6266
assertTrue(json.containsKey("name"));
@@ -76,6 +80,8 @@ public void handleAlert(Page page, String message) {
7680
HtmlPage page = wc.getPage(new URL(url, "/"));
7781

7882
page.executeJavaScript("v.getSomeExcludedList(callback);");
83+
wc.getJavaScriptEngine().processPostponedActions();
84+
wc.waitForBackgroundJavaScript(10000);
7985

8086
Object[] json = (Object[])JSON.parse(msg[0]);
8187
assertEquals(3, json.length);

core/src/test/java/org/kohsuke/stapler/json/JsonBodyTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
import com.gargoylesoftware.htmlunit.HttpMethod;
44
import com.gargoylesoftware.htmlunit.WebClient;
5-
import com.gargoylesoftware.htmlunit.WebRequestSettings;
5+
import com.gargoylesoftware.htmlunit.WebRequest;
66
import com.gargoylesoftware.htmlunit.WebResponse;
77
import java.net.URL;
88
import org.kohsuke.stapler.test.JettyTestCase;
99

1010
public class JsonBodyTest extends JettyTestCase {
1111

1212
public void testSmokes() throws Exception {
13-
WebRequestSettings req = new WebRequestSettings(new URL(url, "double"), HttpMethod.POST);
13+
WebRequest req = new WebRequest(new URL(url, "double"), HttpMethod.POST);
1414
req.setAdditionalHeader("Content-Type", "application/json");
1515
req.setRequestBody("{\"x\":10,\"y\":5}");
1616
WebResponse response = new WebClient().getPage(req).getWebResponse();

core/src/test/java/org/kohsuke/stapler/json/SubmittedFormTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public void testMainFeature() throws Exception {
2929
HtmlPage page = wc.getPage(new URL(url, "/form.html"));
3030
HtmlForm f = page.getFormByName("main");
3131
f.getInputByName("json").setValueAttribute("{\"first\":\"Kohsuke\",\"last\":\"Kawaguchi\"}");
32-
f.submit();
32+
f.submit(null);
3333
}
3434

3535
public HttpResponse doSubmit(@SubmittedForm JSONObject o) {

groovy/pom.xml

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
12
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
23
<modelVersion>4.0.0</modelVersion>
34
<parent>
@@ -48,6 +49,7 @@
4849
<dependency>
4950
<groupId>org.mockito</groupId>
5051
<artifactId>mockito-core</artifactId>
52+
<scope>test</scope>
5153
</dependency>
5254
</dependencies>
5355
</project>

jelly/pom.xml

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
12
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
23
<modelVersion>4.0.0</modelVersion>
34
<parent>
@@ -36,10 +37,6 @@
3637
</exclusion>
3738
</exclusions>
3839
</dependency>
39-
<dependency>
40-
<groupId>commons-collections</groupId>
41-
<artifactId>commons-collections</artifactId>
42-
</dependency>
4340
<dependency>
4441
<groupId>org.dom4j</groupId>
4542
<artifactId>dom4j</artifactId>
@@ -73,8 +70,9 @@
7370
<scope>test</scope>
7471
</dependency>
7572
<dependency>
76-
<groupId>org.jvnet.hudson</groupId>
77-
<artifactId>htmlunit</artifactId>
73+
<groupId>org.jenkins-ci.main</groupId>
74+
<artifactId>jenkins-test-harness-htmlunit</artifactId>
75+
<scope>test</scope>
7876
</dependency>
7977
<dependency>
8078
<groupId>org.kohsuke.metainf-services</groupId>
@@ -90,23 +88,26 @@
9088
<dependency>
9189
<groupId>org.eclipse.jetty</groupId>
9290
<artifactId>jetty-server</artifactId>
91+
<scope>test</scope>
9392
</dependency>
9493
<dependency>
9594
<groupId>org.eclipse.jetty</groupId>
9695
<artifactId>jetty-util</artifactId>
96+
<scope>test</scope>
9797
</dependency>
9898
<dependency>
9999
<groupId>org.eclipse.jetty</groupId>
100100
<artifactId>jetty-servlet</artifactId>
101+
<scope>test</scope>
101102
</dependency>
102103
<dependency>
103104
<groupId>org.eclipse.jetty</groupId>
104105
<artifactId>jetty-webapp</artifactId>
106+
<scope>test</scope>
105107
</dependency>
106108
<dependency>
107109
<groupId>org.jvnet.hudson</groupId>
108110
<artifactId>commons-jelly-tags-define</artifactId>
109-
<version>1.0.1-hudson-20071021</version>
110111
<scope>test</scope>
111112
<exclusions>
112113
<exclusion>

jelly/src/test/java/org/kohsuke/stapler/jelly/BindTagJQueryTest.java

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ public void test1() throws Exception {
3333
//Check that prototype is included in the page
3434
assertFalse(content.contains("/am/org/kohsuke/stapler/framework/prototype/prototype.js"));
3535
page.executeJavaScript("v.foo('hello world', 2);");
36+
wc.getJavaScriptEngine().processPostponedActions();
37+
wc.waitForBackgroundJavaScript(10000);
3638
assertEquals("hello world",value);
3739
assertEquals(2, number);
3840
}

jelly/src/test/java/org/kohsuke/stapler/jelly/BindTagTest.java

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ public void test1() throws Exception {
3030
//Check that prototype is included in the page
3131
assertTrue(content.contains("/am/org/kohsuke/stapler/framework/prototype/prototype.js"));
3232
page.executeJavaScript("v.foo('hello world');");
33+
wc.getJavaScriptEngine().processPostponedActions();
34+
wc.waitForBackgroundJavaScript(10000);
3335
assertEquals("hello world",value);
3436
}
3537

jrebel/pom.xml

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
12
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
23
<modelVersion>4.0.0</modelVersion>
34
<parent>

0 commit comments

Comments
 (0)