Update SNAPSHOT to 2.2.9.RELEASE
This commit is contained in:
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<artifactId>spring-cloud-openfeign</artifactId>
|
<artifactId>spring-cloud-openfeign</artifactId>
|
||||||
<version>2.2.9.BUILD-SNAPSHOT</version>
|
<version>2.2.9.RELEASE</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>spring-cloud-openfeign-docs</artifactId>
|
<artifactId>spring-cloud-openfeign-docs</artifactId>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|||||||
@@ -4,14 +4,14 @@
|
|||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>spring-cloud-openfeign</artifactId>
|
<artifactId>spring-cloud-openfeign</artifactId>
|
||||||
<version>2.2.9.BUILD-SNAPSHOT</version>
|
<version>2.2.9.RELEASE</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<name>Spring Cloud OpenFeign</name>
|
<name>Spring Cloud OpenFeign</name>
|
||||||
<description>Spring Cloud OpenFeign</description>
|
<description>Spring Cloud OpenFeign</description>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<artifactId>spring-cloud-build</artifactId>
|
<artifactId>spring-cloud-build</artifactId>
|
||||||
<version>2.3.4.RELEASE</version>
|
<version>2.3.5.RELEASE</version>
|
||||||
<relativePath/>
|
<relativePath/>
|
||||||
</parent>
|
</parent>
|
||||||
<scm>
|
<scm>
|
||||||
@@ -26,8 +26,8 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<main.basedir>${basedir}</main.basedir>
|
<main.basedir>${basedir}</main.basedir>
|
||||||
<jackson.version>2.11.3</jackson.version>
|
<jackson.version>2.11.3</jackson.version>
|
||||||
<spring-cloud-commons.version>2.2.9.BUILD-SNAPSHOT</spring-cloud-commons.version>
|
<spring-cloud-commons.version>2.2.9.RELEASE</spring-cloud-commons.version>
|
||||||
<spring-cloud-netflix.version>2.2.9.BUILD-SNAPSHOT</spring-cloud-netflix.version>
|
<spring-cloud-netflix.version>2.2.9.RELEASE</spring-cloud-netflix.version>
|
||||||
|
|
||||||
<!-- Plugin versions -->
|
<!-- Plugin versions -->
|
||||||
<maven-eclipse-plugin.version>2.10</maven-eclipse-plugin.version>
|
<maven-eclipse-plugin.version>2.10</maven-eclipse-plugin.version>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<artifactId>spring-cloud-openfeign</artifactId>
|
<artifactId>spring-cloud-openfeign</artifactId>
|
||||||
<version>2.2.9.BUILD-SNAPSHOT</version>
|
<version>2.2.9.RELEASE</version>
|
||||||
<relativePath>..</relativePath> <!-- lookup parent from repository -->
|
<relativePath>..</relativePath> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>spring-cloud-openfeign-core</artifactId>
|
<artifactId>spring-cloud-openfeign-core</artifactId>
|
||||||
|
|||||||
+2
-1
@@ -375,7 +375,8 @@ public class FeignClientFactoryBean implements FactoryBean<Object>, Initializing
|
|||||||
if (!StringUtils.hasText(url)) {
|
if (!StringUtils.hasText(url)) {
|
||||||
|
|
||||||
if (LOG.isInfoEnabled()) {
|
if (LOG.isInfoEnabled()) {
|
||||||
LOG.info("For '" + name + "' URL not provided. Will try picking an instance via load-balancing.");
|
LOG.info("For '" + name
|
||||||
|
+ "' URL not provided. Will try picking an instance via load-balancing.");
|
||||||
}
|
}
|
||||||
if (!name.startsWith("http")) {
|
if (!name.startsWith("http")) {
|
||||||
url = "http://" + name;
|
url = "http://" + name;
|
||||||
|
|||||||
+4
-2
@@ -28,11 +28,13 @@ import org.springframework.cloud.client.loadbalancer.RetryableStatusCodeExceptio
|
|||||||
*
|
*
|
||||||
* @author Ryan Baxter
|
* @author Ryan Baxter
|
||||||
*/
|
*/
|
||||||
public class LoadBalancerResponseStatusCodeException extends RetryableStatusCodeException {
|
public class LoadBalancerResponseStatusCodeException
|
||||||
|
extends RetryableStatusCodeException {
|
||||||
|
|
||||||
private final Response response;
|
private final Response response;
|
||||||
|
|
||||||
public LoadBalancerResponseStatusCodeException(String serviceId, Response response, byte[] body, URI uri) {
|
public LoadBalancerResponseStatusCodeException(String serviceId, Response response,
|
||||||
|
byte[] body, URI uri) {
|
||||||
super(serviceId, response.status(), response, uri);
|
super(serviceId, response.status(), response, uri);
|
||||||
this.response = Response.builder()
|
this.response = Response.builder()
|
||||||
.body(new ByteArrayInputStream(body), body.length)
|
.body(new ByteArrayInputStream(body), body.length)
|
||||||
|
|||||||
+2
-2
@@ -113,10 +113,10 @@ public class RetryableFeignBlockingLoadBalancerClient implements Client {
|
|||||||
String.format("Retrying on status code: %d", responseStatus));
|
String.format("Retrying on status code: %d", responseStatus));
|
||||||
}
|
}
|
||||||
byte[] byteArray = response.body() == null ? new byte[] {}
|
byte[] byteArray = response.body() == null ? new byte[] {}
|
||||||
: StreamUtils.copyToByteArray(response.body().asInputStream());
|
: StreamUtils.copyToByteArray(response.body().asInputStream());
|
||||||
response.close();
|
response.close();
|
||||||
throw new LoadBalancerResponseStatusCodeException(serviceId, response,
|
throw new LoadBalancerResponseStatusCodeException(serviceId, response,
|
||||||
byteArray, URI.create(request.url()));
|
byteArray, URI.create(request.url()));
|
||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
}, new LoadBalancedRecoveryCallback<Response, Response>() {
|
}, new LoadBalancedRecoveryCallback<Response, Response>() {
|
||||||
|
|||||||
+14
-12
@@ -119,8 +119,10 @@ class RetryableFeignBlockingLoadBalancerClientTests {
|
|||||||
|
|
||||||
private Response testResponse(int status, String body) {
|
private Response testResponse(int status, String body) {
|
||||||
// ByteArrayInputStream ignores close() and must be wrapped
|
// ByteArrayInputStream ignores close() and must be wrapped
|
||||||
InputStream reallyCloseable = new BufferedInputStream(new ByteArrayInputStream(body.getBytes(StandardCharsets.UTF_8)));
|
InputStream reallyCloseable = new BufferedInputStream(
|
||||||
return Response.builder().request(testRequest()).status(status).body(reallyCloseable, null).build();
|
new ByteArrayInputStream(body.getBytes(StandardCharsets.UTF_8)));
|
||||||
|
return Response.builder().request(testRequest()).status(status)
|
||||||
|
.body(reallyCloseable, null).build();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,23 +165,23 @@ class RetryableFeignBlockingLoadBalancerClientTests {
|
|||||||
void shouldExposeResponseBodyOnRetry() throws IOException {
|
void shouldExposeResponseBodyOnRetry() throws IOException {
|
||||||
properties.getRetryableStatusCodes().add(503);
|
properties.getRetryableStatusCodes().add(503);
|
||||||
Request request = testRequest();
|
Request request = testRequest();
|
||||||
when(delegate.execute(any(), any()))
|
when(delegate.execute(any(), any())).thenReturn(testResponse(503, "foo"),
|
||||||
.thenReturn(testResponse(503, "foo"), testResponse(503, "foo"));
|
testResponse(503, "foo"));
|
||||||
when(retryFactory.createRetryPolicy(any(), eq(loadBalancerClient)))
|
when(retryFactory.createRetryPolicy(any(), eq(loadBalancerClient)))
|
||||||
.thenReturn(new BlockingLoadBalancedRetryPolicy("test",
|
.thenReturn(new BlockingLoadBalancedRetryPolicy("test",
|
||||||
loadBalancerClient, properties));
|
loadBalancerClient, properties));
|
||||||
when(loadBalancerClient.reconstructURI(serviceInstance,
|
when(loadBalancerClient.reconstructURI(serviceInstance,
|
||||||
URI.create("http://test/path")))
|
URI.create("http://test/path")))
|
||||||
.thenReturn(URI.create("http://testhost:80/path"));
|
.thenReturn(URI.create("http://testhost:80/path"));
|
||||||
|
|
||||||
Response response = feignBlockingLoadBalancerClient.execute(request, new Request.Options());
|
Response response = feignBlockingLoadBalancerClient.execute(request,
|
||||||
|
new Request.Options());
|
||||||
|
|
||||||
String bodyContent = IOUtils.toString(response.body().asReader(StandardCharsets.UTF_8));
|
String bodyContent = IOUtils
|
||||||
|
.toString(response.body().asReader(StandardCharsets.UTF_8));
|
||||||
assertThat(bodyContent).isEqualTo("foo");
|
assertThat(bodyContent).isEqualTo("foo");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void shouldPassCorrectRequestToDelegate() throws IOException {
|
void shouldPassCorrectRequestToDelegate() throws IOException {
|
||||||
Request request = testRequest();
|
Request request = testRequest();
|
||||||
|
|||||||
+41
-45
@@ -181,7 +181,7 @@ public class FeignClientTests {
|
|||||||
public void testClient() {
|
public void testClient() {
|
||||||
assertThat(testClient).as("testClient was null").isNotNull();
|
assertThat(testClient).as("testClient was null").isNotNull();
|
||||||
assertThat(Proxy.isProxyClass(testClient.getClass()))
|
assertThat(Proxy.isProxyClass(testClient.getClass()))
|
||||||
.as("testClient is not a java Proxy").isTrue();
|
.as("testClient is not a java Proxy").isTrue();
|
||||||
InvocationHandler invocationHandler = Proxy.getInvocationHandler(testClient);
|
InvocationHandler invocationHandler = Proxy.getInvocationHandler(testClient);
|
||||||
assertThat(invocationHandler).as("invocationHandler was null").isNotNull();
|
assertThat(invocationHandler).as("invocationHandler was null").isNotNull();
|
||||||
}
|
}
|
||||||
@@ -198,7 +198,7 @@ public class FeignClientTests {
|
|||||||
Hello hello = testClient.getHello();
|
Hello hello = testClient.getHello();
|
||||||
assertThat(hello).as("hello was null").isNotNull();
|
assertThat(hello).as("hello was null").isNotNull();
|
||||||
assertThat(hello).as("first hello didn't match")
|
assertThat(hello).as("first hello didn't match")
|
||||||
.isEqualTo(new Hello(HELLO_WORLD_1));
|
.isEqualTo(new Hello(HELLO_WORLD_1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -219,9 +219,9 @@ public class FeignClientTests {
|
|||||||
List<String> headers = testClient.getHelloHeaders();
|
List<String> headers = testClient.getHelloHeaders();
|
||||||
assertThat(headers).as("headers was null").isNotNull();
|
assertThat(headers).as("headers was null").isNotNull();
|
||||||
assertThat(headers.contains("myheader1value"))
|
assertThat(headers.contains("myheader1value"))
|
||||||
.as("headers didn't contain myheader1value").isTrue();
|
.as("headers didn't contain myheader1value").isTrue();
|
||||||
assertThat(headers.contains("myheader2value"))
|
assertThat(headers.contains("myheader2value"))
|
||||||
.as("headers didn't contain myheader2value").isTrue();
|
.as("headers didn't contain myheader2value").isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -241,12 +241,11 @@ public class FeignClientTests {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testServiceId() {
|
public void testServiceId() {
|
||||||
assertThat(testClientServiceId).as("testClientServiceId was null")
|
assertThat(testClientServiceId).as("testClientServiceId was null").isNotNull();
|
||||||
.isNotNull();
|
|
||||||
final Hello hello = testClientServiceId.getHello();
|
final Hello hello = testClientServiceId.getHello();
|
||||||
assertThat(hello).as("The hello response was null").isNotNull();
|
assertThat(hello).as("The hello response was null").isNotNull();
|
||||||
assertThat(hello).as("first hello didn't match")
|
assertThat(hello).as("first hello didn't match")
|
||||||
.isEqualTo(new Hello(HELLO_WORLD_1));
|
.isEqualTo(new Hello(HELLO_WORLD_1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -260,7 +259,7 @@ public class FeignClientTests {
|
|||||||
@Test
|
@Test
|
||||||
public void testFormattedParams() {
|
public void testFormattedParams() {
|
||||||
List<LocalDate> list = Arrays.asList(LocalDate.of(2001, 1, 1),
|
List<LocalDate> list = Arrays.asList(LocalDate.of(2001, 1, 1),
|
||||||
LocalDate.of(2018, 6, 10));
|
LocalDate.of(2018, 6, 10));
|
||||||
List<LocalDate> params = testClient.getFormattedParams(list);
|
List<LocalDate> params = testClient.getFormattedParams(list);
|
||||||
assertThat(params).as("params was null").isNotNull();
|
assertThat(params).as("params was null").isNotNull();
|
||||||
assertThat(params).as("params not converted correctly").isEqualTo(list);
|
assertThat(params).as("params not converted correctly").isEqualTo(list);
|
||||||
@@ -271,13 +270,13 @@ public class FeignClientTests {
|
|||||||
HystrixCommand<List<Hello>> command = testClient.getHellosHystrix();
|
HystrixCommand<List<Hello>> command = testClient.getHellosHystrix();
|
||||||
assertThat(command).as("command was null").isNotNull();
|
assertThat(command).as("command was null").isNotNull();
|
||||||
assertThat(command.getCommandGroup().name()).as(
|
assertThat(command.getCommandGroup().name()).as(
|
||||||
"Hystrix command group name should match the name of the feign client")
|
"Hystrix command group name should match the name of the feign client")
|
||||||
.isEqualTo("localapp");
|
.isEqualTo("localapp");
|
||||||
String configKey = Feign.configKey(TestClient.class,
|
String configKey = Feign.configKey(TestClient.class,
|
||||||
TestClient.class.getMethod("getHellosHystrix", (Class<?>[]) null));
|
TestClient.class.getMethod("getHellosHystrix", (Class<?>[]) null));
|
||||||
assertThat(command.getCommandKey().name())
|
assertThat(command.getCommandKey().name())
|
||||||
.as("Hystrix command key name should match the feign config key")
|
.as("Hystrix command key name should match the feign config key")
|
||||||
.isEqualTo(configKey);
|
.isEqualTo(configKey);
|
||||||
List<Hello> hellos = command.execute();
|
List<Hello> hellos = command.execute();
|
||||||
assertThat(hellos).as("hellos was null").isNotNull();
|
assertThat(hellos).as("hellos was null").isNotNull();
|
||||||
assertThat(getHelloList()).as("hellos didn't match").isEqualTo(hellos);
|
assertThat(getHelloList()).as("hellos didn't match").isEqualTo(hellos);
|
||||||
@@ -290,7 +289,7 @@ public class FeignClientTests {
|
|||||||
Hello hello = single.toBlocking().value();
|
Hello hello = single.toBlocking().value();
|
||||||
assertThat(hello).as("hello was null").isNotNull();
|
assertThat(hello).as("hello was null").isNotNull();
|
||||||
assertThat(hello).as("first hello didn't match")
|
assertThat(hello).as("first hello didn't match")
|
||||||
.isEqualTo(new Hello(HELLO_WORLD_1));
|
.isEqualTo(new Hello(HELLO_WORLD_1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -298,7 +297,7 @@ public class FeignClientTests {
|
|||||||
ResponseEntity<Void> response = testClient.noContent();
|
ResponseEntity<Void> response = testClient.noContent();
|
||||||
assertThat(response).as("response was null").isNotNull();
|
assertThat(response).as("response was null").isNotNull();
|
||||||
assertThat(response.getStatusCode()).as("status code was wrong")
|
assertThat(response.getStatusCode()).as("status code was wrong")
|
||||||
.isEqualTo(HttpStatus.NO_CONTENT);
|
.isEqualTo(HttpStatus.NO_CONTENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -306,7 +305,7 @@ public class FeignClientTests {
|
|||||||
ResponseEntity<Void> response = testClient.head();
|
ResponseEntity<Void> response = testClient.head();
|
||||||
assertThat(response).as("response was null").isNotNull();
|
assertThat(response).as("response was null").isNotNull();
|
||||||
assertThat(response.getStatusCode()).as("status code was wrong")
|
assertThat(response.getStatusCode()).as("status code was wrong")
|
||||||
.isEqualTo(HttpStatus.OK);
|
.isEqualTo(HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -316,7 +315,7 @@ public class FeignClientTests {
|
|||||||
Hello hello = entity.getBody();
|
Hello hello = entity.getBody();
|
||||||
assertThat(hello).as("hello was null").isNotNull();
|
assertThat(hello).as("hello was null").isNotNull();
|
||||||
assertThat(hello).as("first hello didn't match")
|
assertThat(hello).as("first hello didn't match")
|
||||||
.isEqualTo(new Hello(HELLO_WORLD_1));
|
.isEqualTo(new Hello(HELLO_WORLD_1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -324,7 +323,7 @@ public class FeignClientTests {
|
|||||||
String response = testClient.moreComplexContentType("{\"value\":\"OK\"}");
|
String response = testClient.moreComplexContentType("{\"value\":\"OK\"}");
|
||||||
assertThat(response).as("response was null").isNotNull();
|
assertThat(response).as("response was null").isNotNull();
|
||||||
assertThat(response).as("didn't respond with {\"value\":\"OK\"}")
|
assertThat(response).as("didn't respond with {\"value\":\"OK\"}")
|
||||||
.isEqualTo("{\"value\":\"OK\"}");
|
.isEqualTo("{\"value\":\"OK\"}");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -332,7 +331,7 @@ public class FeignClientTests {
|
|||||||
ResponseEntity<String> response = decodingTestClient.notFound();
|
ResponseEntity<String> response = decodingTestClient.notFound();
|
||||||
assertThat(response).as("response was null").isNotNull();
|
assertThat(response).as("response was null").isNotNull();
|
||||||
assertThat(response.getStatusCode()).as("status code was wrong")
|
assertThat(response.getStatusCode()).as("status code was wrong")
|
||||||
.isEqualTo(HttpStatus.NOT_FOUND);
|
.isEqualTo(HttpStatus.NOT_FOUND);
|
||||||
assertThat(response.getBody()).as("response body was not null").isNull();
|
assertThat(response.getBody()).as("response body was not null").isNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -371,7 +370,7 @@ public class FeignClientTests {
|
|||||||
Hello hello = single.toBlocking().value();
|
Hello hello = single.toBlocking().value();
|
||||||
assertThat(hello).as("hello was null").isNotNull();
|
assertThat(hello).as("hello was null").isNotNull();
|
||||||
assertThat(hello.getMessage()).as("message was wrong")
|
assertThat(hello.getMessage()).as("message was wrong")
|
||||||
.isEqualTo("fallbacksingle");
|
.isEqualTo("fallbacksingle");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -381,7 +380,7 @@ public class FeignClientTests {
|
|||||||
Hello hello = command.execute();
|
Hello hello = command.execute();
|
||||||
assertThat(hello).as("hello was null").isNotNull();
|
assertThat(hello).as("hello was null").isNotNull();
|
||||||
assertThat(hello.getMessage()).as("message was wrong")
|
assertThat(hello.getMessage()).as("message was wrong")
|
||||||
.isEqualTo("fallbackcommand");
|
.isEqualTo("fallbackcommand");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -391,7 +390,7 @@ public class FeignClientTests {
|
|||||||
Hello hello = observable.toBlocking().first();
|
Hello hello = observable.toBlocking().first();
|
||||||
assertThat(hello).as("hello was null").isNotNull();
|
assertThat(hello).as("hello was null").isNotNull();
|
||||||
assertThat(hello.getMessage()).as("message was wrong")
|
assertThat(hello.getMessage()).as("message was wrong")
|
||||||
.isEqualTo("fallbackobservable");
|
.isEqualTo("fallbackobservable");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -401,7 +400,7 @@ public class FeignClientTests {
|
|||||||
Hello hello = future.get(1, TimeUnit.SECONDS);
|
Hello hello = future.get(1, TimeUnit.SECONDS);
|
||||||
assertThat(hello).as("hello was null").isNotNull();
|
assertThat(hello).as("hello was null").isNotNull();
|
||||||
assertThat(hello.getMessage()).as("message was wrong")
|
assertThat(hello.getMessage()).as("message was wrong")
|
||||||
.isEqualTo("fallbackfuture");
|
.isEqualTo("fallbackfuture");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -410,8 +409,8 @@ public class FeignClientTests {
|
|||||||
assertThat(hello).as("hello was null").isNotNull();
|
assertThat(hello).as("hello was null").isNotNull();
|
||||||
assertThat(hello.getMessage()).as("hello#message was null").isNotNull();
|
assertThat(hello.getMessage()).as("hello#message was null").isNotNull();
|
||||||
assertThat(hello.getMessage().contains("500")).as(
|
assertThat(hello.getMessage().contains("500")).as(
|
||||||
"hello#message did not contain the cause (status code) of the fallback invocation")
|
"hello#message did not contain the cause (status code) of the fallback invocation")
|
||||||
.isTrue();
|
.isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = HystrixRuntimeException.class)
|
@Test(expected = HystrixRuntimeException.class)
|
||||||
@@ -439,17 +438,17 @@ public class FeignClientTests {
|
|||||||
@Test
|
@Test
|
||||||
public void testHystrixSetterFactory() {
|
public void testHystrixSetterFactory() {
|
||||||
HystrixCommand<List<Hello>> command = hystrixSetterFactoryClient
|
HystrixCommand<List<Hello>> command = hystrixSetterFactoryClient
|
||||||
.getHellosHystrix();
|
.getHellosHystrix();
|
||||||
assertThat(command).as("command was null").isNotNull();
|
assertThat(command).as("command was null").isNotNull();
|
||||||
String setterPrefix = TestHystrixSetterFactoryClientConfig.SETTER_PREFIX;
|
String setterPrefix = TestHystrixSetterFactoryClientConfig.SETTER_PREFIX;
|
||||||
assertThat(command.getCommandGroup().name()).as(
|
assertThat(command.getCommandGroup().name()).as(
|
||||||
"Hystrix command group name should match the name of the feign client with a prefix of "
|
"Hystrix command group name should match the name of the feign client with a prefix of "
|
||||||
+ setterPrefix)
|
+ setterPrefix)
|
||||||
.isEqualTo(setterPrefix + "localapp5");
|
.isEqualTo(setterPrefix + "localapp5");
|
||||||
assertThat(command.getCommandKey().name()).as(
|
assertThat(command.getCommandKey().name()).as(
|
||||||
"Hystrix command key name should match the request method (space) request path with a prefix of "
|
"Hystrix command key name should match the request method (space) request path with a prefix of "
|
||||||
+ setterPrefix)
|
+ setterPrefix)
|
||||||
.isEqualTo(setterPrefix + "GET /hellos");
|
.isEqualTo(setterPrefix + "GET /hellos");
|
||||||
List<Hello> hellos = command.execute();
|
List<Hello> hellos = command.execute();
|
||||||
assertThat(hellos).as("hellos was null").isNotNull();
|
assertThat(hellos).as("hellos was null").isNotNull();
|
||||||
assertThat(getHelloList()).as("hellos didn't match").isEqualTo(hellos);
|
assertThat(getHelloList()).as("hellos didn't match").isEqualTo(hellos);
|
||||||
@@ -481,8 +480,7 @@ public class FeignClientTests {
|
|||||||
Hello pojo2 = new Hello(OI_TERRA_2);
|
Hello pojo2 = new Hello(OI_TERRA_2);
|
||||||
MockMultipartFile file = new MockMultipartFile("file", "hello.bin", null,
|
MockMultipartFile file = new MockMultipartFile("file", "hello.bin", null,
|
||||||
"hello".getBytes());
|
"hello".getBytes());
|
||||||
String response = multipartClient.multipartPojo("abc", "123", pojo1, pojo2,
|
String response = multipartClient.multipartPojo("abc", "123", pojo1, pojo2, file);
|
||||||
file);
|
|
||||||
assertThat(response).isEqualTo("abc123hello world 1oi terra 2hello.bin");
|
assertThat(response).isEqualTo("abc123hello world 1oi terra 2hello.bin");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -507,9 +505,8 @@ public class FeignClientTests {
|
|||||||
"hello".getBytes());
|
"hello".getBytes());
|
||||||
MockMultipartFile file2 = new MockMultipartFile("file2", "hello2.bin", null,
|
MockMultipartFile file2 = new MockMultipartFile("file2", "hello2.bin", null,
|
||||||
"hello".getBytes());
|
"hello".getBytes());
|
||||||
String response = multipartClient
|
String response = multipartClient.requestPartListOfPojosAndListOfMultipartFiles(
|
||||||
.requestPartListOfPojosAndListOfMultipartFiles(
|
Arrays.asList(pojo1, pojo2), Arrays.asList(file1, file2));
|
||||||
Arrays.asList(pojo1, pojo2), Arrays.asList(file1, file2));
|
|
||||||
assertThat(response).isEqualTo("hello world 1oi terra 2hello1.binhello2.bin");
|
assertThat(response).isEqualTo("hello world 1oi terra 2hello1.binhello2.bin");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -624,7 +621,7 @@ public class FeignClientTests {
|
|||||||
String getToString(@RequestParam("arg") Arg arg);
|
String getToString(@RequestParam("arg") Arg arg);
|
||||||
|
|
||||||
@PostMapping(path = "/form-urlencoded",
|
@PostMapping(path = "/form-urlencoded",
|
||||||
consumes = APPLICATION_FORM_URLENCODED_VALUE)
|
consumes = APPLICATION_FORM_URLENCODED_VALUE)
|
||||||
Hello postFormUrlEncoded(Hello hello);
|
Hello postFormUrlEncoded(Hello hello);
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.GET, path = "/tostring2")
|
@RequestMapping(method = RequestMethod.GET, path = "/tostring2")
|
||||||
@@ -824,8 +821,7 @@ public class FeignClientTests {
|
|||||||
public HystrixClientWithFallBackFactory create(final Throwable cause) {
|
public HystrixClientWithFallBackFactory create(final Throwable cause) {
|
||||||
return () -> {
|
return () -> {
|
||||||
assertThat(cause).isNotNull().as("Cause was null");
|
assertThat(cause).isNotNull().as("Cause was null");
|
||||||
return new Hello(
|
return new Hello("Hello from the fallback side: " + cause.getMessage());
|
||||||
"Hello from the fallback side: " + cause.getMessage());
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -888,12 +884,12 @@ public class FeignClientTests {
|
|||||||
return (target, method) -> {
|
return (target, method) -> {
|
||||||
String groupKey = SETTER_PREFIX + target.name();
|
String groupKey = SETTER_PREFIX + target.name();
|
||||||
RequestMapping requestMapping = method
|
RequestMapping requestMapping = method
|
||||||
.getAnnotation(RequestMapping.class);
|
.getAnnotation(RequestMapping.class);
|
||||||
String commandKey = SETTER_PREFIX + requestMapping.method()[0] + " "
|
String commandKey = SETTER_PREFIX + requestMapping.method()[0] + " "
|
||||||
+ requestMapping.path()[0];
|
+ requestMapping.path()[0];
|
||||||
return HystrixCommand.Setter
|
return HystrixCommand.Setter
|
||||||
.withGroupKey(HystrixCommandGroupKey.Factory.asKey(groupKey))
|
.withGroupKey(HystrixCommandGroupKey.Factory.asKey(groupKey))
|
||||||
.andCommandKey(HystrixCommandKey.Factory.asKey(commandKey));
|
.andCommandKey(HystrixCommandKey.Factory.asKey(commandKey));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1161,7 +1157,7 @@ public class FeignClientTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(path = "/form-urlencoded",
|
@PostMapping(path = "/form-urlencoded",
|
||||||
consumes = APPLICATION_FORM_URLENCODED_VALUE)
|
consumes = APPLICATION_FORM_URLENCODED_VALUE)
|
||||||
Hello postFormUrlEncoded(Hello hello) {
|
Hello postFormUrlEncoded(Hello hello) {
|
||||||
return hello;
|
return hello;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,11 +6,11 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>spring-cloud-dependencies-parent</artifactId>
|
<artifactId>spring-cloud-dependencies-parent</artifactId>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<version>2.3.5.BUILD-SNAPSHOT</version>
|
<version>2.3.5.RELEASE</version>
|
||||||
<relativePath/>
|
<relativePath/>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>spring-cloud-openfeign-dependencies</artifactId>
|
<artifactId>spring-cloud-openfeign-dependencies</artifactId>
|
||||||
<version>2.2.9.BUILD-SNAPSHOT</version>
|
<version>2.2.9.RELEASE</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<name>spring-cloud-openfeign-dependencies</name>
|
<name>spring-cloud-openfeign-dependencies</name>
|
||||||
<description>Spring Cloud OpenFeign Dependencies</description>
|
<description>Spring Cloud OpenFeign Dependencies</description>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<artifactId>spring-cloud-openfeign</artifactId>
|
<artifactId>spring-cloud-openfeign</artifactId>
|
||||||
<version>2.2.9.BUILD-SNAPSHOT</version>
|
<version>2.2.9.RELEASE</version>
|
||||||
<relativePath>..</relativePath>
|
<relativePath>..</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||||
|
|||||||
Reference in New Issue
Block a user