From 8983c9bce1c7b3e7bf5dc6f064126c82b9bbccdb Mon Sep 17 00:00:00 2001 From: Luke Tornquist Date: Tue, 9 May 2017 13:16:12 -0400 Subject: [PATCH 01/18] Add support for Wildcard Types in Feign Client. Fixes gh-1676 --- .../netflix/feign/support/SpringDecoder.java | 24 +++++------ .../netflix/feign/SpringDecoderTests.java | 40 ++++++++++++++----- 2 files changed, 42 insertions(+), 22 deletions(-) diff --git a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/feign/support/SpringDecoder.java b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/feign/support/SpringDecoder.java index 6651283c..a82a17ad 100644 --- a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/feign/support/SpringDecoder.java +++ b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/feign/support/SpringDecoder.java @@ -16,13 +16,10 @@ package org.springframework.cloud.netflix.feign.support; -import static org.springframework.cloud.netflix.feign.support.FeignUtils.getHttpHeaders; - -import java.io.IOException; -import java.io.InputStream; -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; - +import feign.FeignException; +import feign.Response; +import feign.codec.DecodeException; +import feign.codec.Decoder; import org.springframework.beans.factory.ObjectFactory; import org.springframework.boot.autoconfigure.web.HttpMessageConverters; import org.springframework.http.HttpHeaders; @@ -30,10 +27,13 @@ import org.springframework.http.HttpStatus; import org.springframework.http.client.ClientHttpResponse; import org.springframework.web.client.HttpMessageConverterExtractor; -import feign.FeignException; -import feign.Response; -import feign.codec.DecodeException; -import feign.codec.Decoder; +import java.io.IOException; +import java.io.InputStream; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.lang.reflect.WildcardType; + +import static org.springframework.cloud.netflix.feign.support.FeignUtils.getHttpHeaders; /** * @author Spencer Gibb @@ -49,7 +49,7 @@ public class SpringDecoder implements Decoder { @Override public Object decode(final Response response, Type type) throws IOException, FeignException { - if (type instanceof Class || type instanceof ParameterizedType) { + if (type instanceof Class || type instanceof ParameterizedType || type instanceof WildcardType) { @SuppressWarnings({ "unchecked", "rawtypes" }) HttpMessageConverterExtractor extractor = new HttpMessageConverterExtractor( type, this.messageConverters.getObject().getConverters()); diff --git a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/feign/SpringDecoderTests.java b/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/feign/SpringDecoderTests.java index 949864da..13221bc2 100644 --- a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/feign/SpringDecoderTests.java +++ b/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/feign/SpringDecoderTests.java @@ -16,13 +16,9 @@ package org.springframework.cloud.netflix.feign; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - -import java.util.ArrayList; -import java.util.List; - +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; @@ -36,13 +32,16 @@ import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import static org.junit.Assert.*; /** * @author Spencer Gibb @@ -108,6 +107,19 @@ public class SpringDecoderTests extends FeignClientFactoryBean { assertEquals("first hello didn't match", "hello world 1", hellos.get(0)); } + @Test + @SuppressWarnings("unchecked") + public void testWildcardTypeDecode() { + ResponseEntity wildcard = testClient().getWildcard(); + assertNotNull("wildcard was null", wildcard); + assertEquals("wrong status code", HttpStatus.OK, wildcard.getStatusCode()); + Object wildcardBody = wildcard.getBody(); + assertNotNull("wildcardBody was null", wildcardBody); + assertTrue("wildcard not an instance of Map", wildcardBody instanceof Map); + Map hello = (Map) wildcardBody; + assertEquals("first hello didn't match", "wildcard", hello.get("message")); + } + @Test public void testResponseEntityVoid() { ResponseEntity response = testClient().getHelloVoid(); @@ -156,6 +168,9 @@ public class SpringDecoderTests extends FeignClientFactoryBean { @RequestMapping(method = RequestMethod.GET, value = "/hellonotfound") ResponseEntity getNotFound(); + + @GetMapping("/helloWildcard") + ResponseEntity getWildcard(); } @Configuration @@ -199,6 +214,11 @@ public class SpringDecoderTests extends FeignClientFactoryBean { return ResponseEntity.status(HttpStatus.NOT_FOUND).body((String) null); } + @Override + public ResponseEntity getWildcard() { + return ResponseEntity.ok(new Hello("wildcard")); + } + public static void main(String[] args) { new SpringApplicationBuilder(Application.class) .properties("spring.application.name=springdecodertest", From d993fe217cd3edde671a0c0b12e7a77c6ddf51e1 Mon Sep 17 00:00:00 2001 From: Luke Tornquist Date: Tue, 9 May 2017 13:20:01 -0400 Subject: [PATCH 02/18] Format using provided Eclipse formatter. --- .../cloud/netflix/feign/support/SpringDecoder.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/feign/support/SpringDecoder.java b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/feign/support/SpringDecoder.java index a82a17ad..40e9d598 100644 --- a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/feign/support/SpringDecoder.java +++ b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/feign/support/SpringDecoder.java @@ -47,9 +47,10 @@ public class SpringDecoder implements Decoder { } @Override - public Object decode(final Response response, Type type) throws IOException, - FeignException { - if (type instanceof Class || type instanceof ParameterizedType || type instanceof WildcardType) { + public Object decode(final Response response, Type type) + throws IOException, FeignException { + if (type instanceof Class || type instanceof ParameterizedType + || type instanceof WildcardType) { @SuppressWarnings({ "unchecked", "rawtypes" }) HttpMessageConverterExtractor extractor = new HttpMessageConverterExtractor( type, this.messageConverters.getObject().getConverters()); From 189d926c6aa1f610ce45491e002cb69163092a3f Mon Sep 17 00:00:00 2001 From: Luke Tornquist Date: Tue, 9 May 2017 16:10:08 -0400 Subject: [PATCH 03/18] Correct import order --- .../netflix/feign/support/SpringDecoder.java | 23 ++++++++++--------- .../netflix/feign/SpringDecoderTests.java | 20 +++++++++------- 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/feign/support/SpringDecoder.java b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/feign/support/SpringDecoder.java index 40e9d598..a7d82783 100644 --- a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/feign/support/SpringDecoder.java +++ b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/feign/support/SpringDecoder.java @@ -16,16 +16,7 @@ package org.springframework.cloud.netflix.feign.support; -import feign.FeignException; -import feign.Response; -import feign.codec.DecodeException; -import feign.codec.Decoder; -import org.springframework.beans.factory.ObjectFactory; -import org.springframework.boot.autoconfigure.web.HttpMessageConverters; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpStatus; -import org.springframework.http.client.ClientHttpResponse; -import org.springframework.web.client.HttpMessageConverterExtractor; +import static org.springframework.cloud.netflix.feign.support.FeignUtils.getHttpHeaders; import java.io.IOException; import java.io.InputStream; @@ -33,7 +24,17 @@ import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.lang.reflect.WildcardType; -import static org.springframework.cloud.netflix.feign.support.FeignUtils.getHttpHeaders; +import org.springframework.beans.factory.ObjectFactory; +import org.springframework.boot.autoconfigure.web.HttpMessageConverters; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.client.ClientHttpResponse; +import org.springframework.web.client.HttpMessageConverterExtractor; + +import feign.FeignException; +import feign.Response; +import feign.codec.DecodeException; +import feign.codec.Decoder; /** * @author Spencer Gibb diff --git a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/feign/SpringDecoderTests.java b/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/feign/SpringDecoderTests.java index 13221bc2..c01cebf9 100644 --- a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/feign/SpringDecoderTests.java +++ b/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/feign/SpringDecoderTests.java @@ -16,9 +16,15 @@ package org.springframework.cloud.netflix.feign; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; @@ -37,11 +43,9 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.*; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; /** * @author Spencer Gibb From b8ed8462476f4b7f8451b76977ccf23cd286164d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9C=A4=EC=9A=A9=EC=84=B1=28Yongsung=20Yoon=29/=EA=B0=9C?= =?UTF-8?q?=EB=B0=9C=ED=98=81=EC=8B=A0=ED=8C=80/SKP?= Date: Thu, 11 May 2017 11:29:59 +0900 Subject: [PATCH 04/18] Update docs to indicate the need of declaring feign's fallback implementation as a Spring bean --- docs/src/main/asciidoc/spring-cloud-netflix.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/main/asciidoc/spring-cloud-netflix.adoc b/docs/src/main/asciidoc/spring-cloud-netflix.adoc index 64c9c7fc..ab48c463 100644 --- a/docs/src/main/asciidoc/spring-cloud-netflix.adoc +++ b/docs/src/main/asciidoc/spring-cloud-netflix.adoc @@ -1107,7 +1107,7 @@ favor for an opt-in approach. [[spring-cloud-feign-hystrix-fallback]] === Feign Hystrix Fallbacks -Hystrix supports the notion of a fallback: a default code path that is executed when they circuit is open or there is an error. To enable fallbacks for a given `@FeignClient` set the `fallback` attribute to the class name that implements the fallback. +Hystrix supports the notion of a fallback: a default code path that is executed when they circuit is open or there is an error. To enable fallbacks for a given `@FeignClient` set the `fallback` attribute to the class name that implements the fallback. You also need to declare your implementation as a Spring bean. [source,java,indent=0] ---- From ccdf0d9f9531b23262689d49be80a358bf7c9334 Mon Sep 17 00:00:00 2001 From: Ryan Baxter Date: Mon, 15 May 2017 10:48:39 -0400 Subject: [PATCH 05/18] Removing duplicate and incorrect dependency. Fixes #1941. --- spring-cloud-netflix-dependencies/pom.xml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/spring-cloud-netflix-dependencies/pom.xml b/spring-cloud-netflix-dependencies/pom.xml index a995dae1..1b7dbc2d 100644 --- a/spring-cloud-netflix-dependencies/pom.xml +++ b/spring-cloud-netflix-dependencies/pom.xml @@ -233,11 +233,6 @@ - - javax-inject - javax-inject - 1 - com.netflix.eureka eureka-core From a1b1a7d702c14db98587893de863bd41647cfc5c Mon Sep 17 00:00:00 2001 From: Spencer Gibb Date: Mon, 15 May 2017 10:04:31 -0600 Subject: [PATCH 06/18] Moves EurekaHealthIndicator creation to auto config. Fixes a race condition introduced in 1.3.0 fixes gh-1933 --- .../eureka/EurekaClientAutoConfiguration.java | 14 +++++++++++++- .../EurekaDiscoveryClientConfiguration.java | 15 ++------------- .../EurekaClientAutoConfigurationTests.java | 9 ++++++++- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaClientAutoConfiguration.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaClientAutoConfiguration.java index ff0df147..98dc80c0 100644 --- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaClientAutoConfiguration.java +++ b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaClientAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2014 the original author or authors. + * Copyright 2013-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -12,6 +12,7 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * */ package org.springframework.cloud.netflix.eureka; @@ -24,6 +25,7 @@ import java.lang.annotation.Target; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.actuate.endpoint.Endpoint; import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.AutoConfigureBefore; import org.springframework.boot.autoconfigure.condition.AnyNestedCondition; @@ -271,4 +273,14 @@ public class EurekaClientAutoConfiguration { } + @Configuration + @ConditionalOnClass(Endpoint.class) + protected static class EurekaHealthIndicatorConfiguration { + @Bean + @ConditionalOnMissingBean + public EurekaHealthIndicator eurekaHealthIndicator(EurekaClient eurekaClient, + EurekaInstanceConfig instanceConfig, EurekaClientConfig clientConfig) { + return new EurekaHealthIndicator(eurekaClient, instanceConfig, clientConfig); + } + } } diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaDiscoveryClientConfiguration.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaDiscoveryClientConfiguration.java index 8f068518..42b7b303 100644 --- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaDiscoveryClientConfiguration.java +++ b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaDiscoveryClientConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2014 the original author or authors. + * Copyright 2013-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -12,12 +12,12 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * */ package org.springframework.cloud.netflix.eureka; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.actuate.endpoint.Endpoint; import org.springframework.boot.actuate.health.HealthAggregator; import org.springframework.boot.actuate.health.OrderedHealthAggregator; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; @@ -30,7 +30,6 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.event.EventListener; -import com.netflix.appinfo.EurekaInstanceConfig; import com.netflix.appinfo.HealthCheckHandler; import com.netflix.discovery.EurekaClient; import com.netflix.discovery.EurekaClientConfig; @@ -82,16 +81,6 @@ public class EurekaDiscoveryClientConfiguration { } } - @Configuration - @ConditionalOnClass(Endpoint.class) - protected static class EurekaHealthIndicatorConfiguration { - @Bean - @ConditionalOnMissingBean - public EurekaHealthIndicator eurekaHealthIndicator(EurekaClient eurekaClient, - EurekaInstanceConfig instanceConfig, EurekaClientConfig clientConfig) { - return new EurekaHealthIndicator(eurekaClient, instanceConfig, clientConfig); - } - } @Configuration @ConditionalOnProperty(value = "eureka.client.healthcheck.enabled", matchIfMissing = false) diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaClientAutoConfigurationTests.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaClientAutoConfigurationTests.java index ccd506ec..98ecaf72 100644 --- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaClientAutoConfigurationTests.java +++ b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaClientAutoConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2015 the original author or authors. + * Copyright 2013-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -12,6 +12,7 @@ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. + * */ package org.springframework.cloud.netflix.eureka; @@ -237,6 +238,12 @@ public class EurekaClientAutoConfigurationTests { assertEquals("mytesteurekaappname", getInstanceConfig().getAppname()); } + @Test + public void eurekaHealthIndicatorCreated() { + setupContext(); + this.context.getBean(EurekaHealthIndicator.class); + } + private void testNonSecurePort(String propName) { addEnvironment(this.context, propName + ":8888"); setupContext(); From fe06370aa21015732250fe095e37e939062e3555 Mon Sep 17 00:00:00 2001 From: Jin Zhang Date: Tue, 16 May 2017 01:44:14 +0800 Subject: [PATCH 07/18] correct comments in FeignClient, SendResponseFilter, RibbonRoutingFilter (#1935) --- .../org/springframework/cloud/netflix/feign/FeignClient.java | 2 +- .../cloud/netflix/zuul/filters/post/SendResponseFilter.java | 2 +- .../cloud/netflix/zuul/filters/route/RibbonRoutingFilter.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/feign/FeignClient.java b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/feign/FeignClient.java index 131b08ff..0a40573c 100644 --- a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/feign/FeignClient.java +++ b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/feign/FeignClient.java @@ -107,7 +107,7 @@ public @interface FeignClient { String path() default ""; /** - * Whether to mark the feign proxy as a primary bean. Defaults to false. + * Whether to mark the feign proxy as a primary bean. Defaults to true. */ boolean primary() default true; diff --git a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/post/SendResponseFilter.java b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/post/SendResponseFilter.java index 6ac172bb..d0338860 100644 --- a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/post/SendResponseFilter.java +++ b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/post/SendResponseFilter.java @@ -71,7 +71,7 @@ public class SendResponseFilter extends ZuulFilter { public SendResponseFilter() { super(); - // To support Servlet API 3.0.1 we need to check if setcontentLengthLong exists + // To support Servlet API 3.1 we need to check if setContentLengthLong exists try { HttpServletResponse.class.getMethod("setContentLengthLong"); } catch(NoSuchMethodException e) { diff --git a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/route/RibbonRoutingFilter.java b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/route/RibbonRoutingFilter.java index f28d82c5..6832abe7 100644 --- a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/route/RibbonRoutingFilter.java +++ b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/route/RibbonRoutingFilter.java @@ -68,7 +68,7 @@ public class RibbonRoutingFilter extends ZuulFilter { this.helper = helper; this.ribbonCommandFactory = ribbonCommandFactory; this.requestCustomizers = requestCustomizers; - // To support Servlet API 3.0.1 we need to check if getcontentLengthLong exists + // To support Servlet API 3.1 we need to check if getContentLengthLong exists try { HttpServletRequest.class.getMethod("getContentLengthLong"); } catch(NoSuchMethodException e) { From 73b5609e63b4cea4bdee3ffb655d4b809e2c953b Mon Sep 17 00:00:00 2001 From: Luke Tornquist Date: Mon, 15 May 2017 14:48:15 -0400 Subject: [PATCH 08/18] Allow easier subclassing of SimpleRouteLocator Fixes gh-1598 --- .../zuul/filters/SimpleRouteLocator.java | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/SimpleRouteLocator.java b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/SimpleRouteLocator.java index 483599f2..28ccdf85 100644 --- a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/SimpleRouteLocator.java +++ b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/SimpleRouteLocator.java @@ -83,6 +83,11 @@ public class SimpleRouteLocator implements RouteLocator, Ordered { @Override public Route getMatchingRoute(final String path) { + return getSimpleMatchingRoute(path); + + } + + protected Route getSimpleMatchingRoute(final String path) { if (log.isDebugEnabled()) { log.debug("Finding route for path: " + path); } @@ -102,29 +107,31 @@ public class SimpleRouteLocator implements RouteLocator, Ordered { String adjustedPath = adjustPath(path); - ZuulRoute route = null; + ZuulRoute route = getZuulRoute(adjustedPath); + + return getRoute(route, adjustedPath); + } + + protected ZuulRoute getZuulRoute(String adjustedPath) { if (!matchesIgnoredPatterns(adjustedPath)) { for (Entry entry : this.routes.get().entrySet()) { String pattern = entry.getKey(); log.debug("Matching pattern:" + pattern); if (this.pathMatcher.match(pattern, adjustedPath)) { - route = entry.getValue(); - break; + return entry.getValue(); } } } - if (log.isDebugEnabled()) { - log.debug("route matched=" + route); - } - - return getRoute(route, adjustedPath); - + return null; } - private Route getRoute(ZuulRoute route, String path) { + protected Route getRoute(ZuulRoute route, String path) { if (route == null) { return null; } + if (log.isDebugEnabled()) { + log.debug("route matched=" + route); + } String targetPath = path; String prefix = this.properties.getPrefix(); if (path.startsWith(prefix) && this.properties.isStripPrefix()) { From 98fd3c737935415777a88d6e2af047d8f4893d56 Mon Sep 17 00:00:00 2001 From: Spencer Gibb Date: Tue, 16 May 2017 19:52:41 -0600 Subject: [PATCH 09/18] Upgrade Hystrix to v1.5.12 fixes gh-1955 --- spring-cloud-netflix-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-cloud-netflix-dependencies/pom.xml b/spring-cloud-netflix-dependencies/pom.xml index 1b7dbc2d..d545a7d4 100644 --- a/spring-cloud-netflix-dependencies/pom.xml +++ b/spring-cloud-netflix-dependencies/pom.xml @@ -17,7 +17,7 @@ 0.7.4 1.6.2 9.4.0 - 1.5.11 + 1.5.12 2.2.2 0.10.1 1.3.0 From cd44a52084ac0b98d8188e542038e932c43a4238 Mon Sep 17 00:00:00 2001 From: Spencer Gibb Date: Tue, 16 May 2017 21:07:19 -0600 Subject: [PATCH 10/18] Update feign to 9.5.0 fixes gh-1956 --- spring-cloud-netflix-dependencies/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-cloud-netflix-dependencies/pom.xml b/spring-cloud-netflix-dependencies/pom.xml index d545a7d4..ecd03a22 100644 --- a/spring-cloud-netflix-dependencies/pom.xml +++ b/spring-cloud-netflix-dependencies/pom.xml @@ -16,7 +16,7 @@ 0.7.4 1.6.2 - 9.4.0 + 9.5.0 1.5.12 2.2.2 0.10.1 From aa4d9d62bcffab868928c4250fc003bed3816f47 Mon Sep 17 00:00:00 2001 From: Biju Kunjummen Date: Fri, 19 May 2017 15:40:49 -0700 Subject: [PATCH 11/18] Test for validating that local service instance resolves for hystrix metrics (#1922) --- .../hystrix/stream/HystrixStreamTests.java | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/spring-cloud-netflix-hystrix-stream/src/test/java/org/springframework/cloud/netflix/hystrix/stream/HystrixStreamTests.java b/spring-cloud-netflix-hystrix-stream/src/test/java/org/springframework/cloud/netflix/hystrix/stream/HystrixStreamTests.java index f6a278f7..63903614 100644 --- a/spring-cloud-netflix-hystrix-stream/src/test/java/org/springframework/cloud/netflix/hystrix/stream/HystrixStreamTests.java +++ b/spring-cloud-netflix-hystrix-stream/src/test/java/org/springframework/cloud/netflix/hystrix/stream/HystrixStreamTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2015 the original author or authors. + * Copyright 2013-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,11 +19,13 @@ package org.springframework.cloud.netflix.hystrix.stream; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; +import org.springframework.cloud.client.ServiceInstance; import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; +import org.springframework.cloud.client.discovery.DiscoveryClient; +import org.springframework.context.annotation.Configuration; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.web.bind.annotation.RequestMapping; @@ -31,12 +33,14 @@ import org.springframework.web.bind.annotation.RestController; import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand; +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Spencer Gibb */ @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(classes = HystrixStreamTests.Application.class, webEnvironment = WebEnvironment.RANDOM_PORT, value = { - "server.port=0", "spring.jmx.enabled=true" }) + "server.port=0", "spring.jmx.enabled=true", "spring.application.name=mytestapp" }) @DirtiesContext public class HystrixStreamTests { @@ -45,10 +49,14 @@ public class HystrixStreamTests { @Autowired private Application application; + + @Autowired + private DiscoveryClient discoveryClient; @EnableAutoConfiguration @EnableCircuitBreaker @RestController + @Configuration public static class Application { @HystrixCommand @@ -56,16 +64,16 @@ public class HystrixStreamTests { public String hello() { return "Hello World"; } - - public static void main(String[] args) { - SpringApplication.run(Application.class, args); - } - } @Test public void contextLoads() { this.application.hello(); + //It is important that local service instance resolves for metrics + //origin details to be populated + ServiceInstance localServiceInstance = discoveryClient.getLocalServiceInstance(); + assertThat(localServiceInstance).isNotNull(); + assertThat(localServiceInstance.getServiceId()).isEqualTo("mytestapp"); this.task.gatherMetrics(); } From 6362be81968792b4618df0066fd785b3886baaa6 Mon Sep 17 00:00:00 2001 From: balp Date: Thu, 18 May 2017 15:46:29 +0200 Subject: [PATCH 12/18] Adds ability to customize simple host conn pool The timeToLive and timeUnit parameters added to configure connection pool. Fixes gh-1720 --- .../netflix/zuul/filters/ZuulProperties.java | 12 +++++++++++- .../route/SimpleHostRoutingFilter.java | 6 ++++-- .../route/SimpleHostRoutingFilterTests.java | 19 ++++++++++++++++++- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/ZuulProperties.java b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/ZuulProperties.java index f411fad2..3b808528 100644 --- a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/ZuulProperties.java +++ b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/ZuulProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2015 the original author or authors. + * Copyright 2013-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,6 +33,7 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import java.util.concurrent.TimeUnit; import static com.netflix.hystrix.HystrixCommandProperties.ExecutionIsolationStrategy.SEMAPHORE; @@ -40,6 +41,7 @@ import static com.netflix.hystrix.HystrixCommandProperties.ExecutionIsolationStr * @author Spencer Gibb * @author Dave Syer * @author Mathias Düsterhöft + * @author Bilal Alp */ @Data @ConfigurationProperties("zuul") @@ -326,6 +328,14 @@ public class ZuulProperties { * The maximum number of connections that can be used by a single route. */ private int maxPerRouteConnections = 20; + /** + * The lifetime for the connection pool. + */ + private long timeToLive = -1; + /** + * The time unit for timeToLive. + */ + private TimeUnit timeUnit = TimeUnit.MILLISECONDS; } @Data diff --git a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/route/SimpleHostRoutingFilter.java b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/route/SimpleHostRoutingFilter.java index 9fec0b08..07d8b947 100644 --- a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/route/SimpleHostRoutingFilter.java +++ b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/route/SimpleHostRoutingFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2013-2015 the original author or authors. + * Copyright 2013-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -92,6 +92,7 @@ import static org.springframework.cloud.netflix.zuul.filters.support.FilterConst * * @author Spencer Gibb * @author Dave Syer + * @author Bilal Alp */ public class SimpleHostRoutingFilter extends ZuulFilter { @@ -235,7 +236,8 @@ public class SimpleHostRoutingFilter extends ZuulFilter { } final Registry registry = registryBuilder.build(); - this.connectionManager = new PoolingHttpClientConnectionManager(registry); + this.connectionManager = new PoolingHttpClientConnectionManager(registry, null, null, null, + hostProperties.getTimeToLive(), hostProperties.getTimeUnit()); this.connectionManager .setMaxTotal(this.hostProperties.getMaxTotalConnections()); this.connectionManager.setDefaultMaxPerRoute( diff --git a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/filters/route/SimpleHostRoutingFilterTests.java b/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/filters/route/SimpleHostRoutingFilterTests.java index 86e32652..daf4b847 100644 --- a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/filters/route/SimpleHostRoutingFilterTests.java +++ b/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/filters/route/SimpleHostRoutingFilterTests.java @@ -19,8 +19,10 @@ package org.springframework.cloud.netflix.zuul.filters.route; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.lang.reflect.Field; import java.nio.charset.Charset; import java.util.Arrays; +import java.util.concurrent.TimeUnit; import java.util.zip.GZIPOutputStream; import javax.servlet.http.HttpServletResponse; @@ -49,6 +51,7 @@ import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.ReflectionUtils; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @@ -87,11 +90,25 @@ public class SimpleHostRoutingFilterTests { @Test public void connectionPropertiesAreApplied() { - addEnvironment(this.context, "zuul.host.maxTotalConnections=100", "zuul.host.maxPerRouteConnections=10"); + addEnvironment(this.context, "zuul.host.maxTotalConnections=100", + "zuul.host.maxPerRouteConnections=10", "zuul.host.timeToLive=5", + "zuul.host.timeUnit=SECONDS"); setupContext(); PoolingHttpClientConnectionManager connMgr = getFilter().newConnectionManager(); assertEquals(100, connMgr.getMaxTotal()); assertEquals(10, connMgr.getDefaultMaxPerRoute()); + Object pool = getField(connMgr, "pool"); + Long timeToLive = getField(pool, "timeToLive"); + TimeUnit timeUnit = getField(pool, "tunit"); + assertEquals(new Long(5), timeToLive); + assertEquals(TimeUnit.SECONDS, timeUnit); + } + + protected T getField(Object target, String name) { + Field field = ReflectionUtils.findField(target.getClass(), name); + ReflectionUtils.makeAccessible(field); + Object value = ReflectionUtils.getField(field, target); + return (T)value; } @Test From e130ec03ad96522682db94916c271632a2619309 Mon Sep 17 00:00:00 2001 From: Roman Rodov Date: Mon, 3 Apr 2017 14:09:06 +1000 Subject: [PATCH 13/18] Add management.context-path to status & health url fixes gh-1795 --- .../eureka/EurekaClientAutoConfiguration.java | 68 +++++++++---------- .../EurekaClientAutoConfigurationTests.java | 48 +++++++++++++ 2 files changed, 82 insertions(+), 34 deletions(-) diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaClientAutoConfiguration.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaClientAutoConfiguration.java index 98dc80c0..2c7829ea 100644 --- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaClientAutoConfiguration.java +++ b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaClientAutoConfiguration.java @@ -22,9 +22,10 @@ import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +import java.net.MalformedURLException; +import java.net.URL; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.actuate.endpoint.Endpoint; import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.AutoConfigureBefore; @@ -55,6 +56,7 @@ import org.springframework.context.annotation.Conditional; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Lazy; import org.springframework.core.env.ConfigurableEnvironment; +import org.springframework.core.env.PropertyResolver; import org.springframework.util.StringUtils; import com.netflix.appinfo.ApplicationInfoManager; @@ -64,7 +66,6 @@ import com.netflix.appinfo.InstanceInfo; import com.netflix.discovery.DiscoveryClient.DiscoveryClientOptionalArgs; import com.netflix.discovery.EurekaClient; import com.netflix.discovery.EurekaClientConfig; - import static org.springframework.cloud.commons.util.IdUtils.getDefaultInstanceId; /** @@ -84,17 +85,15 @@ import static org.springframework.cloud.commons.util.IdUtils.getDefaultInstanceI @AutoConfigureAfter(name = "org.springframework.cloud.autoconfigure.RefreshAutoConfiguration") public class EurekaClientAutoConfiguration { - @Value("${server.port:${SERVER_PORT:${PORT:8080}}}") - private int nonSecurePort; - - @Value("${management.port:${MANAGEMENT_PORT:${server.port:${SERVER_PORT:${PORT:8080}}}}}") - private int managementPort; - - @Autowired private ConfigurableEnvironment env; - @Autowired(required = false) private HealthCheckHandler healthCheckHandler; + private RelaxedPropertyResolver propertyResolver; + + public EurekaClientAutoConfiguration(ConfigurableEnvironment env) { + this.env = env; + this.propertyResolver = new RelaxedPropertyResolver(env); + } @Bean public HasFeatures eurekaFeature() { @@ -105,7 +104,7 @@ public class EurekaClientAutoConfiguration { @ConditionalOnMissingBean(value = EurekaClientConfig.class, search = SearchStrategy.CURRENT) public EurekaClientConfigBean eurekaClientConfigBean() { EurekaClientConfigBean client = new EurekaClientConfigBean(); - if ("bootstrap".equals(this.env.getProperty("spring.config.name"))) { + if ("bootstrap".equals(propertyResolver.getProperty("spring.config.name"))) { // We don't register during bootstrap by default, but there will be another // chance later. client.setRegisterWithEureka(false); @@ -115,21 +114,27 @@ public class EurekaClientAutoConfiguration { @Bean @ConditionalOnMissingBean(value = EurekaInstanceConfig.class, search = SearchStrategy.CURRENT) - public EurekaInstanceConfigBean eurekaInstanceConfigBean(InetUtils inetUtils) { - RelaxedPropertyResolver relaxedPropertyResolver = new RelaxedPropertyResolver(env, "eureka.instance."); - String hostname = relaxedPropertyResolver.getProperty("hostname"); - boolean preferIpAddress = Boolean.parseBoolean(relaxedPropertyResolver.getProperty("preferIpAddress")); - EurekaInstanceConfigBean instance = new EurekaInstanceConfigBean(inetUtils); - instance.setNonSecurePort(this.nonSecurePort); - instance.setInstanceId(getDefaultInstanceId(this.env)); - instance.setPreferIpAddress(preferIpAddress); + public EurekaInstanceConfigBean eurekaInstanceConfigBean(InetUtils inetUtils) throws MalformedURLException { + PropertyResolver eurekaPropertyResolver = new RelaxedPropertyResolver(this.env, "eureka.instance."); + String hostname = eurekaPropertyResolver.getProperty("hostname"); - if (this.managementPort != this.nonSecurePort && this.managementPort != 0) { + boolean preferIpAddress = Boolean.parseBoolean(eurekaPropertyResolver.getProperty("preferIpAddress")); + int nonSecurePort = Integer.valueOf(propertyResolver.getProperty("server.port", propertyResolver.getProperty("port", "8080"))); + int managementPort = Integer.valueOf(propertyResolver.getProperty("management.port", String.valueOf(nonSecurePort))); + String managementContextPath = propertyResolver.getProperty("management.contextPath", propertyResolver.getProperty("server.contextPath", "/")); + EurekaInstanceConfigBean instance = new EurekaInstanceConfigBean(inetUtils); + instance.setNonSecurePort(nonSecurePort); + instance.setInstanceId(getDefaultInstanceId(propertyResolver)); + instance.setPreferIpAddress(preferIpAddress); + if (managementPort != nonSecurePort && managementPort != 0) { if (StringUtils.hasText(hostname)) { instance.setHostname(hostname); } - String statusPageUrlPath = relaxedPropertyResolver.getProperty("statusPageUrlPath"); - String healthCheckUrlPath = relaxedPropertyResolver.getProperty("healthCheckUrlPath"); + String statusPageUrlPath = eurekaPropertyResolver.getProperty("statusPageUrlPath"); + String healthCheckUrlPath = eurekaPropertyResolver.getProperty("healthCheckUrlPath"); + if (!managementContextPath.endsWith("/")) { + managementContextPath = managementContextPath + "/"; + } if (StringUtils.hasText(statusPageUrlPath)) { instance.setStatusPageUrlPath(statusPageUrlPath); } @@ -137,17 +142,15 @@ public class EurekaClientAutoConfiguration { instance.setHealthCheckUrlPath(healthCheckUrlPath); } String scheme = instance.getSecurePortEnabled() ? "https" : "http"; - instance.setStatusPageUrl(scheme + "://" + instance.getHostname() + ":" - + this.managementPort + instance.getStatusPageUrlPath()); - instance.setHealthCheckUrl(scheme + "://" + instance.getHostname() + ":" - + this.managementPort + instance.getHealthCheckUrlPath()); + URL base = new URL(scheme, instance.getHostname(), managementPort, managementContextPath); + instance.setStatusPageUrl(new URL(base, StringUtils.trimLeadingCharacter(instance.getStatusPageUrlPath(), '/')).toString()); + instance.setHealthCheckUrl(new URL(base, StringUtils.trimLeadingCharacter(instance.getHealthCheckUrlPath(), '/')).toString()); } return instance; } @Bean - public DiscoveryClient discoveryClient(EurekaInstanceConfig config, - EurekaClient client) { + public DiscoveryClient discoveryClient(EurekaInstanceConfig config, EurekaClient client) { return new EurekaDiscoveryClient(config, client); } @@ -192,8 +195,7 @@ public class EurekaClientAutoConfiguration { @Bean(destroyMethod = "shutdown") @ConditionalOnMissingBean(value = EurekaClient.class, search = SearchStrategy.CURRENT) - public EurekaClient eurekaClient(ApplicationInfoManager manager, - EurekaClientConfig config) { + public EurekaClient eurekaClient(ApplicationInfoManager manager, EurekaClientConfig config) { return new CloudEurekaClient(manager, config, this.optionalArgs, this.context); } @@ -221,8 +223,7 @@ public class EurekaClientAutoConfiguration { @ConditionalOnMissingBean(value = EurekaClient.class, search = SearchStrategy.CURRENT) @org.springframework.cloud.context.config.annotation.RefreshScope @Lazy - public EurekaClient eurekaClient(ApplicationInfoManager manager, - EurekaClientConfig config, EurekaInstanceConfig instance) { + public EurekaClient eurekaClient(ApplicationInfoManager manager, EurekaClientConfig config, EurekaInstanceConfig instance) { manager.getInfo(); // force initialization return new CloudEurekaClient(manager, config, this.optionalArgs, this.context); @@ -232,8 +233,7 @@ public class EurekaClientAutoConfiguration { @ConditionalOnMissingBean(value = ApplicationInfoManager.class, search = SearchStrategy.CURRENT) @org.springframework.cloud.context.config.annotation.RefreshScope @Lazy - public ApplicationInfoManager eurekaApplicationInfoManager( - EurekaInstanceConfig config) { + public ApplicationInfoManager eurekaApplicationInfoManager(EurekaInstanceConfig config) { InstanceInfo instanceInfo = new InstanceInfoFactory().create(config); return new ApplicationInfoManager(config, instanceInfo); } diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaClientAutoConfigurationTests.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaClientAutoConfigurationTests.java index 98ecaf72..22f89941 100644 --- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaClientAutoConfigurationTests.java +++ b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaClientAutoConfigurationTests.java @@ -113,6 +113,54 @@ public class EurekaClientAutoConfigurationTests { instance.getHealthCheckUrl().contains("/myHealthCheck")); } + @Test + public void statusPageUrlPathAndManagementPortAndContextPath() { + EnvironmentTestUtils.addEnvironment(this.context, "server.port=8989", + "management.port=9999", "management.contextPath=/manage", + "eureka.instance.statusPageUrlPath=/myStatusPage"); + setupContext(RefreshAutoConfiguration.class); + EurekaInstanceConfigBean instance = this.context + .getBean(EurekaInstanceConfigBean.class); + assertTrue("Wrong status page: " + instance.getStatusPageUrl(), + instance.getStatusPageUrl().endsWith(":9999/manage/myStatusPage")); + } + + @Test + public void healthCheckUrlPathAndManagementPortAndContextPath() { + EnvironmentTestUtils.addEnvironment(this.context, "server.port=8989", + "management.port=9999", "management.contextPath=/manage", + "eureka.instance.healthCheckUrlPath=/myHealthCheck"); + setupContext(RefreshAutoConfiguration.class); + EurekaInstanceConfigBean instance = this.context + .getBean(EurekaInstanceConfigBean.class); + assertTrue("Wrong health check: " + instance.getHealthCheckUrl(), + instance.getHealthCheckUrl().endsWith(":9999/manage/myHealthCheck")); + } + + @Test + public void statusPageUrlPathAndManagementPortAndContextPathKebobCase() { + EnvironmentTestUtils.addEnvironment(this.context, "server.port=8989", + "management.port=9999", "management.context-path=/manage", + "eureka.instance.statusPageUrlPath=/myStatusPage"); + setupContext(RefreshAutoConfiguration.class); + EurekaInstanceConfigBean instance = this.context + .getBean(EurekaInstanceConfigBean.class); + assertTrue("Wrong status page: " + instance.getStatusPageUrl(), + instance.getStatusPageUrl().endsWith(":9999/manage/myStatusPage")); + } + + @Test + public void healthCheckUrlPathAndManagementPortAndContextPathKebobCase() { + EnvironmentTestUtils.addEnvironment(this.context, "server.port=8989", + "management.port=9999", "management.context-path=/manage", + "eureka.instance.healthCheckUrlPath=/myHealthCheck"); + setupContext(RefreshAutoConfiguration.class); + EurekaInstanceConfigBean instance = this.context + .getBean(EurekaInstanceConfigBean.class); + assertTrue("Wrong health check: " + instance.getHealthCheckUrl(), + instance.getHealthCheckUrl().endsWith(":9999/manage/myHealthCheck")); + } + @Test public void statusPageUrlPathAndManagementPortKabobCase() { EnvironmentTestUtils.addEnvironment(this.context, "server.port=8989", From 25a1881127eca416c145dfd1299f44a3aa11efa7 Mon Sep 17 00:00:00 2001 From: Spencer Gibb Date: Mon, 22 May 2017 09:47:49 -0600 Subject: [PATCH 14/18] Ignore feign.hystrix.enabled. Let SecurityContextConcurrencyStrategy be installed as the hystrix concurrency strategy regardless of if feign's hystrix support is installed. fixes gh-1969 --- .../HystrixSecurityAutoConfiguration.java | 5 --- .../security/HystrixSecurityNoFeignTests.java | 42 +++++++++++++++++++ .../security/HystrixSecurityTests.java | 14 ++++++- 3 files changed, 55 insertions(+), 6 deletions(-) create mode 100644 spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/security/HystrixSecurityNoFeignTests.java diff --git a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/security/HystrixSecurityAutoConfiguration.java b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/security/HystrixSecurityAutoConfiguration.java index 37cc3620..272f234e 100644 --- a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/security/HystrixSecurityAutoConfiguration.java +++ b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/security/HystrixSecurityAutoConfiguration.java @@ -74,11 +74,6 @@ public class HystrixSecurityAutoConfiguration { super(ConfigurationPhase.REGISTER_BEAN); } - @ConditionalOnProperty(name = "feign.hystrix.enabled", matchIfMissing = false) - static class HystrixEnabled { - - } - @ConditionalOnProperty(name = "hystrix.shareSecurityContext") static class ShareSecurityContext { diff --git a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/security/HystrixSecurityNoFeignTests.java b/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/security/HystrixSecurityNoFeignTests.java new file mode 100644 index 00000000..e9a36fd3 --- /dev/null +++ b/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/security/HystrixSecurityNoFeignTests.java @@ -0,0 +1,42 @@ +/* + * Copyright 2013-2017 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package org.springframework.cloud.netflix.hystrix.security; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.context.junit4.SpringRunner; + +import com.netflix.hystrix.strategy.HystrixPlugins; +import com.netflix.hystrix.strategy.concurrency.HystrixConcurrencyStrategy; + +import static org.assertj.core.api.Assertions.assertThat; + +@RunWith(SpringRunner.class) +@DirtiesContext +@SpringBootTest(classes = HystrixSecurityApplication.class) +public class HystrixSecurityNoFeignTests { + + @Test + public void testSecurityConcurrencyStrategyInstalled() { + HystrixConcurrencyStrategy concurrencyStrategy = HystrixPlugins.getInstance().getConcurrencyStrategy(); + assertThat(concurrencyStrategy).isInstanceOf(SecurityContextConcurrencyStrategy.class); + } + +} diff --git a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/security/HystrixSecurityTests.java b/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/security/HystrixSecurityTests.java index 5f22f975..3ed019e3 100644 --- a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/security/HystrixSecurityTests.java +++ b/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/security/HystrixSecurityTests.java @@ -18,6 +18,8 @@ package org.springframework.cloud.netflix.hystrix.security; import java.util.Base64; +import com.netflix.hystrix.strategy.HystrixPlugins; +import com.netflix.hystrix.strategy.concurrency.HystrixConcurrencyStrategy; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; @@ -33,6 +35,8 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.web.client.RestTemplate; +import static org.assertj.core.api.Assertions.assertThat; + /** * Tests that a secured web service returning values using a feign client properly access * the security context from a hystrix command. @@ -40,7 +44,9 @@ import org.springframework.web.client.RestTemplate; */ @RunWith(SpringJUnit4ClassRunner.class) @DirtiesContext -@SpringBootTest(classes = HystrixSecurityApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT, properties = {"username.ribbon.listOfServers=localhost:${local.server.port}","feign.hystrix.enabled=true"}) +@SpringBootTest(classes = HystrixSecurityApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT, + properties = { "username.ribbon.listOfServers=localhost:${local.server.port}", + "feign.hystrix.enabled=true"}) public class HystrixSecurityTests { @Autowired private CustomConcurrenyStrategy customConcurrenyStrategy; @@ -54,6 +60,12 @@ public class HystrixSecurityTests { @Value("${security.user.password}") private String password; + @Test + public void testSecurityConcurrencyStrategyInstalled() { + HystrixConcurrencyStrategy concurrencyStrategy = HystrixPlugins.getInstance().getConcurrencyStrategy(); + assertThat(concurrencyStrategy).isInstanceOf(SecurityContextConcurrencyStrategy.class); + } + @Test public void testFeignHystrixSecurity() { HttpHeaders headers = HystrixSecurityTests.createBasicAuthHeader(username, From 7898ad772bd21fbe8b594842672ccc966c015f40 Mon Sep 17 00:00:00 2001 From: Spencer Gibb Date: Mon, 22 May 2017 12:09:31 -0600 Subject: [PATCH 15/18] Update SNAPSHOT to 1.3.1.RELEASE --- docs/pom.xml | 2 +- mvnw.cmd | 286 +++++++++--------- pom.xml | 8 +- spring-cloud-netflix-core/pom.xml | 2 +- ...ClientPreprocessorOverridesRetryTests.java | 240 +++++++-------- spring-cloud-netflix-dependencies/pom.xml | 4 +- spring-cloud-netflix-eureka-client/pom.xml | 2 +- spring-cloud-netflix-eureka-server/pom.xml | 2 +- spring-cloud-netflix-hystrix-amqp/pom.xml | 2 +- .../pom.xml | 2 +- spring-cloud-netflix-hystrix-stream/pom.xml | 2 +- spring-cloud-netflix-sidecar/pom.xml | 2 +- spring-cloud-netflix-spectator/pom.xml | 2 +- spring-cloud-netflix-turbine-stream/pom.xml | 2 +- spring-cloud-netflix-turbine/pom.xml | 2 +- spring-cloud-starter-archaius/pom.xml | 2 +- spring-cloud-starter-atlas/pom.xml | 2 +- spring-cloud-starter-eureka-server/pom.xml | 2 +- spring-cloud-starter-eureka/pom.xml | 2 +- spring-cloud-starter-feign/pom.xml | 2 +- .../pom.xml | 2 +- spring-cloud-starter-hystrix/pom.xml | 2 +- spring-cloud-starter-ribbon/pom.xml | 2 +- spring-cloud-starter-spectator/pom.xml | 2 +- spring-cloud-starter-turbine-amqp/pom.xml | 2 +- spring-cloud-starter-turbine-stream/pom.xml | 2 +- spring-cloud-starter-turbine/pom.xml | 2 +- spring-cloud-starter-zuul/pom.xml | 2 +- 28 files changed, 293 insertions(+), 293 deletions(-) diff --git a/docs/pom.xml b/docs/pom.xml index 68ff2796..a96019a3 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.1.RELEASE spring-cloud-netflix-docs pom diff --git a/mvnw.cmd b/mvnw.cmd index fc830243..b0dc0e7e 100644 --- a/mvnw.cmd +++ b/mvnw.cmd @@ -1,145 +1,145 @@ -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@REM "License"); you may not use this file except in compliance -@REM with the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Maven2 Start Up Batch script -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir -@REM -@REM Optional ENV vars -@REM M2_HOME - location of maven2's installed home dir -@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands -@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending -@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven -@REM e.g. to debug Maven itself, use -@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files -@REM ---------------------------------------------------------------------------- - -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@REM check for pre script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" -if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -echo Error: JAVA_HOME not found in your environment. >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -@REM ==== END VALIDATION ==== - -:init - -set MAVEN_CMD_LINE_ARGS=%* - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@setlocal EnableExtensions EnableDelayedExpansion -for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven2 Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +set MAVEN_CMD_LINE_ARGS=%* + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" set WRAPPER_JAR="".\.mvn\wrapper\maven-wrapper.jar"" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CMD_LINE_ARGS% -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% - -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost -@REM check for post script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" -if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" -:skipRcPost - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%" == "on" pause - -if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% - -exit /B %ERROR_CODE% +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CMD_LINE_ARGS% +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/pom.xml b/pom.xml index b991763d..cb17e15b 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.1.RELEASE pom Spring Cloud Netflix Spring Cloud Netflix @@ -24,9 +24,9 @@ ${basedir} 4.0.27.Final 2.7.3 - 1.2.1.BUILD-SNAPSHOT - 1.3.1.BUILD-SNAPSHOT - Chelsea.BUILD-SNAPSHOT + 1.2.2.RELEASE + 1.3.1.RELEASE + Chelsea.SR2 2.19.1 diff --git a/spring-cloud-netflix-core/pom.xml b/spring-cloud-netflix-core/pom.xml index 9942ef8c..8b4de00d 100644 --- a/spring-cloud-netflix-core/pom.xml +++ b/spring-cloud-netflix-core/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.1.RELEASE .. spring-cloud-netflix-core diff --git a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/ribbon/RibbonClientPreprocessorOverridesRetryTests.java b/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/ribbon/RibbonClientPreprocessorOverridesRetryTests.java index a71dd28e..4f4a2a9d 100644 --- a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/ribbon/RibbonClientPreprocessorOverridesRetryTests.java +++ b/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/ribbon/RibbonClientPreprocessorOverridesRetryTests.java @@ -1,120 +1,120 @@ -/* - * Copyright 2013-2016 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.cloud.netflix.ribbon; - -import java.net.ConnectException; -import java.net.SocketException; -import java.net.SocketTimeoutException; -import java.net.UnknownHostException; -import java.util.ArrayList; -import java.util.List; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.cloud.netflix.archaius.ArchaiusAutoConfiguration; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.util.Assert; - -import com.netflix.client.DefaultLoadBalancerRetryHandler; -import com.netflix.client.RetryHandler; -import com.netflix.client.config.IClientConfig; - -/** - * @author Tyler Van Gorder - */ -@RunWith(SpringJUnit4ClassRunner.class) -@SpringBootTest(classes = RibbonClientPreprocessorOverridesRetryTests.TestConfiguration.class, value = { - "customRetry.ribbon.MaxAutoRetries=0", - "customRetry.ribbon.MaxAutoRetriesNextServer=1", - "customRetry.ribbon.OkToRetryOnAllOperations=true" }) -@DirtiesContext -public class RibbonClientPreprocessorOverridesRetryTests { - - @Autowired - private SpringClientFactory factory; - - @Test - public void customRetryIsConfigured() throws Exception { - RibbonLoadBalancerContext context = (RibbonLoadBalancerContext) this.factory - .getLoadBalancerContext("customRetry"); - Assert.isInstanceOf(RetryRibbonConfiguration.CustomRetryHandler.class, - context.getRetryHandler()); - Assert.isTrue(context.getRetryHandler().getMaxRetriesOnSameServer() == 0); - Assert.isTrue(context.getRetryHandler().getMaxRetriesOnNextServer() == 1); - Assert.isTrue(context.getRetryHandler() - .isCircuitTrippingException(new UnknownHostException("Unknown Host"))); - } - - @Configuration - @RibbonClient(name = "customRetry", configuration = RetryRibbonConfiguration.class) - @Import({ PropertyPlaceholderAutoConfiguration.class, ArchaiusAutoConfiguration.class, - RibbonAutoConfiguration.class }) - protected static class TestConfiguration { - } - -} - -@Configuration -class RetryRibbonConfiguration { - @Bean - public RetryHandler retryHandler(IClientConfig config) { - return new CustomRetryHandler(config); - } - - class CustomRetryHandler extends DefaultLoadBalancerRetryHandler { - - @SuppressWarnings("unchecked") - private List> retriable = new ArrayList() { - { - add(UnknownHostException.class); - add(ConnectException.class); - add(SocketTimeoutException.class); - } - }; - - @SuppressWarnings("unchecked") - private List> circuitRelated = new ArrayList() { - { - add(UnknownHostException.class); - add(SocketException.class); - add(SocketTimeoutException.class); - } - }; - - CustomRetryHandler(IClientConfig config) { - super(config); - } - - @Override - protected List> getRetriableExceptions() { - return retriable; - } - - @Override - protected List> getCircuitRelatedExceptions() { - return circuitRelated; - } - - } -} +/* + * Copyright 2013-2016 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.cloud.netflix.ribbon; + +import java.net.ConnectException; +import java.net.SocketException; +import java.net.SocketTimeoutException; +import java.net.UnknownHostException; +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.cloud.netflix.archaius.ArchaiusAutoConfiguration; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; +import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.util.Assert; + +import com.netflix.client.DefaultLoadBalancerRetryHandler; +import com.netflix.client.RetryHandler; +import com.netflix.client.config.IClientConfig; + +/** + * @author Tyler Van Gorder + */ +@RunWith(SpringJUnit4ClassRunner.class) +@SpringBootTest(classes = RibbonClientPreprocessorOverridesRetryTests.TestConfiguration.class, value = { + "customRetry.ribbon.MaxAutoRetries=0", + "customRetry.ribbon.MaxAutoRetriesNextServer=1", + "customRetry.ribbon.OkToRetryOnAllOperations=true" }) +@DirtiesContext +public class RibbonClientPreprocessorOverridesRetryTests { + + @Autowired + private SpringClientFactory factory; + + @Test + public void customRetryIsConfigured() throws Exception { + RibbonLoadBalancerContext context = (RibbonLoadBalancerContext) this.factory + .getLoadBalancerContext("customRetry"); + Assert.isInstanceOf(RetryRibbonConfiguration.CustomRetryHandler.class, + context.getRetryHandler()); + Assert.isTrue(context.getRetryHandler().getMaxRetriesOnSameServer() == 0); + Assert.isTrue(context.getRetryHandler().getMaxRetriesOnNextServer() == 1); + Assert.isTrue(context.getRetryHandler() + .isCircuitTrippingException(new UnknownHostException("Unknown Host"))); + } + + @Configuration + @RibbonClient(name = "customRetry", configuration = RetryRibbonConfiguration.class) + @Import({ PropertyPlaceholderAutoConfiguration.class, ArchaiusAutoConfiguration.class, + RibbonAutoConfiguration.class }) + protected static class TestConfiguration { + } + +} + +@Configuration +class RetryRibbonConfiguration { + @Bean + public RetryHandler retryHandler(IClientConfig config) { + return new CustomRetryHandler(config); + } + + class CustomRetryHandler extends DefaultLoadBalancerRetryHandler { + + @SuppressWarnings("unchecked") + private List> retriable = new ArrayList() { + { + add(UnknownHostException.class); + add(ConnectException.class); + add(SocketTimeoutException.class); + } + }; + + @SuppressWarnings("unchecked") + private List> circuitRelated = new ArrayList() { + { + add(UnknownHostException.class); + add(SocketException.class); + add(SocketTimeoutException.class); + } + }; + + CustomRetryHandler(IClientConfig config) { + super(config); + } + + @Override + protected List> getRetriableExceptions() { + return retriable; + } + + @Override + protected List> getCircuitRelatedExceptions() { + return circuitRelated; + } + + } +} diff --git a/spring-cloud-netflix-dependencies/pom.xml b/spring-cloud-netflix-dependencies/pom.xml index ecd03a22..0b9ba53e 100644 --- a/spring-cloud-netflix-dependencies/pom.xml +++ b/spring-cloud-netflix-dependencies/pom.xml @@ -5,11 +5,11 @@ spring-cloud-dependencies-parent org.springframework.cloud - 1.3.1.BUILD-SNAPSHOT + 1.3.2.RELEASE spring-cloud-netflix-dependencies - 1.3.1.BUILD-SNAPSHOT + 1.3.1.RELEASE pom spring-cloud-netflix-dependencies Spring Cloud Netflix Dependencies diff --git a/spring-cloud-netflix-eureka-client/pom.xml b/spring-cloud-netflix-eureka-client/pom.xml index 64b5040a..ca98b91b 100644 --- a/spring-cloud-netflix-eureka-client/pom.xml +++ b/spring-cloud-netflix-eureka-client/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.1.RELEASE .. spring-cloud-netflix-eureka-client diff --git a/spring-cloud-netflix-eureka-server/pom.xml b/spring-cloud-netflix-eureka-server/pom.xml index dc952333..6fb41364 100644 --- a/spring-cloud-netflix-eureka-server/pom.xml +++ b/spring-cloud-netflix-eureka-server/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.1.RELEASE .. spring-cloud-netflix-eureka-server diff --git a/spring-cloud-netflix-hystrix-amqp/pom.xml b/spring-cloud-netflix-hystrix-amqp/pom.xml index 08107e4f..bffb83a7 100644 --- a/spring-cloud-netflix-hystrix-amqp/pom.xml +++ b/spring-cloud-netflix-hystrix-amqp/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.1.RELEASE .. spring-cloud-netflix-hystrix-amqp diff --git a/spring-cloud-netflix-hystrix-dashboard/pom.xml b/spring-cloud-netflix-hystrix-dashboard/pom.xml index cfbc2c93..ddec351f 100644 --- a/spring-cloud-netflix-hystrix-dashboard/pom.xml +++ b/spring-cloud-netflix-hystrix-dashboard/pom.xml @@ -8,7 +8,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.1.RELEASE .. diff --git a/spring-cloud-netflix-hystrix-stream/pom.xml b/spring-cloud-netflix-hystrix-stream/pom.xml index 9c05c847..1d522a6e 100644 --- a/spring-cloud-netflix-hystrix-stream/pom.xml +++ b/spring-cloud-netflix-hystrix-stream/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.1.RELEASE .. spring-cloud-netflix-hystrix-stream diff --git a/spring-cloud-netflix-sidecar/pom.xml b/spring-cloud-netflix-sidecar/pom.xml index a320cb22..3f6648a7 100644 --- a/spring-cloud-netflix-sidecar/pom.xml +++ b/spring-cloud-netflix-sidecar/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.1.RELEASE .. spring-cloud-netflix-sidecar diff --git a/spring-cloud-netflix-spectator/pom.xml b/spring-cloud-netflix-spectator/pom.xml index f717bf3d..bfeb76cf 100644 --- a/spring-cloud-netflix-spectator/pom.xml +++ b/spring-cloud-netflix-spectator/pom.xml @@ -6,7 +6,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.1.RELEASE .. spring-cloud-netflix-spectator diff --git a/spring-cloud-netflix-turbine-stream/pom.xml b/spring-cloud-netflix-turbine-stream/pom.xml index 58475fe2..528bec03 100644 --- a/spring-cloud-netflix-turbine-stream/pom.xml +++ b/spring-cloud-netflix-turbine-stream/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.1.RELEASE .. spring-cloud-netflix-turbine-stream diff --git a/spring-cloud-netflix-turbine/pom.xml b/spring-cloud-netflix-turbine/pom.xml index 410c9b4f..401df22c 100644 --- a/spring-cloud-netflix-turbine/pom.xml +++ b/spring-cloud-netflix-turbine/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.1.RELEASE .. spring-cloud-netflix-turbine diff --git a/spring-cloud-starter-archaius/pom.xml b/spring-cloud-starter-archaius/pom.xml index 60377136..891953ef 100644 --- a/spring-cloud-starter-archaius/pom.xml +++ b/spring-cloud-starter-archaius/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.1.RELEASE .. spring-cloud-starter-archaius diff --git a/spring-cloud-starter-atlas/pom.xml b/spring-cloud-starter-atlas/pom.xml index a9156eaa..f43709a5 100644 --- a/spring-cloud-starter-atlas/pom.xml +++ b/spring-cloud-starter-atlas/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.1.RELEASE .. spring-cloud-starter-atlas diff --git a/spring-cloud-starter-eureka-server/pom.xml b/spring-cloud-starter-eureka-server/pom.xml index 1f79cdc8..e732e7ac 100644 --- a/spring-cloud-starter-eureka-server/pom.xml +++ b/spring-cloud-starter-eureka-server/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.1.RELEASE .. spring-cloud-starter-eureka-server diff --git a/spring-cloud-starter-eureka/pom.xml b/spring-cloud-starter-eureka/pom.xml index 9b1923f7..79b5d41d 100644 --- a/spring-cloud-starter-eureka/pom.xml +++ b/spring-cloud-starter-eureka/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.1.RELEASE .. spring-cloud-starter-eureka diff --git a/spring-cloud-starter-feign/pom.xml b/spring-cloud-starter-feign/pom.xml index dfd2bcd7..15ddb802 100644 --- a/spring-cloud-starter-feign/pom.xml +++ b/spring-cloud-starter-feign/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.1.RELEASE .. spring-cloud-starter-feign diff --git a/spring-cloud-starter-hystrix-dashboard/pom.xml b/spring-cloud-starter-hystrix-dashboard/pom.xml index 3a43c78c..2e39fd0e 100644 --- a/spring-cloud-starter-hystrix-dashboard/pom.xml +++ b/spring-cloud-starter-hystrix-dashboard/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.1.RELEASE .. spring-cloud-starter-hystrix-dashboard diff --git a/spring-cloud-starter-hystrix/pom.xml b/spring-cloud-starter-hystrix/pom.xml index dedf5ab2..5f928b98 100644 --- a/spring-cloud-starter-hystrix/pom.xml +++ b/spring-cloud-starter-hystrix/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.1.RELEASE .. spring-cloud-starter-hystrix diff --git a/spring-cloud-starter-ribbon/pom.xml b/spring-cloud-starter-ribbon/pom.xml index 93bce8a0..e21978a1 100644 --- a/spring-cloud-starter-ribbon/pom.xml +++ b/spring-cloud-starter-ribbon/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.1.RELEASE .. spring-cloud-starter-ribbon diff --git a/spring-cloud-starter-spectator/pom.xml b/spring-cloud-starter-spectator/pom.xml index 77d5755d..4a355a32 100644 --- a/spring-cloud-starter-spectator/pom.xml +++ b/spring-cloud-starter-spectator/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.1.RELEASE .. spring-cloud-starter-spectator diff --git a/spring-cloud-starter-turbine-amqp/pom.xml b/spring-cloud-starter-turbine-amqp/pom.xml index c62e578d..2c495e0a 100644 --- a/spring-cloud-starter-turbine-amqp/pom.xml +++ b/spring-cloud-starter-turbine-amqp/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.1.RELEASE .. spring-cloud-starter-turbine-amqp diff --git a/spring-cloud-starter-turbine-stream/pom.xml b/spring-cloud-starter-turbine-stream/pom.xml index 8202e97d..4028a4b2 100644 --- a/spring-cloud-starter-turbine-stream/pom.xml +++ b/spring-cloud-starter-turbine-stream/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.1.RELEASE .. spring-cloud-starter-turbine-stream diff --git a/spring-cloud-starter-turbine/pom.xml b/spring-cloud-starter-turbine/pom.xml index 64dd0a76..201961ba 100644 --- a/spring-cloud-starter-turbine/pom.xml +++ b/spring-cloud-starter-turbine/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.1.RELEASE .. spring-cloud-starter-turbine diff --git a/spring-cloud-starter-zuul/pom.xml b/spring-cloud-starter-zuul/pom.xml index a5ff32ab..571d165e 100644 --- a/spring-cloud-starter-zuul/pom.xml +++ b/spring-cloud-starter-zuul/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.1.RELEASE .. spring-cloud-starter-zuul From 0de72d2dad480d268146b38c82a90f195e7511ce Mon Sep 17 00:00:00 2001 From: Spencer Gibb Date: Mon, 22 May 2017 12:18:03 -0600 Subject: [PATCH 16/18] Going back to snapshots --- docs/pom.xml | 2 +- mvnw.cmd | 286 +++++++++--------- pom.xml | 8 +- spring-cloud-netflix-core/pom.xml | 2 +- ...ClientPreprocessorOverridesRetryTests.java | 240 +++++++-------- spring-cloud-netflix-dependencies/pom.xml | 4 +- spring-cloud-netflix-eureka-client/pom.xml | 2 +- spring-cloud-netflix-eureka-server/pom.xml | 2 +- spring-cloud-netflix-hystrix-amqp/pom.xml | 2 +- .../pom.xml | 2 +- spring-cloud-netflix-hystrix-stream/pom.xml | 2 +- spring-cloud-netflix-sidecar/pom.xml | 2 +- spring-cloud-netflix-spectator/pom.xml | 2 +- spring-cloud-netflix-turbine-stream/pom.xml | 2 +- spring-cloud-netflix-turbine/pom.xml | 2 +- spring-cloud-starter-archaius/pom.xml | 2 +- spring-cloud-starter-atlas/pom.xml | 2 +- spring-cloud-starter-eureka-server/pom.xml | 2 +- spring-cloud-starter-eureka/pom.xml | 2 +- spring-cloud-starter-feign/pom.xml | 2 +- .../pom.xml | 2 +- spring-cloud-starter-hystrix/pom.xml | 2 +- spring-cloud-starter-ribbon/pom.xml | 2 +- spring-cloud-starter-spectator/pom.xml | 2 +- spring-cloud-starter-turbine-amqp/pom.xml | 2 +- spring-cloud-starter-turbine-stream/pom.xml | 2 +- spring-cloud-starter-turbine/pom.xml | 2 +- spring-cloud-starter-zuul/pom.xml | 2 +- 28 files changed, 293 insertions(+), 293 deletions(-) diff --git a/docs/pom.xml b/docs/pom.xml index a96019a3..68ff2796 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.RELEASE + 1.3.1.BUILD-SNAPSHOT spring-cloud-netflix-docs pom diff --git a/mvnw.cmd b/mvnw.cmd index b0dc0e7e..fc830243 100644 --- a/mvnw.cmd +++ b/mvnw.cmd @@ -1,145 +1,145 @@ -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@REM "License"); you may not use this file except in compliance -@REM with the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Maven2 Start Up Batch script -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir -@REM -@REM Optional ENV vars -@REM M2_HOME - location of maven2's installed home dir -@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands -@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending -@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven -@REM e.g. to debug Maven itself, use -@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files -@REM ---------------------------------------------------------------------------- - -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@REM check for pre script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" -if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -echo Error: JAVA_HOME not found in your environment. >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -@REM ==== END VALIDATION ==== - -:init - -set MAVEN_CMD_LINE_ARGS=%* - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@setlocal EnableExtensions EnableDelayedExpansion -for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven2 Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +set MAVEN_CMD_LINE_ARGS=%* + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" set WRAPPER_JAR="".\.mvn\wrapper\maven-wrapper.jar"" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CMD_LINE_ARGS% -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% - -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost -@REM check for post script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" -if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" -:skipRcPost - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%" == "on" pause - -if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% - -exit /B %ERROR_CODE% +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CMD_LINE_ARGS% +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/pom.xml b/pom.xml index cb17e15b..b991763d 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 spring-cloud-netflix - 1.3.1.RELEASE + 1.3.1.BUILD-SNAPSHOT pom Spring Cloud Netflix Spring Cloud Netflix @@ -24,9 +24,9 @@ ${basedir} 4.0.27.Final 2.7.3 - 1.2.2.RELEASE - 1.3.1.RELEASE - Chelsea.SR2 + 1.2.1.BUILD-SNAPSHOT + 1.3.1.BUILD-SNAPSHOT + Chelsea.BUILD-SNAPSHOT 2.19.1 diff --git a/spring-cloud-netflix-core/pom.xml b/spring-cloud-netflix-core/pom.xml index 8b4de00d..9942ef8c 100644 --- a/spring-cloud-netflix-core/pom.xml +++ b/spring-cloud-netflix-core/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.RELEASE + 1.3.1.BUILD-SNAPSHOT .. spring-cloud-netflix-core diff --git a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/ribbon/RibbonClientPreprocessorOverridesRetryTests.java b/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/ribbon/RibbonClientPreprocessorOverridesRetryTests.java index 4f4a2a9d..a71dd28e 100644 --- a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/ribbon/RibbonClientPreprocessorOverridesRetryTests.java +++ b/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/ribbon/RibbonClientPreprocessorOverridesRetryTests.java @@ -1,120 +1,120 @@ -/* - * Copyright 2013-2016 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.cloud.netflix.ribbon; - -import java.net.ConnectException; -import java.net.SocketException; -import java.net.SocketTimeoutException; -import java.net.UnknownHostException; -import java.util.ArrayList; -import java.util.List; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.cloud.netflix.archaius.ArchaiusAutoConfiguration; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.util.Assert; - -import com.netflix.client.DefaultLoadBalancerRetryHandler; -import com.netflix.client.RetryHandler; -import com.netflix.client.config.IClientConfig; - -/** - * @author Tyler Van Gorder - */ -@RunWith(SpringJUnit4ClassRunner.class) -@SpringBootTest(classes = RibbonClientPreprocessorOverridesRetryTests.TestConfiguration.class, value = { - "customRetry.ribbon.MaxAutoRetries=0", - "customRetry.ribbon.MaxAutoRetriesNextServer=1", - "customRetry.ribbon.OkToRetryOnAllOperations=true" }) -@DirtiesContext -public class RibbonClientPreprocessorOverridesRetryTests { - - @Autowired - private SpringClientFactory factory; - - @Test - public void customRetryIsConfigured() throws Exception { - RibbonLoadBalancerContext context = (RibbonLoadBalancerContext) this.factory - .getLoadBalancerContext("customRetry"); - Assert.isInstanceOf(RetryRibbonConfiguration.CustomRetryHandler.class, - context.getRetryHandler()); - Assert.isTrue(context.getRetryHandler().getMaxRetriesOnSameServer() == 0); - Assert.isTrue(context.getRetryHandler().getMaxRetriesOnNextServer() == 1); - Assert.isTrue(context.getRetryHandler() - .isCircuitTrippingException(new UnknownHostException("Unknown Host"))); - } - - @Configuration - @RibbonClient(name = "customRetry", configuration = RetryRibbonConfiguration.class) - @Import({ PropertyPlaceholderAutoConfiguration.class, ArchaiusAutoConfiguration.class, - RibbonAutoConfiguration.class }) - protected static class TestConfiguration { - } - -} - -@Configuration -class RetryRibbonConfiguration { - @Bean - public RetryHandler retryHandler(IClientConfig config) { - return new CustomRetryHandler(config); - } - - class CustomRetryHandler extends DefaultLoadBalancerRetryHandler { - - @SuppressWarnings("unchecked") - private List> retriable = new ArrayList() { - { - add(UnknownHostException.class); - add(ConnectException.class); - add(SocketTimeoutException.class); - } - }; - - @SuppressWarnings("unchecked") - private List> circuitRelated = new ArrayList() { - { - add(UnknownHostException.class); - add(SocketException.class); - add(SocketTimeoutException.class); - } - }; - - CustomRetryHandler(IClientConfig config) { - super(config); - } - - @Override - protected List> getRetriableExceptions() { - return retriable; - } - - @Override - protected List> getCircuitRelatedExceptions() { - return circuitRelated; - } - - } -} +/* + * Copyright 2013-2016 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.cloud.netflix.ribbon; + +import java.net.ConnectException; +import java.net.SocketException; +import java.net.SocketTimeoutException; +import java.net.UnknownHostException; +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.cloud.netflix.archaius.ArchaiusAutoConfiguration; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; +import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.util.Assert; + +import com.netflix.client.DefaultLoadBalancerRetryHandler; +import com.netflix.client.RetryHandler; +import com.netflix.client.config.IClientConfig; + +/** + * @author Tyler Van Gorder + */ +@RunWith(SpringJUnit4ClassRunner.class) +@SpringBootTest(classes = RibbonClientPreprocessorOverridesRetryTests.TestConfiguration.class, value = { + "customRetry.ribbon.MaxAutoRetries=0", + "customRetry.ribbon.MaxAutoRetriesNextServer=1", + "customRetry.ribbon.OkToRetryOnAllOperations=true" }) +@DirtiesContext +public class RibbonClientPreprocessorOverridesRetryTests { + + @Autowired + private SpringClientFactory factory; + + @Test + public void customRetryIsConfigured() throws Exception { + RibbonLoadBalancerContext context = (RibbonLoadBalancerContext) this.factory + .getLoadBalancerContext("customRetry"); + Assert.isInstanceOf(RetryRibbonConfiguration.CustomRetryHandler.class, + context.getRetryHandler()); + Assert.isTrue(context.getRetryHandler().getMaxRetriesOnSameServer() == 0); + Assert.isTrue(context.getRetryHandler().getMaxRetriesOnNextServer() == 1); + Assert.isTrue(context.getRetryHandler() + .isCircuitTrippingException(new UnknownHostException("Unknown Host"))); + } + + @Configuration + @RibbonClient(name = "customRetry", configuration = RetryRibbonConfiguration.class) + @Import({ PropertyPlaceholderAutoConfiguration.class, ArchaiusAutoConfiguration.class, + RibbonAutoConfiguration.class }) + protected static class TestConfiguration { + } + +} + +@Configuration +class RetryRibbonConfiguration { + @Bean + public RetryHandler retryHandler(IClientConfig config) { + return new CustomRetryHandler(config); + } + + class CustomRetryHandler extends DefaultLoadBalancerRetryHandler { + + @SuppressWarnings("unchecked") + private List> retriable = new ArrayList() { + { + add(UnknownHostException.class); + add(ConnectException.class); + add(SocketTimeoutException.class); + } + }; + + @SuppressWarnings("unchecked") + private List> circuitRelated = new ArrayList() { + { + add(UnknownHostException.class); + add(SocketException.class); + add(SocketTimeoutException.class); + } + }; + + CustomRetryHandler(IClientConfig config) { + super(config); + } + + @Override + protected List> getRetriableExceptions() { + return retriable; + } + + @Override + protected List> getCircuitRelatedExceptions() { + return circuitRelated; + } + + } +} diff --git a/spring-cloud-netflix-dependencies/pom.xml b/spring-cloud-netflix-dependencies/pom.xml index 0b9ba53e..ecd03a22 100644 --- a/spring-cloud-netflix-dependencies/pom.xml +++ b/spring-cloud-netflix-dependencies/pom.xml @@ -5,11 +5,11 @@ spring-cloud-dependencies-parent org.springframework.cloud - 1.3.2.RELEASE + 1.3.1.BUILD-SNAPSHOT spring-cloud-netflix-dependencies - 1.3.1.RELEASE + 1.3.1.BUILD-SNAPSHOT pom spring-cloud-netflix-dependencies Spring Cloud Netflix Dependencies diff --git a/spring-cloud-netflix-eureka-client/pom.xml b/spring-cloud-netflix-eureka-client/pom.xml index ca98b91b..64b5040a 100644 --- a/spring-cloud-netflix-eureka-client/pom.xml +++ b/spring-cloud-netflix-eureka-client/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.RELEASE + 1.3.1.BUILD-SNAPSHOT .. spring-cloud-netflix-eureka-client diff --git a/spring-cloud-netflix-eureka-server/pom.xml b/spring-cloud-netflix-eureka-server/pom.xml index 6fb41364..dc952333 100644 --- a/spring-cloud-netflix-eureka-server/pom.xml +++ b/spring-cloud-netflix-eureka-server/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.RELEASE + 1.3.1.BUILD-SNAPSHOT .. spring-cloud-netflix-eureka-server diff --git a/spring-cloud-netflix-hystrix-amqp/pom.xml b/spring-cloud-netflix-hystrix-amqp/pom.xml index bffb83a7..08107e4f 100644 --- a/spring-cloud-netflix-hystrix-amqp/pom.xml +++ b/spring-cloud-netflix-hystrix-amqp/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.RELEASE + 1.3.1.BUILD-SNAPSHOT .. spring-cloud-netflix-hystrix-amqp diff --git a/spring-cloud-netflix-hystrix-dashboard/pom.xml b/spring-cloud-netflix-hystrix-dashboard/pom.xml index ddec351f..cfbc2c93 100644 --- a/spring-cloud-netflix-hystrix-dashboard/pom.xml +++ b/spring-cloud-netflix-hystrix-dashboard/pom.xml @@ -8,7 +8,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.RELEASE + 1.3.1.BUILD-SNAPSHOT .. diff --git a/spring-cloud-netflix-hystrix-stream/pom.xml b/spring-cloud-netflix-hystrix-stream/pom.xml index 1d522a6e..9c05c847 100644 --- a/spring-cloud-netflix-hystrix-stream/pom.xml +++ b/spring-cloud-netflix-hystrix-stream/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.RELEASE + 1.3.1.BUILD-SNAPSHOT .. spring-cloud-netflix-hystrix-stream diff --git a/spring-cloud-netflix-sidecar/pom.xml b/spring-cloud-netflix-sidecar/pom.xml index 3f6648a7..a320cb22 100644 --- a/spring-cloud-netflix-sidecar/pom.xml +++ b/spring-cloud-netflix-sidecar/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.RELEASE + 1.3.1.BUILD-SNAPSHOT .. spring-cloud-netflix-sidecar diff --git a/spring-cloud-netflix-spectator/pom.xml b/spring-cloud-netflix-spectator/pom.xml index bfeb76cf..f717bf3d 100644 --- a/spring-cloud-netflix-spectator/pom.xml +++ b/spring-cloud-netflix-spectator/pom.xml @@ -6,7 +6,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.RELEASE + 1.3.1.BUILD-SNAPSHOT .. spring-cloud-netflix-spectator diff --git a/spring-cloud-netflix-turbine-stream/pom.xml b/spring-cloud-netflix-turbine-stream/pom.xml index 528bec03..58475fe2 100644 --- a/spring-cloud-netflix-turbine-stream/pom.xml +++ b/spring-cloud-netflix-turbine-stream/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.RELEASE + 1.3.1.BUILD-SNAPSHOT .. spring-cloud-netflix-turbine-stream diff --git a/spring-cloud-netflix-turbine/pom.xml b/spring-cloud-netflix-turbine/pom.xml index 401df22c..410c9b4f 100644 --- a/spring-cloud-netflix-turbine/pom.xml +++ b/spring-cloud-netflix-turbine/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.RELEASE + 1.3.1.BUILD-SNAPSHOT .. spring-cloud-netflix-turbine diff --git a/spring-cloud-starter-archaius/pom.xml b/spring-cloud-starter-archaius/pom.xml index 891953ef..60377136 100644 --- a/spring-cloud-starter-archaius/pom.xml +++ b/spring-cloud-starter-archaius/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.RELEASE + 1.3.1.BUILD-SNAPSHOT .. spring-cloud-starter-archaius diff --git a/spring-cloud-starter-atlas/pom.xml b/spring-cloud-starter-atlas/pom.xml index f43709a5..a9156eaa 100644 --- a/spring-cloud-starter-atlas/pom.xml +++ b/spring-cloud-starter-atlas/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.RELEASE + 1.3.1.BUILD-SNAPSHOT .. spring-cloud-starter-atlas diff --git a/spring-cloud-starter-eureka-server/pom.xml b/spring-cloud-starter-eureka-server/pom.xml index e732e7ac..1f79cdc8 100644 --- a/spring-cloud-starter-eureka-server/pom.xml +++ b/spring-cloud-starter-eureka-server/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.RELEASE + 1.3.1.BUILD-SNAPSHOT .. spring-cloud-starter-eureka-server diff --git a/spring-cloud-starter-eureka/pom.xml b/spring-cloud-starter-eureka/pom.xml index 79b5d41d..9b1923f7 100644 --- a/spring-cloud-starter-eureka/pom.xml +++ b/spring-cloud-starter-eureka/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.RELEASE + 1.3.1.BUILD-SNAPSHOT .. spring-cloud-starter-eureka diff --git a/spring-cloud-starter-feign/pom.xml b/spring-cloud-starter-feign/pom.xml index 15ddb802..dfd2bcd7 100644 --- a/spring-cloud-starter-feign/pom.xml +++ b/spring-cloud-starter-feign/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.RELEASE + 1.3.1.BUILD-SNAPSHOT .. spring-cloud-starter-feign diff --git a/spring-cloud-starter-hystrix-dashboard/pom.xml b/spring-cloud-starter-hystrix-dashboard/pom.xml index 2e39fd0e..3a43c78c 100644 --- a/spring-cloud-starter-hystrix-dashboard/pom.xml +++ b/spring-cloud-starter-hystrix-dashboard/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.RELEASE + 1.3.1.BUILD-SNAPSHOT .. spring-cloud-starter-hystrix-dashboard diff --git a/spring-cloud-starter-hystrix/pom.xml b/spring-cloud-starter-hystrix/pom.xml index 5f928b98..dedf5ab2 100644 --- a/spring-cloud-starter-hystrix/pom.xml +++ b/spring-cloud-starter-hystrix/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.RELEASE + 1.3.1.BUILD-SNAPSHOT .. spring-cloud-starter-hystrix diff --git a/spring-cloud-starter-ribbon/pom.xml b/spring-cloud-starter-ribbon/pom.xml index e21978a1..93bce8a0 100644 --- a/spring-cloud-starter-ribbon/pom.xml +++ b/spring-cloud-starter-ribbon/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.RELEASE + 1.3.1.BUILD-SNAPSHOT .. spring-cloud-starter-ribbon diff --git a/spring-cloud-starter-spectator/pom.xml b/spring-cloud-starter-spectator/pom.xml index 4a355a32..77d5755d 100644 --- a/spring-cloud-starter-spectator/pom.xml +++ b/spring-cloud-starter-spectator/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.RELEASE + 1.3.1.BUILD-SNAPSHOT .. spring-cloud-starter-spectator diff --git a/spring-cloud-starter-turbine-amqp/pom.xml b/spring-cloud-starter-turbine-amqp/pom.xml index 2c495e0a..c62e578d 100644 --- a/spring-cloud-starter-turbine-amqp/pom.xml +++ b/spring-cloud-starter-turbine-amqp/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.RELEASE + 1.3.1.BUILD-SNAPSHOT .. spring-cloud-starter-turbine-amqp diff --git a/spring-cloud-starter-turbine-stream/pom.xml b/spring-cloud-starter-turbine-stream/pom.xml index 4028a4b2..8202e97d 100644 --- a/spring-cloud-starter-turbine-stream/pom.xml +++ b/spring-cloud-starter-turbine-stream/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.RELEASE + 1.3.1.BUILD-SNAPSHOT .. spring-cloud-starter-turbine-stream diff --git a/spring-cloud-starter-turbine/pom.xml b/spring-cloud-starter-turbine/pom.xml index 201961ba..64dd0a76 100644 --- a/spring-cloud-starter-turbine/pom.xml +++ b/spring-cloud-starter-turbine/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.RELEASE + 1.3.1.BUILD-SNAPSHOT .. spring-cloud-starter-turbine diff --git a/spring-cloud-starter-zuul/pom.xml b/spring-cloud-starter-zuul/pom.xml index 571d165e..a5ff32ab 100644 --- a/spring-cloud-starter-zuul/pom.xml +++ b/spring-cloud-starter-zuul/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.RELEASE + 1.3.1.BUILD-SNAPSHOT .. spring-cloud-starter-zuul From 58e62ebd06365441d60aa793a15de5c07ea2c977 Mon Sep 17 00:00:00 2001 From: Spencer Gibb Date: Mon, 22 May 2017 12:18:04 -0600 Subject: [PATCH 17/18] Bumping versions to 1.3.2.BUILD-SNAPSHOT after release --- docs/pom.xml | 2 +- mvnw.cmd | 286 +++++++++--------- pom.xml | 2 +- spring-cloud-netflix-core/pom.xml | 2 +- ...ClientPreprocessorOverridesRetryTests.java | 240 +++++++-------- spring-cloud-netflix-dependencies/pom.xml | 2 +- spring-cloud-netflix-eureka-client/pom.xml | 2 +- spring-cloud-netflix-eureka-server/pom.xml | 2 +- spring-cloud-netflix-hystrix-amqp/pom.xml | 2 +- .../pom.xml | 2 +- spring-cloud-netflix-hystrix-stream/pom.xml | 2 +- spring-cloud-netflix-sidecar/pom.xml | 2 +- spring-cloud-netflix-spectator/pom.xml | 2 +- spring-cloud-netflix-turbine-stream/pom.xml | 2 +- spring-cloud-netflix-turbine/pom.xml | 2 +- spring-cloud-starter-archaius/pom.xml | 2 +- spring-cloud-starter-atlas/pom.xml | 2 +- spring-cloud-starter-eureka-server/pom.xml | 2 +- spring-cloud-starter-eureka/pom.xml | 2 +- spring-cloud-starter-feign/pom.xml | 2 +- .../pom.xml | 2 +- spring-cloud-starter-hystrix/pom.xml | 2 +- spring-cloud-starter-ribbon/pom.xml | 2 +- spring-cloud-starter-spectator/pom.xml | 2 +- spring-cloud-starter-turbine-amqp/pom.xml | 2 +- spring-cloud-starter-turbine-stream/pom.xml | 2 +- spring-cloud-starter-turbine/pom.xml | 2 +- spring-cloud-starter-zuul/pom.xml | 2 +- 28 files changed, 289 insertions(+), 289 deletions(-) diff --git a/docs/pom.xml b/docs/pom.xml index 68ff2796..de673b88 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.2.BUILD-SNAPSHOT spring-cloud-netflix-docs pom diff --git a/mvnw.cmd b/mvnw.cmd index fc830243..b0dc0e7e 100644 --- a/mvnw.cmd +++ b/mvnw.cmd @@ -1,145 +1,145 @@ -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@REM "License"); you may not use this file except in compliance -@REM with the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Maven2 Start Up Batch script -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir -@REM -@REM Optional ENV vars -@REM M2_HOME - location of maven2's installed home dir -@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands -@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending -@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven -@REM e.g. to debug Maven itself, use -@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files -@REM ---------------------------------------------------------------------------- - -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@REM check for pre script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" -if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -echo Error: JAVA_HOME not found in your environment. >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -@REM ==== END VALIDATION ==== - -:init - -set MAVEN_CMD_LINE_ARGS=%* - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@setlocal EnableExtensions EnableDelayedExpansion -for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven2 Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +set MAVEN_CMD_LINE_ARGS=%* + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" set WRAPPER_JAR="".\.mvn\wrapper\maven-wrapper.jar"" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CMD_LINE_ARGS% -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% - -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost -@REM check for post script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" -if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" -:skipRcPost - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%" == "on" pause - -if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% - -exit /B %ERROR_CODE% +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CMD_LINE_ARGS% +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/pom.xml b/pom.xml index b991763d..eb24510a 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.2.BUILD-SNAPSHOT pom Spring Cloud Netflix Spring Cloud Netflix diff --git a/spring-cloud-netflix-core/pom.xml b/spring-cloud-netflix-core/pom.xml index 9942ef8c..f4b834cf 100644 --- a/spring-cloud-netflix-core/pom.xml +++ b/spring-cloud-netflix-core/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.2.BUILD-SNAPSHOT .. spring-cloud-netflix-core diff --git a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/ribbon/RibbonClientPreprocessorOverridesRetryTests.java b/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/ribbon/RibbonClientPreprocessorOverridesRetryTests.java index a71dd28e..4f4a2a9d 100644 --- a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/ribbon/RibbonClientPreprocessorOverridesRetryTests.java +++ b/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/ribbon/RibbonClientPreprocessorOverridesRetryTests.java @@ -1,120 +1,120 @@ -/* - * Copyright 2013-2016 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.cloud.netflix.ribbon; - -import java.net.ConnectException; -import java.net.SocketException; -import java.net.SocketTimeoutException; -import java.net.UnknownHostException; -import java.util.ArrayList; -import java.util.List; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.cloud.netflix.archaius.ArchaiusAutoConfiguration; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.util.Assert; - -import com.netflix.client.DefaultLoadBalancerRetryHandler; -import com.netflix.client.RetryHandler; -import com.netflix.client.config.IClientConfig; - -/** - * @author Tyler Van Gorder - */ -@RunWith(SpringJUnit4ClassRunner.class) -@SpringBootTest(classes = RibbonClientPreprocessorOverridesRetryTests.TestConfiguration.class, value = { - "customRetry.ribbon.MaxAutoRetries=0", - "customRetry.ribbon.MaxAutoRetriesNextServer=1", - "customRetry.ribbon.OkToRetryOnAllOperations=true" }) -@DirtiesContext -public class RibbonClientPreprocessorOverridesRetryTests { - - @Autowired - private SpringClientFactory factory; - - @Test - public void customRetryIsConfigured() throws Exception { - RibbonLoadBalancerContext context = (RibbonLoadBalancerContext) this.factory - .getLoadBalancerContext("customRetry"); - Assert.isInstanceOf(RetryRibbonConfiguration.CustomRetryHandler.class, - context.getRetryHandler()); - Assert.isTrue(context.getRetryHandler().getMaxRetriesOnSameServer() == 0); - Assert.isTrue(context.getRetryHandler().getMaxRetriesOnNextServer() == 1); - Assert.isTrue(context.getRetryHandler() - .isCircuitTrippingException(new UnknownHostException("Unknown Host"))); - } - - @Configuration - @RibbonClient(name = "customRetry", configuration = RetryRibbonConfiguration.class) - @Import({ PropertyPlaceholderAutoConfiguration.class, ArchaiusAutoConfiguration.class, - RibbonAutoConfiguration.class }) - protected static class TestConfiguration { - } - -} - -@Configuration -class RetryRibbonConfiguration { - @Bean - public RetryHandler retryHandler(IClientConfig config) { - return new CustomRetryHandler(config); - } - - class CustomRetryHandler extends DefaultLoadBalancerRetryHandler { - - @SuppressWarnings("unchecked") - private List> retriable = new ArrayList() { - { - add(UnknownHostException.class); - add(ConnectException.class); - add(SocketTimeoutException.class); - } - }; - - @SuppressWarnings("unchecked") - private List> circuitRelated = new ArrayList() { - { - add(UnknownHostException.class); - add(SocketException.class); - add(SocketTimeoutException.class); - } - }; - - CustomRetryHandler(IClientConfig config) { - super(config); - } - - @Override - protected List> getRetriableExceptions() { - return retriable; - } - - @Override - protected List> getCircuitRelatedExceptions() { - return circuitRelated; - } - - } -} +/* + * Copyright 2013-2016 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.cloud.netflix.ribbon; + +import java.net.ConnectException; +import java.net.SocketException; +import java.net.SocketTimeoutException; +import java.net.UnknownHostException; +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.cloud.netflix.archaius.ArchaiusAutoConfiguration; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; +import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.util.Assert; + +import com.netflix.client.DefaultLoadBalancerRetryHandler; +import com.netflix.client.RetryHandler; +import com.netflix.client.config.IClientConfig; + +/** + * @author Tyler Van Gorder + */ +@RunWith(SpringJUnit4ClassRunner.class) +@SpringBootTest(classes = RibbonClientPreprocessorOverridesRetryTests.TestConfiguration.class, value = { + "customRetry.ribbon.MaxAutoRetries=0", + "customRetry.ribbon.MaxAutoRetriesNextServer=1", + "customRetry.ribbon.OkToRetryOnAllOperations=true" }) +@DirtiesContext +public class RibbonClientPreprocessorOverridesRetryTests { + + @Autowired + private SpringClientFactory factory; + + @Test + public void customRetryIsConfigured() throws Exception { + RibbonLoadBalancerContext context = (RibbonLoadBalancerContext) this.factory + .getLoadBalancerContext("customRetry"); + Assert.isInstanceOf(RetryRibbonConfiguration.CustomRetryHandler.class, + context.getRetryHandler()); + Assert.isTrue(context.getRetryHandler().getMaxRetriesOnSameServer() == 0); + Assert.isTrue(context.getRetryHandler().getMaxRetriesOnNextServer() == 1); + Assert.isTrue(context.getRetryHandler() + .isCircuitTrippingException(new UnknownHostException("Unknown Host"))); + } + + @Configuration + @RibbonClient(name = "customRetry", configuration = RetryRibbonConfiguration.class) + @Import({ PropertyPlaceholderAutoConfiguration.class, ArchaiusAutoConfiguration.class, + RibbonAutoConfiguration.class }) + protected static class TestConfiguration { + } + +} + +@Configuration +class RetryRibbonConfiguration { + @Bean + public RetryHandler retryHandler(IClientConfig config) { + return new CustomRetryHandler(config); + } + + class CustomRetryHandler extends DefaultLoadBalancerRetryHandler { + + @SuppressWarnings("unchecked") + private List> retriable = new ArrayList() { + { + add(UnknownHostException.class); + add(ConnectException.class); + add(SocketTimeoutException.class); + } + }; + + @SuppressWarnings("unchecked") + private List> circuitRelated = new ArrayList() { + { + add(UnknownHostException.class); + add(SocketException.class); + add(SocketTimeoutException.class); + } + }; + + CustomRetryHandler(IClientConfig config) { + super(config); + } + + @Override + protected List> getRetriableExceptions() { + return retriable; + } + + @Override + protected List> getCircuitRelatedExceptions() { + return circuitRelated; + } + + } +} diff --git a/spring-cloud-netflix-dependencies/pom.xml b/spring-cloud-netflix-dependencies/pom.xml index ecd03a22..41ff6134 100644 --- a/spring-cloud-netflix-dependencies/pom.xml +++ b/spring-cloud-netflix-dependencies/pom.xml @@ -9,7 +9,7 @@ spring-cloud-netflix-dependencies - 1.3.1.BUILD-SNAPSHOT + 1.3.2.BUILD-SNAPSHOT pom spring-cloud-netflix-dependencies Spring Cloud Netflix Dependencies diff --git a/spring-cloud-netflix-eureka-client/pom.xml b/spring-cloud-netflix-eureka-client/pom.xml index 64b5040a..7b35f695 100644 --- a/spring-cloud-netflix-eureka-client/pom.xml +++ b/spring-cloud-netflix-eureka-client/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.2.BUILD-SNAPSHOT .. spring-cloud-netflix-eureka-client diff --git a/spring-cloud-netflix-eureka-server/pom.xml b/spring-cloud-netflix-eureka-server/pom.xml index dc952333..afa2e3c2 100644 --- a/spring-cloud-netflix-eureka-server/pom.xml +++ b/spring-cloud-netflix-eureka-server/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.2.BUILD-SNAPSHOT .. spring-cloud-netflix-eureka-server diff --git a/spring-cloud-netflix-hystrix-amqp/pom.xml b/spring-cloud-netflix-hystrix-amqp/pom.xml index 08107e4f..3ff30b5b 100644 --- a/spring-cloud-netflix-hystrix-amqp/pom.xml +++ b/spring-cloud-netflix-hystrix-amqp/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.2.BUILD-SNAPSHOT .. spring-cloud-netflix-hystrix-amqp diff --git a/spring-cloud-netflix-hystrix-dashboard/pom.xml b/spring-cloud-netflix-hystrix-dashboard/pom.xml index cfbc2c93..424d8919 100644 --- a/spring-cloud-netflix-hystrix-dashboard/pom.xml +++ b/spring-cloud-netflix-hystrix-dashboard/pom.xml @@ -8,7 +8,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.2.BUILD-SNAPSHOT .. diff --git a/spring-cloud-netflix-hystrix-stream/pom.xml b/spring-cloud-netflix-hystrix-stream/pom.xml index 9c05c847..ca5f3769 100644 --- a/spring-cloud-netflix-hystrix-stream/pom.xml +++ b/spring-cloud-netflix-hystrix-stream/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.2.BUILD-SNAPSHOT .. spring-cloud-netflix-hystrix-stream diff --git a/spring-cloud-netflix-sidecar/pom.xml b/spring-cloud-netflix-sidecar/pom.xml index a320cb22..94f9c4b2 100644 --- a/spring-cloud-netflix-sidecar/pom.xml +++ b/spring-cloud-netflix-sidecar/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.2.BUILD-SNAPSHOT .. spring-cloud-netflix-sidecar diff --git a/spring-cloud-netflix-spectator/pom.xml b/spring-cloud-netflix-spectator/pom.xml index f717bf3d..b10b8eec 100644 --- a/spring-cloud-netflix-spectator/pom.xml +++ b/spring-cloud-netflix-spectator/pom.xml @@ -6,7 +6,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.2.BUILD-SNAPSHOT .. spring-cloud-netflix-spectator diff --git a/spring-cloud-netflix-turbine-stream/pom.xml b/spring-cloud-netflix-turbine-stream/pom.xml index 58475fe2..b3e80045 100644 --- a/spring-cloud-netflix-turbine-stream/pom.xml +++ b/spring-cloud-netflix-turbine-stream/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.2.BUILD-SNAPSHOT .. spring-cloud-netflix-turbine-stream diff --git a/spring-cloud-netflix-turbine/pom.xml b/spring-cloud-netflix-turbine/pom.xml index 410c9b4f..9c0ea64e 100644 --- a/spring-cloud-netflix-turbine/pom.xml +++ b/spring-cloud-netflix-turbine/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.2.BUILD-SNAPSHOT .. spring-cloud-netflix-turbine diff --git a/spring-cloud-starter-archaius/pom.xml b/spring-cloud-starter-archaius/pom.xml index 60377136..d7067dd9 100644 --- a/spring-cloud-starter-archaius/pom.xml +++ b/spring-cloud-starter-archaius/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.2.BUILD-SNAPSHOT .. spring-cloud-starter-archaius diff --git a/spring-cloud-starter-atlas/pom.xml b/spring-cloud-starter-atlas/pom.xml index a9156eaa..4328ab78 100644 --- a/spring-cloud-starter-atlas/pom.xml +++ b/spring-cloud-starter-atlas/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.2.BUILD-SNAPSHOT .. spring-cloud-starter-atlas diff --git a/spring-cloud-starter-eureka-server/pom.xml b/spring-cloud-starter-eureka-server/pom.xml index 1f79cdc8..e6e975f9 100644 --- a/spring-cloud-starter-eureka-server/pom.xml +++ b/spring-cloud-starter-eureka-server/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.2.BUILD-SNAPSHOT .. spring-cloud-starter-eureka-server diff --git a/spring-cloud-starter-eureka/pom.xml b/spring-cloud-starter-eureka/pom.xml index 9b1923f7..022f2e03 100644 --- a/spring-cloud-starter-eureka/pom.xml +++ b/spring-cloud-starter-eureka/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.2.BUILD-SNAPSHOT .. spring-cloud-starter-eureka diff --git a/spring-cloud-starter-feign/pom.xml b/spring-cloud-starter-feign/pom.xml index dfd2bcd7..f2341c78 100644 --- a/spring-cloud-starter-feign/pom.xml +++ b/spring-cloud-starter-feign/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.2.BUILD-SNAPSHOT .. spring-cloud-starter-feign diff --git a/spring-cloud-starter-hystrix-dashboard/pom.xml b/spring-cloud-starter-hystrix-dashboard/pom.xml index 3a43c78c..f11a7c16 100644 --- a/spring-cloud-starter-hystrix-dashboard/pom.xml +++ b/spring-cloud-starter-hystrix-dashboard/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.2.BUILD-SNAPSHOT .. spring-cloud-starter-hystrix-dashboard diff --git a/spring-cloud-starter-hystrix/pom.xml b/spring-cloud-starter-hystrix/pom.xml index dedf5ab2..2b54dd36 100644 --- a/spring-cloud-starter-hystrix/pom.xml +++ b/spring-cloud-starter-hystrix/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.2.BUILD-SNAPSHOT .. spring-cloud-starter-hystrix diff --git a/spring-cloud-starter-ribbon/pom.xml b/spring-cloud-starter-ribbon/pom.xml index 93bce8a0..dd41acef 100644 --- a/spring-cloud-starter-ribbon/pom.xml +++ b/spring-cloud-starter-ribbon/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.2.BUILD-SNAPSHOT .. spring-cloud-starter-ribbon diff --git a/spring-cloud-starter-spectator/pom.xml b/spring-cloud-starter-spectator/pom.xml index 77d5755d..69698243 100644 --- a/spring-cloud-starter-spectator/pom.xml +++ b/spring-cloud-starter-spectator/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.2.BUILD-SNAPSHOT .. spring-cloud-starter-spectator diff --git a/spring-cloud-starter-turbine-amqp/pom.xml b/spring-cloud-starter-turbine-amqp/pom.xml index c62e578d..cbfaa6ea 100644 --- a/spring-cloud-starter-turbine-amqp/pom.xml +++ b/spring-cloud-starter-turbine-amqp/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.2.BUILD-SNAPSHOT .. spring-cloud-starter-turbine-amqp diff --git a/spring-cloud-starter-turbine-stream/pom.xml b/spring-cloud-starter-turbine-stream/pom.xml index 8202e97d..13580acb 100644 --- a/spring-cloud-starter-turbine-stream/pom.xml +++ b/spring-cloud-starter-turbine-stream/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.2.BUILD-SNAPSHOT .. spring-cloud-starter-turbine-stream diff --git a/spring-cloud-starter-turbine/pom.xml b/spring-cloud-starter-turbine/pom.xml index 64dd0a76..c36a1258 100644 --- a/spring-cloud-starter-turbine/pom.xml +++ b/spring-cloud-starter-turbine/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.2.BUILD-SNAPSHOT .. spring-cloud-starter-turbine diff --git a/spring-cloud-starter-zuul/pom.xml b/spring-cloud-starter-zuul/pom.xml index a5ff32ab..76d046c3 100644 --- a/spring-cloud-starter-zuul/pom.xml +++ b/spring-cloud-starter-zuul/pom.xml @@ -5,7 +5,7 @@ org.springframework.cloud spring-cloud-netflix - 1.3.1.BUILD-SNAPSHOT + 1.3.2.BUILD-SNAPSHOT .. spring-cloud-starter-zuul From 7425f974cb2e45ea86effe15779d8ad3e5b366a1 Mon Sep 17 00:00:00 2001 From: Spencer Gibb Date: Thu, 25 May 2017 14:51:58 -0600 Subject: [PATCH 18/18] Adds timeout test. see gh-1950 --- .../route/SimpleHostRoutingFilterTests.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/filters/route/SimpleHostRoutingFilterTests.java b/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/filters/route/SimpleHostRoutingFilterTests.java index daf4b847..6d813b87 100644 --- a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/filters/route/SimpleHostRoutingFilterTests.java +++ b/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/filters/route/SimpleHostRoutingFilterTests.java @@ -30,15 +30,19 @@ import javax.servlet.http.HttpServletResponse; import org.apache.http.HttpEntityEnclosingRequest; import org.apache.http.HttpHost; import org.apache.http.HttpRequest; +import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.Configurable; import org.apache.http.entity.InputStreamEntity; +import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; +import org.assertj.core.api.Assertions; import org.junit.After; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration; +import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration; import org.springframework.boot.context.embedded.LocalServerPort; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.test.context.SpringBootTest; @@ -72,7 +76,8 @@ import static org.springframework.util.StreamUtils.copyToString; @RunWith(SpringRunner.class) @SpringBootTest(classes = SampleApplication.class, webEnvironment = RANDOM_PORT, - properties = "server.contextPath: /app") + properties = {"server.contextPath: /app", "zuul.host.socket-timeout-millis=11000", + "zuul.host.connect-timeout-millis=2100"}) @DirtiesContext public class SimpleHostRoutingFilterTests { @@ -88,6 +93,16 @@ public class SimpleHostRoutingFilterTests { } } + @Test + public void timeoutPropertiesAreApplied() { + setupContext(); + CloseableHttpClient httpClient = getFilter().newClient(); + Assertions.assertThat(httpClient).isInstanceOf(Configurable.class); + RequestConfig config = ((Configurable) httpClient).getConfig(); + assertEquals(11000, config.getSocketTimeout()); + assertEquals(2100, config.getConnectTimeout()); + } + @Test public void connectionPropertiesAreApplied() { addEnvironment(this.context, "zuul.host.maxTotalConnections=100",