You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juneau.apache.org by ja...@apache.org on 2022/06/20 14:13:58 UTC

[juneau] branch master updated: Fix JUnit failures due to behavior change in HttpClient 4.5.13.

This is an automated email from the ASF dual-hosted git repository.

jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git


The following commit(s) were added to refs/heads/master by this push:
     new 689e26781 Fix JUnit failures due to behavior change in HttpClient 4.5.13.
689e26781 is described below

commit 689e26781c3710766dd91c861475d3e3f50298dc
Author: JamesBognar <ja...@salesforce.com>
AuthorDate: Mon Jun 20 10:13:35 2022 -0400

    Fix JUnit failures due to behavior change in HttpClient 4.5.13.
---
 .../apache/juneau/http/remote/Remote_PathAnnotation_Test.java    | 5 +++--
 .../src/test/java/org/apache/juneau/rest/Paths_Test.java         | 9 +++++----
 .../test/java/org/apache/juneau/rest/annotation/Path_Test.java   | 7 ++++---
 3 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/juneau-utest/src/test/java/org/apache/juneau/http/remote/Remote_PathAnnotation_Test.java b/juneau-utest/src/test/java/org/apache/juneau/http/remote/Remote_PathAnnotation_Test.java
index b8d6aebb1..91b71ea41 100644
--- a/juneau-utest/src/test/java/org/apache/juneau/http/remote/Remote_PathAnnotation_Test.java
+++ b/juneau-utest/src/test/java/org/apache/juneau/http/remote/Remote_PathAnnotation_Test.java
@@ -24,6 +24,7 @@ import java.util.*;
 import java.util.concurrent.atomic.*;
 
 import org.apache.http.*;
+import org.apache.http.client.config.*;
 import org.apache.juneau.collections.*;
 import org.apache.juneau.http.annotation.*;
 import org.apache.juneau.http.part.*;
@@ -780,10 +781,10 @@ public class Remote_PathAnnotation_Test {
 	}
 
 	private static RestClient.Builder client(Class<?> c) {
-		return MockRestClient.create(c);
+		return MockRestClient.create(c).defaultRequestConfig(RequestConfig.custom().setNormalizeUri(false).build());
 	}
 
 	private static <T> T remote(Class<?> rest, Class<T> t) {
-		return MockRestClient.build(rest).getRemote(t);
+		return MockRestClient.create(rest).defaultRequestConfig(RequestConfig.custom().setNormalizeUri(false).build()).build().getRemote(t);
 	}
 }
diff --git a/juneau-utest/src/test/java/org/apache/juneau/rest/Paths_Test.java b/juneau-utest/src/test/java/org/apache/juneau/rest/Paths_Test.java
index 36afd2c35..a9617c61f 100644
--- a/juneau-utest/src/test/java/org/apache/juneau/rest/Paths_Test.java
+++ b/juneau-utest/src/test/java/org/apache/juneau/rest/Paths_Test.java
@@ -14,6 +14,7 @@ package org.apache.juneau.rest;
 
 import static org.junit.runners.MethodSorters.*;
 
+import org.apache.http.client.config.*;
 import org.apache.juneau.collections.*;
 import org.apache.juneau.http.annotation.Path;
 import org.apache.juneau.rest.annotation.*;
@@ -51,7 +52,7 @@ public class Paths_Test {
 			return getPaths(req).append("pathRemainder2", r).append("method",1);
 		}
 	}
-	static MockRestClient a = MockRestClient.create(A.class).contextPath("/cp").servletPath("/sp").build();
+	static MockRestClient a = MockRestClient.create(A.class).contextPath("/cp").servletPath("/sp").defaultRequestConfig(RequestConfig.custom().setNormalizeUri(false).build()).build();
 
 	@Test
 	public void a01() throws Exception {
@@ -199,7 +200,7 @@ public class Paths_Test {
 			return getPaths(req).append("pathRemainder2", r).append("method",2);
 		}
 	}
-	static MockRestClient b = MockRestClient.create(B.class).contextPath("/cp").servletPath("/sp").build();
+	static MockRestClient b = MockRestClient.create(B.class).contextPath("/cp").servletPath("/sp").defaultRequestConfig(RequestConfig.custom().setNormalizeUri(false).build()).build();
 
 	@Test
 	public void b01() throws Exception {
@@ -351,7 +352,7 @@ public class Paths_Test {
 			return getPaths(req).append("pathRemainder2", r).append("method",3);
 		}
 	}
-	static MockRestClient c = MockRestClient.create(C.class).contextPath("/cp").servletPath("/sp").build();
+	static MockRestClient c = MockRestClient.create(C.class).contextPath("/cp").servletPath("/sp").defaultRequestConfig(RequestConfig.custom().setNormalizeUri(false).build()).build();
 
 	@Test
 	public void c01() throws Exception {
@@ -503,7 +504,7 @@ public class Paths_Test {
 			return getPaths(req).append("pathRemainder2", r).append("method",4);
 		}
 	}
-	static MockRestClient d = MockRestClient.create(D.class).contextPath("/cp").servletPath("/sp").build();
+	static MockRestClient d = MockRestClient.create(D.class).contextPath("/cp").servletPath("/sp").defaultRequestConfig(RequestConfig.custom().setNormalizeUri(false).build()).build();
 
 	@Test
 	public void d01() throws Exception {
diff --git a/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/Path_Test.java b/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/Path_Test.java
index a2feb3a09..c23c4603a 100644
--- a/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/Path_Test.java
+++ b/juneau-utest/src/test/java/org/apache/juneau/rest/annotation/Path_Test.java
@@ -18,6 +18,7 @@ import static org.junit.runners.MethodSorters.*;
 
 import java.util.*;
 
+import org.apache.http.client.config.*;
 import org.apache.juneau.collections.*;
 import org.apache.juneau.http.annotation.*;
 import org.apache.juneau.internal.*;
@@ -413,7 +414,7 @@ public class Path_Test {
 
 	@Test
 	public void f01_pathVariablesOnClass() throws Exception {
-		RestClient f = MockRestClient.createLax(F.class).servletPath("/f").build();
+		RestClient f = MockRestClient.createLax(F.class).servletPath("/f").defaultRequestConfig(RequestConfig.custom().setNormalizeUri(false).build()).build();
 		f.get("http://localhost/f/x1/x2")
 			.run()
 			.assertContent().is("a: {a:'x1',b:'x2'}");
@@ -498,7 +499,7 @@ public class Path_Test {
 
 	@Test
 	public void g01_pathVariablesOnChildClass() throws Exception {
-		RestClient g = MockRestClient.buildLax(G.class);
+		RestClient g = MockRestClient.createLax(G.class).defaultRequestConfig(RequestConfig.custom().setNormalizeUri(false).build()).build();
 		g.get("http://localhost/f/x1/x2")
 			.run()
 			.assertContent().is("a: {a:'x1',b:'x2'}");
@@ -570,7 +571,7 @@ public class Path_Test {
 
 	@Test
 	public void h01_pathVariablesOnParentAndChildClass() throws Exception {
-		RestClient h = MockRestClient.createLax(H.class).servletPath("/h").build();
+		RestClient h = MockRestClient.createLax(H.class).servletPath("/h").defaultRequestConfig(RequestConfig.custom().setNormalizeUri(false).build()).build();
 		h.get("http://localhost/h/ha1/hb1/f/x1/x2")
 			.run()
 			.assertContent().is("a: {a:'x1',b:'x2',ha:'ha1',hb:'hb1'}");