Merge branch 'polish-urls-remaining-master' of https://github.com/spring-operator/spring-cloud-openfeign into spring-operator-polish-urls-remaining-master
This commit is contained in:
@@ -136,7 +136,7 @@ public class FeignClientBuilderTests {
|
||||
assertFactoryBeanField(builder, "name", "TestClient");
|
||||
|
||||
// and:
|
||||
assertFactoryBeanField(builder, "url", "http://Url/");
|
||||
assertFactoryBeanField(builder, "url", "https://Url/");
|
||||
assertFactoryBeanField(builder, "path", "/Path");
|
||||
assertFactoryBeanField(builder, "decode404", true);
|
||||
assertFactoryBeanField(builder, "fallback", Object.class);
|
||||
|
||||
@@ -141,7 +141,7 @@ public class FeignClientOverrideDefaultsTests {
|
||||
.isEqualTo(2);
|
||||
}
|
||||
|
||||
@FeignClient(name = "foo", url = "http://foo", configuration = FooConfiguration.class)
|
||||
@FeignClient(name = "foo", url = "https://foo", configuration = FooConfiguration.class)
|
||||
interface FooClient {
|
||||
|
||||
@RequestLine("GET /")
|
||||
@@ -149,7 +149,7 @@ public class FeignClientOverrideDefaultsTests {
|
||||
|
||||
}
|
||||
|
||||
@FeignClient(name = "bar", url = "http://bar", configuration = BarConfiguration.class)
|
||||
@FeignClient(name = "bar", url = "https://bar", configuration = BarConfiguration.class)
|
||||
interface BarClient {
|
||||
|
||||
@RequestMapping(value = "/", method = RequestMethod.GET)
|
||||
|
||||
@@ -37,7 +37,7 @@ public class FeignClientsRegistrarTests {
|
||||
|
||||
@Test(expected = IllegalStateException.class)
|
||||
public void badNameHttpPrefix() {
|
||||
testGetName("http://bad_hostname");
|
||||
testGetName("https://bad_hostname");
|
||||
}
|
||||
|
||||
@Test(expected = IllegalStateException.class)
|
||||
@@ -63,8 +63,8 @@ public class FeignClientsRegistrarTests {
|
||||
|
||||
@Test
|
||||
public void goodNameHttpPrefix() {
|
||||
String name = testGetName("http://good-name");
|
||||
assertThat(name).as("name was wrong").isEqualTo("http://good-name");
|
||||
String name = testGetName("https://good-name");
|
||||
assertThat(name).as("name was wrong").isEqualTo("https://good-name");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -96,7 +96,7 @@ public class FeignLoadBalancerTests {
|
||||
|
||||
this.feignLoadBalancer = new FeignLoadBalancer(this.lb, this.config,
|
||||
this.inspector);
|
||||
Request request = new RequestTemplate().method(GET).target("http://foo/")
|
||||
Request request = new RequestTemplate().method(GET).target("https://foo/")
|
||||
.resolve(new HashMap<>()).request();
|
||||
RibbonRequest ribbonRequest = new RibbonRequest(this.delegate, request,
|
||||
new URI(request.url()));
|
||||
@@ -108,7 +108,7 @@ public class FeignLoadBalancerTests {
|
||||
|
||||
RibbonResponse resp = this.feignLoadBalancer.execute(ribbonRequest, null);
|
||||
|
||||
assertThat(resp.getRequestedURI()).isEqualTo(new URI("http://foo"));
|
||||
assertThat(resp.getRequestedURI()).isEqualTo(new URI("https://foo"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -118,7 +118,7 @@ public class FeignLoadBalancerTests {
|
||||
this.inspector);
|
||||
Server server = new Server("foo", 7777);
|
||||
URI uri = this.feignLoadBalancer.reconstructURIWithServer(server,
|
||||
new URI("http://foo/"));
|
||||
new URI("https://foo/"));
|
||||
assertThat(uri).isEqualTo(new URI("https://foo:7777/"));
|
||||
}
|
||||
|
||||
@@ -140,8 +140,8 @@ public class FeignLoadBalancerTests {
|
||||
});
|
||||
Server server = new Server("foo", 7777);
|
||||
URI uri = this.feignLoadBalancer.reconstructURIWithServer(server,
|
||||
new URI("http://foo/"));
|
||||
assertThat(uri).isEqualTo(new URI("http://foo:7777/"));
|
||||
new URI("https://foo/"));
|
||||
assertThat(uri).isEqualTo(new URI("https://foo:7777/"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -152,13 +152,13 @@ public class FeignLoadBalancerTests {
|
||||
when(server.getPort()).thenReturn(443);
|
||||
when(server.getHost()).thenReturn("foo");
|
||||
URI uri = this.feignLoadBalancer.reconstructURIWithServer(server,
|
||||
new URI("http://bar/"));
|
||||
new URI("https://bar/"));
|
||||
assertThat(uri).isEqualTo(new URI("https://foo:443/"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRibbonRequestURLEncode() throws Exception {
|
||||
String url = "http://foo/?name=%7bcookie"; // name={cookie
|
||||
String url = "https://foo/?name=%7bcookie"; // name={cookie
|
||||
Request request = Request.create(GET, url, new HashMap<>(), null, null);
|
||||
|
||||
assertThat(request.url()).isEqualTo(url);
|
||||
|
||||
@@ -98,28 +98,28 @@ public class FeignRibbonClientTests {
|
||||
|
||||
@Test
|
||||
public void remoteRequestIsSentAtRoot() throws Exception {
|
||||
Request request = new RequestTemplate().method(GET).target("http://foo")
|
||||
Request request = new RequestTemplate().method(GET).target("https://foo")
|
||||
.resolve(new HashMap<>()).request();
|
||||
this.client.execute(request, new Options());
|
||||
RequestMatcher matcher = new RequestMatcher("http://foo.com:8000/");
|
||||
RequestMatcher matcher = new RequestMatcher("https://foo.com:8000/");
|
||||
verify(this.delegate).execute(argThat(matcher), any(Options.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void remoteRequestIsSent() throws Exception {
|
||||
Request request = new RequestTemplate().method(GET).target("http://foo/")
|
||||
Request request = new RequestTemplate().method(GET).target("https://foo/")
|
||||
.resolve(new HashMap<>()).request();
|
||||
this.client.execute(request, new Options());
|
||||
RequestMatcher matcher = new RequestMatcher("http://foo.com:8000/");
|
||||
RequestMatcher matcher = new RequestMatcher("https://foo.com:8000/");
|
||||
verify(this.delegate).execute(argThat(matcher), any(Options.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void verifyCleanUrl() throws Exception {
|
||||
Request request = new RequestTemplate().method(GET)
|
||||
.target("http://tp/abc/bcd.json").resolve(new HashMap<>()).request();
|
||||
.target("https://tp/abc/bcd.json").resolve(new HashMap<>()).request();
|
||||
this.client.execute(request, new Options());
|
||||
RequestMatcher matcher = new RequestMatcher("http://foo.com:8000/abc/bcd.json");
|
||||
RequestMatcher matcher = new RequestMatcher("https://foo.com:8000/abc/bcd.json");
|
||||
verify(this.delegate).execute(argThat(matcher), any(Options.class));
|
||||
}
|
||||
|
||||
|
||||
@@ -132,11 +132,11 @@ public class RetryableFeignLoadBalancerTests {
|
||||
doReturn(config).when(clientFactory).getClientConfig(eq("default"));
|
||||
RibbonLoadBalancedRetryFactory loadBalancedRetryFactory = new RibbonLoadBalancedRetryFactory(
|
||||
clientFactory);
|
||||
Request feignRequest = Request.create(GET, "http://foo", new HashMap<>(),
|
||||
Request feignRequest = Request.create(GET, "https://foo", new HashMap<>(),
|
||||
new byte[] {}, UTF_8);
|
||||
Client client = mock(Client.class);
|
||||
FeignLoadBalancer.RibbonRequest request = new FeignLoadBalancer.RibbonRequest(
|
||||
client, feignRequest, new URI("http://foo"));
|
||||
client, feignRequest, new URI("https://foo"));
|
||||
Response response = Response.builder().status(200).request(feignRequest)
|
||||
.headers(new HashMap<>()).build();
|
||||
doReturn(response).when(client).execute(any(Request.class),
|
||||
@@ -150,11 +150,11 @@ public class RetryableFeignLoadBalancerTests {
|
||||
|
||||
@Test
|
||||
public void executeNeverRetry() throws Exception {
|
||||
Request feignRequest = Request.create(GET, "http://foo", new HashMap<>(),
|
||||
Request feignRequest = Request.create(GET, "https://foo", new HashMap<>(),
|
||||
new byte[] {}, UTF_8);
|
||||
Client client = mock(Client.class);
|
||||
FeignLoadBalancer.RibbonRequest request = new FeignLoadBalancer.RibbonRequest(
|
||||
client, feignRequest, new URI("http://foo"));
|
||||
client, feignRequest, new URI("https://foo"));
|
||||
doThrow(new IOException("boom")).when(client).execute(any(Request.class),
|
||||
any(Request.Options.class));
|
||||
RetryableFeignLoadBalancer feignLb = new RetryableFeignLoadBalancer(this.lb,
|
||||
@@ -214,11 +214,11 @@ public class RetryableFeignLoadBalancerTests {
|
||||
return backOffPolicy;
|
||||
}
|
||||
};
|
||||
Request feignRequest = Request.create(GET, "http://foo", new HashMap<>(),
|
||||
Request feignRequest = Request.create(GET, "https://foo", new HashMap<>(),
|
||||
new byte[] {}, UTF_8);
|
||||
Client client = mock(Client.class);
|
||||
FeignLoadBalancer.RibbonRequest request = new FeignLoadBalancer.RibbonRequest(
|
||||
client, feignRequest, new URI("http://foo"));
|
||||
client, feignRequest, new URI("https://foo"));
|
||||
Response response = Response.builder().status(200).request(feignRequest)
|
||||
.headers(new HashMap<>()).build();
|
||||
doThrow(new IOException("boom")).doReturn(response).when(client)
|
||||
@@ -259,11 +259,11 @@ public class RetryableFeignLoadBalancerTests {
|
||||
return backOffPolicy;
|
||||
}
|
||||
};
|
||||
Request feignRequest = Request.create(GET, "http://foo", new HashMap<>(),
|
||||
Request feignRequest = Request.create(GET, "https://foo", new HashMap<>(),
|
||||
new byte[] {}, UTF_8);
|
||||
Client client = mock(Client.class);
|
||||
FeignLoadBalancer.RibbonRequest request = new FeignLoadBalancer.RibbonRequest(
|
||||
client, feignRequest, new URI("http://foo"));
|
||||
client, feignRequest, new URI("https://foo"));
|
||||
Response response = Response.builder().request(feignRequest).status(200)
|
||||
.headers(new HashMap<>()).build();
|
||||
Response fourOFourResponse = Response.builder().request(feignRequest).status(404)
|
||||
@@ -309,11 +309,11 @@ public class RetryableFeignLoadBalancerTests {
|
||||
return backOffPolicy;
|
||||
}
|
||||
};
|
||||
Request feignRequest = Request.create(GET, "http://foo", new HashMap<>(),
|
||||
Request feignRequest = Request.create(GET, "https://foo", new HashMap<>(),
|
||||
new byte[] {}, UTF_8);
|
||||
Client client = mock(Client.class);
|
||||
FeignLoadBalancer.RibbonRequest request = new FeignLoadBalancer.RibbonRequest(
|
||||
client, feignRequest, new URI("http://foo"));
|
||||
client, feignRequest, new URI("https://foo"));
|
||||
Response response = Response.builder().request(feignRequest).status(404)
|
||||
.headers(new HashMap<>()).build();
|
||||
Response fourOFourResponse = Response.builder().request(feignRequest).status(404)
|
||||
@@ -338,11 +338,11 @@ public class RetryableFeignLoadBalancerTests {
|
||||
doReturn(lbContext).when(clientFactory).getLoadBalancerContext(any(String.class));
|
||||
RibbonLoadBalancedRetryFactory loadBalancedRetryFactory = new RibbonLoadBalancedRetryFactory(
|
||||
clientFactory);
|
||||
Request feignRequest = Request.create(GET, "http://foo", new HashMap<>(),
|
||||
Request feignRequest = Request.create(GET, "https://foo", new HashMap<>(),
|
||||
new byte[] {}, UTF_8);
|
||||
Client client = mock(Client.class);
|
||||
FeignLoadBalancer.RibbonRequest request = new FeignLoadBalancer.RibbonRequest(
|
||||
client, feignRequest, new URI("http://foo"));
|
||||
client, feignRequest, new URI("https://foo"));
|
||||
Response response = Response.builder().request(feignRequest).status(200)
|
||||
.headers(new HashMap<>()).build();
|
||||
doReturn(response).when(client).execute(any(Request.class),
|
||||
@@ -364,11 +364,11 @@ public class RetryableFeignLoadBalancerTests {
|
||||
doReturn(lbContext).when(clientFactory).getLoadBalancerContext(any(String.class));
|
||||
RibbonLoadBalancedRetryFactory loadBalancedRetryFactory = new RibbonLoadBalancedRetryFactory(
|
||||
clientFactory);
|
||||
Request feignRequest = Request.create(GET, "http://foo", new HashMap<>(),
|
||||
Request feignRequest = Request.create(GET, "https://foo", new HashMap<>(),
|
||||
new byte[] {}, UTF_8);
|
||||
Client client = mock(Client.class);
|
||||
FeignLoadBalancer.RibbonRequest request = new FeignLoadBalancer.RibbonRequest(
|
||||
client, feignRequest, new URI("http://foo"));
|
||||
client, feignRequest, new URI("https://foo"));
|
||||
Response response = Response.builder().request(feignRequest).status(200)
|
||||
.headers(new HashMap<>()).build();
|
||||
doReturn(response).when(client).execute(any(Request.class),
|
||||
@@ -445,11 +445,11 @@ public class RetryableFeignLoadBalancerTests {
|
||||
return backOffPolicy;
|
||||
}
|
||||
};
|
||||
Request feignRequest = Request.create(GET, "http://listener", new HashMap<>(),
|
||||
Request feignRequest = Request.create(GET, "https://listener", new HashMap<>(),
|
||||
new byte[] {}, UTF_8);
|
||||
Client client = mock(Client.class);
|
||||
FeignLoadBalancer.RibbonRequest request = new FeignLoadBalancer.RibbonRequest(
|
||||
client, feignRequest, new URI("http://listener"));
|
||||
client, feignRequest, new URI("https://listener"));
|
||||
Response response = Response.builder().request(feignRequest).status(200)
|
||||
.headers(new HashMap<>()).build();
|
||||
doThrow(new IOException("boom")).doReturn(response).when(client)
|
||||
@@ -497,11 +497,11 @@ public class RetryableFeignLoadBalancerTests {
|
||||
return backOffPolicy;
|
||||
}
|
||||
};
|
||||
Request feignRequest = Request.create(GET, "http://listener", new HashMap<>(),
|
||||
Request feignRequest = Request.create(GET, "https://listener", new HashMap<>(),
|
||||
new byte[] {}, UTF_8);
|
||||
Client client = mock(Client.class);
|
||||
FeignLoadBalancer.RibbonRequest request = new FeignLoadBalancer.RibbonRequest(
|
||||
client, feignRequest, new URI("http://listener"));
|
||||
client, feignRequest, new URI("https://listener"));
|
||||
RetryableFeignLoadBalancer feignLb = new RetryableFeignLoadBalancer(this.lb,
|
||||
config, this.inspector, loadBalancedRetryFactory);
|
||||
FeignLoadBalancer.RibbonResponse ribbonResponse = feignLb.execute(request, null);
|
||||
@@ -534,11 +534,11 @@ public class RetryableFeignLoadBalancerTests {
|
||||
return backOffPolicy;
|
||||
}
|
||||
};
|
||||
Request feignRequest = Request.create(GET, "http://listener", new HashMap<>(),
|
||||
Request feignRequest = Request.create(GET, "https://listener", new HashMap<>(),
|
||||
new byte[] {}, UTF_8);
|
||||
Client client = mock(Client.class);
|
||||
FeignLoadBalancer.RibbonRequest request = new FeignLoadBalancer.RibbonRequest(
|
||||
client, feignRequest, new URI("http://listener"));
|
||||
client, feignRequest, new URI("https://listener"));
|
||||
Response response = Response.builder().request(feignRequest).status(200)
|
||||
.headers(new HashMap<>()).build();
|
||||
doThrow(new IOException("boom")).doReturn(response).when(client)
|
||||
@@ -579,11 +579,11 @@ public class RetryableFeignLoadBalancerTests {
|
||||
return backOffPolicy;
|
||||
}
|
||||
};
|
||||
Request feignRequest = Request.create(GET, "http://foo", new HashMap<>(),
|
||||
Request feignRequest = Request.create(GET, "https://foo", new HashMap<>(),
|
||||
new byte[] {}, UTF_8);
|
||||
Client client = mock(Client.class);
|
||||
FeignLoadBalancer.RibbonRequest request = new FeignLoadBalancer.RibbonRequest(
|
||||
client, feignRequest, new URI("http://foo"));
|
||||
client, feignRequest, new URI("https://foo"));
|
||||
Response fourOFourResponse = Response.builder().request(feignRequest).status(404)
|
||||
.headers(new HashMap<>()).body(new Response.Body() { // set content into
|
||||
// response
|
||||
|
||||
@@ -48,7 +48,7 @@ public class RibbonResponseStatusCodeExceptionTest {
|
||||
List<String> fooValues = new ArrayList<String>();
|
||||
fooValues.add("bar");
|
||||
headers.put("foo", fooValues);
|
||||
Request request = Request.create(GET, "http://service.com",
|
||||
Request request = Request.create(GET, "https://service.com",
|
||||
new HashMap<String, Collection<String>>(), new byte[] {},
|
||||
Charset.defaultCharset());
|
||||
byte[] body = "foo".getBytes();
|
||||
|
||||
@@ -69,7 +69,7 @@ public class FeignClientValidationTests {
|
||||
@EnableFeignClients(clients = GoodUrlConfiguration.Client.class)
|
||||
protected static class GoodUrlConfiguration {
|
||||
|
||||
@FeignClient(name = "example", url = "http://example.com")
|
||||
@FeignClient(name = "example", url = "https://example.com")
|
||||
interface Client {
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/")
|
||||
@@ -85,7 +85,7 @@ public class FeignClientValidationTests {
|
||||
@EnableFeignClients(clients = PlaceholderUrlConfiguration.Client.class)
|
||||
protected static class PlaceholderUrlConfiguration {
|
||||
|
||||
@FeignClient(name = "example", url = "${feignClient.url:http://example.com}")
|
||||
@FeignClient(name = "example", url = "${feignClient.url:https://example.com}")
|
||||
interface Client {
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/")
|
||||
|
||||
Reference in New Issue
Block a user