diff --git a/config/releaser.yml b/config/releaser.yml
deleted file mode 100644
index 26e5e8c2..00000000
--- a/config/releaser.yml
+++ /dev/null
@@ -1,3 +0,0 @@
-releaser:
- maven:
- buildCommand: ./scripts/build.sh {{systemProps}}
diff --git a/docs/pom.xml b/docs/pom.xml
index f94598fa..18d453df 100644
--- a/docs/pom.xml
+++ b/docs/pom.xml
@@ -4,17 +4,17 @@
4.0.0org.springframework.cloud
- spring-cloud-netflix
+ spring-cloud-openfeign2.0.0.BUILD-SNAPSHOT
- spring-cloud-netflix-docs
+ spring-cloud-openfeign-docspom
- Spring Cloud Netflix Docs
+ Spring Cloud OpenFeign DocsSpring Cloud Docs
- spring-cloud-netflix
+ spring-cloud-openfeign${basedir}/..
- 1.2.x,1.3.x,1.4.x
+ 2.0.x
diff --git a/docs/src/main/asciidoc/README.adoc b/docs/src/main/asciidoc/README.adoc
index 6e0d6947..0f493a8f 100644
--- a/docs/src/main/asciidoc/README.adoc
+++ b/docs/src/main/asciidoc/README.adoc
@@ -1,20 +1,8 @@
-image::https://circleci.com/gh/spring-cloud/spring-cloud-netflix/tree/master.svg?style=svg["CircleCI", link="https://circleci.com/gh/spring-cloud/spring-cloud-netflix/tree/master"]
-image::https://codecov.io/gh/spring-cloud/spring-cloud-netflix/branch/master/graph/badge.svg["Codecov", link="https://codecov.io/gh/spring-cloud/spring-cloud-netflix/branch/master"]
-image::https://api.codacy.com/project/badge/Grade/a6885a06921e4f72a0df0b7aabd6d118["Codacy code quality", link="https://www.codacy.com/app/Spring-Cloud/spring-cloud-netflix?utm_source=github.com&utm_medium=referral&utm_content=spring-cloud/spring-cloud-netflix&utm_campaign=Badge_Grade"]
-
-
include::intro.adoc[]
== Features
-* Service Discovery: Eureka instances can be registered and clients can discover the instances using Spring-managed beans
-* Service Discovery: an embedded Eureka server can be created with declarative Java configuration
-* Circuit Breaker: Hystrix clients can be built with a simple annotation-driven method decorator
-* Circuit Breaker: embedded Hystrix dashboard with declarative Java configuration
* Declarative REST Client: Feign creates a dynamic implementation of an interface decorated with JAX-RS or Spring MVC annotations
-* Client Side Load Balancer: Ribbon
-* External Configuration: a bridge from the Spring Environment to Archaius (enables native configuration of Netflix components using Spring Boot conventions)
-* Router and Filter: automatic registration of Zuul filters, and a simple convention over configuration approach to reverse proxy creation
== Building
diff --git a/docs/src/main/asciidoc/intro.adoc b/docs/src/main/asciidoc/intro.adoc
index b2425626..a69a78c5 100644
--- a/docs/src/main/asciidoc/intro.adoc
+++ b/docs/src/main/asciidoc/intro.adoc
@@ -1,7 +1,3 @@
-This project provides Netflix OSS integrations for Spring Boot apps through autoconfiguration
-and binding to the Spring Environment and other Spring programming model idioms. With a few
-simple annotations you can quickly enable and configure the common patterns inside your
-application and build large distributed systems with battle-tested Netflix components. The
-patterns provided include Service Discovery (Eureka), Circuit Breaker (Hystrix),
-Intelligent Routing (Zuul) and Client Side Load Balancing (Ribbon).
+This project provides OpenFeign integrations for Spring Boot apps through autoconfiguration
+and binding to the Spring Environment and other Spring programming model idioms.
diff --git a/docs/src/main/asciidoc/spring-cloud-netflix.adoc b/docs/src/main/asciidoc/spring-cloud-netflix.adoc
index 29548712..81f7fea5 100644
--- a/docs/src/main/asciidoc/spring-cloud-netflix.adoc
+++ b/docs/src/main/asciidoc/spring-cloud-netflix.adoc
@@ -1,987 +1,17 @@
:github-tag: master
-:github-repo: spring-cloud/spring-cloud-netflix
+:github-repo: spring-cloud/spring-cloud-openfeign
:github-raw: http://raw.github.com/{github-repo}/{github-tag}
:github-code: http://github.com/{github-repo}/tree/{github-tag}
:all: {asterisk}{asterisk}
:nofooter:
:branch: master
-= Spring Cloud Netflix
+= Spring Cloud OpenFeign
*{spring-cloud-version}*
include::intro.adoc[]
-== Service Discovery: Eureka Clients
-
-Service Discovery is one of the key tenets of a microservice based architecture. Trying to hand configure each client or some form of convention can be very difficult to do and can be very brittle. Eureka is the Netflix Service Discovery Server and Client. The server can be configured and deployed to be highly available, with each server replicating state about the registered services to the others.
-
-[[netflix-eureka-client-starter]]
-=== How to Include Eureka Client
-
-To include Eureka Client in your project use the starter with group `org.springframework.cloud`
-and artifact id `spring-cloud-starter-netflix-eureka-client`. See the http://projects.spring.io/spring-cloud/[Spring Cloud Project page]
-for details on setting up your build system with the current Spring Cloud Release Train.
-
-=== Registering with Eureka
-
-When a client registers with Eureka, it provides meta-data about itself
-such as host and port, health indicator URL, home page etc. Eureka
-receives heartbeat messages from each instance belonging to a service.
-If the heartbeat fails over a configurable timetable, the instance is
-normally removed from the registry.
-
-Example eureka client:
-
-[source,java,indent=0]
-----
-@SpringBootApplication
-@RestController
-public class Application {
-
- @RequestMapping("/")
- public String home() {
- return "Hello world";
- }
-
- public static void main(String[] args) {
- new SpringApplicationBuilder(Application.class).web(true).run(args);
- }
-
-}
-----
-
-(i.e. utterly normal Spring Boot app). By having `spring-cloud-starter-netflix-eureka-client`
- on the classpath your application will automatically register with the Eureka Server. Configuration is required to
-locate the Eureka server. Example:
-
-
-.application.yml
-----
-eureka:
- client:
- serviceUrl:
- defaultZone: http://localhost:8761/eureka/
-----
-
-where "defaultZone" is a magic string fallback value that provides the
-service URL for any client that doesn't express a preference
-(i.e. it's a useful default).
-
-The default application name (service ID), virtual host and non-secure
-port, taken from the `Environment`, are `${spring.application.name}`,
-`${spring.application.name}` and `${server.port}` respectively.
-
-Having `spring-cloud-starter-netflix-eureka-client` on the classpath
-makes the app into both a Eureka "instance"
-(i.e. it registers itself) and a "client" (i.e. it can query the
-registry to locate other services). The instance behaviour is driven
-by `eureka.instance.*` configuration keys, but the defaults will be
-fine if you ensure that your application has a
-`spring.application.name` (this is the default for the Eureka service
-ID, or VIP).
-
-See {github-code}/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaInstanceConfigBean.java[EurekaInstanceConfigBean] and {github-code}/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaClientConfigBean.java[EurekaClientConfigBean] for more details of the configurable options.
-
-To disable the Eureka Discovery Client you can set `eureka.client.enabled` to `false`.
-
-=== Authenticating with the Eureka Server
-
-HTTP basic authentication will be automatically added to your eureka
-client if one of the `eureka.client.serviceUrl.defaultZone` URLs has
-credentials embedded in it (curl style, like
-`http://user:password@localhost:8761/eureka`). For more complex needs
-you can create a `@Bean` of type `DiscoveryClientOptionalArgs` and
-inject `ClientFilter` instances into it, all of which will be applied
-to the calls from the client to the server.
-
-NOTE: Because of a limitation in Eureka it isn't possible to support
-per-server basic auth credentials, so only the first set that are
-found will be used.
-
-=== Status Page and Health Indicator
-
-The status page and health indicators for a Eureka instance default to
-"/info" and "/health" respectively, which are the default locations of
-useful endpoints in a Spring Boot Actuator application. You need to
-change these, even for an Actuator application if you use a
-non-default context path or servlet path
-(e.g. `server.servletPath=/foo`) or management endpoint path
-(e.g. `management.contextPath=/admin`). Example:
-
-.application.yml
-----
-eureka:
- instance:
- statusPageUrlPath: ${management.context-path}/info
- healthCheckUrlPath: ${management.context-path}/health
-----
-
-These links show up in the metadata that is consumed by clients, and
-used in some scenarios to decide whether to send requests to your
-application, so it's helpful if they are accurate.
-
-=== Registering a Secure Application
-
-If your app wants to be contacted over HTTPS you can set two flags in
-the `EurekaInstanceConfig`, _viz_
-`eureka.instance.[nonSecurePortEnabled,securePortEnabled]=[false,true]`
-respectively. This will make Eureka publish instance information
-showing an explicit preference for secure communication. The Spring
-Cloud `DiscoveryClient` will always return a URI starting with `https` for a
-service configured this way, and the Eureka (native) instance
-information will have a secure health check URL.
-
-Because of the way
-Eureka works internally, it will still publish a non-secure URL for
-status and home page unless you also override those explicitly.
-You can use placeholders to configure the eureka instance urls,
-e.g.
-
-.application.yml
-----
-eureka:
- instance:
- statusPageUrl: https://${eureka.hostname}/info
- healthCheckUrl: https://${eureka.hostname}/health
- homePageUrl: https://${eureka.hostname}/
-----
-
-(Note that `${eureka.hostname}` is a native placeholder only available
-in later versions of Eureka. You could achieve the same thing with
-Spring placeholders as well, e.g. using `${eureka.instance.hostName}`.)
-
-NOTE: If your app is running behind a proxy, and the SSL termination
-is in the proxy (e.g. if you run in Cloud Foundry or other platforms
-as a service) then you will need to ensure that the proxy "forwarded"
-headers are intercepted and handled by the application. An embedded
-Tomcat container in a Spring Boot app does this automatically if it
-has explicit configuration for the 'X-Forwarded-\*` headers. A sign
-that you got this wrong will be that the links rendered by your app to
-itself will be wrong (the wrong host, port or protocol).
-
-=== Eureka's Health Checks
-
-By default, Eureka uses the client heartbeat to determine if a client is up.
-Unless specified otherwise the Discovery Client will not propagate the
-current health check status of the application per the Spring Boot Actuator. Which means
-that after successful registration Eureka will always announce that the
-application is in 'UP' state. This behaviour can be altered by enabling
-Eureka health checks, which results in propagating application status
-to Eureka. As a consequence every other application won't be sending
-traffic to application in state other then 'UP'.
-
-.application.yml
-----
-eureka:
- client:
- healthcheck:
- enabled: true
-----
-
-WARNING: `eureka.client.healthcheck.enabled=true` should only be set in `application.yml`. Setting the value in `bootstrap.yml` will cause undesirable side effects like registering in eureka with an `UNKNOWN` status.
-
-If you require more control over the health checks, you may consider
-implementing your own `com.netflix.appinfo.HealthCheckHandler`.
-
-=== Eureka Metadata for Instances and Clients
-
-It's worth spending a bit of time understanding how the Eureka metadata works, so you can use it in a way that makes sense in your platform. There is standard metadata for things like hostname, IP address, port numbers, status page and health check. These are published in the service registry and used by clients to contact the services in a straightforward way. Additional metadata can be added to the instance registration in the `eureka.instance.metadataMap`, and this will be accessible in the remote clients, but in general will not change the behaviour of the client, unless it is made aware of the meaning of the metadata. There are a couple of special cases described below where Spring Cloud already assigns meaning to the metadata map.
-
-==== Using Eureka on Cloudfoundry
-
-Cloudfoundry has a global router so that all instances of the same app have the same hostname (it's the same in other PaaS solutions with a similar architecture). This isn't necessarily a barrier to using Eureka, but if you use the router (recommended, or even mandatory depending on the way your platform was set up), you need to explicitly set the hostname and port numbers (secure or non-secure) so that they use the router. You might also want to use instance metadata so you can distinguish between the instances on the client (e.g. in a custom load balancer). By default, the `eureka.instance.instanceId` is `vcap.application.instance_id`. For example:
-
-.application.yml
-----
-eureka:
- instance:
- hostname: ${vcap.application.uris[0]}
- nonSecurePort: 80
-----
-
-Depending on the way the security rules are set up in your Cloudfoundry instance, you might be able to register and use the IP address of the host VM for direct service-to-service calls. This feature is not (yet) available on Pivotal Web Services (https://run.pivotal.io[PWS]).
-
-==== Using Eureka on AWS
-
-If the application is planned to be deployed to an AWS cloud, then the Eureka instance will have to be configured to be AWS aware and this can be done by customizing the {github-code}/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaInstanceConfigBean.java[EurekaInstanceConfigBean] the following way:
-
-[source,java,indent=0]
-----
-@Bean
-@Profile("!default")
-public EurekaInstanceConfigBean eurekaInstanceConfig(InetUtils inetUtils) {
- EurekaInstanceConfigBean b = new EurekaInstanceConfigBean(inetUtils);
- AmazonInfo info = AmazonInfo.Builder.newBuilder().autoBuild("eureka");
- b.setDataCenterInfo(info);
- return b;
-}
-----
-
-==== Changing the Eureka Instance ID
-
-A vanilla Netflix Eureka instance is registered with an ID that is equal to its host name (i.e. only one service per host). Spring Cloud Eureka provides a sensible default that looks like this: `${spring.cloud.client.hostname}:${spring.application.name}:${spring.application.instance_id:${server.port}}}`. For example `myhost:myappname:8080`.
-
-Using Spring Cloud you can override this by providing a unique identifier in `eureka.instance.instanceId`. For example:
-
-.application.yml
-----
-eureka:
- instance:
- instanceId: ${spring.application.name}:${vcap.application.instance_id:${spring.application.instance_id:${random.value}}}
-----
-
-With this metadata, and multiple service instances deployed on
-localhost, the random value will kick in there to make the instance
-unique. In Cloudfoundry the `vcap.application.instance_id` will be
-populated automatically in a Spring Boot application, so the
-random value will not be needed.
-
-=== Using the EurekaClient
-
-Once you have an app that is a discovery client you can use it to
-discover service instances from the <>. One way to do that is to use the native
-`com.netflix.discovery.EurekaClient` (as opposed to the Spring
-Cloud `DiscoveryClient`), e.g.
-
-----
-@Autowired
-private EurekaClient discoveryClient;
-
-public String serviceUrl() {
- InstanceInfo instance = discoveryClient.getNextServerFromEureka("STORES", false);
- return instance.getHomePageUrl();
-}
-----
-
-[TIP]
-====
-Don't use the `EurekaClient` in `@PostConstruct` method or in a
-`@Scheduled` method (or anywhere where the `ApplicationContext` might
-not be started yet). It is initialized in a `SmartLifecycle` (with
-`phase=0`) so the earliest you can rely on it being available is in
-another `SmartLifecycle` with higher phase.
-====
-
-==== EurekaClient without Jersey
-
-By default, EurekaClient uses Jersey for HTTP communication. If you wish
-to avoid dependencies from Jersey, you can exclude it from your dependencies.
-Spring Cloud will auto configure a transport client based on Spring
-`RestTemplate`.
-
-----
-
- org.springframework.cloud
- spring-cloud-starter-netflix-eureka-client
-
-
- com.sun.jersey
- jersey-client
-
-
- com.sun.jersey
- jersey-core
-
-
- com.sun.jersey.contribs
- jersey-apache-client4
-
-
-
-----
-
-=== Alternatives to the native Netflix EurekaClient
-
-You don't have to use the raw Netflix `EurekaClient` and usually it
-is more convenient to use it behind a wrapper of some sort. Spring
-Cloud has support for <> (a REST client
-builder) and also <> using
-the logical Eureka service identifiers (VIPs) instead of physical
-URLs. To configure Ribbon with a fixed list of physical servers you
-can simply set `.ribbon.listOfServers` to a comma-separated
-list of physical addresses (or hostnames), where `` is the ID
-of the client.
-
-You can also use the `org.springframework.cloud.client.discovery.DiscoveryClient`
-which provides a simple API for discovery clients that is not specific
-to Netflix, e.g.
-
-----
-@Autowired
-private DiscoveryClient discoveryClient;
-
-public String serviceUrl() {
- List list = discoveryClient.getInstances("STORES");
- if (list != null && list.size() > 0 ) {
- return list.get(0).getUri();
- }
- return null;
-}
-----
-
-=== Why is it so Slow to Register a Service?
-
-Being an instance also involves a periodic heartbeat to the registry
-(via the client's `serviceUrl`) with default duration 30 seconds. A
-service is not available for discovery by clients until the instance,
-the server and the client all have the same metadata in their local
-cache (so it could take 3 heartbeats). You can change the period using
-`eureka.instance.leaseRenewalIntervalInSeconds` and this will speed up
-the process of getting clients connected to other services. In
-production it's probably better to stick with the default because
-there are some computations internally in the server that make
-assumptions about the lease renewal period.
-
-
-=== Zones
-
-If you have deployed Eureka clients to multiple zones than you may prefer that
-those clients leverage services within the same zone before trying services
-in another zone. To do this you need to configure your Eureka clients correctly.
-
-First, you need to make sure you have Eureka servers deployed to each zone and that
-they are peers of each other. See the section on <>
-for more information.
-
-Next you need to tell Eureka which zone your service is in. You can do this using
-the `metadataMap` property. For example if `service 1` is deployed to both `zone 1`
-and `zone 2` you would need to set the following Eureka properties in `service 1`
-
-*Service 1 in Zone 1*
-```
-eureka.instance.metadataMap.zone = zone1
-eureka.client.preferSameZoneEureka = true
-```
-
-*Service 1 in Zone 2*
-```
-eureka.instance.metadataMap.zone = zone2
-eureka.client.preferSameZoneEureka = true
-```
-
-[[spring-cloud-eureka-server]]
-== Service Discovery: Eureka Server
-
-[[netflix-eureka-server-starter]]
-=== How to Include Eureka Server
-
-To include Eureka Server in your project use the starter with group `org.springframework.cloud`
-and artifact id `spring-cloud-starter-netflix-eureka-server`. See the http://projects.spring.io/spring-cloud/[Spring Cloud Project page]
-for details on setting up your build system with the current Spring Cloud Release Train.
-
-[[spring-cloud-running-eureka-server]]
-=== How to Run a Eureka Server
-
-Example eureka server;
-
-[source,java,indent=0]
-----
-@SpringBootApplication
-@EnableEurekaServer
-public class Application {
-
- public static void main(String[] args) {
- new SpringApplicationBuilder(Application.class).web(true).run(args);
- }
-
-}
-----
-
-The server has a home page with a UI, and HTTP API endpoints per the
-normal Eureka functionality under `/eureka/*`.
-
-Eureka background reading: see https://github.com/cfregly/fluxcapacitor/wiki/NetflixOSS-FAQ#eureka-service-discovery-load-balancer[flux capacitor] and https://groups.google.com/forum/?fromgroups#!topic/eureka_netflix/g3p2r7gHnN0[google group discussion].
-
-
-[TIP]
-====
-Due to Gradle's dependency resolution rules and the lack of a parent bom feature, simply depending on spring-cloud-starter-netflix-eureka-server can cause failures on application startup. To remedy this the Spring Boot Gradle plugin must be added and the Spring cloud starter parent bom must be imported like so:
-
-.build.gradle
-[source,java,indent=0]
-----
-buildscript {
- dependencies {
- classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.5.RELEASE")
- }
-}
-
-apply plugin: "spring-boot"
-
-dependencyManagement {
- imports {
- mavenBom "org.springframework.cloud:spring-cloud-dependencies:Brixton.RELEASE"
- }
-}
-----
-====
-
-[[spring-cloud-eureka-server-zones-and-regions]]
-=== High Availability, Zones and Regions
-
-The Eureka server does not have a backend store, but the service
-instances in the registry all have to send heartbeats to keep their
-registrations up to date (so this can be done in memory). Clients also
-have an in-memory cache of eureka registrations (so they don't have to
-go to the registry for every single request to a service).
-
-By default every Eureka server is also a Eureka client and requires
-(at least one) service URL to locate a peer. If you don't provide it
-the service will run and work, but it will shower your logs with a lot
-of noise about not being able to register with the peer.
-
-See also <> on the client side for Zones and Regions.
-
-=== Standalone Mode
-
-The combination of the two caches (client and server) and the
-heartbeats make a standalone Eureka server fairly resilient to
-failure, as long as there is some sort of monitor or elastic runtime
-keeping it alive (e.g. Cloud Foundry). In standalone mode, you might
-prefer to switch off the client side behaviour, so it doesn't keep
-trying and failing to reach its peers. Example:
-
-.application.yml (Standalone Eureka Server)
-----
-server:
- port: 8761
-
-eureka:
- instance:
- hostname: localhost
- client:
- registerWithEureka: false
- fetchRegistry: false
- serviceUrl:
- defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/
-----
-
-Notice that the `serviceUrl` is pointing to the same host as the local
-instance.
-
-=== Peer Awareness
-
-Eureka can be made even more resilient and available by running
-multiple instances and asking them to register with each other. In
-fact, this is the default behaviour, so all you need to do to make it
-work is add a valid `serviceUrl` to a peer, e.g.
-
-.application.yml (Two Peer Aware Eureka Servers)
-----
-
----
-spring:
- profiles: peer1
-eureka:
- instance:
- hostname: peer1
- client:
- serviceUrl:
- defaultZone: http://peer2/eureka/
-
----
-spring:
- profiles: peer2
-eureka:
- instance:
- hostname: peer2
- client:
- serviceUrl:
- defaultZone: http://peer1/eureka/
-----
-
-In this example we have a YAML file that can be used to run the same
-server on 2 hosts (peer1 and peer2), by running it in different
-Spring profiles. You could use this configuration to test the peer
-awareness on a single host (there's not much value in doing that in
-production) by manipulating `/etc/hosts` to resolve the host names. In
-fact, the `eureka.instance.hostname` is not needed if you are running
-on a machine that knows its own hostname (it is looked up using
-`java.net.InetAddress` by default).
-
-You can add multiple peers to a system, and as long as they are all
-connected to each other by at least one edge, they will synchronize
-the registrations amongst themselves. If the peers are physically
-separated (inside a data centre or between multiple data centres) then
-the system can in principle survive split-brain type failures.
-
-=== Prefer IP Address
-
-In some cases, it is preferable for Eureka to advertise the IP Adresses
-of services rather than the hostname. Set `eureka.instance.preferIpAddress`
-to `true` and when the application registers with eureka, it will use its
-IP Address rather than its hostname.
-
-[TIP]
-====
-If hostname can't be determined by Java, then IP address is sent to Eureka.
-Only explict way of setting hostname is by using `eureka.instance.hostname`.
-You can set your hostname at the run time using environment variable, for
-example `eureka.instance.hostname=${HOST_NAME}`.
-====
-
-== Circuit Breaker: Hystrix Clients
-
-Netflix has created a library called https://github.com/Netflix/Hystrix[Hystrix] that implements the http://martinfowler.com/bliki/CircuitBreaker.html[circuit breaker pattern]. In a microservice architecture it is common to have multiple layers of service calls.
-
-.Microservice Graph
-image::https://raw.githubusercontent.com/spring-cloud/spring-cloud-netflix/{branch}/docs/src/main/asciidoc/images/Hystrix.png[]
-
-A service failure in the lower level of services can cause cascading failure all the way up to the user. When calls to a particular service is greater than `circuitBreaker.requestVolumeThreshold` (default: 20 requests) and failue percentage is greater than `circuitBreaker.errorThresholdPercentage` (default: >50%) in a rolling window defined by `metrics.rollingStats.timeInMilliseconds` (default: 10 seconds), the circuit opens and the call is not made. In cases of error and an open circuit a fallback can be provided by the developer.
-
-.Hystrix fallback prevents cascading failures
-image::https://raw.githubusercontent.com/spring-cloud/spring-cloud-netflix/{branch}/docs/src/main/asciidoc/images/HystrixFallback.png[]
-
-Having an open circuit stops cascading failures and allows overwhelmed or failing services time to heal. The fallback can be another Hystrix protected call, static data or a sane empty value. Fallbacks may be chained so the first fallback makes some other business call which in turn falls back to static data.
-
-
-[[netflix-hystrix-starter]]
-=== How to Include Hystrix
-
-To include Hystrix in your project use the starter with group `org.springframework.cloud`
-and artifact id `spring-cloud-starter-netflix-hystrix`. See the http://projects.spring.io/spring-cloud/[Spring Cloud Project page]
-for details on setting up your build system with the current Spring Cloud Release Train.
-
-Example boot app:
-
-----
-@SpringBootApplication
-@EnableCircuitBreaker
-public class Application {
-
- public static void main(String[] args) {
- new SpringApplicationBuilder(Application.class).web(true).run(args);
- }
-
-}
-
-@Component
-public class StoreIntegration {
-
- @HystrixCommand(fallbackMethod = "defaultStores")
- public Object getStores(Map parameters) {
- //do stuff that might fail
- }
-
- public Object defaultStores(Map parameters) {
- return /* something useful */;
- }
-}
-
-----
-
-The `@HystrixCommand` is provided by a Netflix contrib library called
-https://github.com/Netflix/Hystrix/tree/master/hystrix-contrib/hystrix-javanica["javanica"].
-Spring Cloud automatically wraps Spring beans with that
-annotation in a proxy that is connected to the Hystrix circuit
-breaker. The circuit breaker calculates when to open and close the
-circuit, and what to do in case of a failure.
-
-To configure the `@HystrixCommand` you can use the `commandProperties`
-attribute with a list of `@HystrixProperty` annotations. See
-https://github.com/Netflix/Hystrix/tree/master/hystrix-contrib/hystrix-javanica#configuration[here]
-for more details. See the https://github.com/Netflix/Hystrix/wiki/Configuration[Hystrix wiki]
-for details on the properties available.
-
-=== Propagating the Security Context or using Spring Scopes
-
-If you want some thread local context to propagate into a `@HystrixCommand` the default declaration will not work because it executes the command in a thread pool (in case of timeouts). You can switch Hystrix to use the same thread as the caller using some configuration, or directly in the annotation, by asking it to use a different "Isolation Strategy". For example:
-
-[source,java]
-----
-@HystrixCommand(fallbackMethod = "stubMyService",
- commandProperties = {
- @HystrixProperty(name="execution.isolation.strategy", value="SEMAPHORE")
- }
-)
-...
-----
-
-The same thing applies if you are using `@SessionScope` or `@RequestScope`. You will know when you need to do this because of a runtime exception that says it can't find the scoped context.
-
-You also have the option to set the `hystrix.shareSecurityContext` property to `true`. Doing so will auto configure an Hystrix concurrency strategy plugin hook who will transfer the `SecurityContext` from your main thread to the one used by the Hystrix command. Hystrix does not allow multiple hystrix concurrency strategy to be registered so an extension mechanism is available by declaring your own `HystrixConcurrencyStrategy` as a Spring bean. Spring Cloud will lookup for your implementation within the Spring context and wrap it inside its own plugin.
-
-### Health Indicator
-
-The state of the connected circuit breakers are also exposed in the
-`/health` endpoint of the calling application.
-
-[source,json,indent=0]
-----
-{
- "hystrix": {
- "openCircuitBreakers": [
- "StoreIntegration::getStoresByLocationLink"
- ],
- "status": "CIRCUIT_OPEN"
- },
- "status": "UP"
-}
-----
-
-=== Hystrix Metrics Stream
-
-To enable the Hystrix metrics stream include a dependency on `spring-boot-starter-actuator`. This will expose the `/hystrix.stream` as a management endpoint.
-
-[source,xml]
-----
-
- org.springframework.boot
- spring-boot-starter-actuator
-
-----
-
-== Circuit Breaker: Hystrix Dashboard
-
-One of the main benefits of Hystrix is the set of metrics it gathers about each HystrixCommand. The Hystrix Dashboard displays the health of each circuit breaker in an efficient manner.
-
-.Hystrix Dashboard
-image::https://raw.githubusercontent.com/spring-cloud/spring-cloud-netflix/{branch}/docs/src/main/asciidoc/images/Hystrix.png[]
-
-== Hystrix Timeouts And Ribbon Clients
-
-When using Hystrix commands that wrap Ribbon clients you want to make sure your Hystrix timeout
-is configured to be longer than the configured Ribbon timeout, including any potential
-retries that might be made. For example, if your Ribbon connection timeout is one second and
-the Ribbon client might retry the request three times, than your Hystrix timeout should
-be slightly more than three seconds.
-
-
-[[netflix-hystrix-dashboard-starter]]
-=== How to Include Hystrix Dashboard
-
-To include the Hystrix Dashboard in your project use the starter with group `org.springframework.cloud`
-and artifact id `spring-cloud-starter-netflix-hystrix-dashboard`. See the http://projects.spring.io/spring-cloud/[Spring Cloud Project page]
-for details on setting up your build system with the current Spring Cloud Release Train.
-
-To run the Hystrix Dashboard annotate your Spring Boot main class with `@EnableHystrixDashboard`. You then visit `/hystrix` and point the dashboard to an individual instances `/hystrix.stream` endpoint in a Hystrix client application.
-
-NOTE: When connecting to a `/hystrix.stream` endpoint which uses HTTPS the certificate used by the server
-must be trusted by the JVM. If the certificate is not trusted you must import the certificate into the JVM
-in order for the Hystrix Dashboard to make a successful connection to the stream endpoint.
-
-=== Turbine
-
-Looking at an individual instances Hystrix data is not very useful in terms of the overall health of the system. https://github.com/Netflix/Turbine[Turbine] is an application that aggregates all of the relevant `/hystrix.stream` endpoints into a combined `/turbine.stream` for use in the Hystrix Dashboard. Individual instances are located via Eureka. Running Turbine is as simple as annotating your main class with the `@EnableTurbine` annotation (e.g. using spring-cloud-starter-netflix-turbine to set up the classpath). All of the documented configuration properties from https://github.com/Netflix/Turbine/wiki/Configuration-(1.x)[the Turbine 1 wiki] apply. The only difference is that the `turbine.instanceUrlSuffix` does not need the port prepended as this is handled automatically unless `turbine.instanceInsertPort=false`.
-
-NOTE: By default, Turbine looks for the `/hystrix.stream` endpoint on a registered instance by looking up its `hostName` and `port` entries in Eureka, then appending `/hystrix.stream` to it.
-If the instance's metadata contains `management.port`, it will be used instead of the `port` value for the `/hystrix.stream` endpoint.
-By default, metadata entry `management.port` is equal to the `management.port` configuration property, it can be overridden though with following configuration:
-----
-eureka:
- instance:
- metadata-map:
- management.port: ${management.port:8081}
-----
-
-
-The configuration key `turbine.appConfig` is a list of eureka serviceIds that turbine will use to lookup instances. The turbine stream is then used in the Hystrix dashboard using a url that looks like: `http://my.turbine.server:8080/turbine.stream?cluster=CLUSTERNAME` (the cluster parameter can be omitted if the name is "default"). The `cluster` parameter must match an entry in `turbine.aggregator.clusterConfig`. Values returned from eureka are uppercase, thus we expect this example to work if there is an app registered with Eureka called "customers":
-
-----
-turbine:
- aggregator:
- clusterConfig: CUSTOMERS
- appConfig: customers
-----
-
-If you need to customize which cluster names should be used by Turbine (you don't want to store cluster names in
-`turbine.aggregator.clusterConfig` configuration) provide a bean of type `TurbineClustersProvider`.
-
-The `clusterName` can be customized by a SPEL expression in `turbine.clusterNameExpression` with root an instance of `InstanceInfo`. The default value is `appName`, which means that the Eureka serviceId ends up as the cluster key (i.e. the `InstanceInfo` for customers has an `appName` of "CUSTOMERS"). A different example would be `turbine.clusterNameExpression=aSGName`, which would get the cluster name from the AWS ASG name. Another example:
-
-----
-turbine:
- aggregator:
- clusterConfig: SYSTEM,USER
- appConfig: customers,stores,ui,admin
- clusterNameExpression: metadata['cluster']
-----
-
-In this case, the cluster name from 4 services is pulled from their metadata map, and is expected to have values that include "SYSTEM" and "USER".
-
-To use the "default" cluster for all apps you need a string literal expression (with single quotes, and escaped with double quotes if it is in YAML as well):
-
-----
-turbine:
- appConfig: customers,stores
- clusterNameExpression: "'default'"
-----
-
-Spring Cloud provides a `spring-cloud-starter-netflix-turbine` that has all the dependencies you need to get a Turbine server running. Just create a Spring Boot application and annotate it with `@EnableTurbine`.
-
-NOTE: by default Spring Cloud allows Turbine to use the host and port to allow multiple processes per host, per cluster. If you want the native Netflix behaviour built into Turbine that does _not_ allow multiple processes per host, per cluster (the key to the instance id is the hostname), then set the property `turbine.combineHostPort=false`.
-
-=== Turbine Stream
-
-In some environments (e.g. in a PaaS setting), the classic Turbine model of pulling metrics from all the distributed Hystrix commands doesn't work. In that case you might want to have your Hystrix commands push metrics to Turbine, and Spring Cloud enables that with messaging. All you need to do on the client is add a dependency to `spring-cloud-netflix-hystrix-stream` and the `spring-cloud-starter-stream-*` of your choice (see Spring Cloud Stream documentation for details on the brokers, and how to configure the client credentials, but it should work out of the box for a local broker).
-
-On the server side Just create a Spring Boot application and annotate it with `@EnableTurbineStream` and by default it will come up on port 8989 (point your Hystrix dashboard to that port, any path). You can customize the port using either `server.port` or `turbine.stream.port`. If you have `spring-boot-starter-web` and `spring-boot-starter-actuator` on the classpath as well, then you can open up the Actuator endpoints on a separate port (with Tomcat by default) by providing a `management.port` which is different.
-
-You can then point the Hystrix Dashboard to the Turbine Stream Server instead of individual Hystrix streams. If Turbine Stream is running on port 8989 on myhost, then put `http://myhost:8989` in the stream input field in the Hystrix Dashboard. Circuits will be prefixed by their respective serviceId, followed by a dot, then the circuit name.
-
-Spring Cloud provides a `spring-cloud-starter-netflix-turbine-stream` that has all the dependencies you need to get a Turbine Stream server running - just add the Stream binder of your choice, e.g. `spring-cloud-starter-stream-rabbit`. You need Java 8 to run the app because it is Netty-based.
-
-[[spring-cloud-ribbon]]
-== Client Side Load Balancer: Ribbon
-
-Ribbon is a client side load balancer which gives you a lot of control
-over the behaviour of HTTP and TCP clients. Feign already uses Ribbon,
-so if you are using `@FeignClient` then this section also applies.
-
-A central concept in Ribbon is that of the named client. Each load
-balancer is part of an ensemble of components that work together to
-contact a remote server on demand, and the ensemble has a name that
-you give it as an application developer (e.g. using the `@FeignClient`
-annotation). Spring Cloud creates a new ensemble as an
-`ApplicationContext` on demand for each named client using
-`RibbonClientConfiguration`. This contains (amongst other things) an
-`ILoadBalancer`, a `RestClient`, and a `ServerListFilter`.
-
-[[netflix-ribbon-starter]]
-=== How to Include Ribbon
-
-To include Ribbon in your project use the starter with group `org.springframework.cloud`
-and artifact id `spring-cloud-starter-netflix-ribbon`. See the http://projects.spring.io/spring-cloud/[Spring Cloud Project page]
-for details on setting up your build system with the current Spring Cloud Release Train.
-
-=== Customizing the Ribbon Client
-
-You can configure some bits of a Ribbon client using external
-properties in `.ribbon.*`, which is no different than using
-the Netflix APIs natively, except that you can use Spring Boot
-configuration files. The native options can
-be inspected as static fields in https://github.com/Netflix/ribbon/blob/master/ribbon-core/src/main/java/com/netflix/client/config/CommonClientConfigKey.java[`CommonClientConfigKey`] (part of
-ribbon-core).
-
-Spring Cloud also lets you take full control of the client by
-declaring additional configuration (on top of the
-`RibbonClientConfiguration`) using `@RibbonClient`. Example:
-
-[source,java,indent=0]
-----
-@Configuration
-@RibbonClient(name = "foo", configuration = FooConfiguration.class)
-public class TestConfiguration {
-}
-----
-
-In this case the client is composed from the components already in
-`RibbonClientConfiguration` together with any in `FooConfiguration`
-(where the latter generally will override the former).
-
-WARNING: The `FooConfiguration` has to be `@Configuration` but take
-care that it is not in a `@ComponentScan` for the main application
-context, otherwise it will be shared by all the `@RibbonClients`. If
-you use `@ComponentScan` (or `@SpringBootApplication`) you need to
-take steps to avoid it being included (for instance put it in a
-separate, non-overlapping package, or specify the packages to scan
-explicitly in the `@ComponentScan`).
-
-Spring Cloud Netflix provides the following beans by default for ribbon
-(`BeanType` beanName: `ClassName`):
-
-* `IClientConfig` ribbonClientConfig: `DefaultClientConfigImpl`
-* `IRule` ribbonRule: `ZoneAvoidanceRule`
-* `IPing` ribbonPing: `DummyPing`
-* `ServerList` ribbonServerList: `ConfigurationBasedServerList`
-* `ServerListFilter` ribbonServerListFilter: `ZonePreferenceServerListFilter`
-* `ILoadBalancer` ribbonLoadBalancer: `ZoneAwareLoadBalancer`
-* `ServerListUpdater` ribbonServerListUpdater: `PollingServerListUpdater`
-
-Creating a bean of one of those type and placing it in a `@RibbonClient`
-configuration (such as `FooConfiguration` above) allows you to override each
-one of the beans described. Example:
-
-[source,java,indent=0]
-----
-include::../../../../spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/ribbon/RibbonClientsPreprocessorIntegrationTests.java[tags=sample_override_ribbon_config,indent=0]
-----
-
-This replaces the `NoOpPing` with `PingUrl` and provides a custom `serverListFilter`
-
-=== Customizing default for all Ribbon Clients
-A default configuration can be provided for all Ribbon Clients using the `@RibbonClients` annotation and registering a default configuration as shown in the following example:
-[source,java,indent=0]
-----
-include::../../../../spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/ribbon/test/RibbonClientDefaultConfigurationTestsConfig.java[tags=sample_default_ribbon_config,indent=0]
-
-----
-
-=== Customizing the Ribbon Client using properties
-
-Starting with version 1.2.0, Spring Cloud Netflix now supports customizing Ribbon clients using properties to be compatible with the https://github.com/Netflix/ribbon/wiki/Working-with-load-balancers#components-of-load-balancer[Ribbon documentation].
-
-This allows you to change behavior at start up time in different environments.
-
-The supported properties are listed below and should be prefixed by `.ribbon.`:
-
-* `NFLoadBalancerClassName`: should implement `ILoadBalancer`
-* `NFLoadBalancerRuleClassName`: should implement `IRule`
-* `NFLoadBalancerPingClassName`: should implement `IPing`
-* `NIWSServerListClassName`: should implement `ServerList`
-* `NIWSServerListFilterClassName` should implement `ServerListFilter`
-
-NOTE: Classes defined in these properties have precedence over beans defined using `@RibbonClient(configuration=MyRibbonConfig.class)` and the defaults provided by Spring Cloud Netflix.
-
-To set the `IRule` for a service name `users` you could set the following:
-
-.application.yml
-----
-users:
- ribbon:
- NIWSServerListClassName: com.netflix.loadbalancer.ConfigurationBasedServerList
- NFLoadBalancerRuleClassName: com.netflix.loadbalancer.WeightedResponseTimeRule
-----
-
-See the https://github.com/Netflix/ribbon/wiki/Working-with-load-balancers[Ribbon documentation] for implementations provided by Ribbon.
-
-=== Using Ribbon with Eureka
-
-When Eureka is used in conjunction with Ribbon (i.e., both are on the classpath) the `ribbonServerList`
-is overridden with an extension of `DiscoveryEnabledNIWSServerList`
-which populates the list of servers from Eureka. It also replaces the
-`IPing` interface with `NIWSDiscoveryPing` which delegates to Eureka
-to determine if a server is up. The `ServerList` that is installed by
-default is a `DomainExtractingServerList` and the purpose of this is
-to make physical metadata available to the load balancer without using
-AWS AMI metadata (which is what Netflix relies on). By default the
-server list will be constructed with "zone" information as provided in
-the instance metadata (so on the remote clients set
-`eureka.instance.metadataMap.zone`), and if that is missing it can use
-the domain name from the server hostname as a proxy for zone (if the
-flag `approximateZoneFromHostname` is set). Once the zone information
-is available it can be used in a `ServerListFilter`. By default it
-will be used to locate a server in the same zone as the client because
-the default is a `ZonePreferenceServerListFilter`. The zone of the
-client is determined the same way as the remote instances by default,
-i.e. via `eureka.instance.metadataMap.zone`.
-
-NOTE: The orthodox "archaius" way to set the client zone is via a
-configuration property called "@zone", and Spring Cloud will use that
-in preference to all other settings if it is available (note that the
-key will have to be quoted in YAML configuration).
-
-NOTE: If there is no other source of zone data then a guess is made
-based on the client configuration (as opposed to the instance
-configuration). We take `eureka.client.availabilityZones`, which is a
-map from region name to a list of zones, and pull out the first zone
-for the instance's own region (i.e. the `eureka.client.region`, which
-defaults to "us-east-1" for comatibility with native Netflix).
-
-[[spring-cloud-ribbon-without-eureka]]
-=== Example: How to Use Ribbon Without Eureka
-
-Eureka is a convenient way to abstract the discovery of remote servers
-so you don't have to hard code their URLs in clients, but if you
-prefer not to use it, Ribbon and Feign are still quite
-amenable. Suppose you have declared a `@RibbonClient` for "stores",
-and Eureka is not in use (and not even on the classpath). The Ribbon
-client defaults to a configured server list, and you can supply the
-configuration like this
-
-.application.yml
-----
-stores:
- ribbon:
- listOfServers: example.com,google.com
-----
-
-=== Example: Disable Eureka use in Ribbon
-
-Setting the property `ribbon.eureka.enabled = false` will explicitly
-disable the use of Eureka in Ribbon.
-
-.application.yml
-----
-ribbon:
- eureka:
- enabled: false
-----
-
-=== Using the Ribbon API Directly
-
-You can also use the `LoadBalancerClient` directly. Example:
-
-[source,java,indent=0]
-----
-public class MyClass {
- @Autowired
- private LoadBalancerClient loadBalancer;
-
- public void doStuff() {
- ServiceInstance instance = loadBalancer.choose("stores");
- URI storesUri = URI.create(String.format("http://%s:%s", instance.getHost(), instance.getPort()));
- // ... do something with the URI
- }
-}
-----
-
-[[ribbon-child-context-eager-load]]
-=== Caching of Ribbon Configuration
-
-Each Ribbon named client has a corresponding child Application Context that Spring Cloud maintains, this application context is lazily loaded up on the first request to the named client.
-This lazy loading behavior can be changed to instead eagerly load up these child Application contexts at startup by specifying the names of the Ribbon clients.
-
-.application.yml
-----
-ribbon:
- eager-load:
- enabled: true
- clients: client1, client2, client3
-----
-
-[[how-to-configure-hystrix-thread-pools]]
-=== How to Configure Hystrix thread pools
-If you change `zuul.ribbonIsolationStrategy` to THREAD, the thread isolation strategy for Hystrix will be used for all routes. In this case, the HystrixThreadPoolKey is set to "RibbonCommand" as default. It means that HystrixCommands for all routes will be executed in the same Hystrix thread pool. This behavior can be changed using the following configuration and it will result in HystrixCommands being executed in the Hystrix thread pool for each route.
-
-.application.yml
-----
-zuul:
- threadPool:
- useSeparateThreadPools: true
-----
-
-The default HystrixThreadPoolKey in this case is same with service ID for each route. To add a prefix to HystrixThreadPoolKey, set `zuul.threadPool.threadPoolKeyPrefix` to a value that you want to add. For example:
-
-.application.yml
-----
-zuul:
- threadPool:
- useSeparateThreadPools: true
- threadPoolKeyPrefix: zuulgw
-----
-
-[[how-to-provdie-a-key-to-ribbon]]
-=== How to Provide a Key to Ribbon's `IRule`
-
-If you need to provide your own `IRule` implementation to handle a special routing requirement like a canary test,
-you probably want to pass some information to the `choose` method of `IRule`.
-
-.com.netflix.loadbalancer.IRule.java
-----
-public interface IRule{
- public Server choose(Object key);
- :
-----
-
-You can provide some information that will be used to choose a target server by your `IRule` implementation like
-the following:
-
-----
-RequestContext.getCurrentContext()
- .set(FilterConstants.LOAD_BALANCER_KEY, "canary-test");
-----
-
-If you put any object into the `RequestContext` with a key `FilterConstants.LOAD_BALANCER_KEY`, it will
-be passed to the `choose` method of `IRule` implementation. Above code must be executed before `RibbonRoutingFilter`
-is executed and Zuul's pre filter is the best place to do that. You can easily access HTTP headers and query parameters
-via `RequestContext` in pre filter, so it can be used to determine `LOAD_BALANCER_KEY` that will be passed to Ribbon.
-If you don't put any value with `LOAD_BALANCER_KEY` in `RequestContext`, null will be passed as a parameter of `choose`
-method.
-
[[spring-cloud-feign]]
== Declarative REST Client: Feign
@@ -1393,1353 +423,11 @@ public class FooConfiguration {
}
}
----
-
-== External Configuration: Archaius
-
-https://github.com/Netflix/archaius[Archaius] is the Netflix client side configuration library. It is the library used by all of the Netflix OSS components for configuration. Archaius is an extension of the http://commons.apache.org/proper/commons-configuration[Apache Commons Configuration] project. It allows updates to configuration by either polling a source for changes or for a source to push changes to the client. Archaius uses DynamicProperty classes as handles to properties.
-
-.Archaius Example
-[source,java]
-----
-class ArchaiusTest {
- DynamicStringProperty myprop = DynamicPropertyFactory
- .getInstance()
- .getStringProperty("my.prop");
-
- void doSomething() {
OtherClass.someMethod(myprop.get());
}
}
-----
-
-Archaius has its own set of configuration files and loading priorities. Spring applications should generally not use Archaius directly, but the need to configure the Netflix tools natively remains. Spring Cloud has a Spring Environment Bridge so Archaius can read properties from the Spring Environment. This allows Spring Boot projects to use the normal configuration toolchain, while allowing them to configure the Netflix tools, for the most part, as documented.
-
-== Router and Filter: Zuul
-
-Routing is an integral part of a microservice architecture. For example, `/` may be mapped to your web application, `/api/users` is mapped to the user service and `/api/shop` is mapped to the shop service. https://github.com/Netflix/zuul[Zuul] is a JVM based router and server side load balancer by Netflix.
-
-http://www.slideshare.net/MikeyCohen1/edge-architecture-ieee-international-conference-on-cloud-engineering-32240146/27[Netflix uses Zuul] for the following:
-
-* Authentication
-* Insights
-* Stress Testing
-* Canary Testing
-* Dynamic Routing
-* Service Migration
-* Load Shedding
-* Security
-* Static Response handling
-* Active/Active traffic management
-
-Zuul's rule engine allows rules and filters to be written in essentially any JVM language, with built in support for Java and Groovy.
-
-NOTE: The configuration property `zuul.max.host.connections` has been replaced by two new properties, `zuul.host.maxTotalConnections` and `zuul.host.maxPerRouteConnections` which default to 200 and 20 respectively.
-
-NOTE: Default Hystrix isolation pattern (ExecutionIsolationStrategy) for all routes is SEMAPHORE. `zuul.ribbonIsolationStrategy` can be changed to THREAD if this isolation pattern is preferred.
-
-[[netflix-zuul-starter]]
-=== How to Include Zuul
-
-To include Zuul in your project use the starter with group `org.springframework.cloud`
-and artifact id `spring-cloud-starter-netflix-zuul`. See the http://projects.spring.io/spring-cloud/[Spring Cloud Project page]
-for details on setting up your build system with the current Spring Cloud Release Train.
-
-[[netflix-zuul-reverse-proxy]]
-=== Embedded Zuul Reverse Proxy
-
-Spring Cloud has created an embedded Zuul proxy to ease the
-development of a very common use case where a UI application wants to
-proxy calls to one or more back end services. This feature is useful
-for a user interface to proxy to the backend services it requires,
-avoiding the need to manage CORS and authentication concerns
-independently for all the backends.
-
-To enable it, annotate a Spring Boot main class with
-`@EnableZuulProxy`, and this forwards local calls to the appropriate
-service. By convention, a service with the ID "users", will
-receive requests from the proxy located at `/users` (with the prefix
stripped). The proxy uses Ribbon to locate an instance to forward to
via discovery, and all requests are executed in a
<>, so
failures will show up in Hystrix metrics, and once the circuit is open
the proxy will not try to contact the service.
-
-NOTE: the Zuul starter does not include a discovery client, so for
-routes based on service IDs you need to provide one of those
-on the classpath as well (e.g. Eureka is one choice).
-
-To skip having a service automatically added, set
-`zuul.ignored-services` to a list of service id patterns. If a service
-matches a pattern that is ignored, but also included in the explicitly
-configured routes map, then it will be unignored. Example:
-
-.application.yml
-[source,yaml]
-----
- zuul:
- ignoredServices: '*'
- routes:
- users: /myusers/**
-----
-
-In this example, all services are ignored *except* "users".
-
-To augment or change
-the proxy routes, you can add external configuration like the
-following:
-
-.application.yml
-[source,yaml]
-----
- zuul:
- routes:
- users: /myusers/**
-----
-
-This means that http calls to "/myusers" get forwarded to the "users"
-service (for example "/myusers/101" is forwarded to "/101").
-
-To get more fine-grained control over a route you can specify the path
-and the serviceId independently:
-
-.application.yml
-[source,yaml]
-----
- zuul:
- routes:
- users:
- path: /myusers/**
- serviceId: users_service
-----
-
-This means that http calls to "/myusers" get forwarded to the
-"users_service" service. The route has to have a "path" which can be
-specified as an ant-style pattern, so "/myusers/{asterisk}" only matches one
-level, but "/myusers/{all}" matches hierarchically.
-
-The location of the backend can be specified as either a "serviceId"
-(for a service from discovery) or a "url" (for a physical location), e.g.
-
-.application.yml
-[source,yaml]
-----
- zuul:
- routes:
- users:
- path: /myusers/**
- url: http://example.com/users_service
-----
-
-These simple url-routes don't get executed as a `HystrixCommand` nor do they loadbalance multiple URLs with Ribbon.
-To achieve this, you can specify a `serviceId` with a static list of servers:
-
-.application.yml
-[source,yaml]
-----
-zuul:
- routes:
- echo:
- path: /myusers/**
- serviceId: myusers-service
- stripPrefix: true
-
-hystrix:
- command:
- myusers-service:
- execution:
- isolation:
- thread:
- timeoutInMilliseconds: ...
-
-myusers-service:
- ribbon:
- NIWSServerListClassName: com.netflix.loadbalancer.ConfigurationBasedServerList
- ListOfServers: http://example1.com,http://example2.com
- ConnectTimeout: 1000
- ReadTimeout: 3000
- MaxTotalHttpConnections: 500
- MaxConnectionsPerHost: 100
-----
-
-Another method is specifiying a service-route and configure a Ribbon client for the
-serviceId (this requires disabling Eureka support in Ribbon:
-see <>), e.g.
-
-.application.yml
-[source,yaml]
-----
-zuul:
- routes:
- users:
- path: /myusers/**
- serviceId: users
-
-ribbon:
- eureka:
- enabled: false
-
-users:
- ribbon:
- listOfServers: example.com,google.com
-----
-
-You can provide convention between serviceId and routes using
-regexmapper. It uses regular expression named groups to extract
-variables from serviceId and inject them into a route pattern.
-
-.ApplicationConfiguration.java
-[source,java]
-----
-@Bean
-public PatternServiceRouteMapper serviceRouteMapper() {
- return new PatternServiceRouteMapper(
- "(?^.+)-(?v.+$)",
- "${version}/${name}");
-}
-----
-
-This means that a serviceId "myusers-v1" will be mapped to route
-"/v1/myusers/{all}". Any regular expression is accepted but all named
-groups must be present in both servicePattern and routePattern. If
-servicePattern does not match a serviceId, the default behavior is
-used. In the example above, a serviceId "myusers" will be mapped to route
-"/myusers/{all}" (no version detected) This feature is disabled by
-default and only applies to discovered services.
-
-To add a prefix to all mappings, set `zuul.prefix` to a value, such as
-`/api`. The proxy prefix is stripped from the request before the
-request is forwarded by default (switch this behaviour off with
-`zuul.stripPrefix=false`). You can also switch off the stripping of
-the service-specific prefix from individual routes, e.g.
-
-.application.yml
-[source,yaml]
-----
- zuul:
- routes:
- users:
- path: /myusers/**
- stripPrefix: false
-----
-
-NOTE: `zuul.stripPrefix` only applies to the prefix set in `zuul.prefix`. It does not have any effect on prefixes
-defined within a given route's `path`.
-
-In this example, requests to "/myusers/101" will be forwarded to "/myusers/101" on the "users" service.
-
-The `zuul.routes` entries actually bind to an object of type `ZuulProperties`. If you
-look at the properties of that object you will see that it also has a "retryable" flag.
-Set that flag to "true" to have the Ribbon client automatically retry failed requests
-(and if you need to you can modify the parameters of the retry operations using
-the Ribbon client configuration).
-
-The `X-Forwarded-Host` header is added to the forwarded requests by
-default. To turn it off set `zuul.addProxyHeaders = false`. The
-prefix path is stripped by default, and the request to the backend
-picks up a header "X-Forwarded-Prefix" ("/myusers" in the examples
-above).
-
-An application with `@EnableZuulProxy` could act as a standalone
-server if you set a default route ("/"), for example `zuul.route.home:
-/` would route all traffic (i.e. "/{all}") to the "home" service.
-
-If more fine-grained ignoring is needed, you can specify specific patterns to ignore.
-These patterns are evaluated at the start of the route location process, which
-means prefixes should be included in the pattern to warrant a match. Ignored patterns
-span all services and supersede any other route specification.
-
-.application.yml
-[source,yaml]
-----
- zuul:
- ignoredPatterns: /**/admin/**
- routes:
- users: /myusers/**
-----
-
-This means that all calls such as "/myusers/101" will be forwarded to "/101" on the "users" service.
-But calls including "/admin/" will not resolve.
-
-WARNING: If you need your routes to have their order preserved you need to use a YAML
-file as the ordering will be lost using a properties file. For example:
-
-.application.yml
-[source,yaml]
-----
- zuul:
- routes:
- users:
- path: /myusers/**
- legacy:
- path: /**
-----
-
-If you were to use a properties file, the `legacy` path may end up in front of the `users`
-path rendering the `users` path unreachable.
-
-=== Zuul Http Client
-
-The default HTTP client used by zuul is now backed by the Apache HTTP Client instead of the
-deprecated Ribbon `RestClient`. To use `RestClient` or to use the `okhttp3.OkHttpClient` set
-`ribbon.restclient.enabled=true` or `ribbon.okhttp.enabled=true` respectively. If you would
-like to customize the Apache HTTP client or the OK HTTP client provide a bean of type
-`ClosableHttpClient` or `OkHttpClient`.
-
-=== Cookies and Sensitive Headers
-
-It's OK to share headers between services in the same system, but you
-probably don't want sensitive headers leaking downstream into external
-servers. You can specify a list of ignored headers as part of the
-route configuration. Cookies play a special role because they have
-well-defined semantics in browsers, and they are always to be treated
-as sensitive. If the consumer of your proxy is a browser, then cookies
-for downstream services also cause problems for the user because they
-all get jumbled up (all downstream services look like they come from
-the same place).
-
-If you are careful with the design of your services, for example if
-only one of the downstream services sets cookies, then you might be
-able to let them flow from the backend all the way up to the
-caller. Also, if your proxy sets cookies and all your back end
-services are part of the same system, it can be natural to simply
-share them (and for instance use Spring Session to link them up to some
-shared state). Other than that, any cookies that get set by downstream
-services are likely to be not very useful to the caller, so it is
-recommended that you make (at least) "Set-Cookie" and "Cookie" into
-sensitive headers for routes that are not part of your domain. Even
-for routes that *are* part of your domain, try to think carefully
-about what it means before allowing cookies to flow between them and
-the proxy.
-
-The sensitive headers can be configured as a comma-separated list per
-route, e.g.
-
-.application.yml
-[source,yaml]
-----
- zuul:
- routes:
- users:
- path: /myusers/**
- sensitiveHeaders: Cookie,Set-Cookie,Authorization
- url: https://downstream
-----
-
-NOTE: this is the default value for `sensitiveHeaders`, so you don't
-need to set it unless you want it to be different. N.B. this is new in
-Spring Cloud Netflix 1.1 (in 1.0 the user had no control over headers
-and all cookies flow in both directions).
-
-The `sensitiveHeaders` are a blacklist and the default is not empty,
-so to make Zuul send all headers (except the "ignored" ones) you would
-have to explicitly set it to the empty list. This is necessary if you
-want to pass cookie or authorization headers to your back end. Example:
-
-.application.yml
-[source,yaml]
-----
- zuul:
- routes:
- users:
- path: /myusers/**
- sensitiveHeaders:
- url: https://downstream
-----
-
-Sensitive headers can also be set globally by setting `zuul.sensitiveHeaders`. If `sensitiveHeaders` is set on a route, this will override the global `sensitiveHeaders` setting.
-
-=== Ignored Headers
-
-In addition to the per-route sensitive headers, you can set a global
-value for `zuul.ignoredHeaders` for values that should be discarded
-(both request and response) during interactions with downstream
-services. By default these are empty, if Spring Security is not on the
-classpath, and otherwise they are initialized to a set of well-known
-"security" headers (e.g. involving caching) as specified by Spring
-Security. The assumption in this case is that the downstream services
-might add these headers too, and we want the values from the proxy.
-To not discard these well known security headers in case Spring Security is on the classpath you can set `zuul.ignoreSecurityHeaders` to `false`. This can be useful if you disabled the HTTP Security response headers in Spring Security and want the values provided by downstream services
-
-=== Management Endpoints
-
-If you are using `@EnableZuulProxy` with the Spring Boot Actuator you
-will enable (by default) two additional endpoints:
-
-* Routes
-* Filters
-
-==== Routes Endpoint
-
-A GET to the routes endpoint at `/routes` will return a list of the mapped
-routes:
-
-.GET /routes
-[source,json]
-----
-{
- /stores/**: "http://localhost:8081"
-}
-----
-
-Additional route details can be requested through the `/routes/details` endpoint. This will produce the following output:
-
-.GET /routes/details
-[source,json]
-----
-{
- "/stores/**": {
- "id": "stores",
- "fullPath": "/stores/**",
- "location": "http://localhost:8081",
- "path": "/**",
- "prefix": "/stores",
- "retryable": false,
- "customSensitiveHeaders": false,
- "prefixStripped": true
- }
-}
-----
-
-A POST to `/routes` will force a refresh of the existing routes (e.g. in
-case there have been changes in the service catalog). You can disable
-this endpoint by setting `endpoints.routes.enabled` to `false`.
-
-NOTE: the routes should respond automatically to changes in the
-service catalog, but the POST to `/routes` is a way to force the change
-to happen immediately.
-
-==== Filters Endpoint
-
-A GET to the filters endpoint at `/filters` will return a map of Zuul
-filters by type. For each filter type in the map, you will find a list
-of all the filters of that type, along with their details.
-
-=== Strangulation Patterns and Local Forwards
-
-A common pattern when migrating an existing application or API is to
-"strangle" old endpoints, slowly replacing them with different
-implementations. The Zuul proxy is a useful tool for this because you
-can use it to handle all traffic from clients of the old endpoints,
-but redirect some of the requests to new ones.
-
-Example configuration:
-
-.application.yml
-[source,yaml]
-----
- zuul:
- routes:
- first:
- path: /first/**
- url: http://first.example.com
- second:
- path: /second/**
- url: forward:/second
- third:
- path: /third/**
- url: forward:/3rd
- legacy:
- path: /**
- url: http://legacy.example.com
-----
-
-In this example we are strangling the "legacy" app which is mapped to
-all requests that do not match one of the other patterns. Paths in
-`/first/{all}` have been extracted into a new service with an external
-URL. And paths in `/second/{all}` are forwarded so they can be handled
-locally, e.g. with a normal Spring `@RequestMapping`. Paths in
-`/third/{all}` are also forwarded, but with a different prefix
-(i.e. `/third/foo` is forwarded to `/3rd/foo`).
-
-NOTE: The ignored patterns aren't completely ignored, they just
-aren't handled by the proxy (so they are also effectively forwarded
-locally).
-
-=== Uploading Files through Zuul
-
-If you use `@EnableZuulProxy`, you can use the proxy paths to
-upload files and it should just work as long as the files
-are small. For large files there is an alternative path
-which bypasses the Spring `DispatcherServlet` (to
-avoid multipart processing) in "/zuul/{asterisk}". I.e. if
-`zuul.routes.customers=/customers/{all}` then you can
-POST large files to "/zuul/customers/*". The servlet
-path is externalized via `zuul.servletPath`. Extremely
-large files will also require elevated timeout settings
-if the proxy route takes you through a Ribbon load
-balancer, e.g.
-
-.application.yml
-[source,yaml]
-----
-hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds: 60000
-ribbon:
- ConnectTimeout: 3000
- ReadTimeout: 60000
-----
-
-Note that for streaming to work with large files, you need to use chunked encoding in the request (which some browsers
-do not do by default). E.g. on the command line:
-
-----
-$ curl -v -H "Transfer-Encoding: chunked" \
- -F "file=@mylarge.iso" localhost:9999/zuul/simple/file
-----
-
-=== Query String Encoding
-When processing the incoming request, query params are decoded so they can be available for possible modifications in
-Zuul filters. They are then re-encoded when building the backend request in the route filters. The result
-can be different than the original input if it was encoded using Javascript's `encodeURIComponent()` method for example.
-While this causes no issues in most cases, some web servers can be picky with the encoding of complex query string.
-
-To force the original encoding of the query string, it is possible to pass a special flag to `ZuulProperties` so
-that the query string is taken as is with the `HttpServletRequest::getQueryString` method :
-
-.application.yml
-[source,yaml]
-----
- zuul:
- forceOriginalQueryStringEncoding: true
-----
-
-*Note:* This special flag only works with `SimpleHostRoutingFilter` and you loose the ability to easily override
-query parameters with `RequestContext.getCurrentContext().setRequestQueryParams(someOverriddenParameters)` since
-the query string is now fetched directly on the original `HttpServletRequest`.
-
-=== Plain Embedded Zuul
-
-You can also run a Zuul server without the proxying, or switch on parts of the proxying platform selectively, if you
-use `@EnableZuulServer` (instead of `@EnableZuulProxy`). Any beans that you add to the application of type `ZuulFilter`
-will be installed automatically, as they are with `@EnableZuulProxy`, but without any of the proxy filters being added
-automatically.
-
-In this case the routes into the Zuul server are still specified by
-configuring "zuul.routes.{asterisk}", but there is no service
-discovery and no proxying, so the "serviceId" and "url" settings are
-ignored. For example:
-
-.application.yml
-[source,yaml]
-----
- zuul:
- routes:
- api: /api/**
-----
-
-maps all paths in "/api/{all}" to the Zuul filter chain.
-
-=== Disable Zuul Filters
-
-Zuul for Spring Cloud comes with a number of `ZuulFilter` beans enabled by default
-in both proxy and server mode. See https://github.com/spring-cloud/spring-cloud-netflix/tree/master/spring-cloud-netflix-zuul/src/main/java/org/springframework/cloud/netflix/zuul/filters[the zuul filters package] for the
-possible filters that are enabled. If you want to disable one, simply set
-`zuul...disable=true`. By convention, the package after
-`filters` is the Zuul filter type. For example to disable
-`org.springframework.cloud.netflix.zuul.filters.post.SendResponseFilter` set
-`zuul.SendResponseFilter.post.disable=true`.
-
-[[hystrix-fallbacks-for-routes]]
-=== Providing Hystrix Fallbacks For Routes
-
-When a circuit for a given route in Zuul is tripped you can provide a fallback response
-by creating a bean of type `FallbackProvider`. Within this bean you need to specify
-the route ID the fallback is for and provide a `ClientHttpResponse` to return
-as a fallback. Here is a very simple `FallbackProvider` implementation.
-
-[source,java]
-----
-class MyFallbackProvider implements FallbackProvider {
-
- @Override
- public String getRoute() {
- return "customers";
- }
-
- @Override
- public ClientHttpResponse fallbackResponse(String route, final Throwable cause) {
- if (cause instanceof HystrixTimeoutException) {
- return response(HttpStatus.GATEWAY_TIMEOUT);
- } else {
- return response(HttpStatus.INTERNAL_SERVER_ERROR);
- }
- }
-
- private ClientHttpResponse response(final HttpStatus status) {
- return new ClientHttpResponse() {
- @Override
- public HttpStatus getStatusCode() throws IOException {
- return status;
- }
-
- @Override
- public int getRawStatusCode() throws IOException {
- return status.value();
- }
-
- @Override
- public String getStatusText() throws IOException {
- return status.getReasonPhrase();
- }
-
- @Override
- public void close() {
- }
-
- @Override
- public InputStream getBody() throws IOException {
- return new ByteArrayInputStream("fallback".getBytes());
- }
-
- @Override
- public HttpHeaders getHeaders() {
- HttpHeaders headers = new HttpHeaders();
- headers.setContentType(MediaType.APPLICATION_JSON);
- return headers;
- }
- };
- }
-}
-----
-
-And here is what the route configuration would look like.
-
-[source,yaml]
-----
-zuul:
- routes:
- customers: /customers/**
-----
-
-If you would like to provide a default fallback for all routes than you can create a bean of
-type `FallbackProvider` and have the `getRoute` method return `*` or `null`.
-
-[source,java]
-----
-class MyFallbackProvider implements FallbackProvider {
- @Override
- public String getRoute() {
- return "*";
- }
-
- @Override
- public ClientHttpResponse fallbackResponse(String route, Throwable throwable) {
- return new ClientHttpResponse() {
- @Override
- public HttpStatus getStatusCode() throws IOException {
- return HttpStatus.OK;
- }
-
- @Override
- public int getRawStatusCode() throws IOException {
- return 200;
- }
-
- @Override
- public String getStatusText() throws IOException {
- return "OK";
- }
-
- @Override
- public void close() {
-
- }
-
- @Override
- public InputStream getBody() throws IOException {
- return new ByteArrayInputStream("fallback".getBytes());
- }
-
- @Override
- public HttpHeaders getHeaders() {
- HttpHeaders headers = new HttpHeaders();
- headers.setContentType(MediaType.APPLICATION_JSON);
- return headers;
- }
- };
- }
-}
-----
-
-=== Zuul Timeouts
-
-If you want to configure the socket timeouts and read timeouts for requests proxied through
-Zuul there are two options based on your configuration.
-
-If Zuul is using service discovery then you need to configure these timeouts via Ribbon properties,
-`ribbon.ReadTimeout` and `ribbon.SocketTimeout`.
-
-If you have configured Zuul routes by specifying URLs then you will need to use
-`zuul.host.connect-timeout-millis` and `zuul.host.socket-timeout-millis`.
-
-[[zuul-redirect-location-rewrite]]
-=== Rewriting `Location` header
-
-If Zuul is fronting a web application then there may be a need to re-write the `Location` header when the web application redirects through a http status code of 3XX, otherwise the browser will end up redirecting to the web application's url instead of the Zuul url.
-A `LocationRewriteFilter` Zuul filter can be configured to re-write the Location header to the Zuul's url, it also adds back the stripped global and route specific prefixes. The filter can be added the following way via a Spring Configuration file:
-
-[source,java]
-----
-import org.springframework.cloud.netflix.zuul.filters.post.LocationRewriteFilter;
-...
-
-@Configuration
-@EnableZuulProxy
-public class ZuulConfig {
- @Bean
- public LocationRewriteFilter locationRewriteFilter() {
- return new LocationRewriteFilter();
- }
-}
-----
-
-[WARNING]
-====
-Use this filter with caution though, the filter acts on the `Location` header of ALL 3XX response codes which may not be appropriate in all scenarios, say if the user is redirecting to an external URL.
-====
-
-[[zuul-developer-guide]]
-=== Zuul Developer Guide
-
-For a general overview of how Zuul works, please see https://github.com/Netflix/zuul/wiki/How-it-Works[the Zuul Wiki].
-
-==== The Zuul Servlet
-
-Zuul is implemented as a Servlet. For the general cases, Zuul is embedded into the Spring Dispatch mechanism. This allows Spring MVC to be in control of the routing. In this case, Zuul is configured to buffer requests. If there is a need to go through Zuul without buffering requests (e.g. for large file uploads), the Servlet is also installed outside of the Spring Dispatcher. By default, this is located at `/zuul`. This path can be changed with the `zuul.servlet-path` property.
-
-==== Zuul RequestContext
-
-To pass information between filters, Zuul uses a https://github.com/Netflix/zuul/blob/1.x/zuul-core/src/main/java/com/netflix/zuul/context/RequestContext.java[`RequestContext`]. Its data is held in a `ThreadLocal` specific to each request. Information about where to route requests, errors and the actual `HttpServletRequest` and `HttpServletResponse` are stored there. The `RequestContext` extends `ConcurrentHashMap`, so anything can be stored in the context. https://github.com/spring-cloud/spring-cloud-netflix/blob/master/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/support/FilterConstants.java[`FilterConstants`] contains the keys that are used by the filters installed by Spring Cloud Netflix (more on these later).
-
-==== `@EnableZuulProxy` vs. `@EnableZuulServer`
-
-Spring Cloud Netflix installs a number of filters based on which annotation was used to enable Zuul. `@EnableZuulProxy` is a superset of `@EnableZuulServer`. In other words, `@EnableZuulProxy` contains all filters installed by `@EnableZuulServer`. The additional filters in the "proxy" enable routing functionality. If you want a "blank" Zuul, you should use `@EnableZuulServer`.
-
-==== `@EnableZuulServer` Filters
-
-Creates a `SimpleRouteLocator` that loads route definitions from Spring Boot configuration files.
-
-The following filters are installed (as normal Spring Beans):
-
-Pre filters:
-
-- `ServletDetectionFilter`: Detects if the request is through the Spring Dispatcher. Sets boolean with key `FilterConstants.IS_DISPATCHER_SERVLET_REQUEST_KEY`.
-- `FormBodyWrapperFilter`: Parses form data and reencodes it for downstream requests.
-- `DebugFilter`: if the `debug` request parameter is set, this filter sets `RequestContext.setDebugRouting()` and `RequestContext.setDebugRequest()` to true.
-
-Route filters:
-
-- `SendForwardFilter`: This filter forwards requests using the Servlet `RequestDispatcher`. The forwarding location is stored in the `RequestContext` attribute `FilterConstants.FORWARD_TO_KEY`. This is useful for forwarding to endpoints in the current application.
-
-Post filters:
-
-- `SendResponseFilter`: Writes responses from proxied requests to the current response.
-
-Error filters:
-
-- `SendErrorFilter`: Forwards to /error (by default) if `RequestContext.getThrowable()` is not null. The default forwarding path (`/error`) can be changed by setting the `error.path` property.
-
-==== `@EnableZuulProxy` Filters
-
-Creates a `DiscoveryClientRouteLocator` that loads route definitions from a `DiscoveryClient` (like Eureka), as well as from properties. A route is created for each `serviceId` from the `DiscoveryClient`. As new services are added, the routes will be refreshed.
-
-In addition to the filters described above, the following filters are installed (as normal Spring Beans):
-
-Pre filters:
-
-- `PreDecorationFilter`: This filter determines where and how to route based on the supplied `RouteLocator`. It also sets various proxy-related headers for downstream requests.
-
-Route filters:
-
-* `RibbonRoutingFilter`: This filter uses Ribbon, Hystrix and pluggable HTTP clients to send requests. Service ids are found in the `RequestContext` attribute `FilterConstants.SERVICE_ID_KEY`. This filter can use different HTTP clients. They are:
-** Apache `HttpClient`. This is the default client.
-** Squareup `OkHttpClient` v3. This is enabled by having the `com.squareup.okhttp3:okhttp` library on the classpath and setting `ribbon.okhttp.enabled=true`.
-** Netflix Ribbon HTTP client. This is enabled by setting `ribbon.restclient.enabled=true`. This client has limitations, such as it doesn't support the PATCH method, but also has built-in retry.
-
-* `SimpleHostRoutingFilter`: This filter sends requests to predetermined URLs via an Apache HttpClient. URLs are found in `RequestContext.getRouteHost()`.
-
-==== Custom Zuul Filter examples
-
-Most of the following "How to Write" examples below are included https://github.com/spring-cloud-samples/sample-zuul-filters[Sample Zuul Filters] project. There are also examples of manipulating the request or response body in that repository.
-
-==== How to Write a Pre Filter
-
-Pre filters are used to set up data in the `RequestContext` for use in filters downstream. The main use case is to set information required for route filters.
-
-[source,java]
-----
-public class QueryParamPreFilter extends ZuulFilter {
- @Override
- public int filterOrder() {
- return PRE_DECORATION_FILTER_ORDER - 1; // run before PreDecoration
- }
-
- @Override
- public String filterType() {
- return PRE_TYPE;
- }
-
- @Override
- public boolean shouldFilter() {
- RequestContext ctx = RequestContext.getCurrentContext();
- return !ctx.containsKey(FORWARD_TO_KEY) // a filter has already forwarded
- && !ctx.containsKey(SERVICE_ID_KEY); // a filter has already determined serviceId
- }
- @Override
- public Object run() {
- RequestContext ctx = RequestContext.getCurrentContext();
- HttpServletRequest request = ctx.getRequest();
- if (request.getParameter("foo") != null) {
- // put the serviceId in `RequestContext`
- ctx.put(SERVICE_ID_KEY, request.getParameter("foo"));
- }
- return null;
- }
-}
-----
-
-The filter above populates `SERVICE_ID_KEY` from the `foo` request parameter. In reality, it's not a good idea to do that kind of direct mapping, but the service id should be looked up from the value of `foo` instead.
-
-Now that `SERVICE_ID_KEY` is populated, `PreDecorationFilter` won't run and `RibbonRoutingFilter` will. If you wanted to route to a full URL instead, call `ctx.setRouteHost(url)` instead.
-
-To modify the path that routing filters will forward to, set the `REQUEST_URI_KEY`.
-
-==== How to Write a Route Filter
-
-Route filters are run after pre filters and are used to make requests to other services. Much of the work here is to translate request and response data to and from the client required model.
-
-[source,java]
-----
-public class OkHttpRoutingFilter extends ZuulFilter {
- @Autowired
- private ProxyRequestHelper helper;
-
- @Override
- public String filterType() {
- return ROUTE_TYPE;
- }
-
- @Override
- public int filterOrder() {
- return SIMPLE_HOST_ROUTING_FILTER_ORDER - 1;
- }
-
- @Override
- public boolean shouldFilter() {
- return RequestContext.getCurrentContext().getRouteHost() != null
- && RequestContext.getCurrentContext().sendZuulResponse();
- }
-
- @Override
- public Object run() {
- OkHttpClient httpClient = new OkHttpClient.Builder()
- // customize
- .build();
-
- RequestContext context = RequestContext.getCurrentContext();
- HttpServletRequest request = context.getRequest();
-
- String method = request.getMethod();
-
- String uri = this.helper.buildZuulRequestURI(request);
-
- Headers.Builder headers = new Headers.Builder();
- Enumeration headerNames = request.getHeaderNames();
- while (headerNames.hasMoreElements()) {
- String name = headerNames.nextElement();
- Enumeration values = request.getHeaders(name);
-
- while (values.hasMoreElements()) {
- String value = values.nextElement();
- headers.add(name, value);
- }
- }
-
- InputStream inputStream = request.getInputStream();
-
- RequestBody requestBody = null;
- if (inputStream != null && HttpMethod.permitsRequestBody(method)) {
- MediaType mediaType = null;
- if (headers.get("Content-Type") != null) {
- mediaType = MediaType.parse(headers.get("Content-Type"));
- }
- requestBody = RequestBody.create(mediaType, StreamUtils.copyToByteArray(inputStream));
- }
-
- Request.Builder builder = new Request.Builder()
- .headers(headers.build())
- .url(uri)
- .method(method, requestBody);
-
- Response response = httpClient.newCall(builder.build()).execute();
-
- LinkedMultiValueMap responseHeaders = new LinkedMultiValueMap<>();
-
- for (Map.Entry> entry : response.headers().toMultimap().entrySet()) {
- responseHeaders.put(entry.getKey(), entry.getValue());
- }
-
- this.helper.setResponse(response.code(), response.body().byteStream(),
- responseHeaders);
- context.setRouteHost(null); // prevent SimpleHostRoutingFilter from running
- return null;
- }
-}
-----
-
-The above filter translates Servlet request information into OkHttp3 request information, executes an HTTP request, then translates OkHttp3 reponse information to the Servlet response. WARNING: this filter might have bugs and not function correctly.
-
-==== How to Write a Post Filter
-
-Post filters typically manipulate the response. In the filter below, we add a random `UUID` as the `X-Foo` header. Other manipulations, such as transforming the response body, are much more complex and compute-intensive.
-
-[source,java]
-----
-public class AddResponseHeaderFilter extends ZuulFilter {
- @Override
- public String filterType() {
- return POST_TYPE;
- }
-
- @Override
- public int filterOrder() {
- return SEND_RESPONSE_FILTER_ORDER - 1;
- }
-
- @Override
- public boolean shouldFilter() {
- return true;
- }
-
- @Override
- public Object run() {
- RequestContext context = RequestContext.getCurrentContext();
- HttpServletResponse servletResponse = context.getResponse();
- servletResponse.addHeader("X-Foo", UUID.randomUUID().toString());
- return null;
- }
-}
-----
-
-==== How Zuul Errors Work
-
-If an exception is thrown during any portion of the Zuul filter lifecycle, the error filters are executed. The `SendErrorFilter` is only run if `RequestContext.getThrowable()` is not `null`. It then sets specific `javax.servlet.error.*` attributes in the request and forwards the request to the Spring Boot error page.
-
-==== Zuul Eager Application Context Loading
-
-Zuul internally uses Ribbon for calling the remote url's and Ribbon clients are by default lazily loaded up by Spring Cloud on first call.
-This behavior can be changed for Zuul using the following configuration and will result in the child Ribbon related Application contexts being eagerly loaded up at application startup time.
-
-.application.yml
-----
-zuul:
- ribbon:
- eager-load:
- enabled: true
-----
-
-== Polyglot support with Sidecar
-
-Do you have non-jvm languages you want to take advantage of Eureka, Ribbon and
-Config Server? The Spring Cloud Netflix Sidecar was inspired by
-https://github.com/Netflix/Prana[Netflix Prana]. It includes a simple http api
-to get all of the instances (ie host and port) for a given service. You can
-also proxy service calls through an embedded Zuul proxy which gets its route
-entries from Eureka. The Spring Cloud Config Server can be accessed directly
-via host lookup or through the Zuul Proxy. The non-jvm app should implement
-a health check so the Sidecar can report to eureka if the app is up or down.
-
-To include Sidecar in your project use the dependency with group `org.springframework.cloud`
-and artifact id `spring-cloud-netflix-sidecar`.
-
-To enable the Sidecar, create a Spring Boot application with `@EnableSidecar`.
-This annotation includes `@EnableCircuitBreaker`, `@EnableDiscoveryClient`,
-and `@EnableZuulProxy`. Run the resulting application on the same host as the
-non-jvm application.
-
-To configure the side car add `sidecar.port` and `sidecar.health-uri` to `application.yml`.
-The `sidecar.port` property is the port the non-jvm app is listening on. This
-is so the Sidecar can properly register the app with Eureka. The `sidecar.health-uri`
-is a uri accessible on the non-jvm app that mimicks a Spring Boot health
-indicator. It should return a json document like the following:
-
-.health-uri-document
-[source,json]
-----
-{
- "status":"UP"
-}
-----
-
-Here is an example application.yml for a Sidecar application:
-
-.application.yml
-[source,yaml]
-----
-server:
- port: 5678
-spring:
- application:
- name: sidecar
-
-sidecar:
- port: 8000
- health-uri: http://localhost:8000/health.json
-----
-
-The api for the `DiscoveryClient.getInstances()` method is `/hosts/{serviceId}`.
-Here is an example response for `/hosts/customers` that returns two instances on
-different hosts. This api is accessible to the non-jvm app (if the sidecar is
-on port 5678) at `http://localhost:5678/hosts/{serviceId}`.
-
-./hosts/customers
-[source,json]
-----
-[
- {
- "host": "myhost",
- "port": 9000,
- "uri": "http://myhost:9000",
- "serviceId": "CUSTOMERS",
- "secure": false
- },
- {
- "host": "myhost2",
- "port": 9000,
- "uri": "http://myhost2:9000",
- "serviceId": "CUSTOMERS",
- "secure": false
- }
-]
-----
-
-The Zuul proxy automatically adds routes for each service known in eureka to
-`/`, so the customers service is available at `/customers`. The
-Non-jvm app can access the customer service via `http://localhost:5678/customers`
-(assuming the sidecar is listening on port 5678).
-
-If the Config Server is registered with Eureka, non-jvm application can access
-it via the Zuul proxy. If the serviceId of the ConfigServer is `configserver`
-and the Sidecar is on port 5678, then it can be accessed at
-http://localhost:5678/configserver
-
-Non-jvm app can take advantage of the Config Server's ability to return YAML
-documents. For example, a call to http://sidecar.local.spring.io:5678/configserver/default-master.yml
-might result in a YAML document like the following
-
-[source,yaml]
-----
-eureka:
- client:
- serviceUrl:
- defaultZone: http://localhost:8761/eureka/
- password: password
-info:
- description: Spring Cloud Samples
- url: https://github.com/spring-cloud-samples
-----
-
-[[netflix-metrics]]
-== Metrics: Spectator, Servo, and Atlas
-
-When used together, Spectator/Servo and Atlas provide a near real-time operational insight platform.
-
-Spectator and Servo are Netflix's metrics collection libraries. Atlas is a Netflix metrics backend to manage dimensional time series data.
-
-Servo served Netflix for several years and is still usable, but is gradually being phased out in favor of Spectator, which is only designed to work with Java 8. Spring Cloud Netflix provides support for both, but Java 8 based applications are encouraged to use Spectator.
-
-=== Dimensional vs. Hierarchical Metrics
-
-Spring Boot Actuator metrics are hierarchical and metrics are separated only by name. These names often follow a naming convention that embeds key/value attribute pairs (dimensions) into the name separated by periods. Consider the following metrics for two endpoints, root and star-star:
-
-[source,json]
-----
-{
- "counter.status.200.root": 20,
- "counter.status.400.root": 3,
- "counter.status.200.star-star": 5,
-}
-----
-
-The first metric gives us a normalized count of successful requests against the root endpoint per unit of time. But what if the system had 20 endpoints and you want to get a count of successful requests against all the endpoints? Some hierarchical metrics backends would allow you to specify a wild card such as `counter.status.200.\*` that would read all 20 metrics and aggregate the results. Alternatively, you could provide a `HandlerInterceptorAdapter` that intercepts and records a metric like `counter.status.200.all` for all successful requests irrespective of the endpoint, but now you must write 20+1 different metrics. Similarly if you want to know the total number of successful requests for all endpoints in the service, you could specify a wild card such as `counter.status.2*.*`.
-
-Even in the presence of wildcarding support on a hierarchical metrics backend, naming consistency can be difficult. Specifically the position of these tags in the name string can slip with time, breaking queries. For example, suppose we add an additional dimension to the hierarchical metrics above for HTTP method. Then `counter.status.200.root` becomes `counter.status.200.method.get.root`, etc. Our `counter.status.200.*` suddenly no longer has the same semantic meaning. Furthermore, if the new dimension is not applied uniformly across the codebase, certain queries may become impossible. This can quickly get out of hand.
-
-Netflix metrics are tagged (a.k.a. dimensional). Each metric has a name, but this single named metric can contain multiple statistics and 'tag' key/value pairs that allows more querying flexibility. In fact, the statistics themselves are recorded in a special tag.
-
-Recorded with Netflix Servo or Spectator, a timer for the root endpoint described above contains 4 statistics per status code, where the count statistic is identical to Spring Boot Actuator's counter. In the event that we have encountered an HTTP 200 and 400 thus far, there will be 8 available data points:
-
-[source,json]
-----
-{
- "root(status=200,stastic=count)": 20,
- "root(status=200,stastic=max)": 0.7265630630000001,
- "root(status=200,stastic=totalOfSquares)": 0.04759702862580789,
- "root(status=200,stastic=totalTime)": 0.2093076914666667,
- "root(status=400,stastic=count)": 1,
- "root(status=400,stastic=max)": 0,
- "root(status=400,stastic=totalOfSquares)": 0,
- "root(status=400,stastic=totalTime)": 0,
-}
-----
-
-=== Default Metrics Collection
-
-Without any additional dependencies or configuration, a Spring Cloud based service will autoconfigure a Servo `MonitorRegistry` and begin collecting metrics on every Spring MVC request. By default, a Servo timer with the name `rest` will be recorded for each MVC request which is tagged with:
-
-1. HTTP method
-2. HTTP status (e.g. 200, 400, 500)
-3. URI (or "root" if the URI is empty), sanitized for Atlas
-4. The exception class name, if the request handler threw an exception
-5. The caller, if a request header with a key matching `netflix.metrics.rest.callerHeader` is set on the request. There is no default key for `netflix.metrics.rest.callerHeader`. You must add it to your application properties if you wish to collect caller information.
-
-Set the `netflix.metrics.rest.metricName` property to change the name of the metric from `rest` to a name you provide.
-
-If Spring AOP is enabled and `org.aspectj:aspectjweaver` is present on your runtime classpath, Spring Cloud will also collect metrics on every client call made with `RestTemplate`. A Servo timer with the name of `restclient` will be recorded for each MVC request which is tagged with:
-
-1. HTTP method
-2. HTTP status (e.g. 200, 400, 500), "CLIENT_ERROR" if the response returned null, or "IO_ERROR" if an `IOException` occurred during the execution of the `RestTemplate` method
-3. URI, sanitized for Atlas
-4. Client name
-
-WARNING: Avoid using hardcoded url parameters within `RestTemplate`. When targeting dynamic endpoints use URL variables. This will avoid potential "GC Overhead Limit Reached" issues where `ServoMonitorCache` treats each url as a unique key.
-
-[source,java,indent=0]
-----
-// recommended
-String orderid = "1";
-restTemplate.getForObject("http://testeurekabrixtonclient/orders/{orderid}", String.class, orderid)
-
-// avoid
-restTemplate.getForObject("http://testeurekabrixtonclient/orders/1", String.class)
-----
-
-[[netflix-metrics-spectator]]
-=== Metrics Collection: Spectator
-
-To enable Spectator metrics, include a dependency on `spring-boot-starter-spectator`:
-
-[source,xml]
-----
-
- org.springframework.cloud
- spring-cloud-starter-netflix-spectator
-
-----
-
-In Spectator parlance, a meter is a named, typed, and tagged configuration and a metric represents the value of a given meter at a point in time. Spectator meters are created and controlled by a registry, which currently has several different implementations. Spectator provides 4 meter types: counter, timer, gauge, and distribution summary.
-
-Spring Cloud Spectator integration configures an injectable `com.netflix.spectator.api.Registry` instance for you. Specifically, it configures a `ServoRegistry` instance in order to unify the collection of REST metrics and the exporting of metrics to the Atlas backend under a single Servo API. Practically, this means that your code may use a mixture of Servo monitors and Spectator meters and both will be scooped up by Spring Boot Actuator `MetricReader` instances and both will be shipped to the Atlas backend.
-
-==== Spectator Counter
-
-A counter is used to measure the rate at which some event is occurring.
-
-[source,java]
-----
-// create a counter with a name and a set of tags
-Counter counter = registry.counter("counterName", "tagKey1", "tagValue1", ...);
-counter.increment(); // increment when an event occurs
-counter.increment(10); // increment by a discrete amount
-----
-
-The counter records a single time-normalized statistic.
-
-==== Spectator Timer
-
-A timer is used to measure how long some event is taking. Spring Cloud automatically records timers for Spring MVC requests and conditionally `RestTemplate` requests, which can later be used to create dashboards for request related metrics like latency:
-
-.Request Latency
-image::https://raw.githubusercontent.com/spring-cloud/spring-cloud-netflix/{branch}/docs/src/main/asciidoc/images/RequestLatency.png[]
-
-[source,java]
-----
-// create a timer with a name and a set of tags
-Timer timer = registry.timer("timerName", "tagKey1", "tagValue1", ...);
-
-// execute an operation and time it at the same time
-T result = timer.record(() -> fooReturnsT());
-
-// alternatively, if you must manually record the time
-Long start = System.nanoTime();
-T result = fooReturnsT();
-timer.record(System.nanoTime() - start, TimeUnit.NANOSECONDS);
-----
-
-The timer simultaneously records 4 statistics: count, max, totalOfSquares, and totalTime. The count statistic will always match the single normalized value provided by a counter if you had called `increment()` once on the counter for each time you recorded a timing, so it is rarely necessary to count and time separately for a single operation.
-
-For link:https://github.com/Netflix/spectator/wiki/Timer-Usage#longtasktimer[long running operations], Spectator provides a special `LongTaskTimer`.
-
-==== Spectator Gauge
-
-Gauges are used to determine some current value like the size of a queue or number of threads in a running state. Since gauges are sampled, they provide no information about how these values fluctuate between samples.
-
-The normal use of a gauge involves registering the gauge once in initialization with an id, a reference to the object to be sampled, and a function to get or compute a numeric value based on the object. The reference to the object is passed in separately and the Spectator registry will keep a weak reference to the object. If the object is garbage collected, then Spectator will automatically drop the registration. See link:https://github.com/Netflix/spectator/wiki/Gauge-Usage#using-lambda[the note] in Spectator's documentation about potential memory leaks if this API is misused.
-
-[source,java]
-----
-// the registry will automatically sample this gauge periodically
-registry.gauge("gaugeName", pool, Pool::numberOfRunningThreads);
-
-// manually sample a value in code at periodic intervals -- last resort!
-registry.gauge("gaugeName", Arrays.asList("tagKey1", "tagValue1", ...), 1000);
-----
-
-==== Spectator Distribution Summaries
-
-A distribution summary is used to track the distribution of events. It is similar to a timer, but more general in that the size does not have to be a period of time. For example, a distribution summary could be used to measure the payload sizes of requests hitting a server.
-
-[source,java]
-----
-// the registry will automatically sample this gauge periodically
-DistributionSummary ds = registry.distributionSummary("dsName", "tagKey1", "tagValue1", ...);
-ds.record(request.sizeInBytes());
-----
-
-[[netflix-metrics-servo]]
-=== Metrics Collection: Servo
-
-WARNING: If your code is compiled on Java 8, please use Spectator instead of Servo as Spectator is destined to replace Servo entirely in the long term.
-
-In Servo parlance, a monitor is a named, typed, and tagged configuration and a metric represents the value of a given monitor at a point in time. Servo monitors are logically equivalent to Spectator meters. Servo monitors are created and controlled by a `MonitorRegistry`. In spite of the above warning, Servo does have a link:https://github.com/Netflix/servo/wiki/Getting-Started[wider array] of monitor options than Spectator has meters.
-
-Spring Cloud integration configures an injectable `com.netflix.servo.MonitorRegistry` instance for you. Once you have created the appropriate `Monitor` type in Servo, the process of recording data is wholly similar to Spectator.
-
-==== Creating Servo Monitors
-
-If you are using the Servo `MonitorRegistry` instance provided by Spring Cloud (specifically, an instance of `DefaultMonitorRegistry`), Servo provides convenience classes for retrieving link:https://github.com/Netflix/spectator/wiki/Servo-Comparison#dynamiccounter[counters] and link:https://github.com/Netflix/spectator/wiki/Servo-Comparison#dynamictimer[timers]. These convenience classes ensure that only one `Monitor` is registered for each unique combination of name and tags.
-
-To manually create a Monitor type in Servo, especially for the more exotic monitor types for which convenience methods are not provided, instantiate the appropriate type by providing a `MonitorConfig` instance:
-
-[source,java]
-----
-MonitorConfig config = MonitorConfig.builder("timerName").withTag("tagKey1", "tagValue1").build();
-
-// somewhere we should cache this Monitor by MonitorConfig
-Timer timer = new BasicTimer(config);
-monitorRegistry.register(timer);
-----
-
-[[netflix-metrics-atlas]]
-=== Metrics Backend: Atlas
-
-Atlas was developed by Netflix to manage dimensional time series data for near real-time operational insight. Atlas features in-memory data storage, allowing it to gather and report very large numbers of metrics, very quickly.
-
-Atlas captures operational intelligence. Whereas business intelligence is data gathered for analyzing trends over time, operational intelligence provides a picture of what is currently happening within a system.
-
-Spring Cloud provides a `spring-cloud-starter-netflix-atlas` that has all the dependencies you need. Then just annotate your Spring Boot application with `@EnableAtlas` and provide a location for your running Atlas server with the `netflix.atlas.uri` property.
-
-==== Global tags
-
-Spring Cloud enables you to add tags to every metric sent to the Atlas backend. Global tags can be used to separate metrics by application name, environment, region, etc.
-
-Each bean implementing `AtlasTagProvider` will contribute to the global tag list:
-
-[source,java]
-----
-@Bean
-AtlasTagProvider atlasCommonTags(
- @Value("${spring.application.name}") String appName) {
- return () -> Collections.singletonMap("app", appName);
-}
-----
-
-==== Using Atlas
-
-To bootstrap a in-memory standalone Atlas instance:
-
-[source,bash]
-----
-$ curl -LO https://github.com/Netflix/atlas/releases/download/v1.4.2/atlas-1.4.2-standalone.jar
-$ java -jar atlas-1.4.2-standalone.jar
-----
-
-TIP: An Atlas standalone node running on an r3.2xlarge (61GB RAM) can handle roughly 2 million metrics per minute for a given 6 hour window.
-
-Once running and you have collected a handful of metrics, verify that your setup is correct by listing tags on the Atlas server:
-
-[source,bash]
-----
-$ curl http://ATLAS/api/v1/tags
-----
-
-TIP: After executing several requests against your service, you can gather some very basic information on the request latency of every request by pasting the following url in your browser: `http://ATLAS/api/v1/graph?q=name,rest,:eq,:avg`
-
-The Atlas wiki contains a link:https://github.com/Netflix/atlas/wiki/Single-Line[compilation of sample queries] for various scenarios.
-
-Make sure to check out the link:https://github.com/Netflix/atlas/wiki/Alerting-Philosophy[alerting philosophy] and docs on using link:https://github.com/Netflix/atlas/wiki/DES[double exponential smoothing] to generate dynamic alert thresholds.
-
-[[retrying-failed-requests]]
-=== Retrying Failed Requests
-
-Spring Cloud Netflix offers a variety of ways to make HTTP requests. You can use a load balanced
-`RestTemplate`, Ribbon, or Feign. No matter how you choose to your HTTP requests, there is always
-a chance the request may fail. When a request fails you may want to have the request retried
-automatically. To accomplish this when using Sping Cloud Netflix you need to include
-https://github.com/spring-projects/spring-retry[Spring Retry] on your application's classpath.
-When Spring Retry is present load balanced `RestTemplates`, Feign, and Zuul will automatically
-retry any failed requests (assuming you configuration allows it to).
-
-==== BackOff Policies
-By default no backoff policy is used when retrying requests. If you would like to configure
-a backoff policy you will need to create a bean of type `LoadBalancedBackOffPolicyFactory`
-which will be used to create a `BackOffPolicy` for a given service.
-
-[source,java,indent=0]
-----
-@Configuration
-public class MyConfiguration {
- @Bean
- LoadBalancedBackOffPolicyFactory backOffPolciyFactory() {
- return new LoadBalancedBackOffPolicyFactory() {
- @Override
- public BackOffPolicy createBackOffPolicy(String service) {
- return new ExponentialBackOffPolicy();
- }
- };
- }
-}
-----
-
-==== Configuration
-
-Anytime Ribbon is used with Spring Retry you can control the retry functionality by configuring
-certain Ribbon properties. The properties you can use are
-`client.ribbon.MaxAutoRetries`, `client.ribbon.MaxAutoRetriesNextServer`, and
-`client.ribbon.OkToRetryOnAllOperations`. See the https://github.com/Netflix/ribbon/wiki/Getting-Started#the-properties-file-sample-clientproperties[Ribbon documentation]
-for a description of what there properties do.
-
-WARNING: Enabling `client.ribbon.OkToRetryOnAllOperations` includes retring POST requests wich can have a impact
-on the server's resources due to the buffering of the request's body.
-
-In addition you may want to retry requests when certain status codes are returned in the
-response. You can list the response codes you would like the Ribbon client to retry using the
- property `clientName.ribbon.retryableStatusCodes`. For example
-
-[source,yaml]
-----
-clientName:
- ribbon:
- retryableStatusCodes: 404,502
-----
-
-You can also create a bean of type `LoadBalancedRetryPolicy` and implement the `retryableStatusCode`
-method to determine whether you want to retry a request given the status code.
-
-
-
-==== Zuul
-
-You can turn off Zuul's retry functionality by setting `zuul.retryable` to `false`. You
-can also disable retry functionality on route by route basis by setting
-`zuul.routes.routename.retryable` to `false`.
-
-== HTTP Clients
-
-Spring Cloud Netflix will automatically create the HTTP client used by Ribbon, Feign, and
-Zuul for you. However you can also provide your own HTTP clients customized how you please
-yourself. To do this you can either create a bean of type `ClosableHttpClient` if you
-are using the Apache Http Cient, or `OkHttpClient` if you are using OK HTTP.
-
-NOTE: When you create your own HTTP client you are also responsible for implementing
-the correct connection management strategies for these clients. Doing this improperly
-can result in resource management issues.
diff --git a/eclipse/eclipse-code-formatter.xml b/eclipse/eclipse-code-formatter.xml
deleted file mode 100644
index 4694d7f2..00000000
--- a/eclipse/eclipse-code-formatter.xml
+++ /dev/null
@@ -1,295 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/eclipse/org.eclipse.jdt.core.prefs b/eclipse/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 63d59166..00000000
--- a/eclipse/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,389 +0,0 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.codeComplete.argumentPrefixes=
-org.eclipse.jdt.core.codeComplete.argumentSuffixes=
-org.eclipse.jdt.core.codeComplete.fieldPrefixes=
-org.eclipse.jdt.core.codeComplete.fieldSuffixes=
-org.eclipse.jdt.core.codeComplete.localPrefixes=
-org.eclipse.jdt.core.codeComplete.localSuffixes=
-org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
-org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
-org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
-org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.doc.comment.support=enabled
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
-org.eclipse.jdt.core.compiler.problem.deadCode=warning
-org.eclipse.jdt.core.compiler.problem.deprecation=warning
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
-org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
-org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
-org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=default
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag
-org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
-org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nullReference=ignore
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
-org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
-org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
-org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=warning
-org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
-org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
-org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.6
-org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
-org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
-org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
-org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
-org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_after_package=1
-org.eclipse.jdt.core.formatter.blank_lines_before_field=0
-org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
-org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
-org.eclipse.jdt.core.formatter.blank_lines_before_method=1
-org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
-org.eclipse.jdt.core.formatter.blank_lines_before_package=0
-org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
-org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
-org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
-org.eclipse.jdt.core.formatter.comment.format_block_comments=true
-org.eclipse.jdt.core.formatter.comment.format_header=false
-org.eclipse.jdt.core.formatter.comment.format_html=true
-org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
-org.eclipse.jdt.core.formatter.comment.format_line_comments=true
-org.eclipse.jdt.core.formatter.comment.format_source_code=false
-org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
-org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
-org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=do not insert
-org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
-org.eclipse.jdt.core.formatter.comment.line_length=90
-org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
-org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
-org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
-org.eclipse.jdt.core.formatter.compact_else_if=true
-org.eclipse.jdt.core.formatter.continuation_indentation=2
-org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
-org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
-org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
-org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
-org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_empty_lines=false
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
-org.eclipse.jdt.core.formatter.indentation.size=8
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
-org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
-org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
-org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.join_lines_in_comments=true
-org.eclipse.jdt.core.formatter.join_wrapped_lines=true
-org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.lineSplit=90
-org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
-org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
-org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
-org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
-org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
-org.eclipse.jdt.core.formatter.tabulation.char=tab
-org.eclipse.jdt.core.formatter.tabulation.size=4
-org.eclipse.jdt.core.formatter.use_on_off_tags=false
-org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
-org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
-org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
-org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
diff --git a/eclipse/org.eclipse.jdt.ui.prefs b/eclipse/org.eclipse.jdt.ui.prefs
deleted file mode 100644
index fb4753fe..00000000
--- a/eclipse/org.eclipse.jdt.ui.prefs
+++ /dev/null
@@ -1,125 +0,0 @@
-cleanup.add_default_serial_version_id=true
-cleanup.add_generated_serial_version_id=false
-cleanup.add_missing_annotations=true
-cleanup.add_missing_deprecated_annotations=true
-cleanup.add_missing_methods=false
-cleanup.add_missing_nls_tags=false
-cleanup.add_missing_override_annotations=true
-cleanup.add_missing_override_annotations_interface_methods=true
-cleanup.add_serial_version_id=false
-cleanup.always_use_blocks=true
-cleanup.always_use_parentheses_in_expressions=false
-cleanup.always_use_this_for_non_static_field_access=true
-cleanup.always_use_this_for_non_static_method_access=false
-cleanup.convert_functional_interfaces=false
-cleanup.convert_to_enhanced_for_loop=false
-cleanup.correct_indentation=false
-cleanup.format_source_code=true
-cleanup.format_source_code_changes_only=false
-cleanup.insert_inferred_type_arguments=false
-cleanup.make_local_variable_final=false
-cleanup.make_parameters_final=false
-cleanup.make_private_fields_final=false
-cleanup.make_type_abstract_if_missing_method=false
-cleanup.make_variable_declarations_final=false
-cleanup.never_use_blocks=false
-cleanup.never_use_parentheses_in_expressions=true
-cleanup.organize_imports=true
-cleanup.qualify_static_field_accesses_with_declaring_class=false
-cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-cleanup.qualify_static_member_accesses_with_declaring_class=true
-cleanup.qualify_static_method_accesses_with_declaring_class=false
-cleanup.remove_private_constructors=true
-cleanup.remove_redundant_type_arguments=true
-cleanup.remove_trailing_whitespaces=true
-cleanup.remove_trailing_whitespaces_all=true
-cleanup.remove_trailing_whitespaces_ignore_empty=false
-cleanup.remove_unnecessary_casts=true
-cleanup.remove_unnecessary_nls_tags=false
-cleanup.remove_unused_imports=true
-cleanup.remove_unused_local_variables=false
-cleanup.remove_unused_private_fields=true
-cleanup.remove_unused_private_members=false
-cleanup.remove_unused_private_methods=true
-cleanup.remove_unused_private_types=true
-cleanup.sort_members=false
-cleanup.sort_members_all=false
-cleanup.use_anonymous_class_creation=false
-cleanup.use_blocks=true
-cleanup.use_blocks_only_for_return_and_throw=false
-cleanup.use_lambda=true
-cleanup.use_parentheses_in_expressions=false
-cleanup.use_this_for_non_static_field_access=true
-cleanup.use_this_for_non_static_field_access_only_if_necessary=false
-cleanup.use_this_for_non_static_method_access=false
-cleanup.use_this_for_non_static_method_access_only_if_necessary=true
-cleanup.use_type_arguments=false
-cleanup_profile=_Spring Cloud Cleanup Conventions
-cleanup_settings_version=2
-eclipse.preferences.version=1
-editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
-formatter_profile=_Spring Cloud Java Conventions
-formatter_settings_version=12
-org.eclipse.jdt.ui.exception.name=e
-org.eclipse.jdt.ui.gettersetter.use.is=false
-org.eclipse.jdt.ui.ignorelowercasenames=true
-org.eclipse.jdt.ui.importorder=java;javax;org;com;\#;
-org.eclipse.jdt.ui.javadoc=true
-org.eclipse.jdt.ui.keywordthis=false
-org.eclipse.jdt.ui.ondemandthreshold=9999
-org.eclipse.jdt.ui.overrideannotation=true
-org.eclipse.jdt.ui.staticondemandthreshold=9999
-org.eclipse.jdt.ui.text.custom_code_templates=/**\n * @return the ${bare_field_name}\n *//**\n * @param ${param} the ${bare_field_name} to set\n *//**\n * ${tags}\n *//*\n * Copyright 2013-2015 the original author or authors.\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http\://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *//**\n * @author ${user}\n *//**\n * \n *//**\n * ${tags}\n *//* (non-Javadoc)\n * ${see_to_overridden}\n *//**\n * ${tags}\n * ${see_to_target}\n */${filecomment}\n\n${package_declaration}\n${typecomment}\n${type_declaration}\n\n\n\n// ${todo} Auto-generated catch block\nthrow new UnsupportedOperationException("Auto-generated method stub", ${exception_var});// ${todo} Auto-generated method stub\nthrow new UnsupportedOperationException("Auto-generated method stub");${body_statement}\n// ${todo} Auto-generated constructor stubreturn ${field};${field} \= ${param};
-sp_cleanup.add_default_serial_version_id=true
-sp_cleanup.add_generated_serial_version_id=false
-sp_cleanup.add_missing_annotations=true
-sp_cleanup.add_missing_deprecated_annotations=true
-sp_cleanup.add_missing_methods=false
-sp_cleanup.add_missing_nls_tags=false
-sp_cleanup.add_missing_override_annotations=true
-sp_cleanup.add_missing_override_annotations_interface_methods=true
-sp_cleanup.add_serial_version_id=false
-sp_cleanup.always_use_blocks=true
-sp_cleanup.always_use_parentheses_in_expressions=true
-sp_cleanup.always_use_this_for_non_static_field_access=true
-sp_cleanup.always_use_this_for_non_static_method_access=false
-sp_cleanup.convert_to_enhanced_for_loop=false
-sp_cleanup.correct_indentation=false
-sp_cleanup.format_source_code=true
-sp_cleanup.format_source_code_changes_only=false
-sp_cleanup.make_local_variable_final=false
-sp_cleanup.make_parameters_final=false
-sp_cleanup.make_private_fields_final=false
-sp_cleanup.make_type_abstract_if_missing_method=false
-sp_cleanup.make_variable_declarations_final=false
-sp_cleanup.never_use_blocks=false
-sp_cleanup.never_use_parentheses_in_expressions=false
-sp_cleanup.on_save_use_additional_actions=true
-sp_cleanup.organize_imports=true
-sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=true
-sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
-sp_cleanup.remove_private_constructors=true
-sp_cleanup.remove_trailing_whitespaces=true
-sp_cleanup.remove_trailing_whitespaces_all=true
-sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
-sp_cleanup.remove_unnecessary_casts=true
-sp_cleanup.remove_unnecessary_nls_tags=false
-sp_cleanup.remove_unused_imports=true
-sp_cleanup.remove_unused_local_variables=false
-sp_cleanup.remove_unused_private_fields=true
-sp_cleanup.remove_unused_private_members=false
-sp_cleanup.remove_unused_private_methods=true
-sp_cleanup.remove_unused_private_types=true
-sp_cleanup.sort_members=false
-sp_cleanup.sort_members_all=false
-sp_cleanup.use_blocks=true
-sp_cleanup.use_blocks_only_for_return_and_throw=false
-sp_cleanup.use_parentheses_in_expressions=false
-sp_cleanup.use_this_for_non_static_field_access=true
-sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=false
-sp_cleanup.use_this_for_non_static_method_access=false
-sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/pom.xml b/pom.xml
index e95e37b6..c69a9cc9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,11 +2,11 @@
4.0.0
- spring-cloud-netflix
+ spring-cloud-openfeign2.0.0.BUILD-SNAPSHOTpom
- Spring Cloud Netflix
- Spring Cloud Netflix
+ Spring Cloud OpenFeign
+ Spring Cloud OpenFeignorg.springframework.cloudspring-cloud-build
@@ -14,20 +14,16 @@
- https://github.com/spring-cloud/spring-cloud-netflix
- scm:git:git://github.com/spring-cloud/spring-cloud-netflix.git
- scm:git:ssh://git@github.com/spring-cloud/spring-cloud-netflix.git
+ https://github.com/spring-cloud/spring-cloud-openfeign
+ scm:git:git://github.com/spring-cloud/spring-cloud-openfeign.git
+ scm:git:ssh://git@github.com/spring-cloud/spring-cloud-openfeign.gitHEAD
- netflix${basedir}2.7.32.0.0.BUILD-SNAPSHOT
- 2.0.0.BUILD-SNAPSHOT
- Elmhurst.BUILD-SNAPSHOT
-
- 1.2.0.RELEASE
+ 2.0.0.BUILD-SNAPSHOT3.6.1
@@ -71,12 +67,6 @@
-
- org.springframework.cloud
- spring-cloud-netflix-hystrix-contract
- ${project.version}
- test
- org.springframework.cloudspring-cloud-netflix-dependencies
@@ -97,27 +87,6 @@
test${spring-cloud-commons.version}
-
- org.springframework.cloud
- spring-cloud-config-dependencies
- ${spring-cloud-config.version}
- pom
- import
-
-
- org.springframework.cloud
- spring-cloud-stream-dependencies
- ${spring-cloud-stream.version}
- pom
- import
-
-
- org.springframework.cloud
- spring-cloud-contract-dependencies
- ${donotreplacespring-cloud-contract.version}
- pom
- import
- com.fasterxml.jackson.dataformatjackson-dataformat-smile
@@ -126,21 +95,9 @@
- spring-cloud-netflix-dependencies
- spring-cloud-netflix-archaius
-
-
- spring-cloud-netflix-core
- spring-cloud-netflix-hystrix-dashboard
- spring-cloud-netflix-hystrix-stream
- spring-cloud-netflix-eureka-client
- spring-cloud-netflix-eureka-server
- spring-cloud-netflix-turbine
- spring-cloud-netflix-turbine-stream
- spring-cloud-netflix-sidecar
- spring-cloud-netflix-zuul
- spring-cloud-netflix-ribbon
- spring-cloud-starter-netflix
+ spring-cloud-openfeign-dependencies
+ spring-cloud-openfeign-core
+ spring-cloud-starter-openfeigndocs
diff --git a/scripts/build.sh b/scripts/build.sh
deleted file mode 100755
index fe43ccda..00000000
--- a/scripts/build.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-
-(cd spring-cloud-netflix-hystrix-contract && ../mvnw clean install -B -Pdocs ${@})
-./mvnw clean install -B -Pdocs ${@}
diff --git a/scripts/runAcceptanceTests.sh b/scripts/runAcceptanceTests.sh
deleted file mode 100755
index 97a9d6bf..00000000
--- a/scripts/runAcceptanceTests.sh
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/bash
-
-set -o errexit
-
-mkdir -p target
-
-SCRIPT_URL="https://raw.githubusercontent.com/spring-cloud-samples/brewery/master/runAcceptanceTests.sh"
-AT_WHAT_TO_TEST="EUREKA"
-
-cd target
-
-curl "${SCRIPT_URL}" --output runAcceptanceTests.sh
-
-chmod +x runAcceptanceTests.sh
-
-echo "Killing all running apps"
-./runAcceptanceTests.sh -t "${AT_WHAT_TO_TEST}" --killnow
-
-./runAcceptanceTests.sh -t "${AT_WHAT_TO_TEST}" --killattheend
-
-SCRIPT_URL="https://raw.githubusercontent.com/spring-cloud-samples/tests/master/scripts/runTests.sh"
-
-curl "${SCRIPT_URL}" --output runIntegrationTests.sh
-
-chmod +x runIntegrationTests.sh
-
-./runIntegrationTests.sh
diff --git a/spring-cloud-netflix-archaius/pom.xml b/spring-cloud-netflix-archaius/pom.xml
deleted file mode 100644
index bfef5c55..00000000
--- a/spring-cloud-netflix-archaius/pom.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
- 4.0.0
-
- spring-cloud-netflix
- org.springframework.cloud
- 2.0.0.BUILD-SNAPSHOT
- ..
-
-
-
- spring-cloud-netflix-archaius
- jar
- Spring Cloud Netflix Archaius
- Spring Cloud Netflix Archaius
-
- ${basedir}/..
-
-
-
-
- org.springframework.boot
- spring-boot-starter-actuator
- true
-
-
- org.springframework.cloud
- spring-cloud-context
- true
-
-
- com.netflix.archaius
- archaius-core
- true
-
-
- commons-configuration
- commons-configuration
- true
-
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
-
-
diff --git a/spring-cloud-netflix-archaius/src/main/java/org/springframework/cloud/netflix/archaius/ArchaiusAutoConfiguration.java b/spring-cloud-netflix-archaius/src/main/java/org/springframework/cloud/netflix/archaius/ArchaiusAutoConfiguration.java
deleted file mode 100644
index b04a7231..00000000
--- a/spring-cloud-netflix-archaius/src/main/java/org/springframework/cloud/netflix/archaius/ArchaiusAutoConfiguration.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * Copyright 2013-2015 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.archaius;
-
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import javax.annotation.PreDestroy;
-
-import org.apache.commons.configuration.AbstractConfiguration;
-import org.apache.commons.configuration.ConfigurationBuilder;
-import org.apache.commons.configuration.EnvironmentConfiguration;
-import org.apache.commons.configuration.SystemConfiguration;
-import org.apache.commons.configuration.event.ConfigurationEvent;
-import org.apache.commons.configuration.event.ConfigurationListener;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnEnabledEndpoint;
-import org.springframework.boot.actuate.health.Health;
-import org.springframework.boot.autoconfigure.AutoConfigureOrder;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.cloud.context.environment.EnvironmentChangeEvent;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationListener;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.core.Ordered;
-import org.springframework.core.env.ConfigurableEnvironment;
-import org.springframework.core.env.Environment;
-import org.springframework.util.ReflectionUtils;
-
-import com.netflix.config.AggregatedConfiguration;
-import com.netflix.config.ConcurrentCompositeConfiguration;
-import com.netflix.config.ConfigurationManager;
-import com.netflix.config.DeploymentContext;
-import com.netflix.config.DynamicProperty;
-import com.netflix.config.DynamicPropertyFactory;
-import com.netflix.config.DynamicURLConfiguration;
-
-import static com.netflix.config.ConfigurationManager.APPLICATION_PROPERTIES;
-import static com.netflix.config.ConfigurationManager.DISABLE_DEFAULT_ENV_CONFIG;
-import static com.netflix.config.ConfigurationManager.DISABLE_DEFAULT_SYS_CONFIG;
-import static com.netflix.config.ConfigurationManager.ENV_CONFIG_NAME;
-import static com.netflix.config.ConfigurationManager.SYS_CONFIG_NAME;
-import static com.netflix.config.ConfigurationManager.URL_CONFIG_NAME;
-
-/**
- * @author Spencer Gibb
- */
-@Configuration
-@ConditionalOnClass({ ConcurrentCompositeConfiguration.class,
- ConfigurationBuilder.class })
-@AutoConfigureOrder(Ordered.HIGHEST_PRECEDENCE)
-public class ArchaiusAutoConfiguration {
-
- private static final Log log = LogFactory.getLog(ArchaiusAutoConfiguration.class);
-
- private static final AtomicBoolean initialized = new AtomicBoolean(false);
-
- @Autowired
- private ConfigurableEnvironment env;
-
- @Autowired(required = false)
- private List externalConfigurations = new ArrayList<>();
-
- private static DynamicURLConfiguration defaultURLConfig;
-
- @PreDestroy
- public void close() {
- if (defaultURLConfig != null) {
- defaultURLConfig.stopLoading();
- }
- setStatic(ConfigurationManager.class, "instance", null);
- setStatic(ConfigurationManager.class, "customConfigurationInstalled", false);
- setStatic(DynamicPropertyFactory.class, "config", null);
- setStatic(DynamicPropertyFactory.class, "initializedWithDefaultConfig", false);
- setStatic(DynamicProperty.class, "dynamicPropertySupportImpl", null);
- initialized.compareAndSet(true, false);
- }
-
- @Bean
- public static ConfigurableEnvironmentConfiguration configurableEnvironmentConfiguration(ConfigurableEnvironment env,
- ApplicationContext context) {
- Map abstractConfigurationMap = context.getBeansOfType(AbstractConfiguration.class);
- List externalConfigurations = new ArrayList<>(abstractConfigurationMap.values());
- ConfigurableEnvironmentConfiguration envConfig = new ConfigurableEnvironmentConfiguration(env);
- configureArchaius(envConfig, env, externalConfigurations);
- return envConfig;
- }
-
- @Configuration
- @ConditionalOnClass(Health.class)
- protected static class ArchaiusEndpointConfiguration {
- @Bean
- @ConditionalOnEnabledEndpoint
- protected ArchaiusEndpoint archaiusEndpoint() {
- return new ArchaiusEndpoint();
- }
- }
-
- @Configuration
- @ConditionalOnProperty(value = "archaius.propagate.environmentChangedEvent", matchIfMissing = true)
- @ConditionalOnClass(EnvironmentChangeEvent.class)
- protected static class PropagateEventsConfiguration
- implements ApplicationListener {
- @Autowired
- private Environment env;
-
- @Override
- public void onApplicationEvent(EnvironmentChangeEvent event) {
- AbstractConfiguration manager = ConfigurationManager.getConfigInstance();
- for (String key : event.getKeys()) {
- for (ConfigurationListener listener : manager
- .getConfigurationListeners()) {
- Object source = event.getSource();
- // TODO: Handle add vs set vs delete?
- int type = AbstractConfiguration.EVENT_SET_PROPERTY;
- String value = this.env.getProperty(key);
- boolean beforeUpdate = false;
- listener.configurationChanged(new ConfigurationEvent(source, type,
- key, value, beforeUpdate));
- }
- }
- }
- }
-
- protected static void configureArchaius(ConfigurableEnvironmentConfiguration envConfig, ConfigurableEnvironment env, List externalConfigurations) {
- if (initialized.compareAndSet(false, true)) {
- String appName = env.getProperty("spring.application.name");
- if (appName == null) {
- appName = "application";
- log.warn("No spring.application.name found, defaulting to 'application'");
- }
- System.setProperty(DeploymentContext.ContextKey.appId.getKey(), appName);
-
- ConcurrentCompositeConfiguration config = new ConcurrentCompositeConfiguration();
-
- // support to add other Configurations (Jdbc, DynamoDb, Zookeeper, jclouds,
- // etc...)
- if (externalConfigurations != null) {
- for (AbstractConfiguration externalConfig : externalConfigurations) {
- config.addConfiguration(externalConfig);
- }
- }
- config.addConfiguration(envConfig,
- ConfigurableEnvironmentConfiguration.class.getSimpleName());
-
- defaultURLConfig = new DynamicURLConfiguration();
- try {
- config.addConfiguration(defaultURLConfig, URL_CONFIG_NAME);
- }
- catch (Throwable ex) {
- log.error("Cannot create config from " + defaultURLConfig, ex);
- }
-
- // TODO: sys/env above urls?
- if (!Boolean.getBoolean(DISABLE_DEFAULT_SYS_CONFIG)) {
- SystemConfiguration sysConfig = new SystemConfiguration();
- config.addConfiguration(sysConfig, SYS_CONFIG_NAME);
- }
- if (!Boolean.getBoolean(DISABLE_DEFAULT_ENV_CONFIG)) {
- EnvironmentConfiguration environmentConfiguration = new EnvironmentConfiguration();
- config.addConfiguration(environmentConfiguration, ENV_CONFIG_NAME);
- }
-
- ConcurrentCompositeConfiguration appOverrideConfig = new ConcurrentCompositeConfiguration();
- config.addConfiguration(appOverrideConfig, APPLICATION_PROPERTIES);
- config.setContainerConfigurationIndex(
- config.getIndexOfConfiguration(appOverrideConfig));
-
- addArchaiusConfiguration(config);
- }
- else {
- // TODO: reinstall ConfigurationManager
- log.warn(
- "Netflix ConfigurationManager has already been installed, unable to re-install");
- }
- }
-
- private static void addArchaiusConfiguration(ConcurrentCompositeConfiguration config) {
- if (ConfigurationManager.isConfigurationInstalled()) {
- AbstractConfiguration installedConfiguration = ConfigurationManager
- .getConfigInstance();
- if (installedConfiguration instanceof ConcurrentCompositeConfiguration) {
- ConcurrentCompositeConfiguration configInstance = (ConcurrentCompositeConfiguration) installedConfiguration;
- configInstance.addConfiguration(config);
- }
- else {
- installedConfiguration.append(config);
- if (!(installedConfiguration instanceof AggregatedConfiguration)) {
- log.warn(
- "Appending a configuration to an existing non-aggregated installed configuration will have no effect");
- }
- }
- }
- else {
- ConfigurationManager.install(config);
- }
- }
-
- private static void setStatic(Class> type, String name, Object value) {
- // Hack a private static field
- Field field = ReflectionUtils.findField(type, name);
- ReflectionUtils.makeAccessible(field);
- ReflectionUtils.setField(field, null, value);
- }
-
-}
diff --git a/spring-cloud-netflix-archaius/src/main/java/org/springframework/cloud/netflix/archaius/ArchaiusDelegatingProxyUtils.java b/spring-cloud-netflix-archaius/src/main/java/org/springframework/cloud/netflix/archaius/ArchaiusDelegatingProxyUtils.java
deleted file mode 100644
index a28507b9..00000000
--- a/spring-cloud-netflix-archaius/src/main/java/org/springframework/cloud/netflix/archaius/ArchaiusDelegatingProxyUtils.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2013-2014 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.archaius;
-
-import org.apache.commons.configuration.AbstractConfiguration;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ConfigurableApplicationContext;
-
-import com.netflix.config.ConfigurationManager;
-
-/**
- * @author Dave Syer
- */
-public class ArchaiusDelegatingProxyUtils {
-
- public static String APPLICATION_CONTEXT = ApplicationContext.class.getName();
-
- public static T getNamedInstance(Class type, String name) {
- ApplicationContext context = (ApplicationContext) ConfigurationManager
- .getConfigInstance().getProperty(APPLICATION_CONTEXT);
- return context != null && context.containsBean(name) ? context
- .getBean(name, type) : null;
- }
-
- public static T getInstanceWithPrefix(Class type, String prefix) {
- String name = prefix + type.getSimpleName();
- return getNamedInstance(type, name);
- }
-
- public static void addApplicationContext(ConfigurableApplicationContext context) {
- AbstractConfiguration config = ConfigurationManager.getConfigInstance();
- config.clearProperty(APPLICATION_CONTEXT);
- config.setProperty(APPLICATION_CONTEXT, context);
- }
-
-}
diff --git a/spring-cloud-netflix-archaius/src/main/java/org/springframework/cloud/netflix/archaius/ArchaiusEndpoint.java b/spring-cloud-netflix-archaius/src/main/java/org/springframework/cloud/netflix/archaius/ArchaiusEndpoint.java
deleted file mode 100644
index e77114da..00000000
--- a/spring-cloud-netflix-archaius/src/main/java/org/springframework/cloud/netflix/archaius/ArchaiusEndpoint.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2013-2014 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.archaius;
-
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.commons.configuration.AbstractConfiguration;
-import org.apache.commons.configuration.Configuration;
-import org.apache.commons.configuration.EnvironmentConfiguration;
-import org.apache.commons.configuration.SystemConfiguration;
-import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
-import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
-
-import com.netflix.config.ConcurrentCompositeConfiguration;
-import com.netflix.config.ConfigurationManager;
-
-/**
- * @author Dave Syer
- */
-@Endpoint(id = "archaius")
-public class ArchaiusEndpoint {
-
- @ReadOperation
- public Map invoke() {
- Map map = new LinkedHashMap<>();
- AbstractConfiguration config = ConfigurationManager.getConfigInstance();
- if (config instanceof ConcurrentCompositeConfiguration) {
- ConcurrentCompositeConfiguration composite = (ConcurrentCompositeConfiguration) config;
- for (Configuration item : composite.getConfigurations()) {
- append(map, item);
- }
- }
- else {
- append(map, config);
- }
- return map;
- }
-
- private void append(Map map, Configuration config) {
- if (config instanceof ConfigurableEnvironmentConfiguration) {
- return;
- }
- if (config instanceof SystemConfiguration) {
- return;
- }
- if (config instanceof EnvironmentConfiguration) {
- return;
- }
- for (Iterator iter = config.getKeys(); iter.hasNext();) {
- String key = iter.next();
- map.put(key, config.getProperty(key));
- }
- }
-
-}
diff --git a/spring-cloud-netflix-archaius/src/main/java/org/springframework/cloud/netflix/archaius/ConfigurableEnvironmentConfiguration.java b/spring-cloud-netflix-archaius/src/main/java/org/springframework/cloud/netflix/archaius/ConfigurableEnvironmentConfiguration.java
deleted file mode 100644
index a2419d78..00000000
--- a/spring-cloud-netflix-archaius/src/main/java/org/springframework/cloud/netflix/archaius/ConfigurableEnvironmentConfiguration.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright 2013-2015 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.archaius;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.configuration.AbstractConfiguration;
-import org.springframework.core.env.CompositePropertySource;
-import org.springframework.core.env.ConfigurableEnvironment;
-import org.springframework.core.env.EnumerablePropertySource;
-import org.springframework.core.env.MutablePropertySources;
-import org.springframework.core.env.PropertySource;
-import org.springframework.core.env.StandardEnvironment;
-
-/**
- * @author Spencer Gibb
- */
-public class ConfigurableEnvironmentConfiguration extends AbstractConfiguration {
-
- private final ConfigurableEnvironment environment;
-
- public ConfigurableEnvironmentConfiguration(ConfigurableEnvironment environment) {
- this.environment = environment;
- }
-
- @Override
- protected void addPropertyDirect(String key, Object value) {
-
- }
-
- @Override
- public boolean isEmpty() {
- return !getKeys().hasNext(); // TODO: find a better way to do this
- }
-
- @Override
- public boolean containsKey(String key) {
- return this.environment.containsProperty(key);
- }
-
- @Override
- public Object getProperty(String key) {
- return this.environment.getProperty(key);
- }
-
- @Override
- public Iterator getKeys() {
- List result = new ArrayList<>();
- for (Map.Entry> entry : getPropertySources().entrySet()) {
- PropertySource> source = entry.getValue();
- if (source instanceof EnumerablePropertySource) {
- EnumerablePropertySource> enumerable = (EnumerablePropertySource>) source;
- for (String name : enumerable.getPropertyNames()) {
- result.add(name);
- }
- }
- }
- return result.iterator();
- }
-
- private Map> getPropertySources() {
- Map> map = new LinkedHashMap<>();
- MutablePropertySources sources = (this.environment != null ? this.environment
- .getPropertySources() : new StandardEnvironment().getPropertySources());
- for (PropertySource> source : sources) {
- extract("", map, source);
- }
- return map;
- }
-
- private void extract(String root, Map> map,
- PropertySource> source) {
- if (source instanceof CompositePropertySource) {
- for (PropertySource> nest : ((CompositePropertySource) source)
- .getPropertySources()) {
- extract(source.getName() + ":", map, nest);
- }
- }
- else {
- map.put(root + source.getName(), source);
- }
- }
-
-}
diff --git a/spring-cloud-netflix-archaius/src/main/resources/META-INF/spring.factories b/spring-cloud-netflix-archaius/src/main/resources/META-INF/spring.factories
deleted file mode 100644
index 834129cc..00000000
--- a/spring-cloud-netflix-archaius/src/main/resources/META-INF/spring.factories
+++ /dev/null
@@ -1,2 +0,0 @@
-org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
-org.springframework.cloud.netflix.archaius.ArchaiusAutoConfiguration
\ No newline at end of file
diff --git a/spring-cloud-netflix-archaius/src/test/java/org/springframework/cloud/netflix/archaius/ArchaiusAutoConfigurationTests.java b/spring-cloud-netflix-archaius/src/test/java/org/springframework/cloud/netflix/archaius/ArchaiusAutoConfigurationTests.java
deleted file mode 100644
index 0a42ec6a..00000000
--- a/spring-cloud-netflix-archaius/src/test/java/org/springframework/cloud/netflix/archaius/ArchaiusAutoConfigurationTests.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright 2013-2015 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.archaius;
-
-import java.util.Collections;
-
-import org.apache.commons.configuration.AbstractConfiguration;
-import org.apache.commons.configuration.event.ConfigurationEvent;
-import org.apache.commons.configuration.event.ConfigurationListener;
-import org.junit.After;
-import org.junit.Test;
-import org.springframework.boot.test.util.EnvironmentTestUtils;
-import org.springframework.cloud.context.environment.EnvironmentChangeEvent;
-import org.springframework.context.annotation.AnnotationConfigApplicationContext;
-
-import com.netflix.config.ConfigurationManager;
-import com.netflix.config.DynamicPropertyFactory;
-import com.netflix.config.DynamicStringProperty;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-/**
- * @author Dave Syer
- */
-public class ArchaiusAutoConfigurationTests {
-
- private AnnotationConfigApplicationContext context;
- private Object propertyValue;
-
- @After
- public void close() {
- if (this.context != null) {
- this.context.close();
- }
- }
-
- @Test
- public void configurationCreated() {
- this.context = new AnnotationConfigApplicationContext(
- ArchaiusAutoConfiguration.class);
- AbstractConfiguration config = this.context
- .getBean(ConfigurableEnvironmentConfiguration.class);
- assertNotNull(config.getString("java.io.tmpdir"));
- }
-
- @Test
- public void environmentChangeEventPropagated() {
- this.context = new AnnotationConfigApplicationContext(
- ArchaiusAutoConfiguration.class);
- ConfigurationManager.getConfigInstance().addConfigurationListener(
- new ConfigurationListener() {
- @Override
- public void configurationChanged(ConfigurationEvent event) {
- if (event.getPropertyName().equals("my.prop")) {
- ArchaiusAutoConfigurationTests.this.propertyValue = event
- .getPropertyValue();
- }
- }
- });
- EnvironmentTestUtils.addEnvironment(this.context, "my.prop=my.newval");
- this.context.publishEvent(new EnvironmentChangeEvent(Collections
- .singleton("my.prop")));
- assertEquals("my.newval", this.propertyValue);
- }
-
- @Test
- public void configurationWithoutExternalConfigurations() throws Exception {
- this.context = new AnnotationConfigApplicationContext(
- ArchaiusAutoConfiguration.class);
- DynamicStringProperty dbProperty = DynamicPropertyFactory.getInstance()
- .getStringProperty("db.property", null);
- DynamicStringProperty staticProperty = DynamicPropertyFactory.getInstance()
- .getStringProperty("archaius.file.property", null);
-
- assertNull(dbProperty.getValue());
- assertNotNull(staticProperty.getValue());
- assertEquals("Static config file property", staticProperty.getValue());
- }
-
- @Test
- public void configurationWithInjectedConfiguration() throws Exception {
- this.context = new AnnotationConfigApplicationContext(
- ArchaiusAutoConfiguration.class, TestArchaiusExternalConfiguration.class);
- DynamicStringProperty dbProperty = DynamicPropertyFactory.getInstance()
- .getStringProperty("db.property", null);
- DynamicStringProperty secondDbProperty = DynamicPropertyFactory.getInstance()
- .getStringProperty("db.second.property", null);
- DynamicStringProperty staticProperty = DynamicPropertyFactory.getInstance()
- .getStringProperty("archaius.file.property", null);
-
- assertNotNull(dbProperty.getValue());
- assertNotNull(secondDbProperty.getValue());
- assertNotNull(staticProperty.getValue());
- assertEquals("this is a db property", dbProperty.getValue());
- assertEquals("this is another db property", secondDbProperty.getValue());
- assertEquals("Static config file property", staticProperty.getValue());
- }
-
-}
diff --git a/spring-cloud-netflix-archaius/src/test/java/org/springframework/cloud/netflix/archaius/ArchaiusEndpointTests.java b/spring-cloud-netflix-archaius/src/test/java/org/springframework/cloud/netflix/archaius/ArchaiusEndpointTests.java
deleted file mode 100644
index 50b883d2..00000000
--- a/spring-cloud-netflix-archaius/src/test/java/org/springframework/cloud/netflix/archaius/ArchaiusEndpointTests.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright 2013-2014 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.archaius;
-
-import java.util.Map;
-
-import org.junit.Test;
-import org.springframework.core.env.StandardEnvironment;
-
-import com.netflix.config.ConcurrentCompositeConfiguration;
-import com.netflix.config.ConfigurationManager;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-/**
- * @author Dave Syer
- */
-public class ArchaiusEndpointTests {
-
- private ArchaiusEndpoint endpoint = new ArchaiusEndpoint();
-
- @Test
- public void detectsPropertiesWhenSet() {
- ConfigurationManager.getConfigInstance().setProperty("foo", "bar");
- assertTrue(this.endpoint.invoke().containsKey("foo"));
- }
-
- @Test
- public void doesNotIncludeSpringEnvironment() {
- ConcurrentCompositeConfiguration composite = new ConcurrentCompositeConfiguration(
- ConfigurationManager.getConfigInstance());
- ConfigurableEnvironmentConfiguration config = new ConfigurableEnvironmentConfiguration(
- new StandardEnvironment());
- assertTrue(config.containsKey("user.dir"));
- composite.addConfiguration(config);
- ConfigurationManager.getConfigInstance().setProperty("foo", "bar");
- Map map = this.endpoint.invoke();
- assertTrue(map.containsKey("foo"));
- assertFalse(map.containsKey("user.dir"));
- }
-
-}
diff --git a/spring-cloud-netflix-archaius/src/test/java/org/springframework/cloud/netflix/archaius/TestArchaiusExternalConfiguration.java b/spring-cloud-netflix-archaius/src/test/java/org/springframework/cloud/netflix/archaius/TestArchaiusExternalConfiguration.java
deleted file mode 100644
index fa871eca..00000000
--- a/spring-cloud-netflix-archaius/src/test/java/org/springframework/cloud/netflix/archaius/TestArchaiusExternalConfiguration.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2013-2015 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.archaius;
-
-import org.apache.commons.configuration.AbstractConfiguration;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-import com.netflix.config.ConcurrentMapConfiguration;
-
-/**
- * @author Alexandru-George Burghelea
- */
-@Configuration
-public class TestArchaiusExternalConfiguration {
-
- @Bean
- @Qualifier("dynamicConfiguration")
- public AbstractConfiguration createDynamicConfiguration() {
- ConcurrentMapConfiguration config = new ConcurrentMapConfiguration();
- config.addProperty("db.property","this is a db property");
- config.addProperty("db.second.property","this is another db property");
- return config;
- }
-
-}
diff --git a/spring-cloud-netflix-archaius/src/test/resources/config.properties b/spring-cloud-netflix-archaius/src/test/resources/config.properties
deleted file mode 100644
index 1e9c021f..00000000
--- a/spring-cloud-netflix-archaius/src/test/resources/config.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-archaius.file.property=Static config file property
-db.second.property=It should be overridden
diff --git a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/EnableHystrix.java b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/EnableHystrix.java
deleted file mode 100644
index eecebe16..00000000
--- a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/EnableHystrix.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2013-2015 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;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
-
-/**
- * Convenience annotation for clients to enable Hystrix circuit breakers (specifically).
- * Use this (optionally) in case you want discovery and know for sure that it is Hystrix
- * you want. All it does is turn on circuit breakers and let the autoconfiguration find
- * the Hystrix classes if they are available (i.e. you need Hystrix on the classpath as
- * well).
- *
- * @author Dave Syer
- * @author Spencer Gibb
- */
-@Target(ElementType.TYPE)
-@Retention(RetentionPolicy.RUNTIME)
-@Documented
-@Inherited
-@EnableCircuitBreaker
-public @interface EnableHystrix {
-
-}
diff --git a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixAutoConfiguration.java b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixAutoConfiguration.java
deleted file mode 100644
index efc05d96..00000000
--- a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixAutoConfiguration.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright 2013-2018 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;
-
-import org.reactivestreams.Publisher;
-import org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnEnabledEndpoint;
-import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
-import org.springframework.boot.actuate.autoconfigure.health.HealthIndicatorAutoConfiguration;
-import org.springframework.boot.actuate.health.Health;
-import org.springframework.boot.actuate.health.HealthIndicator;
-import org.springframework.boot.autoconfigure.AutoConfigureAfter;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.cloud.client.actuator.HasFeatures;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.web.reactive.DispatcherHandler;
-
-import com.netflix.hystrix.Hystrix;
-import com.netflix.hystrix.contrib.javanica.aop.aspectj.HystrixCommandAspect;
-import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
-import com.netflix.hystrix.metric.consumer.HystrixDashboardStream;
-import com.netflix.hystrix.serial.SerialHystrixDashboardData;
-
-import static org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type.REACTIVE;
-import static org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type.SERVLET;
-
-import rx.Observable;
-import rx.RxReactiveStreams;
-
-/**
- * Auto configuration for Hystrix.
- *
- * @author Christian Dupuis
- * @author Dave Syer
- */
-@Configuration
-@ConditionalOnClass({ Hystrix.class, HealthIndicator.class })
-@AutoConfigureAfter({ HealthIndicatorAutoConfiguration.class })
-public class HystrixAutoConfiguration {
-
- @Bean
- @ConditionalOnEnabledHealthIndicator("hystrix")
- public HystrixHealthIndicator hystrixHealthIndicator() {
- return new HystrixHealthIndicator();
- }
-
- /**
- * See original {@link org.springframework.boot.actuate.autoconfigure.jolokia.JolokiaEndpointAutoConfiguration}
- */
- @Configuration
- @ConditionalOnWebApplication(type = SERVLET)
- @ConditionalOnBean(HystrixCommandAspect.class) // only install the stream if enabled
- @ConditionalOnClass({ Health.class, HystrixMetricsStreamServlet.class })
- @EnableConfigurationProperties(HystrixProperties.class)
- protected static class HystrixServletAutoConfiguration {
-
- @Bean
- @ConditionalOnEnabledEndpoint
- public HystrixStreamEndpoint hystrixStreamEndpoint(HystrixProperties properties) {
- return new HystrixStreamEndpoint(properties.getConfig());
- }
-
- @Bean
- public HasFeatures hystrixStreamFeature() {
- return HasFeatures.namedFeature("Hystrix Stream Servlet", HystrixMetricsStreamServlet.class);
- }
- }
-
- @Configuration
- @ConditionalOnWebApplication(type = REACTIVE)
- @ConditionalOnBean(HystrixCommandAspect.class) // only install the stream if enabled
- @ConditionalOnClass({ Health.class, DispatcherHandler.class })
- @EnableConfigurationProperties(HystrixProperties.class)
- protected static class HystrixWebfluxManagementContextConfiguration {
-
- @Bean
- @ConditionalOnEnabledEndpoint
- public HystrixWebfluxEndpoint hystrixWebfluxController() {
- Observable serializedDashboardData = HystrixDashboardStream.getInstance().observe()
- .concatMap(dashboardData -> Observable.from(SerialHystrixDashboardData.toMultipleJsonStrings(dashboardData)));
- Publisher publisher = RxReactiveStreams.toPublisher(serializedDashboardData);
- return new HystrixWebfluxEndpoint(publisher);
- }
-
- @Bean
- public HasFeatures hystrixStreamFeature() {
- return HasFeatures.namedFeature("Hystrix Stream Webflux", HystrixMetricsStreamServlet.class);
- }
- }
-}
diff --git a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixCircuitBreakerConfiguration.java b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixCircuitBreakerConfiguration.java
deleted file mode 100644
index 20e6a611..00000000
--- a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixCircuitBreakerConfiguration.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * 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;
-
-import org.apache.catalina.core.ApplicationContext;
-import org.springframework.beans.factory.DisposableBean;
-import org.springframework.cloud.client.actuator.HasFeatures;
-import org.springframework.cloud.client.actuator.NamedFeature;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-import com.netflix.hystrix.Hystrix;
-import com.netflix.hystrix.contrib.javanica.aop.aspectj.HystrixCommandAspect;
-
-/**
- * @author Spencer Gibb
- * @author Christian Dupuis
- * @author Venil Noronha
- */
-@Configuration
-public class HystrixCircuitBreakerConfiguration {
-
- @Bean
- public HystrixCommandAspect hystrixCommandAspect() {
- return new HystrixCommandAspect();
- }
-
- @Bean
- public HystrixShutdownHook hystrixShutdownHook() {
- return new HystrixShutdownHook();
- }
-
- @Bean
- public HasFeatures hystrixFeature() {
- return HasFeatures.namedFeatures(new NamedFeature("Hystrix", HystrixCommandAspect.class));
- }
-
- //FIXME: 2.0.0
- /*@Configuration
- @ConditionalOnProperty(value = "hystrix.metrics.enabled", matchIfMissing = true)
- @ConditionalOnClass({ HystrixMetricsPoller.class, GaugeService.class })
- @EnableConfigurationProperties(HystrixMetricsProperties.class)
- protected static class HystrixMetricsPollerConfiguration implements SmartLifecycle {
-
- private static Log logger = LogFactory
- .getLog(HystrixMetricsPollerConfiguration.class);
-
- @Autowired(required = false)
- private GaugeService gauges;
-
- @Autowired
- private HystrixMetricsProperties metricsProperties;
-
- private ObjectMapper mapper = new ObjectMapper();
-
- private HystrixMetricsPoller poller;
-
- private Set reserved = new HashSet(Arrays.asList("group", "name",
- "type", "currentTime"));
-
- @Override
- public void start() {
- if (this.gauges == null) {
- return;
- }
- MetricsAsJsonPollerListener listener = new MetricsAsJsonPollerListener() {
- @Override
- public void handleJsonMetric(String json) {
- try {
- @SuppressWarnings("unchecked")
- Map map = HystrixMetricsPollerConfiguration.this.mapper
- .readValue(json, Map.class);
- if (map != null && map.containsKey("type")) {
- addMetrics(map, "hystrix.");
- }
- }
- catch (IOException ex) {
- // ignore
- }
- }
-
- };
- this.poller = new HystrixMetricsPoller(listener,
- metricsProperties.getPollingIntervalMs());
- // start polling and it will write directly to the listener
- this.poller.start();
- logger.info("Starting poller");
- }
-
- private void addMetrics(Map map, String root) {
- StringBuilder prefixBuilder = new StringBuilder(root);
- if (map.containsKey("type")) {
- prefixBuilder.append((String) map.get("type"));
- if (map.containsKey("group")) {
- prefixBuilder.append(".").append(map.get("group"));
- }
- prefixBuilder.append(".").append(map.get("name"));
- }
- String prefix = prefixBuilder.toString();
- for (String key : map.keySet()) {
- Object value = map.get(key);
- if (!this.reserved.contains(key)) {
- if (value instanceof Number) {
- String name = prefix + "." + key;
- this.gauges.submit(name, ((Number) value).doubleValue());
- }
- else if (value instanceof Map) {
- @SuppressWarnings("unchecked")
- Map sub = (Map) value;
- addMetrics(sub, prefix);
- }
- }
- }
- }
-
- @Override
- public void stop() {
- if (this.poller != null) {
- this.poller.shutdown();
- }
- }
-
- @Override
- public boolean isRunning() {
- return this.poller != null ? this.poller.isRunning() : false;
- }
-
- @Override
- public int getPhase() {
- return Ordered.LOWEST_PRECEDENCE;
- }
-
- @Override
- public boolean isAutoStartup() {
- return true;
- }
-
- @Override
- public void stop(Runnable callback) {
- if (this.poller != null) {
- this.poller.shutdown();
- }
- callback.run();
- }
-
- }*/
-
- /**
- * {@link DisposableBean} that makes sure that Hystrix internal state is cleared when
- * {@link ApplicationContext} shuts down.
- */
- private class HystrixShutdownHook implements DisposableBean {
-
- @Override
- public void destroy() throws Exception {
- // Just call Hystrix to reset thread pool etc.
- Hystrix.reset();
- }
-
- }
-
-}
diff --git a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixCommands.java b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixCommands.java
deleted file mode 100644
index 763442dd..00000000
--- a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixCommands.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * 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;
-
-import java.util.function.Function;
-
-import org.reactivestreams.Publisher;
-import org.springframework.util.StringUtils;
-
-import com.netflix.hystrix.HystrixCommandGroupKey;
-import com.netflix.hystrix.HystrixCommandKey;
-import com.netflix.hystrix.HystrixCommandProperties;
-import com.netflix.hystrix.HystrixObservableCommand;
-import com.netflix.hystrix.HystrixObservableCommand.Setter;
-
-import reactor.core.publisher.Flux;
-import reactor.core.publisher.Mono;
-import rx.Observable;
-import rx.RxReactiveStreams;
-
-/**
- * Utility class to wrap a {@see Publisher} in a {@see HystrixObservableCommand}. Good for
- * use in a Spring WebFlux application. Allows more flexibility than the @HystrixCommand
- * annotation.
- * @author Spencer Gibb
- */
-public class HystrixCommands {
-
- public static PublisherBuilder from(Publisher publisher) {
- return new PublisherBuilder<>(publisher);
- }
-
- public static class PublisherBuilder {
- private final Publisher publisher;
- private String commandName;
- private String groupName;
- private Publisher fallback;
- private Setter setter;
- private HystrixCommandProperties.Setter commandProperties;
- private boolean eager = false;
- private Function, Observable> toObservable;
-
- public PublisherBuilder(Publisher publisher) {
- this.publisher = publisher;
- }
-
- public PublisherBuilder commandName(String commandName) {
- this.commandName = commandName;
- return this;
- }
-
- public PublisherBuilder groupName(String groupName) {
- this.groupName = groupName;
- return this;
- }
-
- public PublisherBuilder fallback(Publisher fallback) {
- this.fallback = fallback;
- return this;
- }
-
- public PublisherBuilder setter(Setter setter) {
- this.setter = setter;
- return this;
- }
-
- public PublisherBuilder commandProperties(
- HystrixCommandProperties.Setter commandProperties) {
- this.commandProperties = commandProperties;
- return this;
- }
-
- public PublisherBuilder commandProperties(
- Function commandProperties) {
- if (commandProperties == null) {
- throw new IllegalArgumentException(
- "commandProperties must not both be null");
- }
- return this.commandProperties(
- commandProperties.apply(HystrixCommandProperties.Setter()));
- }
-
- public PublisherBuilder eager() {
- this.eager = true;
- return this;
- }
-
- public PublisherBuilder toObservable(Function, Observable> toObservable) {
- this.toObservable = toObservable;
- return this;
- }
-
- public Publisher build() {
- if (!StringUtils.hasText(commandName) && setter == null) {
- throw new IllegalStateException("commandName and setter can not both be empty");
- }
- Setter setterToUse = getSetter();
-
- PublisherHystrixCommand command = new PublisherHystrixCommand<>(setterToUse, this.publisher, this.fallback);
-
- Observable observable = getObservableFunction().apply(command);
-
- return RxReactiveStreams.toPublisher(observable);
- }
-
- public Function, Observable> getObservableFunction() {
- Function, Observable> observableFunc;
-
- if (this.toObservable != null) {
- observableFunc = this.toObservable;
- } else if (this.eager) {
- observableFunc = cmd -> cmd.observe();
- } else { // apply a default onBackpressureBuffer if not eager
- observableFunc = cmd -> cmd.toObservable().onBackpressureBuffer();
- }
- return observableFunc;
- }
-
- public Setter getSetter() {
- Setter setterToUse;
- if (this.setter != null) {
- setterToUse = this.setter;
- } else {
- String groupNameToUse;
- if (StringUtils.hasText(this.groupName)) {
- groupNameToUse = this.groupName;
- } else {
- groupNameToUse = commandName + "group";
- }
-
- HystrixCommandGroupKey groupKey = HystrixCommandGroupKey.Factory.asKey(groupNameToUse);
- HystrixCommandKey commandKey = HystrixCommandKey.Factory.asKey(this.commandName);
- HystrixCommandProperties.Setter commandProperties = this.commandProperties != null
- ? this.commandProperties
- : HystrixCommandProperties.Setter();
- setterToUse = Setter.withGroupKey(groupKey).andCommandKey(commandKey)
- .andCommandPropertiesDefaults(commandProperties);
- }
- return setterToUse;
- }
-
- public Flux toFlux() {
- return Flux.from(build());
- }
-
- public Mono toMono() {
- return Mono.from(build());
- }
-
- }
-
- private static class PublisherHystrixCommand extends HystrixObservableCommand {
-
- private Publisher publisher;
- private Publisher fallback;
-
- protected PublisherHystrixCommand(Setter setter, Publisher publisher,
- Publisher fallback) {
- super(setter);
- this.publisher = publisher;
- this.fallback = fallback;
- }
-
- @Override
- protected Observable construct() {
- return RxReactiveStreams.toObservable(publisher);
- }
-
- @Override
- protected Observable resumeWithFallback() {
- if (this.fallback != null) {
- return RxReactiveStreams.toObservable(this.fallback);
- }
- return super.resumeWithFallback();
- }
- }
-}
diff --git a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixConstants.java b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixConstants.java
deleted file mode 100644
index 073eec02..00000000
--- a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixConstants.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2013-2015 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;
-
-/**
- * @author Spencer Gibb
- */
-public class HystrixConstants {
-
- public static final String HYSTRIX_STREAM_DESTINATION = "springCloudHystrixStream";
-
- private HystrixConstants() {
- throw new AssertionError("Must not instantiate constant utility class");
- }
-
-}
diff --git a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixHealthIndicator.java b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixHealthIndicator.java
deleted file mode 100644
index fb1a8bfe..00000000
--- a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixHealthIndicator.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright 2013-2014 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;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.springframework.boot.actuate.health.AbstractHealthIndicator;
-import org.springframework.boot.actuate.health.Health.Builder;
-import org.springframework.boot.actuate.health.HealthIndicator;
-import org.springframework.boot.actuate.health.Status;
-
-import com.netflix.hystrix.HystrixCircuitBreaker;
-import com.netflix.hystrix.HystrixCommandMetrics;
-
-/**
- * A {@link HealthIndicator} implementation for Hystrix circuit breakers.
- *
- * This default implementation will not change the system state (e.g. OK) but
- * includes all open circuits by name.
- *
- * @author Christian Dupuis
- */
-public class HystrixHealthIndicator extends AbstractHealthIndicator {
-
- private static final Status CIRCUIT_OPEN = new Status("CIRCUIT_OPEN");
-
- @Override
- protected void doHealthCheck(Builder builder) throws Exception {
- List openCircuitBreakers = new ArrayList<>();
-
- // Collect all open circuit breakers from Hystrix
- for (HystrixCommandMetrics metrics : HystrixCommandMetrics.getInstances()) {
- HystrixCircuitBreaker circuitBreaker = HystrixCircuitBreaker.Factory
- .getInstance(metrics.getCommandKey());
- if (circuitBreaker != null && circuitBreaker.isOpen()) {
- openCircuitBreakers.add(metrics.getCommandGroup().name() + "::"
- + metrics.getCommandKey().name());
- }
- }
-
- // If there is at least one open circuit report OUT_OF_SERVICE adding the command
- // group
- // and key name
- if (!openCircuitBreakers.isEmpty()) {
- builder.status(CIRCUIT_OPEN).withDetail("openCircuitBreakers",
- openCircuitBreakers);
- }
- else {
- builder.up();
- }
- }
-
-}
diff --git a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixMetricsProperties.java b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixMetricsProperties.java
deleted file mode 100644
index 5501efd6..00000000
--- a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixMetricsProperties.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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.hystrix;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-import java.util.Objects;
-
-/**
- * @author Venil Noronha
- * @author Gregor Zurowski
- */
-@ConfigurationProperties("hystrix.metrics")
-public class HystrixMetricsProperties {
-
- /** Enable Hystrix metrics polling. Defaults to true. */
- private boolean enabled = true;
-
- /** Interval between subsequent polling of metrics. Defaults to 2000 ms. */
- private Integer pollingIntervalMs = 2000;
-
- public boolean isEnabled() {
- return enabled;
- }
-
- public void setEnabled(boolean enabled) {
- this.enabled = enabled;
- }
-
- public Integer getPollingIntervalMs() {
- return pollingIntervalMs;
- }
-
- public void setPollingIntervalMs(Integer pollingIntervalMs) {
- this.pollingIntervalMs = pollingIntervalMs;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- HystrixMetricsProperties that = (HystrixMetricsProperties) o;
- return enabled == that.enabled &&
- Objects.equals(pollingIntervalMs, that.pollingIntervalMs);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(enabled, pollingIntervalMs);
- }
-
- @Override
- public String toString() {
- return new StringBuilder("HystrixMetricsProperties{")
- .append("enabled=").append(enabled).append(", ")
- .append("pollingIntervalMs=").append(pollingIntervalMs)
- .append("}").toString();
- }
-}
diff --git a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixProperties.java b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixProperties.java
deleted file mode 100644
index 2039c62c..00000000
--- a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixProperties.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2013-2018 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;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-/**
- * Configuration properties for Hystrix Servlet.
- *
- * @author Spencer Gibb
- * @since 2.0.0
- */
-@ConfigurationProperties(prefix = "management.endpoint.hystrix")
-public class HystrixProperties {
-
- /**
- * Hystrix settings. These are traditionally set using servlet parameters. Refer to
- * the documentation of Hystrix for more details.
- */
- private final Map config = new HashMap<>();
-
- public Map getConfig() {
- return this.config;
- }
-
-}
-
diff --git a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixStreamEndpoint.java b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixStreamEndpoint.java
deleted file mode 100644
index af2d870b..00000000
--- a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixStreamEndpoint.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2013-2018 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;
-
-import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
-import org.springframework.boot.actuate.endpoint.web.EndpointServlet;
-import org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpoint;
-
-import java.util.Map;
-import java.util.function.Supplier;
-
-/**
- * {@link org.springframework.boot.actuate.endpoint.annotation.Endpoint} to expose a Jolokia {@link HystrixMetricsStreamServlet}.
- *
- * @author Phillip Webb
- * @since 2.0.0
- */
-@ServletEndpoint(id = "hystrix.stream")
-public class HystrixStreamEndpoint implements Supplier {
-
- private final Map initParameters;
-
- public HystrixStreamEndpoint(Map initParameters) {
- this.initParameters = initParameters;
- }
-
- @Override
- public EndpointServlet get() {
- return new EndpointServlet(HystrixMetricsStreamServlet.class)
- .withInitParameters(this.initParameters);
- }
-}
diff --git a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixWebfluxEndpoint.java b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixWebfluxEndpoint.java
deleted file mode 100644
index a9f4f220..00000000
--- a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixWebfluxEndpoint.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2013-2018 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;
-
-import java.time.Duration;
-
-import org.reactivestreams.Publisher;
-import org.springframework.boot.actuate.endpoint.web.annotation.RestControllerEndpoint;
-import org.springframework.http.MediaType;
-import org.springframework.web.bind.annotation.GetMapping;
-
-import reactor.core.publisher.Flux;
-
-/**
- * @author Spencer Gibb
- */
-@RestControllerEndpoint(id = "hystrix.stream")
-public class HystrixWebfluxEndpoint {
-
- private final Flux stream;
-
- public HystrixWebfluxEndpoint(Publisher dashboardData) {
- stream = Flux.interval(Duration.ofMillis(500)).map(aLong -> "{\"type\":\"ping\"}")
- .mergeWith(dashboardData).share();
- }
-
- // path needs to be empty, so it registers correct as /actuator/hystrix.stream
- @GetMapping(path = "", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
- public Flux hystrixStream() {
- return stream;
- }
-}
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
deleted file mode 100644
index 272f234e..00000000
--- a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/security/HystrixSecurityAutoConfiguration.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * 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.hystrix.security;
-
-import javax.annotation.PostConstruct;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.condition.AllNestedConditions;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.cloud.netflix.hystrix.security.HystrixSecurityAutoConfiguration.HystrixSecurityCondition;
-import org.springframework.context.annotation.Conditional;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.security.core.context.SecurityContext;
-
-import com.netflix.hystrix.Hystrix;
-import com.netflix.hystrix.strategy.HystrixPlugins;
-import com.netflix.hystrix.strategy.concurrency.HystrixConcurrencyStrategy;
-import com.netflix.hystrix.strategy.eventnotifier.HystrixEventNotifier;
-import com.netflix.hystrix.strategy.executionhook.HystrixCommandExecutionHook;
-import com.netflix.hystrix.strategy.metrics.HystrixMetricsPublisher;
-import com.netflix.hystrix.strategy.properties.HystrixPropertiesStrategy;
-
-/**
- * @author Daniel Lavoie
- */
-@Configuration
-@Conditional(HystrixSecurityCondition.class)
-@ConditionalOnClass({ Hystrix.class, SecurityContext.class })
-public class HystrixSecurityAutoConfiguration {
- @Autowired(required = false)
- private HystrixConcurrencyStrategy existingConcurrencyStrategy;
-
- @PostConstruct
- public void init() {
- // Keeps references of existing Hystrix plugins.
- HystrixEventNotifier eventNotifier = HystrixPlugins.getInstance()
- .getEventNotifier();
- HystrixMetricsPublisher metricsPublisher = HystrixPlugins.getInstance()
- .getMetricsPublisher();
- HystrixPropertiesStrategy propertiesStrategy = HystrixPlugins.getInstance()
- .getPropertiesStrategy();
- HystrixCommandExecutionHook commandExecutionHook = HystrixPlugins.getInstance()
- .getCommandExecutionHook();
-
- HystrixPlugins.reset();
-
- // Registers existing plugins excepts the Concurrent Strategy plugin.
- HystrixPlugins.getInstance().registerConcurrencyStrategy(
- new SecurityContextConcurrencyStrategy(existingConcurrencyStrategy));
- HystrixPlugins.getInstance().registerEventNotifier(eventNotifier);
- HystrixPlugins.getInstance().registerMetricsPublisher(metricsPublisher);
- HystrixPlugins.getInstance().registerPropertiesStrategy(propertiesStrategy);
- HystrixPlugins.getInstance().registerCommandExecutionHook(commandExecutionHook);
- }
-
- static class HystrixSecurityCondition extends AllNestedConditions {
-
- public HystrixSecurityCondition() {
- super(ConfigurationPhase.REGISTER_BEAN);
- }
-
- @ConditionalOnProperty(name = "hystrix.shareSecurityContext")
- static class ShareSecurityContext {
-
- }
- }
-}
diff --git a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/security/SecurityContextConcurrencyStrategy.java b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/security/SecurityContextConcurrencyStrategy.java
deleted file mode 100644
index a438882c..00000000
--- a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/security/SecurityContextConcurrencyStrategy.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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.hystrix.security;
-
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-
-import com.netflix.hystrix.HystrixThreadPoolProperties;
-import org.springframework.security.concurrent.DelegatingSecurityContextCallable;
-
-import com.netflix.hystrix.HystrixThreadPoolKey;
-import com.netflix.hystrix.strategy.concurrency.HystrixConcurrencyStrategy;
-import com.netflix.hystrix.strategy.concurrency.HystrixRequestVariable;
-import com.netflix.hystrix.strategy.concurrency.HystrixRequestVariableLifecycle;
-import com.netflix.hystrix.strategy.properties.HystrixProperty;
-
-/**
- * @author daniellavoie
- */
-public class SecurityContextConcurrencyStrategy extends HystrixConcurrencyStrategy {
- private HystrixConcurrencyStrategy existingConcurrencyStrategy;
-
- public SecurityContextConcurrencyStrategy(
- HystrixConcurrencyStrategy existingConcurrencyStrategy) {
- this.existingConcurrencyStrategy = existingConcurrencyStrategy;
- }
-
- @Override
- public BlockingQueue getBlockingQueue(int maxQueueSize) {
- return existingConcurrencyStrategy != null
- ? existingConcurrencyStrategy.getBlockingQueue(maxQueueSize)
- : super.getBlockingQueue(maxQueueSize);
- }
-
- @Override
- public HystrixRequestVariable getRequestVariable(
- HystrixRequestVariableLifecycle rv) {
- return existingConcurrencyStrategy != null
- ? existingConcurrencyStrategy.getRequestVariable(rv)
- : super.getRequestVariable(rv);
- }
-
- @Override
- public ThreadPoolExecutor getThreadPool(HystrixThreadPoolKey threadPoolKey,
- HystrixProperty corePoolSize,
- HystrixProperty maximumPoolSize,
- HystrixProperty keepAliveTime, TimeUnit unit,
- BlockingQueue workQueue) {
- return existingConcurrencyStrategy != null
- ? existingConcurrencyStrategy.getThreadPool(threadPoolKey, corePoolSize,
- maximumPoolSize, keepAliveTime, unit, workQueue)
- : super.getThreadPool(threadPoolKey, corePoolSize, maximumPoolSize,
- keepAliveTime, unit, workQueue);
- }
-
- @Override
- public ThreadPoolExecutor getThreadPool(HystrixThreadPoolKey threadPoolKey, HystrixThreadPoolProperties threadPoolProperties) {
- return existingConcurrencyStrategy != null
- ? existingConcurrencyStrategy.getThreadPool(threadPoolKey, threadPoolProperties)
- : super.getThreadPool(threadPoolKey, threadPoolProperties);
- }
-
- @Override
- public Callable wrapCallable(Callable callable) {
- return existingConcurrencyStrategy != null
- ? existingConcurrencyStrategy
- .wrapCallable(new DelegatingSecurityContextCallable(callable))
- : super.wrapCallable(new DelegatingSecurityContextCallable(callable));
- }
-}
diff --git a/spring-cloud-netflix-core/src/main/resources/META-INF/spring.factories b/spring-cloud-netflix-core/src/main/resources/META-INF/spring.factories
deleted file mode 100644
index d14e8902..00000000
--- a/spring-cloud-netflix-core/src/main/resources/META-INF/spring.factories
+++ /dev/null
@@ -1,11 +0,0 @@
-org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
-org.springframework.cloud.netflix.feign.ribbon.FeignRibbonClientAutoConfiguration,\
-org.springframework.cloud.netflix.feign.FeignAutoConfiguration,\
-org.springframework.cloud.netflix.feign.encoding.FeignAcceptGzipEncodingAutoConfiguration,\
-org.springframework.cloud.netflix.feign.encoding.FeignContentGzipEncodingAutoConfiguration,\
-org.springframework.cloud.netflix.hystrix.HystrixAutoConfiguration,\
-org.springframework.cloud.netflix.hystrix.security.HystrixSecurityAutoConfiguration,\
-org.springframework.cloud.netflix.ribbon.RibbonAutoConfiguration
-
-org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker=\
-org.springframework.cloud.netflix.hystrix.HystrixCircuitBreakerConfiguration
diff --git a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/AdhocTestSuite.java b/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/AdhocTestSuite.java
deleted file mode 100644
index f57abb17..00000000
--- a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/AdhocTestSuite.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright 2012-2013 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;
-
-import org.junit.Ignore;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.junit.runners.Suite.SuiteClasses;
-
-/**
- * A test suite for probing weird ordering problems in the tests.
- *
- * @author Dave Syer
- */
-@RunWith(Suite.class)
-@SuiteClasses({
- // org.springframework.cloud.netflix.test.OkHttpClientConfigurationTests.class,
- // org.springframework.cloud.netflix.test.ApacheHttpClientConfigurationTests.class,
- // org.springframework.cloud.netflix.hystrix.HystrixCommandsTests.class,
- // org.springframework.cloud.netflix.hystrix.HystrixOnlyTests.class,
- // org.springframework.cloud.netflix.hystrix.security.HystrixSecurityTests.class,
- // org.springframework.cloud.netflix.hystrix.security.HystrixSecurityNoFeignTests.class,
- // org.springframework.cloud.netflix.hystrix.HystrixStreamEndpointTests.class,
- // org.springframework.cloud.netflix.hystrix.HystrixConfigurationTests.class,
- // org.springframework.cloud.netflix.resttemplate.RestTemplateRetryTests.class,
- // org.springframework.cloud.netflix.ribbon.RibbonClientPreprocessorOverridesRetryTests.class,
- // org.springframework.cloud.netflix.ribbon.RibbonUtilsTests.class,
- // org.springframework.cloud.netflix.ribbon.test.RibbonClientDefaultConfigurationTests.class,
- // org.springframework.cloud.netflix.ribbon.RibbonClientConfigurationTests.class,
- // org.springframework.cloud.netflix.ribbon.RibbonClientHttpRequestFactoryTests.class,
- // org.springframework.cloud.netflix.ribbon.SpringRetryEnabledTests.class,
- // org.springframework.cloud.netflix.ribbon.PlainRibbonClientPreprocessorIntegrationTests.class,
- // org.springframework.cloud.netflix.ribbon.apache.RibbonLoadBalancingHttpClientTests.class,
- // org.springframework.cloud.netflix.ribbon.apache.RibbonApacheHttpRequestTests.class,
- // org.springframework.cloud.netflix.ribbon.apache.RibbonApacheHttpResponseTests.class,
- // org.springframework.cloud.netflix.ribbon.RibbonClientPreprocessorIntegrationTests.class,
- // org.springframework.cloud.netflix.ribbon.RibbonClientsPreprocessorIntegrationTests.class,
- // org.springframework.cloud.netflix.ribbon.RibbonClientsEagerInitializationTests.class,
- // org.springframework.cloud.netflix.ribbon.RibbonInterceptorTests.class,
- // org.springframework.cloud.netflix.ribbon.support.ContextAwareRequestTests.class,
- // org.springframework.cloud.netflix.ribbon.support.RibbonCommandContextTest.class,
- // org.springframework.cloud.netflix.ribbon.support.RetryableStatusCodeExceptionTests.class,
- // org.springframework.cloud.netflix.ribbon.ZonePreferenceServerListFilterTests.class,
- // org.springframework.cloud.netflix.ribbon.DefaultServerIntrospectorDefaultTests.class,
- // org.springframework.cloud.netflix.ribbon.RibbonClientPreprocessorPropertiesOverridesIntegrationTests.class,
- // org.springframework.cloud.netflix.ribbon.RibbonLoadBalancedRetryPolicyFactoryTests.class,
- // org.springframework.cloud.netflix.ribbon.SpringClientFactoryTests.class,
- // org.springframework.cloud.netflix.ribbon.RibbonAutoConfigurationIntegrationTests.class,
- // org.springframework.cloud.netflix.ribbon.RibbonLoadBalancerClientTests.class,
- // org.springframework.cloud.netflix.ribbon.RibbonClientPreprocessorOverridesIntegrationTests.class,
- // org.springframework.cloud.netflix.ribbon.RibbonApplicationContextInitializerTests.class,
- // org.springframework.cloud.netflix.ribbon.okhttp.SpringRetryDisableOkHttpClientTests.class,
- // org.springframework.cloud.netflix.ribbon.okhttp.OkHttpRibbonResponseTests.class,
- // org.springframework.cloud.netflix.ribbon.okhttp.OkHttpLoadBalancingClientTests.class,
- // org.springframework.cloud.netflix.ribbon.okhttp.OkHttpRibbonRequestTests.class,
- // org.springframework.cloud.netflix.ribbon.okhttp.SpringRetryEnabledOkHttpClientTests.class,
- // org.springframework.cloud.netflix.ribbon.RibbonClientConfigurationIntegrationTests.class,
- // org.springframework.cloud.netflix.ribbon.RibbonDisabledTests.class,
- // org.springframework.cloud.netflix.ribbon.DefaultServerIntrospectorTests.class,
- // org.springframework.cloud.netflix.ribbon.SpringRetryDisabledTests.class,
- // org.springframework.cloud.netflix.feign.beans.FeignClientTests.class,
- // org.springframework.cloud.netflix.feign.FeignClientsRegistrarTests.class,
- // org.springframework.cloud.netflix.feign.encoding.FeignAcceptEncodingTests.class,
- // org.springframework.cloud.netflix.feign.encoding.FeignContentEncodingTests.class,
- // org.springframework.cloud.netflix.feign.FeignLoggerFactoryTests.class,
- // org.springframework.cloud.netflix.feign.FeignCompressionTests.class,
- // org.springframework.cloud.netflix.feign.EnableFeignClientsTests.class,
- // org.springframework.cloud.netflix.feign.SpringDecoderTests.class,
- // org.springframework.cloud.netflix.feign.FeignClientUsingPropertiesTests.class,
- // org.springframework.cloud.netflix.feign.FeignHttpClientUrlTests.class,
- // org.springframework.cloud.netflix.feign.invalid.FeignClientValidationTests.class,
- // org.springframework.cloud.netflix.feign.support.FeignHttpClientPropertiesTests.class,
- // org.springframework.cloud.netflix.feign.support.SpringMvcContractTests.class,
- // org.springframework.cloud.netflix.feign.support.SpringEncoderTests.class,
- // org.springframework.cloud.netflix.feign.FeignClientOverrideDefaultsTests.class,
- // org.springframework.cloud.netflix.feign.ribbon.LoadBalancerFeignClientOverrideTests.class,
- // org.springframework.cloud.netflix.feign.ribbon.FeignRibbonClientPathTests.class,
- // org.springframework.cloud.netflix.feign.ribbon.RetryableFeignLoadBalancerTests.class,
- // org.springframework.cloud.netflix.feign.ribbon.FeignRibbonClientRetryTests.class,
- // org.springframework.cloud.netflix.feign.ribbon.FeignLoadBalancerTests.class,
- // org.springframework.cloud.netflix.feign.ribbon.FeignRibbonClientTests.class,
- // org.springframework.cloud.netflix.feign.ribbon.CachingSpringLoadBalancerFactoryTests.class,
- // org.springframework.cloud.netflix.feign.valid.scanning.FeignClientEnvVarTests.class,
- // org.springframework.cloud.netflix.feign.valid.scanning.FeignClientScanningTests.class,
- // org.springframework.cloud.netflix.feign.valid.FeignOkHttpTests.class,
- // org.springframework.cloud.netflix.feign.valid.FeignClientValidationTests.class,
- // org.springframework.cloud.netflix.feign.valid.FeignClientTests.class,
- // org.springframework.cloud.netflix.feign.valid.FeignHttpClientTests.class,
- // org.springframework.cloud.netflix.feign.valid.FeignClientNotPrimaryTests.class,
- // org.springframework.cloud.netflix.feign.FeignClientFactoryTests.class,
-
-})
-@Ignore
-public class AdhocTestSuite {
-
-}
diff --git a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/HystrixCommandsTests.java b/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/HystrixCommandsTests.java
deleted file mode 100644
index 698ee8a2..00000000
--- a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/HystrixCommandsTests.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * 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;
-
-import java.time.Duration;
-
-import org.junit.Test;
-
-import com.netflix.hystrix.exception.HystrixRuntimeException;
-
-import reactor.core.publisher.Flux;
-import reactor.core.publisher.Mono;
-import reactor.test.StepVerifier;
-
-public class HystrixCommandsTests {
-
- @Test
- public void monoWorks() {
- StepVerifier.create(HystrixCommands.from(Flux.just("works"))
- .commandName("testworks")
- .toMono())
- .expectNext("works")
- .verifyComplete();
- }
-
- @Test
- public void eagerMonoWorks() {
- StepVerifier.create(HystrixCommands.from(Mono.just("works"))
- .eager()
- .commandName("testworks")
- .toMono())
- .expectNext("works")
- .verifyComplete();
- }
-
- @Test
- public void monoTimesOut() {
- StepVerifier.create(HystrixCommands.from(Mono.fromCallable(() -> {
- Thread.sleep(1500);
- return "timeout";
- })).commandName("failcmd").toMono())
- .verifyError(HystrixRuntimeException.class);
- }
-
- @Test
- public void monoFallbackWorks() {
- StepVerifier.create(HystrixCommands.from(Mono.error(new Exception()))
- .commandName("failcmd")
- .fallback(Mono.just("fallback"))
- .toMono())
- .expectNext("fallback")
- .verifyComplete();
- }
-
- @Test
- public void fluxWorks() {
- StepVerifier.create(HystrixCommands.from( Flux.just("1", "2"))
- .commandName("multiflux")
- .toFlux())
- .expectNext("1")
- .expectNext("2")
- .verifyComplete();
- }
-
- @Test
- public void fluxWorksDeferredRequest() {
- StepVerifier.create(HystrixCommands.from(Flux.just("1", "2"))
- .commandName("multiflux")
- .build(), 1)
- .expectNext("1")
- .thenAwait(Duration.ofSeconds(1))
- .thenRequest(1)
- .expectNext("2")
- .verifyComplete();
- }
-
- @Test
- public void toObservableFunctionWorks() {
- StepVerifier.create(HystrixCommands.from(Flux.just("1", "2"))
- .commandName("multiflux")
- .toObservable(cmd -> cmd.toObservable())
- .build(), 1)
- .expectNext("1")
- .thenAwait(Duration.ofSeconds(1))
- .thenRequest(1)
- .verifyError();
- }
-
- @Test
- public void eagerFluxWorks() {
- StepVerifier.create(HystrixCommands.from( Flux.just("1", "2"))
- .commandName("multiflux")
- .eager()
- .toFlux())
- .expectNext("1")
- .expectNext("2")
- .verifyComplete();
- }
-
- @Test
- public void fluxTimesOut() {
- StepVerifier.create(HystrixCommands.from( Flux.from(s -> {
- try {
- Thread.sleep(1500);
- } catch (InterruptedException e) {
- throw new RuntimeException(e);
- }
- })).commandName("failcmd").toFlux())
- .verifyError(HystrixRuntimeException.class);
- }
-
- @Test
- public void fluxFallbackWorks() {
- StepVerifier.create(HystrixCommands.from(Flux.error(new Exception()))
- .commandName("multiflux")
- .fallback(Flux.just("a", "b"))
- .toFlux())
- .expectNext("a")
- .expectNext("b")
- .verifyComplete();
- }
-
- @Test
- public void extendTimeout() {
- StepVerifier.create(HystrixCommands.from(Mono.fromCallable(() -> {
- Thread.sleep(1500);
- return "works";
- })).commandName("extendTimeout")
- .commandProperties(
- setter -> setter.withExecutionTimeoutInMilliseconds(2000))
- .toMono())
- .expectNext("works")
- .verifyComplete();
- }
-
-}
diff --git a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/HystrixConfigurationTests.java b/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/HystrixConfigurationTests.java
deleted file mode 100644
index 39628434..00000000
--- a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/HystrixConfigurationTests.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2013-2018 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;
-
-import org.junit.Test;
-import org.springframework.boot.test.context.runner.ApplicationContextRunner;
-
-import com.netflix.hystrix.contrib.javanica.aop.aspectj.HystrixCommandAspect;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-/**
- * @author Dave Syer
- * @author Biju Kunjummen
- */
-public class HystrixConfigurationTests {
-
- @Test
- public void nonWebAppStartsUp() {
- new ApplicationContextRunner()
- .withUserConfiguration(HystrixCircuitBreakerConfiguration.class)
- .run(c -> {
- assertThat(c).hasSingleBean(HystrixCommandAspect.class);
- });
- }
-
-}
\ No newline at end of file
diff --git a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/HystrixOnlyTests.java b/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/HystrixOnlyTests.java
deleted file mode 100644
index d11dae59..00000000
--- a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/HystrixOnlyTests.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Copyright 2013-2015 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;
-
-import java.util.Base64;
-import java.util.Map;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties;
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.test.web.client.TestRestTemplate;
-import org.springframework.boot.web.server.LocalServerPort;
-import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.ResponseEntity;
-import org.springframework.test.annotation.DirtiesContext;
-import org.springframework.test.context.ActiveProfiles;
-import org.springframework.test.context.junit4.SpringRunner;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
-import static org.springframework.cloud.netflix.test.TestAutoConfiguration.PASSWORD;
-import static org.springframework.cloud.netflix.test.TestAutoConfiguration.USER;
-
-/**
- * @author Spencer Gibb
- */
-@RunWith(SpringRunner.class)
-@SpringBootTest(classes = HystrixOnlyApplication.class, webEnvironment = RANDOM_PORT,
- properties = "management.endpoint.health.show-details=true")
-@DirtiesContext
-@ActiveProfiles("proxysecurity")
-public class HystrixOnlyTests {
- private static final String BASE_PATH = new WebEndpointProperties().getBasePath();
-
- @LocalServerPort
- private int port;
-
- @Test
- public void testNormalExecution() {
- ResponseEntity res = new TestRestTemplate()
- .getForEntity("http://localhost:" + this.port + "/", String.class);
- assertEquals("incorrect response", "Hello world", res.getBody());
- }
-
- @Test
- public void testFailureFallback() {
- ResponseEntity res = new TestRestTemplate()
- .getForEntity("http://localhost:" + this.port + "/fail", String.class);
- assertEquals("incorrect fallback", "Fallback Hello world", res.getBody());
- }
-
- @Test
- @SuppressWarnings("unchecked")
- public void testHystrixHealth() {
- Map map = getHealth();
- assertThat(map).containsKeys("details");
- Map details = (Map) map.get("details");
- assertThat(details).containsKeys("hystrix");
- Map hystrix = (Map) details.get("hystrix");
- assertThat(hystrix).containsEntry("status", "UP");
- }
-
- @Test
- public void testNoDiscoveryHealth() {
- Map, ?> map = getHealth();
- // There is explicitly no discovery, so there should be no discovery health key
- assertFalse("Incorrect existing discovery health key",
- map.containsKey("discovery"));
- }
-
- private Map getHealth() {
- return new TestRestTemplate().exchange(
- "http://localhost:" + this.port + BASE_PATH + "/health", HttpMethod.GET,
- new HttpEntity(createBasicAuthHeader(USER, PASSWORD)),
- Map.class).getBody();
- }
-
- public static HttpHeaders createBasicAuthHeader(final String username,
- final String password) {
- return new HttpHeaders() {
- private static final long serialVersionUID = 1766341693637204893L;
-
- {
- String auth = username + ":" + password;
- byte[] encodedAuth = Base64.getEncoder().encode(auth.getBytes());
- String authHeader = "Basic " + new String(encodedAuth);
- this.set("Authorization", authHeader);
- }
- };
- }
-}
-
-class Service {
- @HystrixCommand
- public String hello() {
- return "Hello world";
- }
-
- @HystrixCommand(fallbackMethod = "fallback")
- public String fail() {
- throw new RuntimeException("Always fail");
- }
-
- public String fallback() {
- return "Fallback Hello world";
- }
-}
-
-// Don't use @SpringBootApplication because we don't want to component scan
-@Configuration
-@EnableAutoConfiguration
-@EnableCircuitBreaker
-@RestController
-class HystrixOnlyApplication {
-
- @Bean
- public Service service() {
- return new Service();
- }
-
- @Autowired
- private Service service;
-
- @RequestMapping("/")
- public String home() {
- return this.service.hello();
- }
-
- @RequestMapping("/fail")
- public String fail() {
- return this.service.fail();
- }
-
-}
diff --git a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/HystrixStreamEndpointTests.java b/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/HystrixStreamEndpointTests.java
deleted file mode 100644
index 405cb987..00000000
--- a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/HystrixStreamEndpointTests.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright 2013-2018 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;
-
-import java.io.InputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties;
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
-import org.springframework.boot.test.web.client.TestRestTemplate;
-import org.springframework.boot.web.server.LocalServerPort;
-import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.test.annotation.DirtiesContext;
-import org.springframework.test.context.junit4.SpringRunner;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-/**
- * @author Dave Syer
- * @author Spencer Gibb
- */
-@RunWith(SpringRunner.class)
-@SpringBootTest(classes = HystrixStreamEndpointTests.Application.class,
- webEnvironment = WebEnvironment.RANDOM_PORT, value = {
- "spring.application.name=hystrixstreamtest" })
-@DirtiesContext
-public class HystrixStreamEndpointTests {
- private static final String BASE_PATH = new WebEndpointProperties().getBasePath();
- private static final Log log = LogFactory.getLog(HystrixStreamEndpointTests.class);
-
- @LocalServerPort
- private int port = 0;
-
- @Test
- public void hystrixStreamWorks() throws Exception {
- String url = "http://localhost:" + port;
- // you have to hit a Hystrix circuit breaker before the stream sends anything
- ResponseEntity response = new TestRestTemplate().getForEntity(url,
- String.class);
- assertEquals("bad response code", HttpStatus.OK, response.getStatusCode());
-
- URL hystrixUrl = new URL(url + BASE_PATH + "/hystrix.stream");
-
- List data = new ArrayList<>();
- for (int i = 0; i < 5; i++) {
- try (InputStream in = hystrixUrl.openStream()) {
- byte[] buffer = new byte[1024];
- in.read(buffer);
- data.add(new String(buffer));
- } catch (Exception e) {
- log.error("Error getting hystrix stream, try " + i, e);
- }
- }
-
- for (String item : data) {
- if (item.contains("data:")) {
- return; // test passed
- }
- }
- fail("/hystrix.stream didn't contain 'data:' was " + data);
- }
-
- @Configuration
- @EnableAutoConfiguration
- @RestController
- @EnableCircuitBreaker
- protected static class Application {
- @Autowired
- Service service;
-
- @Bean
- Service service() {
- return new Service();
- }
-
- @RequestMapping("/")
- public String hello() {
- return service.hello();
- }
- }
-
- protected static class Service {
- @HystrixCommand
- public String hello() {
- return "Hello World";
- }
- }
-}
diff --git a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/HystrixWebfluxEndpointTests.java b/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/HystrixWebfluxEndpointTests.java
deleted file mode 100644
index c8a2bd2a..00000000
--- a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/HystrixWebfluxEndpointTests.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright 2013-2018 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;
-
-import java.util.Map;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.boot.SpringBootConfiguration;
-import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties;
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.web.server.LocalServerPort;
-import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
-import org.springframework.cloud.netflix.test.TestAutoConfiguration;
-import org.springframework.http.MediaType;
-import org.springframework.test.annotation.DirtiesContext;
-import org.springframework.test.context.junit4.SpringRunner;
-import org.springframework.test.web.reactive.server.WebTestClient;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.reactive.function.client.WebClient;
-
-import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
-
-import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
-
-import reactor.core.publisher.Flux;
-import reactor.test.StepVerifier;
-
-/**
- * @author Dave Syer
- * @author Spencer Gibb
- */
-@RunWith(SpringRunner.class)
-@SpringBootTest( webEnvironment = RANDOM_PORT, properties = {
- "spring.main.web-application-type=reactive",
- "spring.application.name=hystrixstreamwebfluxtest", /*"debug=true"*/ })
-@DirtiesContext
-public class HystrixWebfluxEndpointTests {
- private static final String BASE_PATH = new WebEndpointProperties().getBasePath();
- private static final Log log = LogFactory.getLog(HystrixWebfluxEndpointTests.class);
-
- @LocalServerPort
- private int port;
-
- @Test
- public void hystrixStreamWorks() {
- String url = "http://localhost:" + port;
- // you have to hit a Hystrix circuit breaker before the stream sends anything
- WebTestClient testClient = WebTestClient.bindToServer().baseUrl(url).build();
- testClient.get().uri("/").exchange().expectStatus().isOk();
-
- WebClient client = WebClient.create(url);
-
- Flux result = client.get().uri(BASE_PATH + "/hystrix.stream")
- .accept(MediaType.TEXT_EVENT_STREAM)
- .exchange()
- .flatMapMany(res -> res.bodyToFlux(Map.class))
- .take(5)
- .filter(map -> "HystrixCommand".equals(map.get("type")))
- .map(map -> (String)map.get("type"));
-
- StepVerifier.create(result)
- .expectNext("HystrixCommand")
- .thenCancel()
- .verify();
- }
-
- @RestController
- @EnableCircuitBreaker
- @EnableAutoConfiguration(exclude = TestAutoConfiguration.class,
- excludeName = {"org.springframework.boot.autoconfigure.security.reactive.ReactiveSecurityAutoConfiguration",
- "org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration"})
- @SpringBootConfiguration
- protected static class Config {
- @HystrixCommand
- @RequestMapping("/")
- public String hi() {
- return "hi";
- }
- }
-}
diff --git a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/security/HystrixSecurityApplication.java b/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/security/HystrixSecurityApplication.java
deleted file mode 100644
index 7d146703..00000000
--- a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/security/HystrixSecurityApplication.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.hystrix.security;
-
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.cloud.netflix.feign.EnableFeignClients;
-import org.springframework.cloud.netflix.hystrix.security.app.UsernameClient;
-import org.springframework.context.annotation.Configuration;
-
-/**
- * @author Daniel Lavoie
- */
-@Configuration
-@SpringBootApplication
-@EnableFeignClients(clients = UsernameClient.class)
-public class HystrixSecurityApplication {
-
-}
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
deleted file mode 100644
index e9a36fd3..00000000
--- a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/security/HystrixSecurityNoFeignTests.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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
deleted file mode 100644
index afba9657..00000000
--- a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/security/HystrixSecurityTests.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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.hystrix.security;
-
-import java.util.Base64;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
-import org.springframework.boot.web.server.LocalServerPort;
-import org.springframework.cloud.netflix.hystrix.security.app.CustomConcurrenyStrategy;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpMethod;
-import org.springframework.test.annotation.DirtiesContext;
-import org.springframework.test.context.ActiveProfiles;
-import org.springframework.test.context.junit4.SpringRunner;
-import org.springframework.web.client.RestTemplate;
-
-import com.netflix.hystrix.strategy.HystrixPlugins;
-import com.netflix.hystrix.strategy.concurrency.HystrixConcurrencyStrategy;
-
-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.
- * @author Daniel Lavoie
- */
-@RunWith(SpringRunner.class)
-@DirtiesContext
-@SpringBootTest(classes = HystrixSecurityApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT,
- properties = { "username.ribbon.listOfServers=localhost:${local.server.port}",
- "feign.hystrix.enabled=true"})
-@ActiveProfiles("proxysecurity")
-public class HystrixSecurityTests {
- @Autowired
- private CustomConcurrenyStrategy customConcurrenyStrategy;
-
- @LocalServerPort
- private String serverPort;
-
- //TODOO: move to constants in TestAutoConfiguration
- private String username = "user";
-
- private String password = "password";
-
- @Test
- public void testSecurityConcurrencyStrategyInstalled() {
- HystrixConcurrencyStrategy concurrencyStrategy = HystrixPlugins.getInstance().getConcurrencyStrategy();
- assertThat(concurrencyStrategy).isInstanceOf(SecurityContextConcurrencyStrategy.class);
- }
-
- @Test
- public void testFeignHystrixSecurity() {
- HttpHeaders headers = HystrixSecurityTests.createBasicAuthHeader(username,
- password);
-
- String usernameResult = new RestTemplate()
- .exchange("http://localhost:" + serverPort + "/proxy-username",
- HttpMethod.GET, new HttpEntity(headers), String.class)
- .getBody();
-
- Assert.assertTrue("Username should have been intercepted by feign interceptor.",
- username.equals(usernameResult));
-
- Assert.assertTrue("Custom hook should have been called.",
- customConcurrenyStrategy.isHookCalled());
- }
-
- public static HttpHeaders createBasicAuthHeader(final String username,
- final String password) {
- return new HttpHeaders() {
- private static final long serialVersionUID = 1766341693637204893L;
-
- {
- String auth = username + ":" + password;
- byte[] encodedAuth = Base64.getEncoder().encode(auth.getBytes());
- String authHeader = "Basic " + new String(encodedAuth);
- this.set("Authorization", authHeader);
- }
- };
- }
-}
diff --git a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/security/app/CustomConcurrenyStrategy.java b/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/security/app/CustomConcurrenyStrategy.java
deleted file mode 100644
index 674adf67..00000000
--- a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/security/app/CustomConcurrenyStrategy.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.springframework.cloud.netflix.hystrix.security.app;
-
-import java.util.concurrent.Callable;
-
-import org.springframework.stereotype.Component;
-
-import com.netflix.hystrix.strategy.concurrency.HystrixConcurrencyStrategy;
-
-@Component
-public class CustomConcurrenyStrategy extends HystrixConcurrencyStrategy {
- private boolean hookCalled;
-
- @Override
- public Callable wrapCallable(Callable callable) {
- this.hookCalled = true;
-
- return super.wrapCallable(callable);
- }
-
- public boolean isHookCalled() {
- return hookCalled;
- }
-}
diff --git a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/security/app/ProxyUsernameController.java b/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/security/app/ProxyUsernameController.java
deleted file mode 100644
index 2f30427c..00000000
--- a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/security/app/ProxyUsernameController.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.hystrix.security.app;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * @author Daniel Lavoie
- */
-@RestController
-@RequestMapping("/proxy-username")
-public class ProxyUsernameController {
- @Autowired
- private UsernameClient usernameClient;
-
- @RequestMapping
- public String getUsername() {
- return usernameClient.getUsername();
- }
-}
diff --git a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/security/app/TestInterceptor.java b/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/security/app/TestInterceptor.java
deleted file mode 100644
index c904de7e..00000000
--- a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/security/app/TestInterceptor.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.hystrix.security.app;
-
-import org.springframework.security.core.context.SecurityContextHolder;
-import org.springframework.stereotype.Component;
-
-import feign.RequestInterceptor;
-import feign.RequestTemplate;
-
-/**
- * This interceptor should be called from an Hyxtrix command execution thread. It is
- * access the SecurityContext and settings an http header from the authentication details.
- *
- * @author Daniel Lavoie
- */
-@Component
-public class TestInterceptor implements RequestInterceptor {
-
- @Override
- public void apply(RequestTemplate template) {
- if (SecurityContextHolder.getContext().getAuthentication() != null)
- template.header("username",
- SecurityContextHolder.getContext().getAuthentication().getName());
- }
-}
diff --git a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/security/app/UsernameClient.java b/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/security/app/UsernameClient.java
deleted file mode 100644
index b630f839..00000000
--- a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/security/app/UsernameClient.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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.hystrix.security.app;
-
-import org.springframework.cloud.netflix.feign.FeignClient;
-import org.springframework.web.bind.annotation.RequestMapping;
-
-/**
- * @author Daniel Lavoie
- */
-@FeignClient("username")
-public interface UsernameClient {
-
- @RequestMapping("/username")
- public String getUsername();
-}
diff --git a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/security/app/UsernameController.java b/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/security/app/UsernameController.java
deleted file mode 100644
index 54605b8e..00000000
--- a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/security/app/UsernameController.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.hystrix.security.app;
-
-import org.springframework.web.bind.annotation.RequestHeader;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * @author Daniel Lavoie
- */
-@RestController
-@RequestMapping("/username")
-public class UsernameController {
- @RequestMapping
- public String getUsername(@RequestHeader String username){
- return username;
- }
-}
diff --git a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/resttemplate/RestTemplateRetryTests.java b/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/resttemplate/RestTemplateRetryTests.java
deleted file mode 100644
index 1458353f..00000000
--- a/spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/resttemplate/RestTemplateRetryTests.java
+++ /dev/null
@@ -1,287 +0,0 @@
-package org.springframework.cloud.netflix.resttemplate;
-
-import java.net.UnknownHostException;
-import java.util.Arrays;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.cloud.client.loadbalancer.LoadBalanced;
-import org.springframework.cloud.netflix.ribbon.RibbonClient;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.test.annotation.DirtiesContext;
-import org.springframework.test.context.junit4.SpringRunner;
-import org.springframework.util.SocketUtils;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.client.RestTemplate;
-
-import com.netflix.client.RetryHandler;
-import com.netflix.client.config.IClientConfig;
-import com.netflix.loadbalancer.AvailabilityFilteringRule;
-import com.netflix.loadbalancer.BaseLoadBalancer;
-import com.netflix.loadbalancer.ILoadBalancer;
-import com.netflix.loadbalancer.IPing;
-import com.netflix.loadbalancer.IRule;
-import com.netflix.loadbalancer.LoadBalancerBuilder;
-import com.netflix.loadbalancer.LoadBalancerStats;
-import com.netflix.loadbalancer.Server;
-import com.netflix.loadbalancer.ServerList;
-import com.netflix.loadbalancer.ServerStats;
-import com.netflix.niws.client.http.HttpClientLoadBalancerErrorHandler;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest(classes = RestTemplateRetryTests.Application.class, webEnvironment = RANDOM_PORT,
- properties = { "spring.application.name=resttemplatetest", "logging.level.com.netflix=DEBUG",
- "logging.level.org.springframework.cloud.netflix.resttemplate=DEBUG",
- "logging.level.com.netflix=DEBUG", "badClients.ribbon.MaxAutoRetries=25",
- "badClients.ribbon.OkToRetryOnAllOperations=true", "ribbon.http.client.enabled" })
-@DirtiesContext
-public class RestTemplateRetryTests {
-
- private static final Log logger = LogFactory.getLog(RestTemplateRetryTests.class);
-
- @Autowired
- private RestTemplate testClient;
-
- @Before
- public void setup() throws Exception {
- // Force Ribbon configuration by making one call.
- this.testClient.getForObject("http://badClients/ping", Integer.class);
- }
-
- @Test
- public void testNullPointer() throws Exception {
-
- LoadBalancerStats stats = LocalBadClientConfiguration.balancer
- .getLoadBalancerStats();
- ServerStats badServer1Stats = stats
- .getSingleServerStat(LocalBadClientConfiguration.badServer);
- ServerStats badServer2Stats = stats
- .getSingleServerStat(LocalBadClientConfiguration.badServer2);
- ServerStats goodServerStats = stats
- .getSingleServerStat(LocalBadClientConfiguration.goodServer);
-
- badServer1Stats.clearSuccessiveConnectionFailureCount();
- badServer2Stats.clearSuccessiveConnectionFailureCount();
- int numCalls = 10;
- long targetConnectionCount = goodServerStats.getTotalRequestsCount() + numCalls;
-
- // A null pointer should NOT trigger a circuit breaker.
- for (int index = 0; index < numCalls; index++) {
- try {
- this.testClient.getForObject("http://badClients/null", Integer.class);
- }
- catch (Exception exception) {
- }
- }
- logServerStats(LocalBadClientConfiguration.badServer);
- logServerStats(LocalBadClientConfiguration.badServer2);
- logServerStats(LocalBadClientConfiguration.goodServer);
-
- assertTrue(badServer1Stats.isCircuitBreakerTripped());
- assertTrue(badServer2Stats.isCircuitBreakerTripped());
- assertThat(targetConnectionCount).isLessThanOrEqualTo(goodServerStats.getTotalRequestsCount());
-
- // Wait for any timeout thread to finish.
-
- }
-
- private void logServerStats(Server server) {
- LoadBalancerStats stats = LocalBadClientConfiguration.balancer
- .getLoadBalancerStats();
- ServerStats serverStats = stats.getSingleServerStat(server);
- logger.debug("Server : " + server.toString() + " : Total Count == "
- + serverStats.getTotalRequestsCount() + ", Failure Count == "
- + serverStats.getFailureCount() + ", Successive Connection Failure == "
- + serverStats.getSuccessiveConnectionFailureCount()
- + ", Circuit Breaker ? == " + serverStats.isCircuitBreakerTripped());
- }
-
- @Test
- public void testRestRetries() {
-
- LoadBalancerStats stats = LocalBadClientConfiguration.balancer
- .getLoadBalancerStats();
- ServerStats badServer1Stats = stats
- .getSingleServerStat(LocalBadClientConfiguration.badServer);
- ServerStats badServer2Stats = stats
- .getSingleServerStat(LocalBadClientConfiguration.badServer2);
- ServerStats goodServerStats = stats
- .getSingleServerStat(LocalBadClientConfiguration.goodServer);
-
- badServer1Stats.clearSuccessiveConnectionFailureCount();
- badServer2Stats.clearSuccessiveConnectionFailureCount();
- int numCalls = 20;
- long targetConnectionCount = goodServerStats.getTotalRequestsCount() + numCalls;
-
- int hits = 0;
-
- for (int index = 0; index < numCalls; index++) {
- hits = this.testClient.getForObject("http://badClients/good", Integer.class);
- }
-
- logServerStats(LocalBadClientConfiguration.badServer);
- logServerStats(LocalBadClientConfiguration.badServer2);
- logServerStats(LocalBadClientConfiguration.goodServer);
-
- assertTrue(badServer1Stats.isCircuitBreakerTripped());
- assertTrue(badServer2Stats.isCircuitBreakerTripped());
- assertThat(targetConnectionCount).isLessThanOrEqualTo(goodServerStats.getTotalRequestsCount());
- assertThat(hits).isGreaterThanOrEqualTo(numCalls);
- logger.debug("Retry Hits: " + hits);
- }
-
- @Test
- public void testRestRetriesWithReadTimeout() throws Exception {
-
- LoadBalancerStats stats = LocalBadClientConfiguration.balancer
- .getLoadBalancerStats();
- ServerStats badServer1Stats = stats
- .getSingleServerStat(LocalBadClientConfiguration.badServer);
- ServerStats badServer2Stats = stats
- .getSingleServerStat(LocalBadClientConfiguration.badServer2);
- ServerStats goodServerStats = stats
- .getSingleServerStat(LocalBadClientConfiguration.goodServer);
-
- badServer1Stats.clearSuccessiveConnectionFailureCount();
- badServer2Stats.clearSuccessiveConnectionFailureCount();
- assertTrue(!badServer1Stats.isCircuitBreakerTripped());
- assertTrue(!badServer2Stats.isCircuitBreakerTripped());
-
- int hits = 0;
-
- int numCalls = 15;
- for (int index = 0; index < numCalls; index++) {
- hits = this.testClient.getForObject("http://badClients/timeout",
- Integer.class);
- }
- logServerStats(LocalBadClientConfiguration.badServer);
- logServerStats(LocalBadClientConfiguration.badServer2);
- logServerStats(LocalBadClientConfiguration.goodServer);
-
- assertTrue(badServer1Stats.isCircuitBreakerTripped());
- assertTrue(badServer2Stats.isCircuitBreakerTripped());
- assertTrue(!goodServerStats.isCircuitBreakerTripped());
-
- // 15 + 4 timeouts. See the endpoint for timeout conditions.
- assertThat(hits).isGreaterThanOrEqualTo(numCalls + 4);
-
- // Wait for any timeout thread to finish.
- Thread.sleep(600);
-
- }
-
- @Configuration
- @EnableAutoConfiguration
- @RestController
- @RibbonClient(name = "badClients", configuration = LocalBadClientConfiguration.class)
- public static class Application {
-
- private AtomicInteger hits = new AtomicInteger(1);
- private AtomicInteger retryHits = new AtomicInteger(1);
-
- @RequestMapping(method = RequestMethod.GET, value = "/ping")
- public int ping() {
- return 0;
- }
-
- @RequestMapping(method = RequestMethod.GET, value = "/good")
- public int good() {
- int lValue = this.hits.getAndIncrement();
- return lValue;
- }
-
- @RequestMapping(method = RequestMethod.GET, value = "/timeout")
- public int timeout() throws Exception {
- int lValue = this.retryHits.getAndIncrement();
-
- // Force the good server to have 2 consecutive errors a couple of times.
- if (lValue == 2 || lValue == 3 || lValue == 5 || lValue == 6) {
- Thread.sleep(500);
- }
- return lValue;
- }
-
- @RequestMapping(method = RequestMethod.GET, value = "/null")
- public int isNull() throws Exception {
- throw new NullPointerException("Null");
- }
-
- @LoadBalanced
- @Bean
- RestTemplate restTemplate() {
- return new RestTemplate();
- }
- }
-
-
- // Load balancer with fixed server list for "local" pointing to localhost
- // and some bogus servers are thrown in to test retry
- @Configuration
- static class LocalBadClientConfiguration {
-
- static BaseLoadBalancer balancer;
- static Server goodServer;
- static Server badServer;
- static Server badServer2;
-
- public LocalBadClientConfiguration() {
- }
-
- @Value("${local.server.port}")
- private int port = 0;
-
- @Bean
- public IRule loadBalancerRule() {
- // This is a good place to try different load balancing rules and how those rules
- // behave in failure states: BestAvailableRule, WeightedResponseTimeRule, etc
-
- // This rule just uses a round robin and will skip servers that are in circuit
- // breaker state.
- return new AvailabilityFilteringRule();
-
- }
-
- @Bean
- public ILoadBalancer ribbonLoadBalancer(IClientConfig config,
- ServerList serverList, IRule rule, IPing ping) {
-
- goodServer = new Server("localhost", this.port);
- badServer = new Server("mybadhost", 10001);
- badServer2 = new Server("localhost", SocketUtils.findAvailableTcpPort());
-
- balancer = LoadBalancerBuilder.newBuilder().withClientConfig(config)
- .withRule(rule).withPing(ping).buildFixedServerListLoadBalancer(
- Arrays.asList(badServer, badServer2, goodServer));
- return balancer;
- }
-
- @Bean
- public RetryHandler retryHandler() {
- return new OverrideRetryHandler();
- }
-
- static class OverrideRetryHandler extends HttpClientLoadBalancerErrorHandler {
- public OverrideRetryHandler() {
- this.circuitRelated.add(UnknownHostException.class);
- this.retriable.add(UnknownHostException.class);
- }
- }
-
- }
-}
diff --git a/spring-cloud-netflix-core/src/test/resources/archaius_db_store.sql b/spring-cloud-netflix-core/src/test/resources/archaius_db_store.sql
deleted file mode 100644
index 6b914cb5..00000000
--- a/spring-cloud-netflix-core/src/test/resources/archaius_db_store.sql
+++ /dev/null
@@ -1,8 +0,0 @@
-create table if not exists properties (
- property_key VARCHAR(40) NOT NULL PRIMARY KEY,
- property_value VARCHAR(255) NOT NULL,
-);
-
-insert into properties(property_key, property_value) values ('db.property','this is a db property');
-insert into properties(property_key, property_value) values ('db.second.property','this is another db property');
-
diff --git a/spring-cloud-netflix-core/src/test/resources/config.properties.bak b/spring-cloud-netflix-core/src/test/resources/config.properties.bak
deleted file mode 100644
index 1e9c021f..00000000
--- a/spring-cloud-netflix-core/src/test/resources/config.properties.bak
+++ /dev/null
@@ -1,2 +0,0 @@
-archaius.file.property=Static config file property
-db.second.property=It should be overridden
diff --git a/spring-cloud-netflix-core/src/test/resources/static/index.html b/spring-cloud-netflix-core/src/test/resources/static/index.html
deleted file mode 100644
index 27f58190..00000000
--- a/spring-cloud-netflix-core/src/test/resources/static/index.html
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/spring-cloud-netflix-dependencies/pom.xml b/spring-cloud-netflix-dependencies/pom.xml
deleted file mode 100644
index 55891682..00000000
--- a/spring-cloud-netflix-dependencies/pom.xml
+++ /dev/null
@@ -1,578 +0,0 @@
-
-
- 4.0.0
-
- spring-cloud-dependencies-parent
- org.springframework.cloud
- 2.0.0.BUILD-SNAPSHOT
-
-
- spring-cloud-netflix-dependencies
- 2.0.0.BUILD-SNAPSHOT
- pom
- spring-cloud-netflix-dependencies
- Spring Cloud Netflix Dependencies
-
- 0.7.5
- 1.8.6
- 9.5.1
- 1.5.12
- 2.2.4
- 0.10.1
- 1.3.1
- 1.2.0
- 1.2.1
- 1.0.0
- 1.19.1
- 1.4.9
- 3.8.1
-
-
-
-
- org.springframework.cloud
- spring-cloud-netflix-eureka-client
- ${project.version}
-
-
- org.springframework.cloud
- spring-cloud-netflix-archaius
- ${project.version}
-
-
- org.springframework.cloud
- spring-cloud-starter-netflix-archaius
- ${project.version}
-
-
- org.springframework.cloud
- spring-cloud-starter-netflix-eureka-client
- ${project.version}
-
-
- org.springframework.cloud
- spring-cloud-starter-netflix-eureka-server
- ${project.version}
-
-
- org.springframework.cloud
- spring-cloud-starter-openfeign
- ${project.version}
-
-
- org.springframework.cloud
- spring-cloud-starter-netflix-hystrix
- ${project.version}
-
-
- org.springframework.cloud
- spring-cloud-netflix-hystrix-contract
- ${project.version}
-
-
- org.springframework.cloud
- spring-cloud-starter-netflix-hystrix-dashboard
- ${project.version}
-
-
- org.springframework.cloud
- spring-cloud-starter-netflix-ribbon
- ${project.version}
-
-
- org.springframework.cloud
- spring-cloud-starter-netflix-turbine
- ${project.version}
-
-
- org.springframework.cloud
- spring-cloud-starter-netflix-turbine-stream
- ${project.version}
-
-
- org.springframework.cloud
- spring-cloud-starter-netflix-zuul
- ${project.version}
-
-
- org.springframework.cloud
- spring-cloud-netflix-core
- ${project.version}
-
-
- org.springframework.cloud
- spring-cloud-netflix-eureka-server
- ${project.version}
-
-
- org.springframework.cloud
- spring-cloud-netflix-hystrix-dashboard
- ${project.version}
-
-
- org.springframework.cloud
- spring-cloud-netflix-hystrix-stream
- ${project.version}
-
-
- org.springframework.cloud
- spring-cloud-netflix-sidecar
- ${project.version}
-
-
- org.springframework.cloud
- spring-cloud-netflix-turbine
- ${project.version}
-
-
- org.springframework.cloud
- spring-cloud-netflix-turbine-stream
- ${project.version}
-
-
- org.springframework.cloud
- spring-cloud-netflix-zuul
- ${project.version}
-
-
- org.springframework.cloud
- spring-cloud-netflix-ribbon
- ${project.version}
-
-
- com.netflix.netflix-commons
- netflix-commons-util
- 0.1.1
-
-
- com.netflix.archaius
- archaius-core
- ${archaius.version}
-
-
- commons-logging
- commons-logging
-
-
- com.google.code.findbugs
- annotations
-
-
-
-
-
- commons-configuration
- commons-configuration
- 1.8
-
-
- commons-logging
- commons-logging
-
-
-
-
-
- com.sun.jersey
- jersey-servlet
- ${eureka-jersey.version}
-
-
- com.sun.jersey
- jersey-core
- ${eureka-jersey.version}
-
-
- com.sun.jersey
- jersey-client
- ${eureka-jersey.version}
-
-
- com.sun.jersey
- jersey-server
- ${eureka-jersey.version}
-
-
- com.sun.jersey.contribs
- jersey-apache-client4
- ${eureka-jersey.version}
-
-
- com.netflix.servo
- servo-core
- ${servo.version}
-
-
- com.google.code.findbugs
- annotations
-
-
-
-
- com.netflix.eureka
- eureka-client
- ${eureka.version}
-
-
- javax.servlet
- servlet-api
-
-
- commons-logging
- commons-logging
-
-
- com.google.code.findbugs
- jsr305
-
-
- com.google.code.findbugs
- annotations
-
-
-
-
- com.netflix.eureka
- eureka-core
- ${eureka.version}
-
-
- javax.servlet
- servlet-api
-
-
- commons-logging
- commons-logging
-
-
- log4j
- log4j
-
-
- com.netflix.blitz4j
- blitz4j
-
-
- com.google.code.findbugs
- annotations
-
-
- com.google.code.findbugs
- jsr305
-
-
- jackson-dataformat-xml
- com.fasterxml.jackson.dataformat
-
-
- *
- com.amazonaws
-
-
-
-
-
- com.thoughtworks.xstream
- xstream
- ${xstream.version}
-
-
- io.github.openfeign
- feign-core
- ${feign.version}
-
-
- io.github.openfeign
- feign-slf4j
- ${feign.version}
-
-
- io.github.openfeign
- feign-httpclient
- ${feign.version}
-
-
- io.github.openfeign
- feign-hystrix
- ${feign.version}
-
-
- io.github.openfeign
- feign-java8
- ${feign.version}
-
-
- io.github.openfeign
- feign-okhttp
- ${feign.version}
-
-
- io.github.openfeign
- feign-gson
- ${feign.version}
-
-
- io.github.openfeign
- feign-jackson-jaxb
- ${feign.version}
-
-
- io.github.openfeign
- feign-jackson
- ${feign.version}
-
-
- io.github.openfeign
- feign-java8
- ${feign.version}
-
-
- io.github.openfeign
- feign-jaxb
- ${feign.version}
-
-
- io.github.openfeign
- feign-jaxrs
- ${feign.version}
-
-
- io.github.openfeign
- feign-ribbon
- ${feign.version}
-
-
- io.github.openfeign
- feign-sax
- ${feign.version}
-
-
- com.netflix.hystrix
- hystrix-core
- ${hystrix.version}
-
-
- com.google.code.findbugs
- annotations
-
-
-
-
- com.netflix.hystrix
- hystrix-serialization
- ${hystrix.version}
-
-
- com.google.code.findbugs
- annotations
-
-
-
-
- com.netflix.hystrix
- hystrix-metrics-event-stream
- ${hystrix.version}
-
-
- javax.servlet
- servlet-api
-
-
-
-
- com.netflix.hystrix
- hystrix-javanica
- ${hystrix.version}
-
-
- com.google.code.findbugs
- jsr305
-
-
- com.google.code.findbugs
- annotations
-
-
- org.aspectj
- aspectjrt
-
-
-
-
- com.netflix.ribbon
- ribbon
- ${ribbon.version}
-
-
- commons-logging
- commons-logging
-
-
-
-
- com.netflix.ribbon
- ribbon-core
- ${ribbon.version}
-
-
- com.google.code.findbugs
- annotations
-
-
-
-
- com.netflix.ribbon
- ribbon-httpclient
- ${ribbon.version}
-
-
- com.google.code.findbugs
- annotations
-
-
-
-
- com.netflix.ribbon
- ribbon-eureka
- ${ribbon.version}
-
-
- com.google.code.findbugs
- annotations
-
-
- javax.servlet
- servlet-api
-
-
-
-
- com.netflix.ribbon
- ribbon-loadbalancer
- ${ribbon.version}
-
-
- com.google.code.findbugs
- annotations
-
-
-
-
- io.reactivex
- rxjava
- ${rxjava.version}
-
-
- io.reactivex
- rxjava-reactive-streams
- ${rxjava-reactive-streams.version}
-
-
- com.netflix.zuul
- zuul-core
- ${zuul.version}
-
-
- groovy-all
- org.codehaus.groovy
-
-
- mockito-all
- org.mockito
-
-
-
-
- com.squareup.okhttp3
- okhttp
- ${okhttp3.version}
-
-
- com.squareup.okhttp3
- logging-interceptor
- ${okhttp3.version}
-
-
- com.google.guava
- guava
- 18.0
-
-
- org.webjars
- d3js
- 3.4.11
-
-
- org.webjars
- jquery
- 2.1.1
-
-
- org.webjars
- bootstrap
- 3.2.0
-
-
- javax.inject
- javax.inject
- 1
-
-
-
-
-
- spring
-
-
- spring-snapshots
- Spring Snapshots
- https://repo.spring.io/libs-snapshot-local
-
- true
-
-
- false
-
-
-
- spring-milestones
- Spring Milestones
- https://repo.spring.io/libs-milestone-local
-
- false
-
-
-
- spring-releases
- Spring Releases
- https://repo.spring.io/release
-
- false
-
-
-
-
-
- spring-snapshots
- Spring Snapshots
- https://repo.spring.io/libs-snapshot-local
-
- true
-
-
- false
-
-
-
- spring-milestones
- Spring Milestones
- https://repo.spring.io/libs-milestone-local
-
- false
-
-
-
-
-
-
diff --git a/spring-cloud-netflix-eureka-client/pom.xml b/spring-cloud-netflix-eureka-client/pom.xml
deleted file mode 100644
index c6891838..00000000
--- a/spring-cloud-netflix-eureka-client/pom.xml
+++ /dev/null
@@ -1,135 +0,0 @@
-
-
- 4.0.0
-
- org.springframework.cloud
- spring-cloud-netflix
- 2.0.0.BUILD-SNAPSHOT
- ..
-
- spring-cloud-netflix-eureka-client
- jar
- Spring Cloud Netflix Eureka Client
- Spring Cloud Netflix Eureka Client
-
-
- false
- ${basedir}/..
-
-
-
- org.springframework.boot
- spring-boot-configuration-processor
- true
-
-
- org.springframework.boot
- spring-boot-starter-actuator
- true
-
-
- org.springframework.cloud
- spring-cloud-netflix-core
-
-
- org.springframework.cloud
- spring-cloud-config-client
- true
-
-
- org.springframework.cloud
- spring-cloud-config-server
- true
-
-
- com.netflix.eureka
- eureka-client
- true
-
-
- javax.inject
- javax.inject
- true
-
-
- com.netflix.eureka
- eureka-core
- true
-
-
-
- com.thoughtworks.xstream
- xstream
- true
-
-
- net.java.dev.rome
- rome
- 1.0.0
- true
-
-
- com.sun.jersey.contribs
- jersey-apache-client4
- true
-
-
- com.netflix.archaius
- archaius-core
- true
-
-
-
- commons-configuration
- commons-configuration
- true
-
-
-
- com.netflix.ribbon
- ribbon
- true
-
-
- com.netflix.ribbon
- ribbon-core
- true
-
-
- com.netflix.ribbon
- ribbon-loadbalancer
- true
-
-
- com.netflix.ribbon
- ribbon-eureka
- true
-
-
- com.netflix.ribbon
- ribbon-httpclient
- true
-
-
- org.springframework.boot
- spring-boot-starter-security
- test
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
- org.springframework.cloud
- spring-cloud-test-support
- test
-
-
- org.springframework.retry
- spring-retry
- test
-
-
-
diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/CloudEurekaClient.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/CloudEurekaClient.java
deleted file mode 100644
index d1c8ead7..00000000
--- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/CloudEurekaClient.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright 2013-2018 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.eureka;
-
-import java.lang.reflect.Field;
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.cloud.client.discovery.event.HeartbeatEvent;
-import org.springframework.context.ApplicationEventPublisher;
-import org.springframework.http.HttpStatus;
-import org.springframework.util.ReflectionUtils;
-
-import com.netflix.appinfo.ApplicationInfoManager;
-import com.netflix.appinfo.InstanceInfo;
-import com.netflix.appinfo.InstanceInfo.InstanceStatus;
-import com.netflix.discovery.AbstractDiscoveryClientOptionalArgs;
-import com.netflix.discovery.DiscoveryClient;
-import com.netflix.discovery.EurekaClientConfig;
-import com.netflix.discovery.shared.transport.EurekaHttpClient;
-import com.netflix.discovery.shared.transport.EurekaHttpResponse;
-
-/**
- * Subclass of {@link DiscoveryClient} that sends a {@link HeartbeatEvent} when
- * {@link CloudEurekaClient#onCacheRefreshed()} is called.
- * @author Spencer Gibb
- */
-public class CloudEurekaClient extends DiscoveryClient {
- private static final Log log = LogFactory.getLog(CloudEurekaClient.class);
-
- private final AtomicLong cacheRefreshedCount = new AtomicLong(0);
-
- private ApplicationEventPublisher publisher;
- private Field eurekaTransportField;
- private ApplicationInfoManager applicationInfoManager;
- private AtomicReference eurekaHttpClient = new AtomicReference<>();
-
- public CloudEurekaClient(ApplicationInfoManager applicationInfoManager,
- EurekaClientConfig config, ApplicationEventPublisher publisher) {
- this(applicationInfoManager, config, null, publisher);
- }
-
- public CloudEurekaClient(ApplicationInfoManager applicationInfoManager,
- EurekaClientConfig config,
- AbstractDiscoveryClientOptionalArgs> args,
- ApplicationEventPublisher publisher) {
- super(applicationInfoManager, config, args);
- this.applicationInfoManager = applicationInfoManager;
- this.publisher = publisher;
- this.eurekaTransportField = ReflectionUtils.findField(DiscoveryClient.class, "eurekaTransport");
- ReflectionUtils.makeAccessible(this.eurekaTransportField);
- }
-
- public ApplicationInfoManager getApplicationInfoManager() {
- return applicationInfoManager;
- }
-
- public void cancelOverrideStatus(InstanceInfo info) {
- getEurekaHttpClient().deleteStatusOverride(info.getAppName(), info.getId(), info);
- }
-
- public InstanceInfo getInstanceInfo(String appname, String instanceId) {
- EurekaHttpResponse response = getEurekaHttpClient().getInstance(appname, instanceId);
- HttpStatus httpStatus = HttpStatus.valueOf(response.getStatusCode());
- if (httpStatus.is2xxSuccessful() && response.getEntity() != null) {
- return response.getEntity();
- }
- return null;
- }
-
- EurekaHttpClient getEurekaHttpClient() {
- if (this.eurekaHttpClient.get() == null) {
- try {
- Object eurekaTransport = this.eurekaTransportField.get(this);
- Field registrationClientField = ReflectionUtils.findField(eurekaTransport.getClass(), "registrationClient");
- ReflectionUtils.makeAccessible(registrationClientField);
- this.eurekaHttpClient.compareAndSet(null, (EurekaHttpClient) registrationClientField.get(eurekaTransport));
- } catch (IllegalAccessException e) {
- log.error("error getting EurekaHttpClient", e);
- }
- }
- return this.eurekaHttpClient.get();
- }
-
- public void setStatus(InstanceStatus newStatus, InstanceInfo info) {
- getEurekaHttpClient().statusUpdate(info.getAppName(), info.getId(), newStatus, info);
- }
-
- @Override
- protected void onCacheRefreshed() {
- super.onCacheRefreshed();
-
- if (this.cacheRefreshedCount != null) { //might be called during construction and will be null
- long newCount = this.cacheRefreshedCount.incrementAndGet();
- log.trace("onCacheRefreshed called with count: " + newCount);
- this.publisher.publishEvent(new HeartbeatEvent(this, newCount));
- }
- }
-}
diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/CloudEurekaInstanceConfig.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/CloudEurekaInstanceConfig.java
deleted file mode 100644
index 6ea3e889..00000000
--- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/CloudEurekaInstanceConfig.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2013-2015 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.eureka;
-
-import com.netflix.appinfo.EurekaInstanceConfig;
-import com.netflix.appinfo.InstanceInfo;
-
-/**
- * @author Spencer Gibb
- */
-public interface CloudEurekaInstanceConfig extends EurekaInstanceConfig {
- void setNonSecurePort(int port);
- void setSecurePort(int securePort);
- InstanceInfo.InstanceStatus getInitialStatus();
-}
diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/CloudEurekaTransportConfig.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/CloudEurekaTransportConfig.java
deleted file mode 100644
index 5eb21163..00000000
--- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/CloudEurekaTransportConfig.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * Copyright 2013-2015 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.eureka;
-
-import com.netflix.discovery.shared.transport.EurekaTransportConfig;
-
-import java.util.Objects;
-
-/**
- * @author Spencer Gibb
- * @author Gregor Zurowski
- */
-public class CloudEurekaTransportConfig implements EurekaTransportConfig {
-
- private int sessionedClientReconnectIntervalSeconds = 20 * 60;
-
- private double retryableClientQuarantineRefreshPercentage = 0.66;
-
- private int bootstrapResolverRefreshIntervalSeconds = 5 * 60;
-
- private int applicationsResolverDataStalenessThresholdSeconds = 5 * 60;
-
- private int asyncResolverRefreshIntervalMs = 5 * 60 * 1000;
-
- private int asyncResolverWarmUpTimeoutMs = 5000;
-
- private int asyncExecutorThreadPoolSize = 5;
-
- private String readClusterVip;
-
- private String writeClusterVip;
-
- private boolean bootstrapResolverForQuery = true;
-
- private String bootstrapResolverStrategy;
-
- private boolean applicationsResolverUseIp = false;
-
- @Override
- public boolean useBootstrapResolverForQuery() {
- return this.bootstrapResolverForQuery;
- }
-
- @Override
- public boolean applicationsResolverUseIp() {
- return this.applicationsResolverUseIp;
- }
-
- public int getSessionedClientReconnectIntervalSeconds() {
- return sessionedClientReconnectIntervalSeconds;
- }
-
- public void setSessionedClientReconnectIntervalSeconds(
- int sessionedClientReconnectIntervalSeconds) {
- this.sessionedClientReconnectIntervalSeconds = sessionedClientReconnectIntervalSeconds;
- }
-
- public double getRetryableClientQuarantineRefreshPercentage() {
- return retryableClientQuarantineRefreshPercentage;
- }
-
- public void setRetryableClientQuarantineRefreshPercentage(
- double retryableClientQuarantineRefreshPercentage) {
- this.retryableClientQuarantineRefreshPercentage = retryableClientQuarantineRefreshPercentage;
- }
-
- public int getBootstrapResolverRefreshIntervalSeconds() {
- return bootstrapResolverRefreshIntervalSeconds;
- }
-
- public void setBootstrapResolverRefreshIntervalSeconds(
- int bootstrapResolverRefreshIntervalSeconds) {
- this.bootstrapResolverRefreshIntervalSeconds = bootstrapResolverRefreshIntervalSeconds;
- }
-
- public int getApplicationsResolverDataStalenessThresholdSeconds() {
- return applicationsResolverDataStalenessThresholdSeconds;
- }
-
- public void setApplicationsResolverDataStalenessThresholdSeconds(
- int applicationsResolverDataStalenessThresholdSeconds) {
- this.applicationsResolverDataStalenessThresholdSeconds = applicationsResolverDataStalenessThresholdSeconds;
- }
-
- public int getAsyncResolverRefreshIntervalMs() {
- return asyncResolverRefreshIntervalMs;
- }
-
- public void setAsyncResolverRefreshIntervalMs(int asyncResolverRefreshIntervalMs) {
- this.asyncResolverRefreshIntervalMs = asyncResolverRefreshIntervalMs;
- }
-
- public int getAsyncResolverWarmUpTimeoutMs() {
- return asyncResolverWarmUpTimeoutMs;
- }
-
- public void setAsyncResolverWarmUpTimeoutMs(int asyncResolverWarmUpTimeoutMs) {
- this.asyncResolverWarmUpTimeoutMs = asyncResolverWarmUpTimeoutMs;
- }
-
- public int getAsyncExecutorThreadPoolSize() {
- return asyncExecutorThreadPoolSize;
- }
-
- public void setAsyncExecutorThreadPoolSize(int asyncExecutorThreadPoolSize) {
- this.asyncExecutorThreadPoolSize = asyncExecutorThreadPoolSize;
- }
-
- public String getReadClusterVip() {
- return readClusterVip;
- }
-
- public void setReadClusterVip(String readClusterVip) {
- this.readClusterVip = readClusterVip;
- }
-
- public String getWriteClusterVip() {
- return writeClusterVip;
- }
-
- public void setWriteClusterVip(String writeClusterVip) {
- this.writeClusterVip = writeClusterVip;
- }
-
- public boolean isBootstrapResolverForQuery() {
- return bootstrapResolverForQuery;
- }
-
- public void setBootstrapResolverForQuery(boolean bootstrapResolverForQuery) {
- this.bootstrapResolverForQuery = bootstrapResolverForQuery;
- }
-
- public String getBootstrapResolverStrategy() {
- return bootstrapResolverStrategy;
- }
-
- public void setBootstrapResolverStrategy(String bootstrapResolverStrategy) {
- this.bootstrapResolverStrategy = bootstrapResolverStrategy;
- }
-
- public boolean isApplicationsResolverUseIp() {
- return applicationsResolverUseIp;
- }
-
- public void setApplicationsResolverUseIp(boolean applicationsResolverUseIp) {
- this.applicationsResolverUseIp = applicationsResolverUseIp;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- CloudEurekaTransportConfig that = (CloudEurekaTransportConfig) o;
- return sessionedClientReconnectIntervalSeconds == that.sessionedClientReconnectIntervalSeconds &&
- Double.compare(retryableClientQuarantineRefreshPercentage, that.retryableClientQuarantineRefreshPercentage) == 0 &&
- bootstrapResolverRefreshIntervalSeconds == that.bootstrapResolverRefreshIntervalSeconds &&
- applicationsResolverDataStalenessThresholdSeconds == that.applicationsResolverDataStalenessThresholdSeconds &&
- asyncResolverRefreshIntervalMs == that.asyncResolverRefreshIntervalMs &&
- asyncResolverWarmUpTimeoutMs == that.asyncResolverWarmUpTimeoutMs &&
- asyncExecutorThreadPoolSize == that.asyncExecutorThreadPoolSize &&
- Objects.equals(readClusterVip, that.readClusterVip) &&
- Objects.equals(writeClusterVip, that.writeClusterVip) &&
- bootstrapResolverForQuery == that.bootstrapResolverForQuery &&
- Objects.equals(bootstrapResolverStrategy, that.bootstrapResolverStrategy) &&
- applicationsResolverUseIp == that.applicationsResolverUseIp;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(sessionedClientReconnectIntervalSeconds,
- retryableClientQuarantineRefreshPercentage,
- bootstrapResolverRefreshIntervalSeconds,
- applicationsResolverDataStalenessThresholdSeconds,
- asyncResolverRefreshIntervalMs, asyncResolverWarmUpTimeoutMs,
- asyncExecutorThreadPoolSize, readClusterVip, writeClusterVip,
- bootstrapResolverForQuery, bootstrapResolverStrategy,
- applicationsResolverUseIp);
- }
-
- @Override
- public String toString() {
- return new StringBuilder("CloudEurekaTransportConfig{")
- .append("sessionedClientReconnectIntervalSeconds=").append(sessionedClientReconnectIntervalSeconds).append(", ")
- .append("retryableClientQuarantineRefreshPercentage=").append(retryableClientQuarantineRefreshPercentage).append(", ")
- .append("bootstrapResolverRefreshIntervalSeconds=").append(bootstrapResolverRefreshIntervalSeconds).append(", ")
- .append("applicationsResolverDataStalenessThresholdSeconds=").append(applicationsResolverDataStalenessThresholdSeconds).append(", ")
- .append("asyncResolverRefreshIntervalMs=").append(asyncResolverRefreshIntervalMs).append(", ")
- .append("asyncResolverWarmUpTimeoutMs=").append(asyncResolverWarmUpTimeoutMs).append(", ")
- .append("asyncExecutorThreadPoolSize=").append(asyncExecutorThreadPoolSize).append(", ")
- .append("readClusterVip='").append(readClusterVip).append("', ")
- .append("writeClusterVip='").append(writeClusterVip).append("', ")
- .append("bootstrapResolverForQuery=").append(bootstrapResolverForQuery).append(", ")
- .append("bootstrapResolverStrategy='").append(bootstrapResolverStrategy).append("', ")
- .append("applicationsResolverUseIp=").append(applicationsResolverUseIp).append(", ").append("}")
- .toString();
- }
-}
diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EnableEurekaClient.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EnableEurekaClient.java
deleted file mode 100644
index 0af19d53..00000000
--- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EnableEurekaClient.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2013-2015 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.eureka;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Convenience annotation for clients to enable Eureka discovery configuration
- * (specifically). Use this (optionally) in case you want discovery and know for sure that
- * it is Eureka you want. All it does is turn on discovery and let the autoconfiguration
- * find the eureka classes if they are available (i.e. you need Eureka on the classpath as
- * well).
- *
- * @author Dave Syer
- * @author Spencer Gibb
- */
-@Target(ElementType.TYPE)
-@Retention(RetentionPolicy.RUNTIME)
-@Documented
-@Inherited
-public @interface EnableEurekaClient {
-
-}
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
deleted file mode 100644
index afd2b0d0..00000000
--- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaClientAutoConfiguration.java
+++ /dev/null
@@ -1,326 +0,0 @@
-/*
- * 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.eureka;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import java.util.Map;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.beans.factory.ObjectProvider;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
-import org.springframework.boot.actuate.health.Health;
-import org.springframework.boot.autoconfigure.AutoConfigureAfter;
-import org.springframework.boot.autoconfigure.AutoConfigureBefore;
-import org.springframework.boot.autoconfigure.condition.AnyNestedCondition;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.boot.autoconfigure.condition.SearchStrategy;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.cloud.autoconfigure.RefreshAutoConfiguration;
-import org.springframework.cloud.client.CommonsClientAutoConfiguration;
-import org.springframework.cloud.client.actuator.HasFeatures;
-import org.springframework.cloud.client.discovery.DiscoveryClient;
-import org.springframework.cloud.client.discovery.noop.NoopDiscoveryClientAutoConfiguration;
-import org.springframework.cloud.client.serviceregistry.AutoServiceRegistrationProperties;
-import org.springframework.cloud.client.serviceregistry.ServiceRegistryAutoConfiguration;
-import org.springframework.cloud.commons.util.InetUtils;
-import org.springframework.cloud.context.scope.refresh.RefreshScope;
-import org.springframework.cloud.netflix.eureka.config.DiscoveryClientOptionalArgsConfiguration;
-import org.springframework.cloud.netflix.eureka.metadata.DefaultManagementMetadataProvider;
-import org.springframework.cloud.netflix.eureka.metadata.ManagementMetadata;
-import org.springframework.cloud.netflix.eureka.metadata.ManagementMetadataProvider;
-import org.springframework.cloud.netflix.eureka.serviceregistry.EurekaAutoServiceRegistration;
-import org.springframework.cloud.netflix.eureka.serviceregistry.EurekaRegistration;
-import org.springframework.cloud.netflix.eureka.serviceregistry.EurekaServiceRegistry;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Conditional;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Import;
-import org.springframework.context.annotation.Lazy;
-import org.springframework.core.env.ConfigurableEnvironment;
-import org.springframework.util.StringUtils;
-
-import com.netflix.appinfo.ApplicationInfoManager;
-import com.netflix.appinfo.EurekaInstanceConfig;
-import com.netflix.appinfo.HealthCheckHandler;
-import com.netflix.appinfo.InstanceInfo;
-import com.netflix.discovery.AbstractDiscoveryClientOptionalArgs;
-import com.netflix.discovery.EurekaClient;
-import com.netflix.discovery.EurekaClientConfig;
-
-import static org.springframework.cloud.commons.util.IdUtils.getDefaultInstanceId;
-
-/**
- * @author Dave Syer
- * @author Spencer Gibb
- * @author Jon Schneider
- * @author Matt Jenkins
- * @author Ryan Baxter
- * @author Daniel Lavoie
- */
-@Configuration
-@EnableConfigurationProperties
-@ConditionalOnClass(EurekaClientConfig.class)
-@Import(DiscoveryClientOptionalArgsConfiguration.class)
-@ConditionalOnBean(EurekaDiscoveryClientConfiguration.Marker.class)
-@ConditionalOnProperty(value = "eureka.client.enabled", matchIfMissing = true)
-@AutoConfigureBefore({ NoopDiscoveryClientAutoConfiguration.class,
- CommonsClientAutoConfiguration.class, ServiceRegistryAutoConfiguration.class })
-@AutoConfigureAfter(name = {"org.springframework.cloud.autoconfigure.RefreshAutoConfiguration",
- "org.springframework.cloud.netflix.eureka.EurekaDiscoveryClientConfiguration",
- "org.springframework.cloud.client.serviceregistry.AutoServiceRegistrationAutoConfiguration"})
-public class EurekaClientAutoConfiguration {
-
- private static final Log log = LogFactory.getLog(EurekaClientAutoConfiguration.class);
-
- private ConfigurableEnvironment env;
-
- public EurekaClientAutoConfiguration(ConfigurableEnvironment env) {
- this.env = env;
- }
-
- @Bean
- public HasFeatures eurekaFeature() {
- return HasFeatures.namedFeature("Eureka Client", EurekaClient.class);
- }
-
- @Bean
- @ConditionalOnMissingBean(value = EurekaClientConfig.class, search = SearchStrategy.CURRENT)
- public EurekaClientConfigBean eurekaClientConfigBean() {
- EurekaClientConfigBean client = new EurekaClientConfigBean();
- if ("bootstrap".equals(this.env.getProperty("spring.config.name"))) {
- // We don't register during bootstrap by default, but there will be another
- // chance later.
- client.setRegisterWithEureka(false);
- }
- return client;
- }
-
- @Bean
- @ConditionalOnMissingBean
- public ManagementMetadataProvider serviceManagementMetadataProvider() {
- return new DefaultManagementMetadataProvider();
- }
-
- private String getProperty(String property) {
- return this.env.containsProperty(property) ? this.env.getProperty(property) : "";
- }
-
- @Bean
- @ConditionalOnMissingBean(value = EurekaInstanceConfig.class, search = SearchStrategy.CURRENT)
- public EurekaInstanceConfigBean eurekaInstanceConfigBean(InetUtils inetUtils,
- ManagementMetadataProvider managementMetadataProvider) {
- String hostname = getProperty("eureka.instance.hostname");
- boolean preferIpAddress = Boolean.parseBoolean(getProperty("eureka.instance.prefer-ip-address"));
- String ipAddress = getProperty("eureka.instance.ipAddress");
- boolean isSecurePortEnabled = Boolean.parseBoolean(getProperty("eureka.instance.secure-port-enabled"));
-
- String serverContextPath = env.getProperty("server.context-path", "/");
- int serverPort = Integer.valueOf(env.getProperty("server.port", env.getProperty("port", "8080")));
-
- Integer managementPort = env.getProperty("management.server.port", Integer.class);// nullable. should be wrapped into optional
- String managementContextPath = env.getProperty("management.server.context-path");// nullable. should be wrapped into optional
- Integer jmxPort = env.getProperty("com.sun.management.jmxremote.port", Integer.class);//nullable
- EurekaInstanceConfigBean instance = new EurekaInstanceConfigBean(inetUtils);
-
- instance.setNonSecurePort(serverPort);
- instance.setInstanceId(getDefaultInstanceId(env));
- instance.setPreferIpAddress(preferIpAddress);
- if (StringUtils.hasText(ipAddress)) {
- instance.setIpAddress(ipAddress);
- }
-
- if(isSecurePortEnabled) {
- instance.setSecurePort(serverPort);
- }
-
- if (StringUtils.hasText(hostname)) {
- instance.setHostname(hostname);
- }
- String statusPageUrlPath = getProperty("eureka.instance.status-page-url-path");
- String healthCheckUrlPath = getProperty("eureka.instance.health-check-url-path");
-
- if (StringUtils.hasText(statusPageUrlPath)) {
- instance.setStatusPageUrlPath(statusPageUrlPath);
- }
- if (StringUtils.hasText(healthCheckUrlPath)) {
- instance.setHealthCheckUrlPath(healthCheckUrlPath);
- }
-
- ManagementMetadata metadata = managementMetadataProvider.get(instance, serverPort,
- serverContextPath, managementContextPath, managementPort);
-
- if(metadata != null) {
- instance.setStatusPageUrl(metadata.getStatusPageUrl());
- instance.setHealthCheckUrl(metadata.getHealthCheckUrl());
- Map metadataMap = instance.getMetadataMap();
- if (metadataMap.get("management.port") == null) {
- metadataMap.put("management.port", String.valueOf(metadata.getManagementPort()));
- }
- }
-
- setupJmxPort(instance, jmxPort);
- return instance;
- }
-
- private void setupJmxPort(EurekaInstanceConfigBean instance, Integer jmxPort) {
- Map metadataMap = instance.getMetadataMap();
- if (metadataMap.get("jmx.port") == null && jmxPort != null) {
- metadataMap.put("jmx.port", String.valueOf(jmxPort));
- }
- }
-
- @Bean
- public DiscoveryClient discoveryClient(EurekaInstanceConfig config, EurekaClient client) {
- return new EurekaDiscoveryClient(config, client);
- }
-
- @Bean
- public EurekaServiceRegistry eurekaServiceRegistry() {
- return new EurekaServiceRegistry();
- }
-
- @Bean
- @ConditionalOnBean(AutoServiceRegistrationProperties.class)
- @ConditionalOnProperty(value = "spring.cloud.service-registry.auto-registration.enabled", matchIfMissing = true)
- public EurekaRegistration eurekaRegistration(EurekaClient eurekaClient, CloudEurekaInstanceConfig instanceConfig, ApplicationInfoManager applicationInfoManager, ObjectProvider healthCheckHandler) {
- return EurekaRegistration.builder(instanceConfig)
- .with(applicationInfoManager)
- .with(eurekaClient)
- .with(healthCheckHandler)
- .build();
- }
-
- @Bean
- @ConditionalOnBean(AutoServiceRegistrationProperties.class)
- @ConditionalOnProperty(value = "spring.cloud.service-registry.auto-registration.enabled", matchIfMissing = true)
- public EurekaAutoServiceRegistration eurekaAutoServiceRegistration(ApplicationContext context, EurekaServiceRegistry registry, EurekaRegistration registration) {
- return new EurekaAutoServiceRegistration(context, registry, registration);
- }
-
- @Configuration
- @ConditionalOnMissingRefreshScope
- protected static class EurekaClientConfiguration {
-
- @Autowired
- private ApplicationContext context;
-
- @Autowired
- private AbstractDiscoveryClientOptionalArgs> optionalArgs;
-
- @Bean(destroyMethod = "shutdown")
- @ConditionalOnMissingBean(value = EurekaClient.class, search = SearchStrategy.CURRENT)
- public EurekaClient eurekaClient(ApplicationInfoManager manager, EurekaClientConfig config) {
- return new CloudEurekaClient(manager, config, this.optionalArgs,
- this.context);
- }
-
- @Bean
- @ConditionalOnMissingBean(value = ApplicationInfoManager.class, search = SearchStrategy.CURRENT)
- public ApplicationInfoManager eurekaApplicationInfoManager(
- EurekaInstanceConfig config) {
- InstanceInfo instanceInfo = new InstanceInfoFactory().create(config);
- return new ApplicationInfoManager(config, instanceInfo);
- }
- }
-
- @Configuration
- @ConditionalOnRefreshScope
- protected static class RefreshableEurekaClientConfiguration {
-
- @Autowired
- private ApplicationContext context;
-
- @Autowired
- private AbstractDiscoveryClientOptionalArgs> optionalArgs;
-
- @Bean(destroyMethod = "shutdown")
- @ConditionalOnMissingBean(value = EurekaClient.class, search = SearchStrategy.CURRENT)
- @org.springframework.cloud.context.config.annotation.RefreshScope
- @Lazy
- public EurekaClient eurekaClient(ApplicationInfoManager manager, EurekaClientConfig config, EurekaInstanceConfig instance) {
- manager.getInfo(); // force initialization
- return new CloudEurekaClient(manager, config, this.optionalArgs,
- this.context);
- }
-
- @Bean
- @ConditionalOnMissingBean(value = ApplicationInfoManager.class, search = SearchStrategy.CURRENT)
- @org.springframework.cloud.context.config.annotation.RefreshScope
- @Lazy
- public ApplicationInfoManager eurekaApplicationInfoManager(EurekaInstanceConfig config) {
- InstanceInfo instanceInfo = new InstanceInfoFactory().create(config);
- return new ApplicationInfoManager(config, instanceInfo);
- }
-
- }
-
- @Target({ ElementType.TYPE, ElementType.METHOD })
- @Retention(RetentionPolicy.RUNTIME)
- @Documented
- @Conditional(OnMissingRefreshScopeCondition.class)
- @interface ConditionalOnMissingRefreshScope {
-
- }
-
- @Target({ ElementType.TYPE, ElementType.METHOD })
- @Retention(RetentionPolicy.RUNTIME)
- @Documented
- @ConditionalOnClass(RefreshScope.class)
- @ConditionalOnBean(RefreshAutoConfiguration.class)
- @interface ConditionalOnRefreshScope {
-
- }
-
- private static class OnMissingRefreshScopeCondition extends AnyNestedCondition {
-
- public OnMissingRefreshScopeCondition() {
- super(ConfigurationPhase.REGISTER_BEAN);
- }
-
- @ConditionalOnMissingClass("org.springframework.cloud.context.scope.refresh.RefreshScope")
- static class MissingClass {
- }
-
- @ConditionalOnMissingBean(RefreshAutoConfiguration.class)
- static class MissingScope {
- }
-
- }
-
- @Configuration
- @ConditionalOnClass(Health.class)
- protected static class EurekaHealthIndicatorConfiguration {
- @Bean
- @ConditionalOnMissingBean
- @ConditionalOnEnabledHealthIndicator("eureka")
- 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/EurekaClientConfigBean.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaClientConfigBean.java
deleted file mode 100644
index 323b607f..00000000
--- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaClientConfigBean.java
+++ /dev/null
@@ -1,1043 +0,0 @@
-/*
-* Copyright 2013-2014 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.eureka;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.boot.context.properties.NestedConfigurationProperty;
-import org.springframework.core.env.PropertyResolver;
-import org.springframework.util.StringUtils;
-
-import com.netflix.appinfo.EurekaAccept;
-import com.netflix.discovery.EurekaClientConfig;
-import com.netflix.discovery.shared.transport.EurekaTransportConfig;
-
-import static org.springframework.cloud.netflix.eureka.EurekaConstants.DEFAULT_PREFIX;
-
-/**
- * @author Dave Syer
- * @author Gregor Zurowski
- */
-@ConfigurationProperties(EurekaClientConfigBean.PREFIX)
-public class EurekaClientConfigBean implements EurekaClientConfig {
-
- public static final String PREFIX = "eureka.client";
-
- public static final String DEFAULT_URL = "http://localhost:8761" + DEFAULT_PREFIX
- + "/";
-
- public static final String DEFAULT_ZONE = "defaultZone";
-
- private static final int MINUTES = 60;
-
- @Autowired(required = false)
- PropertyResolver propertyResolver;
-
- /**
- * Flag to indicate that the Eureka client is enabled.
- */
- private boolean enabled = true;
-
- @NestedConfigurationProperty
- private EurekaTransportConfig transport = new CloudEurekaTransportConfig();
-
- /**
- * Indicates how often(in seconds) to fetch the registry information from the eureka
- * server.
- */
- private int registryFetchIntervalSeconds = 30;
-
- /**
- * Indicates how often(in seconds) to replicate instance changes to be replicated to
- * the eureka server.
- */
- private int instanceInfoReplicationIntervalSeconds = 30;
-
- /**
- * Indicates how long initially (in seconds) to replicate instance info to the eureka
- * server
- */
- private int initialInstanceInfoReplicationIntervalSeconds = 40;
-
- /**
- * Indicates how often(in seconds) to poll for changes to eureka server information.
- * Eureka servers could be added or removed and this setting controls how soon the
- * eureka clients should know about it.
- */
- private int eurekaServiceUrlPollIntervalSeconds = 5 * MINUTES;
-
- /**
- * Gets the proxy port to eureka server if any.
- */
- private String proxyPort;
-
- /**
- * Gets the proxy host to eureka server if any.
- */
- private String proxyHost;
-
- /**
- * Gets the proxy user name if any.
- */
- private String proxyUserName;
-
- /**
- * Gets the proxy password if any.
- */
- private String proxyPassword;
-
- /**
- * Indicates how long to wait (in seconds) before a read from eureka server needs to
- * timeout.
- */
- private int eurekaServerReadTimeoutSeconds = 8;
-
- /**
- * Indicates how long to wait (in seconds) before a connection to eureka server needs
- * to timeout. Note that the connections in the client are pooled by
- * org.apache.http.client.HttpClient and this setting affects the actual connection
- * creation and also the wait time to get the connection from the pool.
- */
- private int eurekaServerConnectTimeoutSeconds = 5;
-
- /**
- * Gets the name of the implementation which implements BackupRegistry to fetch the
- * registry information as a fall back option for only the first time when the eureka
- * client starts.
- *
- * This may be needed for applications which needs additional resiliency for registry
- * information without which it cannot operate.
- */
- private String backupRegistryImpl;
-
- /**
- * Gets the total number of connections that is allowed from eureka client to all
- * eureka servers.
- */
- private int eurekaServerTotalConnections = 200;
-
- /**
- * Gets the total number of connections that is allowed from eureka client to a eureka
- * server host.
- */
- private int eurekaServerTotalConnectionsPerHost = 50;
-
- /**
- * Gets the URL context to be used to construct the service url to contact eureka
- * server when the list of eureka servers come from the DNS. This information is not
- * required if the contract returns the service urls from eurekaServerServiceUrls.
- *
- * The DNS mechanism is used when useDnsForFetchingServiceUrls is set to true and the
- * eureka client expects the DNS to configured a certain way so that it can fetch
- * changing eureka servers dynamically. The changes are effective at runtime.
- */
- private String eurekaServerURLContext;
-
- /**
- * Gets the port to be used to construct the service url to contact eureka server when
- * the list of eureka servers come from the DNS.This information is not required if
- * the contract returns the service urls eurekaServerServiceUrls(String).
- *
- * The DNS mechanism is used when useDnsForFetchingServiceUrls is set to true and the
- * eureka client expects the DNS to configured a certain way so that it can fetch
- * changing eureka servers dynamically.
- *
- * The changes are effective at runtime.
- */
- private String eurekaServerPort;
-
- /**
- * Gets the DNS name to be queried to get the list of eureka servers.This information
- * is not required if the contract returns the service urls by implementing
- * serviceUrls.
- *
- * The DNS mechanism is used when useDnsForFetchingServiceUrls is set to true and the
- * eureka client expects the DNS to configured a certain way so that it can fetch
- * changing eureka servers dynamically.
- *
- * The changes are effective at runtime.
- */
- private String eurekaServerDNSName;
-
- /**
- * Gets the region (used in AWS datacenters) where this instance resides.
- */
- private String region = "us-east-1";
-
- /**
- * Indicates how much time (in seconds) that the HTTP connections to eureka server can
- * stay idle before it can be closed.
- *
- * In the AWS environment, it is recommended that the values is 30 seconds or less,
- * since the firewall cleans up the connection information after a few mins leaving
- * the connection hanging in limbo
- */
- private int eurekaConnectionIdleTimeoutSeconds = 30;
-
- /**
- * Indicates whether the client is only interested in the registry information for a
- * single VIP.
- */
- private String registryRefreshSingleVipAddress;
-
- /**
- * The thread pool size for the heartbeatExecutor to initialise with
- */
- private int heartbeatExecutorThreadPoolSize = 2;
-
- /**
- * Heartbeat executor exponential back off related property. It is a maximum
- * multiplier value for retry delay, in case where a sequence of timeouts occurred.
- */
- private int heartbeatExecutorExponentialBackOffBound = 10;
-
- /**
- * The thread pool size for the cacheRefreshExecutor to initialise with
- */
- private int cacheRefreshExecutorThreadPoolSize = 2;
-
- /**
- * Cache refresh executor exponential back off related property. It is a maximum
- * multiplier value for retry delay, in case where a sequence of timeouts occurred.
- */
- private int cacheRefreshExecutorExponentialBackOffBound = 10;
-
- /**
- * Map of availability zone to list of fully qualified URLs to communicate with eureka
- * server. Each value can be a single URL or a comma separated list of alternative
- * locations.
- *
- * Typically the eureka server URLs carry protocol,host,port,context and version
- * information if any. Example:
- * http://ec2-256-156-243-129.compute-1.amazonaws.com:7001/eureka/
- *
- * The changes are effective at runtime at the next service url refresh cycle as
- * specified by eurekaServiceUrlPollIntervalSeconds.
- */
- private Map serviceUrl = new HashMap<>();
-
- {
- this.serviceUrl.put(DEFAULT_ZONE, DEFAULT_URL);
- }
-
- /**
- * Indicates whether the content fetched from eureka server has to be compressed
- * whenever it is supported by the server. The registry information from the eureka
- * server is compressed for optimum network traffic.
- */
- private boolean gZipContent = true;
-
- /**
- * Indicates whether the eureka client should use the DNS mechanism to fetch a list of
- * eureka servers to talk to. When the DNS name is updated to have additional servers,
- * that information is used immediately after the eureka client polls for that
- * information as specified in eurekaServiceUrlPollIntervalSeconds.
- *
- * Alternatively, the service urls can be returned serviceUrls, but the users should
- * implement their own mechanism to return the updated list in case of changes.
- *
- * The changes are effective at runtime.
- */
- private boolean useDnsForFetchingServiceUrls = false;
-
- /**
- * Indicates whether or not this instance should register its information with eureka
- * server for discovery by others.
- *
- * In some cases, you do not want your instances to be discovered whereas you just
- * want do discover other instances.
- */
- private boolean registerWithEureka = true;
-
- /**
- * Indicates whether or not this instance should try to use the eureka server in the
- * same zone for latency and/or other reason.
- *
- * Ideally eureka clients are configured to talk to servers in the same zone
- *
- * The changes are effective at runtime at the next registry fetch cycle as specified
- * by registryFetchIntervalSeconds
- */
- private boolean preferSameZoneEureka = true;
-
- /**
- * Indicates whether to log differences between the eureka server and the eureka
- * client in terms of registry information.
- *
- * Eureka client tries to retrieve only delta changes from eureka server to minimize
- * network traffic. After receiving the deltas, eureka client reconciles the
- * information from the server to verify it has not missed out some information.
- * Reconciliation failures could happen when the client has had network issues
- * communicating to server.If the reconciliation fails, eureka client gets the full
- * registry information.
- *
- * While getting the full registry information, the eureka client can log the
- * differences between the client and the server and this setting controls that.
- *
- * The changes are effective at runtime at the next registry fetch cycle as specified
- * by registryFetchIntervalSecondsr
- */
- private boolean logDeltaDiff;
-
- /**
- * Indicates whether the eureka client should disable fetching of delta and should
- * rather resort to getting the full registry information.
- *
- * Note that the delta fetches can reduce the traffic tremendously, because the rate
- * of change with the eureka server is normally much lower than the rate of fetches.
- *
- * The changes are effective at runtime at the next registry fetch cycle as specified
- * by registryFetchIntervalSeconds
- */
- private boolean disableDelta;
-
- /**
- * Comma separated list of regions for which the eureka registry information will be
- * fetched. It is mandatory to define the availability zones for each of these regions
- * as returned by availabilityZones. Failing to do so, will result in failure of
- * discovery client startup.
- *
- */
- private String fetchRemoteRegionsRegistry;
-
- /**
- * Gets the list of availability zones (used in AWS data centers) for the region in
- * which this instance resides.
- *
- * The changes are effective at runtime at the next registry fetch cycle as specified
- * by registryFetchIntervalSeconds.
- */
- private Map availabilityZones = new HashMap<>();
-
- /**
- * Indicates whether to get the applications after filtering the applications for
- * instances with only InstanceStatus UP states.
- */
- private boolean filterOnlyUpInstances = true;
-
- /**
- * Indicates whether this client should fetch eureka registry information from eureka
- * server.
- */
- private boolean fetchRegistry = true;
-
- /**
- * Get a replacement string for Dollar sign $ during
- * serializing/deserializing information in eureka server.
- */
- private String dollarReplacement = "_-";
-
- /**
- * Get a replacement string for underscore sign _ during
- * serializing/deserializing information in eureka server.
- */
- private String escapeCharReplacement = "__";
-
- /**
- * Indicates whether server can redirect a client request to a backup server/cluster.
- * If set to false, the server will handle the request directly, If set to true, it
- * may send HTTP redirect to the client, with a new server location.
- */
- private boolean allowRedirects = false;
-
- /**
- * If set to true, local status updates via ApplicationInfoManager will trigger
- * on-demand (but rate limited) register/updates to remote eureka servers
- */
- private boolean onDemandUpdateStatusChange = true;
-
- /**
- * This is a transient config and once the latest codecs are stable, can be removed
- * (as there will only be one)
- */
- private String encoderName;
-
- /**
- * This is a transient config and once the latest codecs are stable, can be removed
- * (as there will only be one)
- */
- private String decoderName;
-
- /**
- * EurekaAccept name for client data accept
- */
- private String clientDataAccept = EurekaAccept.full.name();
-
- /**
- * Indicates whether the client should explicitly unregister itself from the remote server
- * on client shutdown.
- */
- private boolean shouldUnregisterOnShutdown = true;
-
- /**
- * Indicates whether the client should enforce registration during initialization. Defaults to false.
- */
- private boolean shouldEnforceRegistrationAtInit = false;
-
- @Override
- public boolean shouldGZipContent() {
- return this.gZipContent;
- }
-
- @Override
- public boolean shouldUseDnsForFetchingServiceUrls() {
- return this.useDnsForFetchingServiceUrls;
- }
-
- @Override
- public boolean shouldRegisterWithEureka() {
- return this.registerWithEureka;
- }
-
- @Override
- public boolean shouldPreferSameZoneEureka() {
- return this.preferSameZoneEureka;
- }
-
- @Override
- public boolean shouldLogDeltaDiff() {
- return this.logDeltaDiff;
- }
-
- @Override
- public boolean shouldDisableDelta() {
- return this.disableDelta;
- }
-
- @Override
- public boolean shouldUnregisterOnShutdown() {
- return this.shouldUnregisterOnShutdown;
- }
-
- @Override
- public boolean shouldEnforceRegistrationAtInit() {
- return this.shouldEnforceRegistrationAtInit;
- }
-
- @Override
- public String fetchRegistryForRemoteRegions() {
- return this.fetchRemoteRegionsRegistry;
- }
-
- @Override
- public String[] getAvailabilityZones(String region) {
- String value = this.availabilityZones.get(region);
- if (value == null) {
- value = DEFAULT_ZONE;
- }
- return value.split(",");
- }
-
- @Override
- public List getEurekaServerServiceUrls(String myZone) {
- String serviceUrls = this.serviceUrl.get(myZone);
- if (serviceUrls == null || serviceUrls.isEmpty()) {
- serviceUrls = this.serviceUrl.get(DEFAULT_ZONE);
- }
- if (!StringUtils.isEmpty(serviceUrls)) {
- final String[] serviceUrlsSplit = StringUtils.commaDelimitedListToStringArray(serviceUrls);
- List eurekaServiceUrls = new ArrayList<>(serviceUrlsSplit.length);
- for (String eurekaServiceUrl : serviceUrlsSplit) {
- if (!endsWithSlash(eurekaServiceUrl)) {
- eurekaServiceUrl += "/";
- }
- eurekaServiceUrls.add(eurekaServiceUrl);
- }
- return eurekaServiceUrls;
- }
-
- return new ArrayList<>();
- }
-
- private boolean endsWithSlash(String url) {
- return url.endsWith("/");
- }
-
- @Override
- public boolean shouldFilterOnlyUpInstances() {
- return this.filterOnlyUpInstances;
- }
-
- @Override
- public boolean shouldFetchRegistry() {
- return this.fetchRegistry;
- }
-
- @Override
- public boolean allowRedirects() {
- return this.allowRedirects;
- }
-
- @Override
- public boolean shouldOnDemandUpdateStatusChange() {
- return this.onDemandUpdateStatusChange;
- }
-
- @Override
- public String getExperimental(String name) {
- if (this.propertyResolver != null) {
- return this.propertyResolver.getProperty(PREFIX + ".experimental." + name,
- String.class, null);
- }
- return null;
- }
-
- @Override
- public EurekaTransportConfig getTransportConfig() {
- return getTransport();
- }
-
- public PropertyResolver getPropertyResolver() {
- return propertyResolver;
- }
-
- public void setPropertyResolver(PropertyResolver propertyResolver) {
- this.propertyResolver = propertyResolver;
- }
-
- public boolean isEnabled() {
- return enabled;
- }
-
- public void setEnabled(boolean enabled) {
- this.enabled = enabled;
- }
-
- public EurekaTransportConfig getTransport() {
- return transport;
- }
-
- public void setTransport(EurekaTransportConfig transport) {
- this.transport = transport;
- }
-
- @Override
- public int getRegistryFetchIntervalSeconds() {
- return registryFetchIntervalSeconds;
- }
-
- public void setRegistryFetchIntervalSeconds(int registryFetchIntervalSeconds) {
- this.registryFetchIntervalSeconds = registryFetchIntervalSeconds;
- }
-
- @Override
- public int getInstanceInfoReplicationIntervalSeconds() {
- return instanceInfoReplicationIntervalSeconds;
- }
-
- public void setInstanceInfoReplicationIntervalSeconds(
- int instanceInfoReplicationIntervalSeconds) {
- this.instanceInfoReplicationIntervalSeconds = instanceInfoReplicationIntervalSeconds;
- }
-
- @Override
- public int getInitialInstanceInfoReplicationIntervalSeconds() {
- return initialInstanceInfoReplicationIntervalSeconds;
- }
-
- public void setInitialInstanceInfoReplicationIntervalSeconds(
- int initialInstanceInfoReplicationIntervalSeconds) {
- this.initialInstanceInfoReplicationIntervalSeconds = initialInstanceInfoReplicationIntervalSeconds;
- }
-
- @Override
- public int getEurekaServiceUrlPollIntervalSeconds() {
- return eurekaServiceUrlPollIntervalSeconds;
- }
-
- public void setEurekaServiceUrlPollIntervalSeconds(
- int eurekaServiceUrlPollIntervalSeconds) {
- this.eurekaServiceUrlPollIntervalSeconds = eurekaServiceUrlPollIntervalSeconds;
- }
-
- @Override
- public String getProxyPort() {
- return proxyPort;
- }
-
- public void setProxyPort(String proxyPort) {
- this.proxyPort = proxyPort;
- }
-
- @Override
- public String getProxyHost() {
- return proxyHost;
- }
-
- public void setProxyHost(String proxyHost) {
- this.proxyHost = proxyHost;
- }
-
- @Override
- public String getProxyUserName() {
- return proxyUserName;
- }
-
- public void setProxyUserName(String proxyUserName) {
- this.proxyUserName = proxyUserName;
- }
-
- @Override
- public String getProxyPassword() {
- return proxyPassword;
- }
-
- public void setProxyPassword(String proxyPassword) {
- this.proxyPassword = proxyPassword;
- }
-
- @Override
- public int getEurekaServerReadTimeoutSeconds() {
- return eurekaServerReadTimeoutSeconds;
- }
-
- public void setEurekaServerReadTimeoutSeconds(int eurekaServerReadTimeoutSeconds) {
- this.eurekaServerReadTimeoutSeconds = eurekaServerReadTimeoutSeconds;
- }
-
- @Override
- public int getEurekaServerConnectTimeoutSeconds() {
- return eurekaServerConnectTimeoutSeconds;
- }
-
- public void setEurekaServerConnectTimeoutSeconds(
- int eurekaServerConnectTimeoutSeconds) {
- this.eurekaServerConnectTimeoutSeconds = eurekaServerConnectTimeoutSeconds;
- }
-
- @Override
- public String getBackupRegistryImpl() {
- return backupRegistryImpl;
- }
-
- public void setBackupRegistryImpl(String backupRegistryImpl) {
- this.backupRegistryImpl = backupRegistryImpl;
- }
-
- @Override
- public int getEurekaServerTotalConnections() {
- return eurekaServerTotalConnections;
- }
-
- public void setEurekaServerTotalConnections(int eurekaServerTotalConnections) {
- this.eurekaServerTotalConnections = eurekaServerTotalConnections;
- }
-
- @Override
- public int getEurekaServerTotalConnectionsPerHost() {
- return eurekaServerTotalConnectionsPerHost;
- }
-
- public void setEurekaServerTotalConnectionsPerHost(
- int eurekaServerTotalConnectionsPerHost) {
- this.eurekaServerTotalConnectionsPerHost = eurekaServerTotalConnectionsPerHost;
- }
-
- @Override
- public String getEurekaServerURLContext() {
- return eurekaServerURLContext;
- }
-
- public void setEurekaServerURLContext(String eurekaServerURLContext) {
- this.eurekaServerURLContext = eurekaServerURLContext;
- }
-
- @Override
- public String getEurekaServerPort() {
- return eurekaServerPort;
- }
-
- public void setEurekaServerPort(String eurekaServerPort) {
- this.eurekaServerPort = eurekaServerPort;
- }
-
- @Override
- public String getEurekaServerDNSName() {
- return eurekaServerDNSName;
- }
-
- public void setEurekaServerDNSName(String eurekaServerDNSName) {
- this.eurekaServerDNSName = eurekaServerDNSName;
- }
-
- @Override
- public String getRegion() {
- return region;
- }
-
- public void setRegion(String region) {
- this.region = region;
- }
-
- @Override
- public int getEurekaConnectionIdleTimeoutSeconds() {
- return eurekaConnectionIdleTimeoutSeconds;
- }
-
- public void setEurekaConnectionIdleTimeoutSeconds(
- int eurekaConnectionIdleTimeoutSeconds) {
- this.eurekaConnectionIdleTimeoutSeconds = eurekaConnectionIdleTimeoutSeconds;
- }
-
- @Override
- public String getRegistryRefreshSingleVipAddress() {
- return registryRefreshSingleVipAddress;
- }
-
- public void setRegistryRefreshSingleVipAddress(
- String registryRefreshSingleVipAddress) {
- this.registryRefreshSingleVipAddress = registryRefreshSingleVipAddress;
- }
-
- @Override
- public int getHeartbeatExecutorThreadPoolSize() {
- return heartbeatExecutorThreadPoolSize;
- }
-
- public void setHeartbeatExecutorThreadPoolSize(int heartbeatExecutorThreadPoolSize) {
- this.heartbeatExecutorThreadPoolSize = heartbeatExecutorThreadPoolSize;
- }
-
- @Override
- public int getHeartbeatExecutorExponentialBackOffBound() {
- return heartbeatExecutorExponentialBackOffBound;
- }
-
- public void setHeartbeatExecutorExponentialBackOffBound(
- int heartbeatExecutorExponentialBackOffBound) {
- this.heartbeatExecutorExponentialBackOffBound = heartbeatExecutorExponentialBackOffBound;
- }
-
- @Override
- public int getCacheRefreshExecutorThreadPoolSize() {
- return cacheRefreshExecutorThreadPoolSize;
- }
-
- public void setCacheRefreshExecutorThreadPoolSize(
- int cacheRefreshExecutorThreadPoolSize) {
- this.cacheRefreshExecutorThreadPoolSize = cacheRefreshExecutorThreadPoolSize;
- }
-
- @Override
- public int getCacheRefreshExecutorExponentialBackOffBound() {
- return cacheRefreshExecutorExponentialBackOffBound;
- }
-
- public void setCacheRefreshExecutorExponentialBackOffBound(
- int cacheRefreshExecutorExponentialBackOffBound) {
- this.cacheRefreshExecutorExponentialBackOffBound = cacheRefreshExecutorExponentialBackOffBound;
- }
-
- public Map getServiceUrl() {
- return serviceUrl;
- }
-
- public void setServiceUrl(Map serviceUrl) {
- this.serviceUrl = serviceUrl;
- }
-
- public boolean isgZipContent() {
- return gZipContent;
- }
-
- public void setgZipContent(boolean gZipContent) {
- this.gZipContent = gZipContent;
- }
-
- public boolean isUseDnsForFetchingServiceUrls() {
- return useDnsForFetchingServiceUrls;
- }
-
- public void setUseDnsForFetchingServiceUrls(boolean useDnsForFetchingServiceUrls) {
- this.useDnsForFetchingServiceUrls = useDnsForFetchingServiceUrls;
- }
-
- public boolean isRegisterWithEureka() {
- return registerWithEureka;
- }
-
- public void setRegisterWithEureka(boolean registerWithEureka) {
- this.registerWithEureka = registerWithEureka;
- }
-
- public boolean isPreferSameZoneEureka() {
- return preferSameZoneEureka;
- }
-
- public void setPreferSameZoneEureka(boolean preferSameZoneEureka) {
- this.preferSameZoneEureka = preferSameZoneEureka;
- }
-
- public boolean isLogDeltaDiff() {
- return logDeltaDiff;
- }
-
- public void setLogDeltaDiff(boolean logDeltaDiff) {
- this.logDeltaDiff = logDeltaDiff;
- }
-
- public boolean isDisableDelta() {
- return disableDelta;
- }
-
- public void setDisableDelta(boolean disableDelta) {
- this.disableDelta = disableDelta;
- }
-
- public String getFetchRemoteRegionsRegistry() {
- return fetchRemoteRegionsRegistry;
- }
-
- public void setFetchRemoteRegionsRegistry(String fetchRemoteRegionsRegistry) {
- this.fetchRemoteRegionsRegistry = fetchRemoteRegionsRegistry;
- }
-
- public Map getAvailabilityZones() {
- return availabilityZones;
- }
-
- public void setAvailabilityZones(Map availabilityZones) {
- this.availabilityZones = availabilityZones;
- }
-
- public boolean isFilterOnlyUpInstances() {
- return filterOnlyUpInstances;
- }
-
- public void setFilterOnlyUpInstances(boolean filterOnlyUpInstances) {
- this.filterOnlyUpInstances = filterOnlyUpInstances;
- }
-
- public boolean isFetchRegistry() {
- return fetchRegistry;
- }
-
- public void setFetchRegistry(boolean fetchRegistry) {
- this.fetchRegistry = fetchRegistry;
- }
-
- @Override
- public String getDollarReplacement() {
- return dollarReplacement;
- }
-
- public void setDollarReplacement(String dollarReplacement) {
- this.dollarReplacement = dollarReplacement;
- }
-
- @Override
- public String getEscapeCharReplacement() {
- return escapeCharReplacement;
- }
-
- public void setEscapeCharReplacement(String escapeCharReplacement) {
- this.escapeCharReplacement = escapeCharReplacement;
- }
-
- public boolean isAllowRedirects() {
- return allowRedirects;
- }
-
- public void setAllowRedirects(boolean allowRedirects) {
- this.allowRedirects = allowRedirects;
- }
-
- public boolean isOnDemandUpdateStatusChange() {
- return onDemandUpdateStatusChange;
- }
-
- public void setOnDemandUpdateStatusChange(boolean onDemandUpdateStatusChange) {
- this.onDemandUpdateStatusChange = onDemandUpdateStatusChange;
- }
-
- @Override
- public String getEncoderName() {
- return encoderName;
- }
-
- public void setEncoderName(String encoderName) {
- this.encoderName = encoderName;
- }
-
- @Override
- public String getDecoderName() {
- return decoderName;
- }
-
- public void setDecoderName(String decoderName) {
- this.decoderName = decoderName;
- }
-
- @Override
- public String getClientDataAccept() {
- return clientDataAccept;
- }
-
- public void setClientDataAccept(String clientDataAccept) {
- this.clientDataAccept = clientDataAccept;
- }
-
- public boolean isShouldUnregisterOnShutdown() {
- return shouldUnregisterOnShutdown;
- }
-
- public void setShouldUnregisterOnShutdown(boolean shouldUnregisterOnShutdown) {
- this.shouldUnregisterOnShutdown = shouldUnregisterOnShutdown;
- }
-
- public boolean isShouldEnforceRegistrationAtInit() {
- return shouldEnforceRegistrationAtInit;
- }
-
- public void setShouldEnforceRegistrationAtInit(boolean shouldEnforceRegistrationAtInit) {
- this.shouldEnforceRegistrationAtInit = shouldEnforceRegistrationAtInit;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- EurekaClientConfigBean that = (EurekaClientConfigBean) o;
- return Objects.equals(propertyResolver, that.propertyResolver) &&
- enabled == that.enabled &&
- Objects.equals(transport, that.transport) &&
- registryFetchIntervalSeconds == that.registryFetchIntervalSeconds &&
- instanceInfoReplicationIntervalSeconds == that.instanceInfoReplicationIntervalSeconds &&
- initialInstanceInfoReplicationIntervalSeconds == that.initialInstanceInfoReplicationIntervalSeconds &&
- eurekaServiceUrlPollIntervalSeconds == that.eurekaServiceUrlPollIntervalSeconds &&
- eurekaServerReadTimeoutSeconds == that.eurekaServerReadTimeoutSeconds &&
- eurekaServerConnectTimeoutSeconds == that.eurekaServerConnectTimeoutSeconds &&
- eurekaServerTotalConnections == that.eurekaServerTotalConnections &&
- eurekaServerTotalConnectionsPerHost == that.eurekaServerTotalConnectionsPerHost &&
- eurekaConnectionIdleTimeoutSeconds == that.eurekaConnectionIdleTimeoutSeconds &&
- heartbeatExecutorThreadPoolSize == that.heartbeatExecutorThreadPoolSize &&
- heartbeatExecutorExponentialBackOffBound == that.heartbeatExecutorExponentialBackOffBound &&
- cacheRefreshExecutorThreadPoolSize == that.cacheRefreshExecutorThreadPoolSize &&
- cacheRefreshExecutorExponentialBackOffBound == that.cacheRefreshExecutorExponentialBackOffBound &&
- gZipContent == that.gZipContent &&
- useDnsForFetchingServiceUrls == that.useDnsForFetchingServiceUrls &&
- registerWithEureka == that.registerWithEureka &&
- preferSameZoneEureka == that.preferSameZoneEureka &&
- logDeltaDiff == that.logDeltaDiff &&
- disableDelta == that.disableDelta &&
- filterOnlyUpInstances == that.filterOnlyUpInstances &&
- fetchRegistry == that.fetchRegistry &&
- allowRedirects == that.allowRedirects &&
- onDemandUpdateStatusChange == that.onDemandUpdateStatusChange &&
- shouldUnregisterOnShutdown == that.shouldUnregisterOnShutdown &&
- shouldEnforceRegistrationAtInit == that.shouldEnforceRegistrationAtInit &&
- Objects.equals(proxyPort, that.proxyPort) &&
- Objects.equals(proxyHost, that.proxyHost) &&
- Objects.equals(proxyUserName, that.proxyUserName) &&
- Objects.equals(proxyPassword, that.proxyPassword) &&
- Objects.equals(backupRegistryImpl, that.backupRegistryImpl) &&
- Objects.equals(eurekaServerURLContext, that.eurekaServerURLContext) &&
- Objects.equals(eurekaServerPort, that.eurekaServerPort) &&
- Objects.equals(eurekaServerDNSName, that.eurekaServerDNSName) &&
- Objects.equals(region, that.region) &&
- Objects.equals(registryRefreshSingleVipAddress, that.registryRefreshSingleVipAddress) &&
- Objects.equals(serviceUrl, that.serviceUrl) &&
- Objects.equals(fetchRemoteRegionsRegistry, that.fetchRemoteRegionsRegistry) &&
- Objects.equals(availabilityZones, that.availabilityZones) &&
- Objects.equals(dollarReplacement, that.dollarReplacement) &&
- Objects.equals(escapeCharReplacement, that.escapeCharReplacement) &&
- Objects.equals(encoderName, that.encoderName) &&
- Objects.equals(decoderName, that.decoderName) &&
- Objects.equals(clientDataAccept, that.clientDataAccept);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(propertyResolver, enabled, transport,
- registryFetchIntervalSeconds, instanceInfoReplicationIntervalSeconds,
- initialInstanceInfoReplicationIntervalSeconds,
- eurekaServiceUrlPollIntervalSeconds, proxyPort, proxyHost, proxyUserName,
- proxyPassword, eurekaServerReadTimeoutSeconds,
- eurekaServerConnectTimeoutSeconds, backupRegistryImpl,
- eurekaServerTotalConnections, eurekaServerTotalConnectionsPerHost,
- eurekaServerURLContext, eurekaServerPort, eurekaServerDNSName, region,
- eurekaConnectionIdleTimeoutSeconds, registryRefreshSingleVipAddress,
- heartbeatExecutorThreadPoolSize, heartbeatExecutorExponentialBackOffBound,
- cacheRefreshExecutorThreadPoolSize,
- cacheRefreshExecutorExponentialBackOffBound, serviceUrl, gZipContent,
- useDnsForFetchingServiceUrls, registerWithEureka, preferSameZoneEureka,
- logDeltaDiff, disableDelta, fetchRemoteRegionsRegistry, availabilityZones,
- filterOnlyUpInstances, fetchRegistry, dollarReplacement,
- escapeCharReplacement, allowRedirects, onDemandUpdateStatusChange,
- encoderName, decoderName, clientDataAccept, shouldUnregisterOnShutdown,
- shouldEnforceRegistrationAtInit);
- }
-
- @Override
- public String toString() {
- return new StringBuilder("EurekaClientConfigBean{")
- .append("propertyResolver=").append(propertyResolver).append(", ")
- .append("enabled=").append(enabled).append(", ")
- .append("transport=").append(transport).append(", ")
- .append("registryFetchIntervalSeconds=").append(registryFetchIntervalSeconds).append(", ")
- .append("instanceInfoReplicationIntervalSeconds=").append(instanceInfoReplicationIntervalSeconds).append(", ")
- .append("initialInstanceInfoReplicationIntervalSeconds=").append(initialInstanceInfoReplicationIntervalSeconds).append(", ")
- .append("eurekaServiceUrlPollIntervalSeconds=").append(eurekaServiceUrlPollIntervalSeconds).append(", ")
- .append("proxyPort='").append(proxyPort).append("', ")
- .append("proxyHost='").append(proxyHost).append("', ")
- .append("proxyUserName='").append(proxyUserName).append("', ")
- .append("proxyPassword='").append(proxyPassword).append("', ")
- .append("eurekaServerReadTimeoutSeconds=").append(eurekaServerReadTimeoutSeconds).append(", ")
- .append("eurekaServerConnectTimeoutSeconds=").append(eurekaServerConnectTimeoutSeconds).append(", ")
- .append("backupRegistryImpl='").append(backupRegistryImpl).append("', ")
- .append("eurekaServerTotalConnections=").append(eurekaServerTotalConnections).append(", ")
- .append("eurekaServerTotalConnectionsPerHost=").append(eurekaServerTotalConnectionsPerHost).append(", ")
- .append("eurekaServerURLContext='").append(eurekaServerURLContext).append("', ")
- .append("eurekaServerPort='").append(eurekaServerPort).append("', ")
- .append("eurekaServerDNSName='").append(eurekaServerDNSName).append("', ")
- .append("region='").append(region).append("', ")
- .append("eurekaConnectionIdleTimeoutSeconds=").append(eurekaConnectionIdleTimeoutSeconds).append(", ")
- .append("registryRefreshSingleVipAddress='").append(registryRefreshSingleVipAddress).append("', ")
- .append("heartbeatExecutorThreadPoolSize=").append(heartbeatExecutorThreadPoolSize).append(", ")
- .append("heartbeatExecutorExponentialBackOffBound=").append(heartbeatExecutorExponentialBackOffBound).append(", ")
- .append("cacheRefreshExecutorThreadPoolSize=").append(cacheRefreshExecutorThreadPoolSize).append(", ")
- .append("cacheRefreshExecutorExponentialBackOffBound=").append(cacheRefreshExecutorExponentialBackOffBound).append(", ")
- .append("serviceUrl=").append(serviceUrl).append(", ")
- .append("gZipContent=").append(gZipContent).append(", ")
- .append("useDnsForFetchingServiceUrls=").append(useDnsForFetchingServiceUrls).append(", ")
- .append("registerWithEureka=").append(registerWithEureka).append(", ")
- .append("preferSameZoneEureka=").append(preferSameZoneEureka).append(", ")
- .append("logDeltaDiff=").append(logDeltaDiff).append(", ")
- .append("disableDelta=").append(disableDelta).append(", ")
- .append("fetchRemoteRegionsRegistry='").append(fetchRemoteRegionsRegistry).append("', ")
- .append("availabilityZones=").append(availabilityZones).append(", ")
- .append("filterOnlyUpInstances=").append(filterOnlyUpInstances).append(", ")
- .append("fetchRegistry=").append(fetchRegistry).append(", ")
- .append("dollarReplacement='").append(dollarReplacement).append("', ")
- .append("escapeCharReplacement='").append(escapeCharReplacement).append("', ")
- .append("allowRedirects=").append(allowRedirects).append(", ")
- .append("onDemandUpdateStatusChange=").append(onDemandUpdateStatusChange).append(", ")
- .append("encoderName='").append(encoderName).append("', ")
- .append("decoderName='").append(decoderName).append("', ")
- .append("clientDataAccept='").append(clientDataAccept).append("'").append("}")
- .append("=shouldUnregisterOnShutdown'").append(shouldUnregisterOnShutdown).append("'").append("}")
- .append("shouldEnforceRegistrationAtInit='").append(shouldEnforceRegistrationAtInit).append("'").append("}")
- .toString();
- }
-
-}
diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaConstants.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaConstants.java
deleted file mode 100644
index 1f24480a..00000000
--- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaConstants.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2013-2015 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.eureka;
-
-/**
- * @author Spencer Gibb
- */
-public class EurekaConstants {
-
- public static final String DEFAULT_PREFIX = "/eureka";
-
- private EurekaConstants() {
- throw new AssertionError("Must not instantiate constant utility class");
- }
-
-}
diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaDiscoveryClient.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaDiscoveryClient.java
deleted file mode 100644
index d45889b2..00000000
--- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaDiscoveryClient.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright 2013-2015 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.eureka;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import org.springframework.cloud.client.DefaultServiceInstance;
-import org.springframework.cloud.client.ServiceInstance;
-import org.springframework.cloud.client.discovery.DiscoveryClient;
-import org.springframework.util.Assert;
-
-import com.netflix.appinfo.EurekaInstanceConfig;
-import com.netflix.appinfo.InstanceInfo;
-import com.netflix.discovery.EurekaClient;
-import com.netflix.discovery.shared.Application;
-import com.netflix.discovery.shared.Applications;
-
-import static com.netflix.appinfo.InstanceInfo.PortType.SECURE;
-
-/**
- * @author Spencer Gibb
- */
-public class EurekaDiscoveryClient implements DiscoveryClient {
-
- public static final String DESCRIPTION = "Spring Cloud Eureka Discovery Client";
-
- private final EurekaInstanceConfig config;
-
- private final EurekaClient eurekaClient;
-
- public EurekaDiscoveryClient(EurekaInstanceConfig config, EurekaClient eurekaClient) {
- this.config = config;
- this.eurekaClient = eurekaClient;
- }
-
- @Override
- public String description() {
- return DESCRIPTION;
- }
-
- @Override
- public List getInstances(String serviceId) {
- List infos = this.eurekaClient.getInstancesByVipAddress(serviceId,
- false);
- List instances = new ArrayList<>();
- for (InstanceInfo info : infos) {
- instances.add(new EurekaServiceInstance(info));
- }
- return instances;
- }
-
- public static class EurekaServiceInstance implements ServiceInstance {
- private InstanceInfo instance;
-
- public EurekaServiceInstance(InstanceInfo instance) {
- Assert.notNull(instance, "Service instance required");
- this.instance = instance;
- }
-
- public InstanceInfo getInstanceInfo() {
- return instance;
- }
-
- @Override
- public String getServiceId() {
- return this.instance.getAppName();
- }
-
- @Override
- public String getHost() {
- return this.instance.getHostName();
- }
-
- @Override
- public int getPort() {
- if (isSecure()) {
- return this.instance.getSecurePort();
- }
- return this.instance.getPort();
- }
-
- @Override
- public boolean isSecure() {
- // assume if secure is enabled, that is the default
- return this.instance.isPortEnabled(SECURE);
- }
-
- @Override
- public URI getUri() {
- return DefaultServiceInstance.getUri(this);
- }
-
- @Override
- public Map getMetadata() {
- return this.instance.getMetadata();
- }
- }
-
- @Override
- public List getServices() {
- Applications applications = this.eurekaClient.getApplications();
- if (applications == null) {
- return Collections.emptyList();
- }
- List registered = applications.getRegisteredApplications();
- List names = new ArrayList<>();
- for (Application app : registered) {
- if (app.getInstances().isEmpty()) {
- continue;
- }
- names.add(app.getName().toLowerCase());
-
- }
- return names;
- }
-
-}
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
deleted file mode 100644
index 07a8edd3..00000000
--- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaDiscoveryClientConfiguration.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * 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.eureka;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.actuate.health.HealthAggregator;
-import org.springframework.boot.actuate.health.OrderedHealthAggregator;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.cloud.context.scope.refresh.RefreshScopeRefreshedEvent;
-import org.springframework.cloud.netflix.eureka.serviceregistry.EurekaAutoServiceRegistration;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.event.EventListener;
-
-import com.netflix.appinfo.HealthCheckHandler;
-import com.netflix.discovery.EurekaClient;
-import com.netflix.discovery.EurekaClientConfig;
-
-/**
- * @author Dave Syer
- * @author Spencer Gibb
- * @author Jon Schneider
- * @author Jakub Narloch
- */
-@Configuration
-@EnableConfigurationProperties
-@ConditionalOnClass(EurekaClientConfig.class)
-@ConditionalOnProperty(value = "eureka.client.enabled", matchIfMissing = true)
-public class EurekaDiscoveryClientConfiguration {
-
- class Marker {}
-
- @Bean
- public Marker eurekaDiscoverClientMarker() {
- return new Marker();
- }
-
- @Configuration
- @ConditionalOnClass(RefreshScopeRefreshedEvent.class)
- protected static class EurekaClientConfigurationRefresher {
-
- @Autowired(required = false)
- private EurekaClient eurekaClient;
-
- @Autowired(required = false)
- private EurekaAutoServiceRegistration autoRegistration;
-
- @EventListener(RefreshScopeRefreshedEvent.class)
- public void onApplicationEvent(RefreshScopeRefreshedEvent event) {
- //This will force the creation of the EurkaClient bean if not already created
- //to make sure the client will be reregistered after a refresh event
- if(eurekaClient != null) {
- eurekaClient.getApplications();
- }
- if (autoRegistration != null) {
- // register in case meta data changed
- this.autoRegistration.stop();
- this.autoRegistration.start();
- }
- }
- }
-
-
- @Configuration
- @ConditionalOnProperty(value = "eureka.client.healthcheck.enabled", matchIfMissing = false)
- protected static class EurekaHealthCheckHandlerConfiguration {
-
- @Autowired(required = false)
- private HealthAggregator healthAggregator = new OrderedHealthAggregator();
-
- @Bean
- @ConditionalOnMissingBean(HealthCheckHandler.class)
- public EurekaHealthCheckHandler eurekaHealthCheckHandler() {
- return new EurekaHealthCheckHandler(this.healthAggregator);
- }
- }
-}
diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaHealthCheckHandler.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaHealthCheckHandler.java
deleted file mode 100644
index 0ab3d745..00000000
--- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaHealthCheckHandler.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * 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.eureka;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.netflix.appinfo.HealthCheckHandler;
-import com.netflix.appinfo.InstanceInfo;
-
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.boot.actuate.health.CompositeHealthIndicator;
-import org.springframework.boot.actuate.health.HealthAggregator;
-import org.springframework.boot.actuate.health.HealthIndicator;
-import org.springframework.boot.actuate.health.Status;
-import org.springframework.cloud.client.discovery.health.DiscoveryCompositeHealthIndicator;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-import org.springframework.util.Assert;
-
-import static com.netflix.appinfo.InstanceInfo.InstanceStatus;
-
-/**
- * A Eureka health checker, maps the application status into {@link InstanceStatus}
- * that will be propagated to Eureka registry.
- *
- * On each heartbeat Eureka performs the health check invoking registered {@link HealthCheckHandler}. By default this
- * implementation will perform aggregation of all registered {@link HealthIndicator}
- * through registered {@link HealthAggregator}.
- *
- * @author Jakub Narloch
- * @see HealthCheckHandler
- * @see HealthAggregator
- */
-public class EurekaHealthCheckHandler implements HealthCheckHandler, ApplicationContextAware, InitializingBean {
-
- private static final Map STATUS_MAPPING =
- new HashMap() {{
- put(Status.UNKNOWN, InstanceStatus.UNKNOWN);
- put(Status.OUT_OF_SERVICE, InstanceStatus.OUT_OF_SERVICE);
- put(Status.DOWN, InstanceStatus.DOWN);
- put(Status.UP, InstanceStatus.UP);
- }};
-
- private final CompositeHealthIndicator healthIndicator;
-
- private ApplicationContext applicationContext;
-
- public EurekaHealthCheckHandler(HealthAggregator healthAggregator) {
- Assert.notNull(healthAggregator, "HealthAggregator must not be null");
- this.healthIndicator = new CompositeHealthIndicator(healthAggregator);
- }
-
- @Override
- public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
- this.applicationContext = applicationContext;
- }
-
- @Override
- public void afterPropertiesSet() throws Exception {
- final Map healthIndicators = applicationContext.getBeansOfType(HealthIndicator.class);
-
- for (Map.Entry entry : healthIndicators.entrySet()) {
-
- //ignore EurekaHealthIndicator and flatten the rest of the composite
- //otherwise there is a never ending cycle of down. See gh-643
- if (entry.getValue() instanceof DiscoveryCompositeHealthIndicator) {
- DiscoveryCompositeHealthIndicator indicator = (DiscoveryCompositeHealthIndicator) entry.getValue();
- for (DiscoveryCompositeHealthIndicator.Holder holder : indicator.getHealthIndicators()) {
- if (!(holder.getDelegate() instanceof EurekaHealthIndicator)) {
- healthIndicator.addHealthIndicator(holder.getDelegate().getName(), holder);
- }
- }
-
- }
- else {
- healthIndicator.addHealthIndicator(entry.getKey(), entry.getValue());
- }
- }
- }
-
- @Override
- public InstanceStatus getStatus(InstanceStatus instanceStatus) {
- return getHealthStatus();
- }
-
- protected InstanceStatus getHealthStatus() {
- final Status status = getHealthIndicator().health().getStatus();
- return mapToInstanceStatus(status);
- }
-
- protected InstanceStatus mapToInstanceStatus(Status status) {
- if (!STATUS_MAPPING.containsKey(status)) {
- return InstanceStatus.UNKNOWN;
- }
- return STATUS_MAPPING.get(status);
- }
-
- protected CompositeHealthIndicator getHealthIndicator() {
- return healthIndicator;
- }
-}
diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaHealthIndicator.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaHealthIndicator.java
deleted file mode 100644
index d7dc499a..00000000
--- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaHealthIndicator.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright 2013-2014 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.eureka;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.springframework.boot.actuate.health.Health;
-import org.springframework.boot.actuate.health.Health.Builder;
-import org.springframework.boot.actuate.health.Status;
-import org.springframework.cloud.client.discovery.health.DiscoveryHealthIndicator;
-
-import com.netflix.appinfo.EurekaInstanceConfig;
-import com.netflix.discovery.DiscoveryClient;
-import com.netflix.discovery.EurekaClient;
-import com.netflix.discovery.EurekaClientConfig;
-import com.netflix.discovery.shared.Application;
-import com.netflix.discovery.shared.Applications;
-
-/**
- * @author Dave Syer
- */
-public class EurekaHealthIndicator implements DiscoveryHealthIndicator {
-
- private final EurekaClient eurekaClient;
-
- private final EurekaInstanceConfig instanceConfig;
-
- private final EurekaClientConfig clientConfig;
-
- public EurekaHealthIndicator(EurekaClient eurekaClient,
- EurekaInstanceConfig instanceConfig, EurekaClientConfig clientConfig) {
- super();
- this.eurekaClient = eurekaClient;
- this.instanceConfig = instanceConfig;
- this.clientConfig = clientConfig;
- }
-
- @Override
- public String getName() {
- return "eureka";
- }
-
- @Override
- public Health health() {
- Builder builder = Health.unknown();
- Status status = getStatus(builder);
- return builder.status(status).withDetail("applications", getApplications())
- .build();
- }
-
- private Status getStatus(Builder builder) {
- Status status = new Status(
- this.eurekaClient.getInstanceRemoteStatus().toString(),
- "Remote status from Eureka server");
-
- if (eurekaClient instanceof DiscoveryClient && clientConfig.shouldFetchRegistry()) {
- DiscoveryClient discoveryClient = (DiscoveryClient) eurekaClient;
- long lastFetch = discoveryClient.getLastSuccessfulRegistryFetchTimePeriod();
-
- if (lastFetch < 0) {
- status = new Status("UP",
- "Eureka discovery client has not yet successfully connected to a Eureka server");
- }
- else if (lastFetch > clientConfig.getRegistryFetchIntervalSeconds() * 2000) {
- status = new Status("UP",
- "Eureka discovery client is reporting failures to connect to a Eureka server");
- builder.withDetail("renewalPeriod",
- instanceConfig.getLeaseRenewalIntervalInSeconds());
- builder.withDetail("failCount",
- lastFetch / clientConfig.getRegistryFetchIntervalSeconds());
- }
- }
-
- return status;
- }
-
- private Map getApplications() {
- Applications applications = this.eurekaClient.getApplications();
- if (applications == null) {
- return Collections.emptyMap();
- }
- Map result = new HashMap<>();
- for (Application application : applications.getRegisteredApplications()) {
- result.put(application.getName(), application.getInstances().size());
- }
- return result;
- }
-
-}
diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaInstanceConfigBean.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaInstanceConfigBean.java
deleted file mode 100644
index 47c43c10..00000000
--- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaInstanceConfigBean.java
+++ /dev/null
@@ -1,650 +0,0 @@
-/*
- * Copyright 2013-2014 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.eureka;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Objects;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.cloud.commons.util.InetUtils;
-import org.springframework.cloud.commons.util.InetUtils.HostInfo;
-import org.springframework.context.EnvironmentAware;
-import org.springframework.core.env.Environment;
-import org.springframework.util.StringUtils;
-
-import com.netflix.appinfo.DataCenterInfo;
-import com.netflix.appinfo.InstanceInfo.InstanceStatus;
-import com.netflix.appinfo.MyDataCenterInfo;
-
-/**
- * @author Dave Syer
- * @author Spencer Gibb
- * @author Ryan Baxter
- * @author Gregor Zurowski
- */
-@ConfigurationProperties("eureka.instance")
-public class EurekaInstanceConfigBean implements CloudEurekaInstanceConfig, EnvironmentAware {
-
- private static final String UNKNOWN = "unknown";
-
- private HostInfo hostInfo;
-
- private InetUtils inetUtils;
-
- /**
- * Get the name of the application to be registered with eureka.
- */
- private String appname = UNKNOWN;
-
- /**
- * Get the name of the application group to be registered with eureka.
- */
- private String appGroupName;
-
- /**
- * Indicates whether the instance should be enabled for taking traffic as soon as it
- * is registered with eureka. Sometimes the application might need to do some
- * pre-processing before it is ready to take traffic.
- */
- private boolean instanceEnabledOnit;
-
- /**
- * Get the non-secure port on which the instance should receive traffic.
- */
- private int nonSecurePort = 80;
-
- /**
- * Get the Secure port on which the instance should receive traffic.
- */
- private int securePort = 443;
-
- /**
- * Indicates whether the non-secure port should be enabled for traffic or not.
- */
- private boolean nonSecurePortEnabled = true;
-
- /**
- * Indicates whether the secure port should be enabled for traffic or not.
- */
- private boolean securePortEnabled;
-
- /**
- * Indicates how often (in seconds) the eureka client needs to send heartbeats to
- * eureka server to indicate that it is still alive. If the heartbeats are not
- * received for the period specified in leaseExpirationDurationInSeconds, eureka
- * server will remove the instance from its view, there by disallowing traffic to this
- * instance.
- *
- * Note that the instance could still not take traffic if it implements
- * HealthCheckCallback and then decides to make itself unavailable.
- */
- private int leaseRenewalIntervalInSeconds = 30;
-
- /**
- * Indicates the time in seconds that the eureka server waits since it received the
- * last heartbeat before it can remove this instance from its view and there by
- * disallowing traffic to this instance.
- *
- * Setting this value too long could mean that the traffic could be routed to the
- * instance even though the instance is not alive. Setting this value too small could
- * mean, the instance may be taken out of traffic because of temporary network
- * glitches.This value to be set to atleast higher than the value specified in
- * leaseRenewalIntervalInSeconds.
- */
- private int leaseExpirationDurationInSeconds = 90;
-
- /**
- * Gets the virtual host name defined for this instance.
- *
- * This is typically the way other instance would find this instance by using the
- * virtual host name.Think of this as similar to the fully qualified domain name, that
- * the users of your services will need to find this instance.
- */
- private String virtualHostName = UNKNOWN;
-
- /**
- * Get the unique Id (within the scope of the appName) of this instance to be
- * registered with eureka.
- */
- private String instanceId;
-
- /**
- * Gets the secure virtual host name defined for this instance.
- *
- * This is typically the way other instance would find this instance by using the
- * secure virtual host name.Think of this as similar to the fully qualified domain
- * name, that the users of your services will need to find this instance.
- */
- private String secureVirtualHostName = UNKNOWN;
-
- /**
- * Gets the AWS autoscaling group name associated with this instance. This information
- * is specifically used in an AWS environment to automatically put an instance out of
- * service after the instance is launched and it has been disabled for traffic..
- */
- private String aSGName;
-
- /**
- * Gets the metadata name/value pairs associated with this instance. This information
- * is sent to eureka server and can be used by other instances.
- */
- private Map metadataMap = new HashMap<>();
-
- /**
- * Returns the data center this instance is deployed. This information is used to get
- * some AWS specific instance information if the instance is deployed in AWS.
- */
- private DataCenterInfo dataCenterInfo = new MyDataCenterInfo(
- DataCenterInfo.Name.MyOwn);
-
- /**
- * Get the IPAdress of the instance. This information is for academic purposes only as
- * the communication from other instances primarily happen using the information
- * supplied in {@link #getHostName(boolean)}.
- */
- private String ipAddress;
-
- /**
- * Gets the relative status page URL path for this instance. The status page URL is
- * then constructed out of the hostName and the type of communication - secure or
- * unsecure as specified in securePort and nonSecurePort.
- *
- * It is normally used for informational purposes for other services to find about the
- * status of this instance. Users can provide a simple HTML indicating what is the
- * current status of the instance.
- */
- private String statusPageUrlPath = "/info";
-
- /**
- * Gets the absolute status page URL path for this instance. The users can provide the
- * statusPageUrlPath if the status page resides in the same instance talking to
- * eureka, else in the cases where the instance is a proxy for some other server,
- * users can provide the full URL. If the full URL is provided it takes precedence.
- *
- * It is normally used for informational purposes for other services to find about the
- * status of this instance. Users can provide a simple HTML indicating what is the
- * current status of the instance.
- */
- private String statusPageUrl;
-
- /**
- * Gets the relative home page URL Path for this instance. The home page URL is then
- * constructed out of the hostName and the type of communication - secure or unsecure.
- *
- * It is normally used for informational purposes for other services to use it as a
- * landing page.
- */
- private String homePageUrlPath = "/";
-
- /**
- * Gets the absolute home page URL for this instance. The users can provide the
- * homePageUrlPath if the home page resides in the same instance talking to eureka,
- * else in the cases where the instance is a proxy for some other server, users can
- * provide the full URL. If the full URL is provided it takes precedence.
- *
- * It is normally used for informational purposes for other services to use it as a
- * landing page. The full URL should follow the format http://${eureka.hostname}:7001/
- * where the value ${eureka.hostname} is replaced at runtime.
- */
- private String homePageUrl;
-
- /**
- * Gets the relative health check URL path for this instance. The health check page
- * URL is then constructed out of the hostname and the type of communication - secure
- * or unsecure as specified in securePort and nonSecurePort.
- *
- * It is normally used for making educated decisions based on the health of the
- * instance - for example, it can be used to determine whether to proceed deployments
- * to an entire farm or stop the deployments without causing further damage.
- */
- private String healthCheckUrlPath = "/health";
-
- /**
- * Gets the absolute health check page URL for this instance. The users can provide
- * the healthCheckUrlPath if the health check page resides in the same instance
- * talking to eureka, else in the cases where the instance is a proxy for some other
- * server, users can provide the full URL. If the full URL is provided it takes
- * precedence.
- *
- *
- * It is normally used for making educated decisions based on the health of the
- * instance - for example, it can be used to determine whether to proceed deployments
- * to an entire farm or stop the deployments without causing further damage. The full
- * URL should follow the format http://${eureka.hostname}:7001/ where the value
- * ${eureka.hostname} is replaced at runtime.
- */
- private String healthCheckUrl;
-
- /**
- * Gets the absolute secure health check page URL for this instance. The users can
- * provide the secureHealthCheckUrl if the health check page resides in the same
- * instance talking to eureka, else in the cases where the instance is a proxy for
- * some other server, users can provide the full URL. If the full URL is provided it
- * takes precedence.
- *
- *
- * It is normally used for making educated decisions based on the health of the
- * instance - for example, it can be used to determine whether to proceed deployments
- * to an entire farm or stop the deployments without causing further damage. The full
- * URL should follow the format http://${eureka.hostname}:7001/ where the value
- * ${eureka.hostname} is replaced at runtime.
- */
- private String secureHealthCheckUrl;
-
- /**
- * Get the namespace used to find properties. Ignored in Spring Cloud.
- */
- private String namespace = "eureka";
-
- /**
- * The hostname if it can be determined at configuration time (otherwise it will be
- * guessed from OS primitives).
- */
- private String hostname;
-
- /**
- * Flag to say that, when guessing a hostname, the IP address of the server should be
- * used in prference to the hostname reported by the OS.
- */
- private boolean preferIpAddress = false;
-
- /**
- * Initial status to register with rmeote Eureka server.
- */
- private InstanceStatus initialStatus = InstanceStatus.UP;
-
- private String[] defaultAddressResolutionOrder = new String[0];
- private Environment environment;
-
- public String getHostname() {
- return getHostName(false);
- }
-
- @SuppressWarnings("unused")
- private EurekaInstanceConfigBean() {
- }
-
- public EurekaInstanceConfigBean(InetUtils inetUtils) {
- this.inetUtils = inetUtils;
- this.hostInfo = this.inetUtils.findFirstNonLoopbackHostInfo();
- this.ipAddress = this.hostInfo.getIpAddress();
- this.hostname = this.hostInfo.getHostname();
- }
-
- @Override
- public String getInstanceId() {
- if (this.instanceId == null && this.metadataMap != null) {
- return this.metadataMap.get("instanceId");
- }
- return this.instanceId;
- }
-
- @Override
- public boolean getSecurePortEnabled() {
- return this.securePortEnabled;
- }
-
- public void setHostname(String hostname) {
- this.hostname = hostname;
- this.hostInfo.override = true;
- }
-
- public void setIpAddress(String ipAddress) {
- this.ipAddress = ipAddress;
- this.hostInfo.override = true;
- }
-
- @Override
- public String getHostName(boolean refresh) {
- if (refresh && !this.hostInfo.override) {
- this.ipAddress = this.hostInfo.getIpAddress();
- this.hostname = this.hostInfo.getHostname();
- }
- return this.preferIpAddress ? this.ipAddress : this.hostname;
- }
-
- @Override
- public void setEnvironment(Environment environment) {
- this.environment = environment;
- // set some defaults from the environment, but allow the defaults to use relaxed binding
- String springAppName = this.environment.getProperty("spring.application.name", "");
- if(StringUtils.hasText(springAppName)) {
- setAppname(springAppName);
- setVirtualHostName(springAppName);
- setSecureVirtualHostName(springAppName);
- }
- }
-
- private HostInfo getHostInfo() {
- return hostInfo;
- }
-
- private void setHostInfo(HostInfo hostInfo) {
- this.hostInfo = hostInfo;
- }
-
- private InetUtils getInetUtils() {
- return inetUtils;
- }
-
- private void setInetUtils(InetUtils inetUtils) {
- this.inetUtils = inetUtils;
- }
-
- public String getAppname() {
- return appname;
- }
-
- public void setAppname(String appname) {
- this.appname = appname;
- }
-
- public String getAppGroupName() {
- return appGroupName;
- }
-
- public void setAppGroupName(String appGroupName) {
- this.appGroupName = appGroupName;
- }
-
- public boolean isInstanceEnabledOnit() {
- return instanceEnabledOnit;
- }
-
- public void setInstanceEnabledOnit(boolean instanceEnabledOnit) {
- this.instanceEnabledOnit = instanceEnabledOnit;
- }
-
- public int getNonSecurePort() {
- return nonSecurePort;
- }
-
- public void setNonSecurePort(int nonSecurePort) {
- this.nonSecurePort = nonSecurePort;
- }
-
- public int getSecurePort() {
- return securePort;
- }
-
- public void setSecurePort(int securePort) {
- this.securePort = securePort;
- }
-
- public boolean isNonSecurePortEnabled() {
- return nonSecurePortEnabled;
- }
-
- public void setNonSecurePortEnabled(boolean nonSecurePortEnabled) {
- this.nonSecurePortEnabled = nonSecurePortEnabled;
- }
-
- public boolean isSecurePortEnabled() {
- return securePortEnabled;
- }
-
- public void setSecurePortEnabled(boolean securePortEnabled) {
- this.securePortEnabled = securePortEnabled;
- }
-
- public int getLeaseRenewalIntervalInSeconds() {
- return leaseRenewalIntervalInSeconds;
- }
-
- public void setLeaseRenewalIntervalInSeconds(int leaseRenewalIntervalInSeconds) {
- this.leaseRenewalIntervalInSeconds = leaseRenewalIntervalInSeconds;
- }
-
- public int getLeaseExpirationDurationInSeconds() {
- return leaseExpirationDurationInSeconds;
- }
-
- public void setLeaseExpirationDurationInSeconds(
- int leaseExpirationDurationInSeconds) {
- this.leaseExpirationDurationInSeconds = leaseExpirationDurationInSeconds;
- }
-
- public String getVirtualHostName() {
- return virtualHostName;
- }
-
- public void setVirtualHostName(String virtualHostName) {
- this.virtualHostName = virtualHostName;
- }
-
- public void setInstanceId(String instanceId) {
- this.instanceId = instanceId;
- }
-
- public String getSecureVirtualHostName() {
- return secureVirtualHostName;
- }
-
- public void setSecureVirtualHostName(String secureVirtualHostName) {
- this.secureVirtualHostName = secureVirtualHostName;
- }
-
- public String getASGName() {
- return aSGName;
- }
-
- public void setASGName(String aSGName) {
- this.aSGName = aSGName;
- }
-
- public Map getMetadataMap() {
- return metadataMap;
- }
-
- public void setMetadataMap(Map metadataMap) {
- this.metadataMap = metadataMap;
- }
-
- public DataCenterInfo getDataCenterInfo() {
- return dataCenterInfo;
- }
-
- public void setDataCenterInfo(DataCenterInfo dataCenterInfo) {
- this.dataCenterInfo = dataCenterInfo;
- }
-
- public String getIpAddress() {
- return ipAddress;
- }
-
- public String getStatusPageUrlPath() {
- return statusPageUrlPath;
- }
-
- public void setStatusPageUrlPath(String statusPageUrlPath) {
- this.statusPageUrlPath = statusPageUrlPath;
- }
-
- public String getStatusPageUrl() {
- return statusPageUrl;
- }
-
- public void setStatusPageUrl(String statusPageUrl) {
- this.statusPageUrl = statusPageUrl;
- }
-
- public String getHomePageUrlPath() {
- return homePageUrlPath;
- }
-
- public void setHomePageUrlPath(String homePageUrlPath) {
- this.homePageUrlPath = homePageUrlPath;
- }
-
- public String getHomePageUrl() {
- return homePageUrl;
- }
-
- public void setHomePageUrl(String homePageUrl) {
- this.homePageUrl = homePageUrl;
- }
-
- public String getHealthCheckUrlPath() {
- return healthCheckUrlPath;
- }
-
- public void setHealthCheckUrlPath(String healthCheckUrlPath) {
- this.healthCheckUrlPath = healthCheckUrlPath;
- }
-
- public String getHealthCheckUrl() {
- return healthCheckUrl;
- }
-
- public void setHealthCheckUrl(String healthCheckUrl) {
- this.healthCheckUrl = healthCheckUrl;
- }
-
- public String getSecureHealthCheckUrl() {
- return secureHealthCheckUrl;
- }
-
- public void setSecureHealthCheckUrl(String secureHealthCheckUrl) {
- this.secureHealthCheckUrl = secureHealthCheckUrl;
- }
-
- public String getNamespace() {
- return namespace;
- }
-
- public void setNamespace(String namespace) {
- this.namespace = namespace;
- }
-
- public boolean isPreferIpAddress() {
- return preferIpAddress;
- }
-
- public void setPreferIpAddress(boolean preferIpAddress) {
- this.preferIpAddress = preferIpAddress;
- }
-
- public InstanceStatus getInitialStatus() {
- return initialStatus;
- }
-
- public void setInitialStatus(InstanceStatus initialStatus) {
- this.initialStatus = initialStatus;
- }
-
- public String[] getDefaultAddressResolutionOrder() {
- return defaultAddressResolutionOrder;
- }
-
- public void setDefaultAddressResolutionOrder(String[] defaultAddressResolutionOrder) {
- this.defaultAddressResolutionOrder = defaultAddressResolutionOrder;
- }
-
- public Environment getEnvironment() {
- return environment;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- EurekaInstanceConfigBean that = (EurekaInstanceConfigBean) o;
- return Objects.equals(hostInfo, that.hostInfo) &&
- Objects.equals(inetUtils, that.inetUtils) &&
- Objects.equals(appname, that.appname) &&
- Objects.equals(appGroupName, that.appGroupName) &&
- instanceEnabledOnit == that.instanceEnabledOnit &&
- nonSecurePort == that.nonSecurePort &&
- securePort == that.securePort &&
- nonSecurePortEnabled == that.nonSecurePortEnabled &&
- securePortEnabled == that.securePortEnabled &&
- leaseRenewalIntervalInSeconds == that.leaseRenewalIntervalInSeconds &&
- leaseExpirationDurationInSeconds == that.leaseExpirationDurationInSeconds &&
- Objects.equals(virtualHostName, that.virtualHostName) &&
- Objects.equals(instanceId, that.instanceId) &&
- Objects.equals(secureVirtualHostName, that.secureVirtualHostName) &&
- Objects.equals(aSGName, that.aSGName) &&
- Objects.equals(metadataMap, that.metadataMap) &&
- Objects.equals(dataCenterInfo, that.dataCenterInfo) &&
- Objects.equals(ipAddress, that.ipAddress) &&
- Objects.equals(statusPageUrlPath, that.statusPageUrlPath) &&
- Objects.equals(statusPageUrl, that.statusPageUrl) &&
- Objects.equals(homePageUrlPath, that.homePageUrlPath) &&
- Objects.equals(homePageUrl, that.homePageUrl) &&
- Objects.equals(healthCheckUrlPath, that.healthCheckUrlPath) &&
- Objects.equals(healthCheckUrl, that.healthCheckUrl) &&
- Objects.equals(secureHealthCheckUrl, that.secureHealthCheckUrl) &&
- Objects.equals(namespace, that.namespace) &&
- Objects.equals(hostname, that.hostname) &&
- preferIpAddress == that.preferIpAddress &&
- Objects.equals(initialStatus, that.initialStatus) &&
- Arrays.equals(defaultAddressResolutionOrder, that.defaultAddressResolutionOrder) &&
- Objects.equals(environment, that.environment);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(hostInfo, inetUtils, appname, appGroupName,
- instanceEnabledOnit, nonSecurePort, securePort, nonSecurePortEnabled,
- securePortEnabled, leaseRenewalIntervalInSeconds,
- leaseExpirationDurationInSeconds, virtualHostName, instanceId,
- secureVirtualHostName, aSGName, metadataMap, dataCenterInfo, ipAddress,
- statusPageUrlPath, statusPageUrl, homePageUrlPath, homePageUrl,
- healthCheckUrlPath, healthCheckUrl, secureHealthCheckUrl, namespace,
- hostname, preferIpAddress, initialStatus, defaultAddressResolutionOrder, environment);
- }
-
- @Override
- public String toString() {
- return new StringBuilder("EurekaInstanceConfigBean{")
- .append("hostInfo=").append(hostInfo).append(", ")
- .append("inetUtils=").append(inetUtils).append(", ")
- .append("appname='").append(appname).append("', ")
- .append("appGroupName='").append(appGroupName).append("', ")
- .append("instanceEnabledOnit=").append(instanceEnabledOnit).append(", ")
- .append("nonSecurePort=").append(nonSecurePort).append(", ")
- .append("securePort=").append(securePort).append(", ")
- .append("nonSecurePortEnabled=").append(nonSecurePortEnabled).append(", ")
- .append("securePortEnabled=").append(securePortEnabled).append(", ")
- .append("leaseRenewalIntervalInSeconds=").append(leaseRenewalIntervalInSeconds).append(", ")
- .append("leaseExpirationDurationInSeconds=").append(leaseExpirationDurationInSeconds).append(", ")
- .append("virtualHostName='").append(virtualHostName).append("', ")
- .append("instanceId='").append(instanceId).append("', ")
- .append("secureVirtualHostName='").append(secureVirtualHostName).append("', ")
- .append("aSGName='").append(aSGName).append("', ")
- .append("metadataMap=").append(metadataMap).append(", ")
- .append("dataCenterInfo=").append(dataCenterInfo).append(", ")
- .append("ipAddress='").append(ipAddress).append("', ")
- .append("statusPageUrlPath='").append(statusPageUrlPath).append("', ")
- .append("statusPageUrl='").append(statusPageUrl).append("', ")
- .append("homePageUrlPath='").append(homePageUrlPath).append("', ")
- .append("homePageUrl='").append(homePageUrl).append("', ")
- .append("healthCheckUrlPath='").append(healthCheckUrlPath).append("', ")
- .append("healthCheckUrl='").append(healthCheckUrl).append("', ")
- .append("secureHealthCheckUrl='").append(secureHealthCheckUrl).append("', ")
- .append("namespace='").append(namespace).append("', ")
- .append("hostname='").append(hostname).append("', ")
- .append("preferIpAddress=").append(preferIpAddress).append(", ")
- .append("initialStatus=").append(initialStatus).append(", ")
- .append("defaultAddressResolutionOrder=").append(Arrays.toString(defaultAddressResolutionOrder)).append(", ")
- .append("environment=").append(environment).append(", ").append("}")
- .toString();
- }
-
-}
diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/InstanceInfoFactory.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/InstanceInfoFactory.java
deleted file mode 100644
index f92891ca..00000000
--- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/InstanceInfoFactory.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright 2013-2015 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.eureka;
-
-import java.util.Map;
-
-import com.netflix.appinfo.EurekaInstanceConfig;
-import com.netflix.appinfo.InstanceInfo;
-import com.netflix.appinfo.LeaseInfo;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * See com.netflix.appinfo.providers.EurekaConfigBasedInstanceInfoProvider
- * @author Spencer Gibb
- */
-public class InstanceInfoFactory {
-
- private static final Log log = LogFactory.getLog(InstanceInfoFactory.class);
-
- public InstanceInfo create(EurekaInstanceConfig config) {
- LeaseInfo.Builder leaseInfoBuilder = LeaseInfo.Builder.newBuilder()
- .setRenewalIntervalInSecs(config.getLeaseRenewalIntervalInSeconds())
- .setDurationInSecs(config.getLeaseExpirationDurationInSeconds());
-
- // Builder the instance information to be registered with eureka
- // server
- InstanceInfo.Builder builder = InstanceInfo.Builder.newBuilder();
-
- String namespace = config.getNamespace();
- if (!namespace.endsWith(".")) {
- namespace = namespace + ".";
- }
- builder.setNamespace(namespace).setAppName(config.getAppname())
- .setInstanceId(config.getInstanceId())
- .setAppGroupName(config.getAppGroupName())
- .setDataCenterInfo(config.getDataCenterInfo())
- .setIPAddr(config.getIpAddress()).setHostName(config.getHostName(false))
- .setPort(config.getNonSecurePort())
- .enablePort(InstanceInfo.PortType.UNSECURE,
- config.isNonSecurePortEnabled())
- .setSecurePort(config.getSecurePort())
- .enablePort(InstanceInfo.PortType.SECURE, config.getSecurePortEnabled())
- .setVIPAddress(config.getVirtualHostName())
- .setSecureVIPAddress(config.getSecureVirtualHostName())
- .setHomePageUrl(config.getHomePageUrlPath(), config.getHomePageUrl())
- .setStatusPageUrl(config.getStatusPageUrlPath(),
- config.getStatusPageUrl())
- .setHealthCheckUrls(config.getHealthCheckUrlPath(),
- config.getHealthCheckUrl(), config.getSecureHealthCheckUrl())
- .setASGName(config.getASGName());
-
- // Start off with the STARTING state to avoid traffic
- if (!config.isInstanceEnabledOnit()) {
- InstanceInfo.InstanceStatus initialStatus = InstanceInfo.InstanceStatus.STARTING;
- if (log.isInfoEnabled()) {
- log.info("Setting initial instance status as: " + initialStatus);
- }
- builder.setStatus(initialStatus);
- }
- else {
- if (log.isInfoEnabled()) {
- log.info("Setting initial instance status as: "
- + InstanceInfo.InstanceStatus.UP
- + ". This may be too early for the instance to advertise itself as available. "
- + "You would instead want to control this via a healthcheck handler.");
- }
- }
-
- // Add any user-specific metadata information
- for (Map.Entry mapEntry : config.getMetadataMap().entrySet()) {
- String key = mapEntry.getKey();
- String value = mapEntry.getValue();
- builder.add(key, value);
- }
-
- InstanceInfo instanceInfo = builder.build();
- instanceInfo.setLeaseInfo(leaseInfoBuilder.build());
- return instanceInfo;
- }
-}
diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/MutableDiscoveryClientOptionalArgs.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/MutableDiscoveryClientOptionalArgs.java
deleted file mode 100644
index f19b0cdb..00000000
--- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/MutableDiscoveryClientOptionalArgs.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2013-2015 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.eureka;
-
-import java.util.Collection;
-import java.util.LinkedHashSet;
-
-import com.netflix.discovery.DiscoveryClient.DiscoveryClientOptionalArgs;
-import com.sun.jersey.api.client.filter.ClientFilter;
-
-/**
- * @author Dave Syer
- */
-public class MutableDiscoveryClientOptionalArgs extends DiscoveryClientOptionalArgs {
-
- private Collection additionalFilters;
-
- @Override
- public void setAdditionalFilters(Collection additionalFilters) {
- additionalFilters = new LinkedHashSet<>(additionalFilters);
- this.additionalFilters = additionalFilters;
- super.setAdditionalFilters(additionalFilters);
- }
-
- public Collection getAdditionalFilters() {
- return this.additionalFilters;
- }
-
-}
diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/DiscoveryClientOptionalArgsConfiguration.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/DiscoveryClientOptionalArgsConfiguration.java
deleted file mode 100644
index d0439afb..00000000
--- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/DiscoveryClientOptionalArgsConfiguration.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 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.eureka.config;
-
-import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
-import org.springframework.boot.autoconfigure.condition.SearchStrategy;
-import org.springframework.cloud.netflix.eureka.MutableDiscoveryClientOptionalArgs;
-import org.springframework.cloud.netflix.eureka.http.RestTemplateDiscoveryClientOptionalArgs;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-import com.netflix.discovery.AbstractDiscoveryClientOptionalArgs;
-
-/**
- * @author Daniel Lavoie
- */
-@Configuration
-public class DiscoveryClientOptionalArgsConfiguration {
- @Bean
- @ConditionalOnMissingClass("com.sun.jersey.api.client.filter.ClientFilter")
- @ConditionalOnMissingBean(value = AbstractDiscoveryClientOptionalArgs.class, search = SearchStrategy.CURRENT)
- public RestTemplateDiscoveryClientOptionalArgs restTemplateDiscoveryClientOptionalArgs() {
- return new RestTemplateDiscoveryClientOptionalArgs();
- }
-
- @Bean
- @ConditionalOnClass(name = "com.sun.jersey.api.client.filter.ClientFilter")
- @ConditionalOnMissingBean(value = AbstractDiscoveryClientOptionalArgs.class, search = SearchStrategy.CURRENT)
- public MutableDiscoveryClientOptionalArgs discoveryClientOptionalArgs() {
- return new MutableDiscoveryClientOptionalArgs();
- }
-}
diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/EurekaClientConfigServerAutoConfiguration.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/EurekaClientConfigServerAutoConfiguration.java
deleted file mode 100644
index 48623bad..00000000
--- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/EurekaClientConfigServerAutoConfiguration.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2013-2014 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.eureka.config;
-
-import javax.annotation.PostConstruct;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.cloud.config.server.config.ConfigServerProperties;
-import org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.util.StringUtils;
-
-import com.netflix.appinfo.EurekaInstanceConfig;
-import com.netflix.discovery.EurekaClient;
-
-/**
- * Extra configuration for config server if it happens to be a Eureka instance.
- *
- * @author Dave Syer
- */
-@Configuration
-@EnableConfigurationProperties
-@ConditionalOnClass({ EurekaInstanceConfigBean.class, EurekaClient.class,
- ConfigServerProperties.class })
-public class EurekaClientConfigServerAutoConfiguration {
-
- @Autowired(required = false)
- private EurekaInstanceConfig instance;
-
- @Autowired(required = false)
- private ConfigServerProperties server;
-
- @PostConstruct
- public void init() {
- if (this.instance == null || this.server == null) {
- return;
- }
- String prefix = this.server.getPrefix();
- if (StringUtils.hasText(prefix)) {
- this.instance.getMetadataMap().put("configPath", prefix);
- }
- }
-
-}
diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/EurekaDiscoveryClientConfigServiceAutoConfiguration.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/EurekaDiscoveryClientConfigServiceAutoConfiguration.java
deleted file mode 100644
index bbfcc094..00000000
--- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/EurekaDiscoveryClientConfigServiceAutoConfiguration.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2013-2014 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.eureka.config;
-
-import javax.annotation.PostConstruct;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.cloud.netflix.eureka.EurekaDiscoveryClientConfiguration;
-import org.springframework.context.ConfigurableApplicationContext;
-
-import com.netflix.discovery.EurekaClient;
-
-/**
- * Bootstrap configuration for a config client that wants to lookup the config server via
- * discovery.
- *
- * @author Dave Syer
- */
-@ConditionalOnBean({ EurekaDiscoveryClientConfiguration.class })
-@ConditionalOnProperty(value = "spring.cloud.config.discovery.enabled", matchIfMissing = false)
-public class EurekaDiscoveryClientConfigServiceAutoConfiguration {
-
- @Autowired
- private ConfigurableApplicationContext context;
-
- @PostConstruct
- public void init() {
- if (this.context.getParent() != null) {
- if (this.context.getBeanNamesForType(EurekaClient.class).length > 0
- && this.context.getParent()
- .getBeanNamesForType(EurekaClient.class).length > 0) {
- // If the parent has a EurekaClient as well it should be shutdown, so the
- // local one can register accurate instance info
- this.context.getParent().getBean(EurekaClient.class).shutdown();
- }
- }
- }
-
-}
diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/EurekaDiscoveryClientConfigServiceBootstrapConfiguration.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/EurekaDiscoveryClientConfigServiceBootstrapConfiguration.java
deleted file mode 100644
index e194076b..00000000
--- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/config/EurekaDiscoveryClientConfigServiceBootstrapConfiguration.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2013-2014 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.eureka.config;
-
-import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.cloud.config.client.ConfigServicePropertySourceLocator;
-import org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration;
-import org.springframework.cloud.netflix.eureka.EurekaDiscoveryClientConfiguration;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Import;
-
-/**
- * Eureka-specific helper for config client that wants to lookup the config server via
- * discovery.
- *
- * @author Dave Syer
- */
-@ConditionalOnClass(ConfigServicePropertySourceLocator.class)
-@ConditionalOnProperty(value = "spring.cloud.config.discovery.enabled", matchIfMissing = false)
-@Configuration
-@Import({ EurekaDiscoveryClientConfiguration.class, // this emulates @EnableDiscoveryClient, the import selector doesn't run before the bootstrap phase
- EurekaClientAutoConfiguration.class })
-public class EurekaDiscoveryClientConfigServiceBootstrapConfiguration {
-}
diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/http/EurekaApplications.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/http/EurekaApplications.java
deleted file mode 100644
index 44906b1b..00000000
--- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/http/EurekaApplications.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 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.eureka.http;
-
-import java.util.List;
-
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.netflix.discovery.shared.Application;
-import com.netflix.discovery.shared.Applications;
-
-/**
- * A simple wrapper class for {@link Applications} that insure proprer Jackson
- * serialization through the JsonPropert overwrites.
- *
- * @author Daniel Lavoie
- */
-public class EurekaApplications extends com.netflix.discovery.shared.Applications {
-
- @JsonCreator
- public EurekaApplications(@JsonProperty("apps__hashcode") String appsHashCode,
- @JsonProperty("versions__delta") Long versionDelta,
- @JsonProperty("application") List registeredApplications) {
- super(appsHashCode, versionDelta, registeredApplications);
- }
-}
\ No newline at end of file
diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/http/RestTemplateDiscoveryClientOptionalArgs.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/http/RestTemplateDiscoveryClientOptionalArgs.java
deleted file mode 100644
index b0eba96f..00000000
--- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/http/RestTemplateDiscoveryClientOptionalArgs.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 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.eureka.http;
-
-import com.netflix.discovery.AbstractDiscoveryClientOptionalArgs;
-
-/**
- * @author Daniel Lavoie
- */
-public class RestTemplateDiscoveryClientOptionalArgs
- extends AbstractDiscoveryClientOptionalArgs {
- public RestTemplateDiscoveryClientOptionalArgs() {
- setTransportClientFactories(new RestTemplateTransportClientFactories());
- }
-}
diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/http/RestTemplateEurekaHttpClient.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/http/RestTemplateEurekaHttpClient.java
deleted file mode 100644
index 12f205b4..00000000
--- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/http/RestTemplateEurekaHttpClient.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * Copyright 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.eureka.http;
-
-import static com.netflix.discovery.shared.transport.EurekaHttpResponse.anEurekaHttpResponse;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.client.RestTemplate;
-
-import com.netflix.appinfo.InstanceInfo;
-import com.netflix.appinfo.InstanceInfo.InstanceStatus;
-import com.netflix.discovery.shared.Application;
-import com.netflix.discovery.shared.Applications;
-import com.netflix.discovery.shared.transport.EurekaHttpClient;
-import com.netflix.discovery.shared.transport.EurekaHttpResponse;
-import com.netflix.discovery.shared.transport.EurekaHttpResponse.EurekaHttpResponseBuilder;
-import com.netflix.discovery.util.StringUtil;
-
-/**
- * @author Daniel Lavoie
- */
-public class RestTemplateEurekaHttpClient implements EurekaHttpClient {
-
- protected final Log logger = LogFactory.getLog(getClass());
-
- private RestTemplate restTemplate;
- private String serviceUrl;
-
- public RestTemplateEurekaHttpClient(RestTemplate restTemplate, String serviceUrl) {
- this.restTemplate = restTemplate;
- this.serviceUrl = serviceUrl;
- }
-
- @Override
- public EurekaHttpResponse register(InstanceInfo info) {
- String urlPath = serviceUrl + "apps/" + info.getAppName();
-
- HttpHeaders headers = new HttpHeaders();
- headers.add(HttpHeaders.ACCEPT_ENCODING, "gzip");
- headers.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
-
- ResponseEntity response = restTemplate.exchange(urlPath, HttpMethod.POST,
- new HttpEntity(info, headers), Void.class);
-
- return anEurekaHttpResponse(response.getStatusCodeValue())
- .headers(headersOf(response)).build();
- }
-
- @Override
- public EurekaHttpResponse cancel(String appName, String id) {
- String urlPath = serviceUrl + "apps/" + appName + '/' + id;
-
- ResponseEntity response = restTemplate.exchange(urlPath, HttpMethod.DELETE,
- null, Void.class);
-
- return anEurekaHttpResponse(response.getStatusCodeValue())
- .headers(headersOf(response)).build();
- }
-
- @Override
- public EurekaHttpResponse sendHeartBeat(String appName, String id,
- InstanceInfo info, InstanceStatus overriddenStatus) {
- String urlPath = serviceUrl + "apps/" + appName + '/' + id + "?status="
- + info.getStatus().toString() + "&lastDirtyTimestamp="
- + info.getLastDirtyTimestamp().toString() + (overriddenStatus != null
- ? "&overriddenstatus=" + overriddenStatus.name() : "");
-
- ResponseEntity response = restTemplate.exchange(urlPath,
- HttpMethod.PUT, null, InstanceInfo.class);
-
- EurekaHttpResponseBuilder eurekaResponseBuilder = anEurekaHttpResponse(
- response.getStatusCodeValue(), InstanceInfo.class)
- .headers(headersOf(response));
-
- if (response.hasBody())
- eurekaResponseBuilder.entity(response.getBody());
-
- return eurekaResponseBuilder.build();
- }
-
- @Override
- public EurekaHttpResponse statusUpdate(String appName, String id,
- InstanceStatus newStatus, InstanceInfo info) {
- String urlPath = serviceUrl + "apps/" + appName + '/' + id + "?status="
- + newStatus.name() + "&lastDirtyTimestamp="
- + info.getLastDirtyTimestamp().toString();
-
- ResponseEntity response = restTemplate.exchange(urlPath, HttpMethod.PUT,
- null, Void.class);
-
- return anEurekaHttpResponse(response.getStatusCodeValue())
- .headers(headersOf(response)).build();
- }
-
- @Override
- public EurekaHttpResponse deleteStatusOverride(String appName, String id,
- InstanceInfo info) {
- String urlPath = serviceUrl + "apps/" + appName + '/' + id
- + "/status?lastDirtyTimestamp=" + info.getLastDirtyTimestamp().toString();
-
- ResponseEntity response = restTemplate.exchange(urlPath, HttpMethod.DELETE,
- null, Void.class);
-
- return anEurekaHttpResponse(response.getStatusCodeValue())
- .headers(headersOf(response)).build();
- }
-
- @Override
- public EurekaHttpResponse getApplications(String... regions) {
- return getApplicationsInternal("apps/", regions);
- }
-
- private EurekaHttpResponse getApplicationsInternal(String urlPath,
- String[] regions) {
- String url = serviceUrl + urlPath;
-
- if (regions != null && regions.length > 0)
- urlPath = (urlPath.contains("?") ? "&" : "?") + "regions="
- + StringUtil.join(regions);
-
- ResponseEntity response = restTemplate.exchange(url,
- HttpMethod.GET, null, EurekaApplications.class);
-
- return anEurekaHttpResponse(response.getStatusCodeValue(),
- response.getStatusCode().value() == HttpStatus.OK.value()
- && response.hasBody() ? (Applications) response.getBody() : null)
- .headers(headersOf(response)).build();
- }
-
- @Override
- public EurekaHttpResponse getDelta(String... regions) {
- return getApplicationsInternal("apps/delta", regions);
- }
-
- @Override
- public EurekaHttpResponse getVip(String vipAddress, String... regions) {
- return getApplicationsInternal("vips/" + vipAddress, regions);
- }
-
- @Override
- public EurekaHttpResponse getSecureVip(String secureVipAddress,
- String... regions) {
- return getApplicationsInternal("svips/" + secureVipAddress, regions);
- }
-
- @Override
- public EurekaHttpResponse getApplication(String appName) {
- String urlPath = serviceUrl + "apps/" + appName;
-
- ResponseEntity response = restTemplate.exchange(urlPath,
- HttpMethod.GET, null, Application.class);
-
- Application application = response.getStatusCodeValue() == HttpStatus.OK.value()
- && response.hasBody() ? response.getBody() : null;
-
- return anEurekaHttpResponse(response.getStatusCodeValue(), application)
- .headers(headersOf(response)).build();
- }
-
- @Override
- public EurekaHttpResponse getInstance(String appName, String id) {
- return getInstanceInternal("apps/" + appName + '/' + id);
- }
-
- @Override
- public EurekaHttpResponse getInstance(String id) {
- return getInstanceInternal("instances/" + id);
- }
-
- private EurekaHttpResponse getInstanceInternal(String urlPath) {
- urlPath = serviceUrl + urlPath;
-
- ResponseEntity response = restTemplate.exchange(urlPath,
- HttpMethod.GET, null, InstanceInfo.class);
-
- return anEurekaHttpResponse(response.getStatusCodeValue(),
- response.getStatusCodeValue() == HttpStatus.OK.value()
- && response.hasBody() ? response.getBody() : null)
- .headers(headersOf(response)).build();
- }
-
- @Override
- public void shutdown() {
- // Nothing to do
- }
-
- private static Map headersOf(ResponseEntity> response) {
- HttpHeaders httpHeaders = response.getHeaders();
- if (httpHeaders == null || httpHeaders.isEmpty()) {
- return Collections.emptyMap();
- }
- Map headers = new HashMap<>();
- for (Entry> entry : httpHeaders.entrySet()) {
- if (!entry.getValue().isEmpty()) {
- headers.put(entry.getKey(), entry.getValue().get(0));
- }
- }
- return headers;
- }
-}
diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/http/RestTemplateTransportClientFactories.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/http/RestTemplateTransportClientFactories.java
deleted file mode 100644
index d437703b..00000000
--- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/http/RestTemplateTransportClientFactories.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 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.eureka.http;
-
-import java.util.Collection;
-import java.util.Optional;
-
-import com.netflix.appinfo.InstanceInfo;
-import com.netflix.discovery.EurekaClientConfig;
-import com.netflix.discovery.shared.transport.TransportClientFactory;
-import com.netflix.discovery.shared.transport.jersey.EurekaJerseyClient;
-import com.netflix.discovery.shared.transport.jersey.TransportClientFactories;
-
-import javax.net.ssl.HostnameVerifier;
-import javax.net.ssl.SSLContext;
-
-/**
- * @author Daniel Lavoie
- */
-public class RestTemplateTransportClientFactories
- implements TransportClientFactories {
-
- @Override
- public TransportClientFactory newTransportClientFactory(
- Collection additionalFilters, EurekaJerseyClient providedJerseyClient) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public TransportClientFactory newTransportClientFactory(
- EurekaClientConfig clientConfig, Collection additionalFilters,
- InstanceInfo myInstanceInfo) {
- return new RestTemplateTransportClientFactory();
- }
-
- @Override
- public TransportClientFactory newTransportClientFactory(final EurekaClientConfig clientConfig,
- final Collection additionalFilters,
- final InstanceInfo myInstanceInfo,
- final Optional sslContext,
- final Optional hostnameVerifier) {
- return new RestTemplateTransportClientFactory();
- }
-}
diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/http/RestTemplateTransportClientFactory.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/http/RestTemplateTransportClientFactory.java
deleted file mode 100644
index 9258a311..00000000
--- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/http/RestTemplateTransportClientFactory.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright 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.eureka.http;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-
-import org.springframework.http.client.support.BasicAuthorizationInterceptor;
-import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
-import org.springframework.web.client.RestTemplate;
-
-import com.fasterxml.jackson.databind.BeanDescription;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.JsonSerializer;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.PropertyNamingStrategy;
-import com.fasterxml.jackson.databind.SerializationConfig;
-import com.fasterxml.jackson.databind.SerializationFeature;
-import com.fasterxml.jackson.databind.module.SimpleModule;
-import com.fasterxml.jackson.databind.ser.BeanSerializerModifier;
-import com.fasterxml.jackson.databind.ser.std.BeanSerializerBase;
-import com.netflix.appinfo.InstanceInfo;
-import com.netflix.discovery.converters.jackson.mixin.ApplicationsJsonMixIn;
-import com.netflix.discovery.converters.jackson.mixin.InstanceInfoJsonMixIn;
-import com.netflix.discovery.converters.jackson.serializer.InstanceInfoJsonBeanSerializer;
-import com.netflix.discovery.shared.Applications;
-import com.netflix.discovery.shared.resolver.EurekaEndpoint;
-import com.netflix.discovery.shared.transport.EurekaHttpClient;
-import com.netflix.discovery.shared.transport.TransportClientFactory;
-
-/**
- * Provides the custom {@link RestTemplate} required by the
- * {@link RestTemplateEurekaHttpClient}. Relies on Jackson for serialization and
- * deserialization.
- *
- * @author Daniel Lavoie
- */
-public class RestTemplateTransportClientFactory implements TransportClientFactory {
-
- @Override
- public EurekaHttpClient newClient(EurekaEndpoint serviceUrl) {
- return new RestTemplateEurekaHttpClient(restTemplate(serviceUrl.getServiceUrl()),
- serviceUrl.getServiceUrl());
- }
-
- private RestTemplate restTemplate(String serviceUrl) {
- RestTemplate restTemplate = new RestTemplate();
- try {
- URI serviceURI = new URI(serviceUrl);
- if (serviceURI.getUserInfo() != null) {
- String[] credentials = serviceURI.getUserInfo().split(":");
- if (credentials.length == 2) {
- restTemplate.getInterceptors().add(new BasicAuthorizationInterceptor(
- credentials[0], credentials[1]));
- }
- }
- }
- catch (URISyntaxException ignore) {
-
- }
-
- restTemplate.getMessageConverters().add(0, mappingJacksonHttpMessageConverter());
-
- return restTemplate;
- }
-
- /**
- * Provides the serialization configurations required by the Eureka Server. JSON
- * content exchanged with eureka requires a root node matching the entity being
- * serialized or deserialized. Achived with
- * {@link SerializationFeature.WRAP_ROOT_VALUE} and
- * {@link DeserializationFeature.UNWRAP_ROOT_VALUE}.
- * {@link PropertyNamingStrategy.SnakeCaseStrategy} is applied to the underlying
- * {@link ObjectMapper}.
- *
- *
- * @return
- */
- public MappingJackson2HttpMessageConverter mappingJacksonHttpMessageConverter() {
- MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
- converter.setObjectMapper(new ObjectMapper()
- .setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE));
-
- SimpleModule jsonModule = new SimpleModule();
- jsonModule.setSerializerModifier(createJsonSerializerModifier());//keyFormatter, compact));
- converter.getObjectMapper().registerModule(jsonModule);
-
- converter.getObjectMapper().configure(SerializationFeature.WRAP_ROOT_VALUE, true);
- converter.getObjectMapper().configure(DeserializationFeature.UNWRAP_ROOT_VALUE,
- true);
- converter.getObjectMapper().addMixIn(Applications.class, ApplicationsJsonMixIn.class);
- converter.getObjectMapper().addMixIn(InstanceInfo.class, InstanceInfoJsonMixIn.class);
-
- // converter.getObjectMapper().addMixIn(DataCenterInfo.class, DataCenterInfoXmlMixIn.class);
- // converter.getObjectMapper().addMixIn(InstanceInfo.PortWrapper.class, PortWrapperXmlMixIn.class);
- // converter.getObjectMapper().addMixIn(Application.class, ApplicationXmlMixIn.class);
- // converter.getObjectMapper().addMixIn(Applications.class, ApplicationsXmlMixIn.class);
-
-
- return converter;
- }
-
- public static BeanSerializerModifier createJsonSerializerModifier() {//final KeyFormatter keyFormatter, final boolean compactMode) {
- return new BeanSerializerModifier() {
- @Override
- public JsonSerializer> modifySerializer(SerializationConfig config,
- BeanDescription beanDesc, JsonSerializer> serializer) {
- /*if (beanDesc.getBeanClass().isAssignableFrom(Applications.class)) {
- return new ApplicationsJsonBeanSerializer((BeanSerializerBase) serializer, keyFormatter);
- }*/
- if (beanDesc.getBeanClass().isAssignableFrom(InstanceInfo.class)) {
- return new InstanceInfoJsonBeanSerializer((BeanSerializerBase) serializer, false);
- }
- return serializer;
- }
- };
- }
-
- @Override
- public void shutdown() {
- }
-
-}
diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/metadata/DefaultManagementMetadataProvider.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/metadata/DefaultManagementMetadataProvider.java
deleted file mode 100644
index 4f19b003..00000000
--- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/metadata/DefaultManagementMetadataProvider.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package org.springframework.cloud.netflix.eureka.metadata;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean;
-import org.springframework.util.StringUtils;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-public class DefaultManagementMetadataProvider implements ManagementMetadataProvider {
-
- private static final int RANDOM_PORT = 0;
- private static final Log log = LogFactory.getLog(DefaultManagementMetadataProvider.class);
-
- @Override
- public ManagementMetadata get(EurekaInstanceConfigBean instance, int serverPort,
- String serverContextPath, String managementContextPath,
- Integer managementPort) {
- if (isRandom(managementPort)) {
- return null;
- }
- if (managementPort == null && isRandom(serverPort)) {
- return null;
- }
- String healthCheckUrl = getHealthCheckUrl(instance, serverPort, serverContextPath,
- managementContextPath, managementPort);
- String statusPageUrl = getStatusPageUrl(instance, serverPort, serverContextPath,
- managementContextPath, managementPort);
-
- return new ManagementMetadata(healthCheckUrl, statusPageUrl, managementPort == null ? serverPort : managementPort);
- }
-
- private boolean isRandom(Integer port) {
- return port != null && port == RANDOM_PORT;
- }
-
- private String getHealthCheckUrl(EurekaInstanceConfigBean instance, int serverPort, String serverContextPath,
- String managementContextPath, Integer managementPort) {
- String healthCheckUrlPath = instance.getHealthCheckUrlPath();
- String healthCheckUrl = getUrl(instance, serverPort, serverContextPath, managementContextPath,
- managementPort, healthCheckUrlPath);
- log.debug("Constructed eureka meta-data healthcheckUrl: " + healthCheckUrl);
- return healthCheckUrl;
- }
-
- public String getStatusPageUrl(EurekaInstanceConfigBean instance, int serverPort, String serverContextPath,
- String managementContextPath, Integer managementPort) {
- String statusPageUrlPath = instance.getStatusPageUrlPath();
- String statusPageUrl = getUrl(instance, serverPort, serverContextPath, managementContextPath,
- managementPort, statusPageUrlPath);
- log.debug("Constructed eureka meta-data statusPageUrl: " + statusPageUrl);
- return statusPageUrl;
- }
-
- private String getUrl(EurekaInstanceConfigBean instance, int serverPort,
- String serverContextPath, String managementContextPath,
- Integer managementPort, String urlPath) {
- managementContextPath = refineManagementContextPath(serverContextPath, managementContextPath, managementPort);
- if (managementPort == null) {
- managementPort = serverPort;
- }
- String scheme = instance.getSecurePortEnabled() ? "https" : "http";
- return constructValidUrl(scheme, instance.getHostname(), managementPort, managementContextPath, urlPath);
- }
-
- private String refineManagementContextPath(String serverContextPath, String managementContextPath,
- Integer managementPort) {
- if(managementContextPath != null) {
- return managementContextPath;
- }
- if(managementPort != null) {
- return "/";
- }
- return serverContextPath;
- }
-
- private String constructValidUrl(String scheme, String hostname, int port,
- String contextPath, String statusPath) {
- try {
- if (!contextPath.endsWith("/")) {
- contextPath = contextPath + "/";
- }
- URL base = new URL(scheme, hostname, port, contextPath);
- String refinedStatusPath = StringUtils.trimLeadingCharacter(statusPath, '/');
- return new URL(base, refinedStatusPath).toString();
- } catch (MalformedURLException e) {
- String message = getErrorMessage(scheme, hostname, port, contextPath, statusPath);
- throw new IllegalStateException(message, e);
- }
- }
-
- private String getErrorMessage(String scheme, String hostname, int port, String contextPath, String statusPath) {
- return String.format("Failed to construct url for scheme: %s, hostName: %s port: %s contextPath: %s statusPath: %s",
- scheme, hostname, port, contextPath, statusPath);
- }
-}
diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/metadata/ManagementMetadata.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/metadata/ManagementMetadata.java
deleted file mode 100644
index baa4a4ac..00000000
--- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/metadata/ManagementMetadata.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.springframework.cloud.netflix.eureka.metadata;
-
-import java.util.Objects;
-
-public class ManagementMetadata {
-
- private final String healthCheckUrl;
- private final String statusPageUrl;
- private final Integer managementPort;
-
- public ManagementMetadata(String healthCheckUrl, String statusPageUrl, Integer managementPort) {
- this.healthCheckUrl = healthCheckUrl;
- this.statusPageUrl = statusPageUrl;
- this.managementPort = managementPort;
- }
-
- public String getHealthCheckUrl() {
- return healthCheckUrl;
- }
-
- public String getStatusPageUrl() {
- return statusPageUrl;
- }
-
- public Integer getManagementPort() {
- return managementPort;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- ManagementMetadata that = (ManagementMetadata) o;
- return Objects.equals(healthCheckUrl, that.healthCheckUrl) &&
- Objects.equals(statusPageUrl, that.statusPageUrl) &&
- Objects.equals(managementPort, that.managementPort);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(healthCheckUrl, statusPageUrl, managementPort);
- }
-
- @Override
- public String toString() {
- final StringBuilder sb = new StringBuilder("ManagementMetadata{");
- sb.append("healthCheckUrl='").append(healthCheckUrl).append('\'');
- sb.append(", statusPageUrl='").append(statusPageUrl).append('\'');
- sb.append(", managementPort=").append(managementPort);
- sb.append('}');
- return sb.toString();
- }
-}
diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/metadata/ManagementMetadataProvider.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/metadata/ManagementMetadataProvider.java
deleted file mode 100644
index 98bc770e..00000000
--- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/metadata/ManagementMetadataProvider.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.springframework.cloud.netflix.eureka.metadata;
-
-import org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean;
-
-public interface ManagementMetadataProvider {
-
- ManagementMetadata get(EurekaInstanceConfigBean instance, int serverPort,
- String serverContextPath, String managementContextPath, Integer managementPort);
-
-}
diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/serviceregistry/EurekaAutoServiceRegistration.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/serviceregistry/EurekaAutoServiceRegistration.java
deleted file mode 100644
index 984842ef..00000000
--- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/serviceregistry/EurekaAutoServiceRegistration.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * 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.eureka.serviceregistry;
-
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.boot.web.servlet.context.ServletWebServerInitializedEvent;
-import org.springframework.cloud.client.discovery.event.InstanceRegisteredEvent;
-import org.springframework.cloud.client.serviceregistry.AutoServiceRegistration;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.SmartLifecycle;
-import org.springframework.context.event.ContextClosedEvent;
-import org.springframework.context.event.EventListener;
-import org.springframework.core.Ordered;
-
-/**
- * @author Dave Syer
- * @author Spencer Gibb
- * @author Jon Schneider
- * @author Jakub Narloch
- * @author raiyan
- */
-public class EurekaAutoServiceRegistration implements AutoServiceRegistration, SmartLifecycle, Ordered {
-
- private static final Log log = LogFactory.getLog(EurekaAutoServiceRegistration.class);
-
- private AtomicBoolean running = new AtomicBoolean(false);
-
- private int order = 0;
-
- private AtomicInteger port = new AtomicInteger(0);
-
- private ApplicationContext context;
-
- private EurekaServiceRegistry serviceRegistry;
-
- private EurekaRegistration registration;
-
- public EurekaAutoServiceRegistration(ApplicationContext context, EurekaServiceRegistry serviceRegistry, EurekaRegistration registration) {
- this.context = context;
- this.serviceRegistry = serviceRegistry;
- this.registration = registration;
- }
-
- @Override
- public void start() {
- // only set the port if the nonSecurePort or securePort is 0 and this.port != 0
- if (this.port.get() != 0) {
- if (this.registration.getNonSecurePort() == 0) {
- this.registration.setNonSecurePort(this.port.get());
- }
-
- if (this.registration.getSecurePort() == 0 && this.registration.isSecure()) {
- this.registration.setSecurePort(this.port.get());
- }
- }
-
- // only initialize if nonSecurePort is greater than 0 and it isn't already running
- // because of containerPortInitializer below
- if (!this.running.get() && this.registration.getNonSecurePort() > 0) {
-
- this.serviceRegistry.register(this.registration);
-
- this.context.publishEvent(
- new InstanceRegisteredEvent<>(this, this.registration.getInstanceConfig()));
- this.running.set(true);
- }
- }
- @Override
- public void stop() {
- this.serviceRegistry.deregister(this.registration);
- this.running.set(false);
- }
-
- @Override
- public boolean isRunning() {
- return this.running.get();
- }
-
- @Override
- public int getPhase() {
- return 0;
- }
-
- @Override
- public boolean isAutoStartup() {
- return true;
- }
-
- @Override
- public void stop(Runnable callback) {
- stop();
- callback.run();
- }
-
- @Override
- public int getOrder() {
- return this.order;
- }
-
- @EventListener(ServletWebServerInitializedEvent.class)
- public void onApplicationEvent(ServletWebServerInitializedEvent event) {
- // TODO: take SSL into account
- int localPort = event.getWebServer().getPort();
- if (this.port.get() == 0) {
- log.info("Updating port to " + localPort);
- this.port.compareAndSet(0, localPort);
- start();
- }
- }
-
- @EventListener(ContextClosedEvent.class)
- public void onApplicationEvent(ContextClosedEvent event) {
- if( event.getApplicationContext() == context ) {
- stop();
- }
- }
-
-}
diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/serviceregistry/EurekaRegistration.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/serviceregistry/EurekaRegistration.java
deleted file mode 100644
index 76e0b9a6..00000000
--- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/serviceregistry/EurekaRegistration.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * 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.eureka.serviceregistry;
-
-import java.io.Closeable;
-import java.io.IOException;
-import java.net.URI;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.aop.framework.Advised;
-import org.springframework.aop.support.AopUtils;
-import org.springframework.beans.factory.ObjectProvider;
-import org.springframework.cloud.client.DefaultServiceInstance;
-import org.springframework.cloud.client.serviceregistry.Registration;
-import org.springframework.cloud.netflix.eureka.CloudEurekaClient;
-import org.springframework.cloud.netflix.eureka.CloudEurekaInstanceConfig;
-import org.springframework.cloud.netflix.eureka.InstanceInfoFactory;
-import org.springframework.context.ApplicationEventPublisher;
-import org.springframework.util.Assert;
-
-import com.netflix.appinfo.ApplicationInfoManager;
-import com.netflix.appinfo.HealthCheckHandler;
-import com.netflix.appinfo.InstanceInfo;
-import com.netflix.discovery.EurekaClient;
-import com.netflix.discovery.EurekaClientConfig;
-
-/**
- * @author Spencer Gibb
- */
-public class EurekaRegistration implements Registration, Closeable {
- private static final Log log = LogFactory.getLog(EurekaRegistration.class);
-
- private final EurekaClient eurekaClient;
- private final AtomicReference cloudEurekaClient = new AtomicReference<>();
- private final CloudEurekaInstanceConfig instanceConfig;
- private final ApplicationInfoManager applicationInfoManager;
- private ObjectProvider healthCheckHandler;
-
- private EurekaRegistration(CloudEurekaInstanceConfig instanceConfig, EurekaClient eurekaClient, ApplicationInfoManager applicationInfoManager, ObjectProvider healthCheckHandler) {
- this.eurekaClient = eurekaClient;
- this.instanceConfig = instanceConfig;
- this.applicationInfoManager = applicationInfoManager;
- this.healthCheckHandler = healthCheckHandler;
- }
-
- public static Builder builder(CloudEurekaInstanceConfig instanceConfig) {
- return new Builder(instanceConfig);
- }
-
- public static class Builder {
- private final CloudEurekaInstanceConfig instanceConfig;
- private ApplicationInfoManager applicationInfoManager;
- private EurekaClient eurekaClient;
- private ObjectProvider healthCheckHandler;
-
- private EurekaClientConfig clientConfig;
- private ApplicationEventPublisher publisher;
-
- Builder(CloudEurekaInstanceConfig instanceConfig) {
- this.instanceConfig = instanceConfig;
- }
-
- public Builder with(ApplicationInfoManager applicationInfoManager) {
- this.applicationInfoManager = applicationInfoManager;
- return this;
- }
-
- public Builder with(EurekaClient eurekaClient) {
- this.eurekaClient = eurekaClient;
- return this;
- }
-
- public Builder with(ObjectProvider healthCheckHandler) {
- this.healthCheckHandler = healthCheckHandler;
- return this;
- }
-
- public Builder with(EurekaClientConfig clientConfig, ApplicationEventPublisher publisher) {
- this.clientConfig = clientConfig;
- this.publisher = publisher;
- return this;
- }
-
- public EurekaRegistration build() {
- Assert.notNull(instanceConfig, "instanceConfig may not be null");
-
- if (this.applicationInfoManager == null) {
- InstanceInfo instanceInfo = new InstanceInfoFactory().create(this.instanceConfig);
- this.applicationInfoManager = new ApplicationInfoManager(this.instanceConfig, instanceInfo);
- }
- if (this.eurekaClient == null) {
- Assert.notNull(this.clientConfig, "if eurekaClient is null, EurekaClientConfig may not be null");
- Assert.notNull(this.publisher, "if eurekaClient is null, ApplicationEventPublisher may not be null");
-
- this.eurekaClient = new CloudEurekaClient(this.applicationInfoManager, this.clientConfig, this.publisher);
- }
- return new EurekaRegistration(instanceConfig, eurekaClient, applicationInfoManager, healthCheckHandler);
- }
-
- }
-
- @Override
- public String getServiceId() {
- return this.instanceConfig.getAppname();
- }
-
- @Override
- public String getHost() {
- return this.instanceConfig.getHostName(false);
- }
-
- @Override
- public int getPort() {
- if (this.instanceConfig.getSecurePortEnabled()) {
- return this.instanceConfig.getSecurePort();
- }
- return this.instanceConfig.getNonSecurePort();
- }
-
- @Override
- public boolean isSecure() {
- return this.instanceConfig.getSecurePortEnabled();
- }
-
- @Override
- public URI getUri() {
- return DefaultServiceInstance.getUri(this);
- }
-
- @Override
- public Map getMetadata() {
- return this.instanceConfig.getMetadataMap();
- }
-
- public CloudEurekaClient getEurekaClient() {
- if (this.cloudEurekaClient.get() == null) {
- try {
- this.cloudEurekaClient.compareAndSet(null, getTargetObject(eurekaClient, CloudEurekaClient.class));
- } catch (Exception e) {
- log.error("error getting CloudEurekaClient", e);
- }
- }
- return this.cloudEurekaClient.get();
- }
-
- @SuppressWarnings({"unchecked"})
- protected T getTargetObject(Object proxy, Class targetClass) throws Exception {
- if (AopUtils.isJdkDynamicProxy(proxy)) {
- return (T) ((Advised) proxy).getTargetSource().getTarget();
- } else {
- return (T) proxy; // expected to be cglib proxy then, which is simply a specialized class
- }
- }
-
- public CloudEurekaInstanceConfig getInstanceConfig() {
- return instanceConfig;
- }
-
- public ApplicationInfoManager getApplicationInfoManager() {
- return applicationInfoManager;
- }
-
- public ObjectProvider getHealthCheckHandler() {
- return healthCheckHandler;
- }
-
- public void setHealthCheckHandler(ObjectProvider healthCheckHandler) {
- this.healthCheckHandler = healthCheckHandler;
- }
-
- public void setNonSecurePort(int port) {
- this.instanceConfig.setNonSecurePort(port);
- }
-
- public int getNonSecurePort() {
- return this.instanceConfig.getNonSecurePort();
- }
-
- public void setSecurePort(int port) {
- this.instanceConfig.setSecurePort(port);
- }
-
- public int getSecurePort() {
- return this.instanceConfig.getSecurePort();
- }
-
- @Override
- public void close() throws IOException {
- this.eurekaClient.shutdown();
- }
-}
diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/serviceregistry/EurekaServiceRegistry.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/serviceregistry/EurekaServiceRegistry.java
deleted file mode 100644
index 47b4ddbb..00000000
--- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/serviceregistry/EurekaServiceRegistry.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright 2013-2018 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.eureka.serviceregistry;
-
-import java.util.HashMap;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.cloud.client.serviceregistry.ServiceRegistry;
-
-import com.netflix.appinfo.InstanceInfo;
-
-import static com.netflix.appinfo.InstanceInfo.InstanceStatus.UNKNOWN;
-
-/**
- * @author Spencer Gibb
- */
-public class EurekaServiceRegistry implements ServiceRegistry {
-
- private static final Log log = LogFactory.getLog(EurekaServiceRegistry.class);
-
- @Override
- public void register(EurekaRegistration reg) {
- maybeInitializeClient(reg);
-
- if (log.isInfoEnabled()) {
- log.info("Registering application " + reg.getInstanceConfig().getAppname()
- + " with eureka with status "
- + reg.getInstanceConfig().getInitialStatus());
- }
-
- reg.getApplicationInfoManager()
- .setInstanceStatus(reg.getInstanceConfig().getInitialStatus());
-
- reg.getHealthCheckHandler().ifAvailable(healthCheckHandler ->
- reg.getEurekaClient().registerHealthCheck(healthCheckHandler));
- }
-
- private void maybeInitializeClient(EurekaRegistration reg) {
- // force initialization of possibly scoped proxies
- reg.getApplicationInfoManager().getInfo();
- reg.getEurekaClient().getApplications();
- }
-
- @Override
- public void deregister(EurekaRegistration reg) {
- if (reg.getApplicationInfoManager().getInfo() != null) {
-
- if (log.isInfoEnabled()) {
- log.info("Unregistering application " + reg.getInstanceConfig().getAppname()
- + " with eureka with status DOWN");
- }
-
- reg.getApplicationInfoManager().setInstanceStatus(InstanceInfo.InstanceStatus.DOWN);
-
- //shutdown of eureka client should happen with EurekaRegistration.close()
- //auto registration will create a bean which will be properly disposed
- //manual registrations will need to call close()
- }
- }
-
- @Override
- public void setStatus(EurekaRegistration registration, String status) {
- InstanceInfo info = registration.getApplicationInfoManager().getInfo();
-
- //TODO: howto deal with delete properly?
- if ("CANCEL_OVERRIDE".equalsIgnoreCase(status)) {
- registration.getEurekaClient().cancelOverrideStatus(info);
- return;
- }
-
- //TODO: howto deal with status types across discovery systems?
- InstanceInfo.InstanceStatus newStatus = InstanceInfo.InstanceStatus.toEnum(status);
- registration.getEurekaClient().setStatus(newStatus, info);
- }
-
- @Override
- public Object getStatus(EurekaRegistration registration) {
- String appname = registration.getInstanceConfig().getAppname();
- String instanceId = registration.getInstanceConfig().getInstanceId();
- InstanceInfo info = registration.getEurekaClient().getInstanceInfo(appname, instanceId);
-
- HashMap status = new HashMap<>();
- if (info != null) {
- status.put("status", info.getStatus().toString());
- status.put("overriddenStatus", info.getOverriddenStatus().toString());
- } else {
- status.put("status", UNKNOWN.toString());
- }
-
- return status;
- }
-
- public void close() {
- }
-
-}
diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/ribbon/eureka/ConditionalOnRibbonAndEurekaEnabled.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/ribbon/eureka/ConditionalOnRibbonAndEurekaEnabled.java
deleted file mode 100644
index 5df8b539..00000000
--- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/ribbon/eureka/ConditionalOnRibbonAndEurekaEnabled.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.springframework.cloud.netflix.ribbon.eureka;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import org.springframework.boot.autoconfigure.condition.AllNestedConditions;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.cloud.netflix.ribbon.SpringClientFactory;
-import org.springframework.context.annotation.Conditional;
-
-import com.netflix.discovery.EurekaClient;
-import com.netflix.niws.loadbalancer.DiscoveryEnabledNIWSServerList;
-
-@Target({ElementType.TYPE, ElementType.METHOD})
-@Retention(RetentionPolicy.RUNTIME)
-@Documented
-@Conditional(ConditionalOnRibbonAndEurekaEnabled.OnRibbonAndEurekaEnabledCondition.class)
-public @interface ConditionalOnRibbonAndEurekaEnabled {
-
- class OnRibbonAndEurekaEnabledCondition extends AllNestedConditions {
-
- public OnRibbonAndEurekaEnabledCondition() {
- super(ConfigurationPhase.REGISTER_BEAN);
- }
-
- @ConditionalOnClass(DiscoveryEnabledNIWSServerList.class)
- @ConditionalOnBean(SpringClientFactory.class)
- @ConditionalOnProperty(value = "ribbon.eureka.enabled", matchIfMissing = true)
- static class Defaults {}
-
- @ConditionalOnBean(EurekaClient.class)
- static class EurekaBeans {}
-
- @ConditionalOnProperty(value = "eureka.client.enabled", matchIfMissing = true)
- static class OnEurekaClientEnabled {}
- }
-}
diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/ribbon/eureka/DomainExtractingServerList.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/ribbon/eureka/DomainExtractingServerList.java
deleted file mode 100644
index 714e57a4..00000000
--- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/ribbon/eureka/DomainExtractingServerList.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright 2013-2014 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.eureka;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.springframework.cloud.netflix.ribbon.RibbonProperties;
-
-import com.netflix.appinfo.InstanceInfo;
-import com.netflix.client.config.IClientConfig;
-import com.netflix.loadbalancer.Server;
-import com.netflix.loadbalancer.ServerList;
-import com.netflix.niws.loadbalancer.DiscoveryEnabledServer;
-
-/**
- * @author Dave Syer
- */
-public class DomainExtractingServerList implements ServerList {
-
- private ServerList list;
- private final RibbonProperties ribbon;
-
- private boolean approximateZoneFromHostname;
-
- public DomainExtractingServerList(ServerList list,
- IClientConfig clientConfig, boolean approximateZoneFromHostname) {
- this.list = list;
- this.ribbon = RibbonProperties.from(clientConfig);
- this.approximateZoneFromHostname = approximateZoneFromHostname;
- }
-
- @Override
- public List getInitialListOfServers() {
- List servers = setZones(this.list
- .getInitialListOfServers());
- return servers;
- }
-
- @Override
- public List getUpdatedListOfServers() {
- List servers = setZones(this.list
- .getUpdatedListOfServers());
- return servers;
- }
-
- private List setZones(List servers) {
- List result = new ArrayList<>();
- boolean isSecure = this.ribbon.isSecure(true);
- boolean shouldUseIpAddr = this.ribbon.isUseIPAddrForServer();
- for (DiscoveryEnabledServer server : servers) {
- result.add(new DomainExtractingServer(server, isSecure, shouldUseIpAddr,
- this.approximateZoneFromHostname));
- }
- return result;
- }
-
-}
-
-class DomainExtractingServer extends DiscoveryEnabledServer {
-
- private String id;
-
- @Override
- public String getId() {
- return id;
- }
-
- @Override
- public void setId(String id) {
- this.id = id;
- }
-
- public DomainExtractingServer(DiscoveryEnabledServer server, boolean useSecurePort,
- boolean useIpAddr, boolean approximateZoneFromHostname) {
- // host and port are set in super()
- super(server.getInstanceInfo(), useSecurePort, useIpAddr);
- if (server.getInstanceInfo().getMetadata().containsKey("zone")) {
- setZone(server.getInstanceInfo().getMetadata().get("zone"));
- }
- else if (approximateZoneFromHostname) {
- setZone(ZoneUtils.extractApproximateZone(server.getHost()));
- }
- else {
- setZone(server.getZone());
- }
- setId(extractId(server));
- setAlive(server.isAlive());
- setReadyToServe(server.isReadyToServe());
- }
-
- private String extractId(Server server) {
- if (server instanceof DiscoveryEnabledServer) {
- DiscoveryEnabledServer enabled = (DiscoveryEnabledServer) server;
- InstanceInfo instance = enabled.getInstanceInfo();
- if (instance.getMetadata().containsKey("instanceId")) {
- return instance.getHostName()+":"+instance.getMetadata().get("instanceId");
- }
- }
- return super.getId();
- }
-}
diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/ribbon/eureka/EurekaRibbonClientConfiguration.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/ribbon/eureka/EurekaRibbonClientConfiguration.java
deleted file mode 100644
index 512d3b19..00000000
--- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/ribbon/eureka/EurekaRibbonClientConfiguration.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Copyright 2013-2015 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.eureka;
-
-import javax.annotation.PostConstruct;
-import javax.inject.Provider;
-
-import com.netflix.discovery.EurekaClient;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
-import org.springframework.cloud.netflix.ribbon.PropertiesFactory;
-import org.springframework.cloud.netflix.ribbon.RibbonClientName;
-import org.springframework.cloud.netflix.ribbon.RibbonUtils;
-import org.springframework.cloud.netflix.ribbon.ServerIntrospector;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.util.StringUtils;
-
-import com.netflix.appinfo.EurekaInstanceConfig;
-import com.netflix.client.config.IClientConfig;
-import com.netflix.config.ConfigurationManager;
-import com.netflix.config.DeploymentContext.ContextKey;
-import com.netflix.discovery.EurekaClientConfig;
-import com.netflix.loadbalancer.IPing;
-import com.netflix.loadbalancer.ServerList;
-import com.netflix.niws.loadbalancer.DiscoveryEnabledNIWSServerList;
-import com.netflix.niws.loadbalancer.NIWSDiscoveryPing;
-
-/**
- * Preprocessor that configures defaults for eureka-discovered ribbon clients. Such as:
- * @zone, NIWSServerListClassName, DeploymentContextBasedVipAddresses,
- * NFLoadBalancerRuleClassName, NIWSServerListFilterClassName and more
- *
- * @author Spencer Gibb
- * @author Dave Syer
- * @author Ryan Baxter
- */
-@Configuration
-public class EurekaRibbonClientConfiguration {
-
- private static final Log log = LogFactory.getLog(EurekaRibbonClientConfiguration.class);
-
- @Value("${ribbon.eureka.approximateZoneFromHostname:false}")
- private boolean approximateZoneFromHostname = false;
-
- @RibbonClientName
- private String serviceId = "client";
-
- @Autowired(required = false)
- private EurekaClientConfig clientConfig;
-
- @Autowired(required = false)
- private EurekaInstanceConfig eurekaConfig;
-
- @Autowired
- private PropertiesFactory propertiesFactory;
-
- public EurekaRibbonClientConfiguration() {
- }
-
- public EurekaRibbonClientConfiguration(EurekaClientConfig clientConfig,
- String serviceId, EurekaInstanceConfig eurekaConfig,
- boolean approximateZoneFromHostname) {
- this.clientConfig = clientConfig;
- this.serviceId = serviceId;
- this.eurekaConfig = eurekaConfig;
- this.approximateZoneFromHostname = approximateZoneFromHostname;
- }
-
- @Bean
- @ConditionalOnMissingBean
- public IPing ribbonPing(IClientConfig config) {
- if (this.propertiesFactory.isSet(IPing.class, serviceId)) {
- return this.propertiesFactory.get(IPing.class, config, serviceId);
- }
- NIWSDiscoveryPing ping = new NIWSDiscoveryPing();
- ping.initWithNiwsConfig(config);
- return ping;
- }
-
- @Bean
- @ConditionalOnMissingBean
- public ServerList> ribbonServerList(IClientConfig config, Provider eurekaClientProvider) {
- if (this.propertiesFactory.isSet(ServerList.class, serviceId)) {
- return this.propertiesFactory.get(ServerList.class, config, serviceId);
- }
- DiscoveryEnabledNIWSServerList discoveryServerList = new DiscoveryEnabledNIWSServerList(
- config, eurekaClientProvider);
- DomainExtractingServerList serverList = new DomainExtractingServerList(
- discoveryServerList, config, this.approximateZoneFromHostname);
- return serverList;
- }
-
- @Bean
- public ServerIntrospector serverIntrospector() {
- return new EurekaServerIntrospector();
- }
-
- @PostConstruct
- public void preprocess() {
- String zone = ConfigurationManager.getDeploymentContext()
- .getValue(ContextKey.zone);
- if (this.clientConfig != null && StringUtils.isEmpty(zone)) {
- if (this.approximateZoneFromHostname && this.eurekaConfig != null) {
- String approxZone = ZoneUtils
- .extractApproximateZone(this.eurekaConfig.getHostName(false));
- log.debug("Setting Zone To " + approxZone);
- ConfigurationManager.getDeploymentContext().setValue(ContextKey.zone,
- approxZone);
- }
- else {
- String availabilityZone = this.eurekaConfig == null ? null
- : this.eurekaConfig.getMetadataMap().get("zone");
- if (availabilityZone == null) {
- String[] zones = this.clientConfig
- .getAvailabilityZones(this.clientConfig.getRegion());
- // Pick the first one from the regions we want to connect to
- availabilityZone = zones != null && zones.length > 0 ? zones[0]
- : null;
- }
- if (availabilityZone != null) {
- // You can set this with archaius.deployment.* (maybe requires
- // custom deployment context)?
- ConfigurationManager.getDeploymentContext().setValue(ContextKey.zone,
- availabilityZone);
- }
- }
- }
- RibbonUtils.initializeRibbonDefaults(serviceId);
- }
-
-}
diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/ribbon/eureka/EurekaServerIntrospector.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/ribbon/eureka/EurekaServerIntrospector.java
deleted file mode 100644
index 4bf4f74a..00000000
--- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/ribbon/eureka/EurekaServerIntrospector.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2013-2015 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.eureka;
-
-import java.util.Map;
-
-import org.springframework.cloud.netflix.ribbon.DefaultServerIntrospector;
-
-import com.netflix.appinfo.InstanceInfo;
-import com.netflix.loadbalancer.Server;
-import com.netflix.niws.loadbalancer.DiscoveryEnabledServer;
-
-/**
- * @author Spencer Gibb
- */
-public class EurekaServerIntrospector extends DefaultServerIntrospector {
-
- @Override
- public boolean isSecure(Server server) {
- if (server instanceof DiscoveryEnabledServer) {
- DiscoveryEnabledServer discoveryServer = (DiscoveryEnabledServer) server;
- return discoveryServer.getInstanceInfo().isPortEnabled(InstanceInfo.PortType.SECURE);
- }
- return super.isSecure(server);
- }
-
- @Override
- public Map getMetadata(Server server) {
- if (server instanceof DiscoveryEnabledServer) {
- DiscoveryEnabledServer discoveryServer = (DiscoveryEnabledServer) server;
- return discoveryServer.getInstanceInfo().getMetadata();
- }
- return super.getMetadata(server);
- }
-}
diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/ribbon/eureka/RibbonEurekaAutoConfiguration.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/ribbon/eureka/RibbonEurekaAutoConfiguration.java
deleted file mode 100644
index 0419690a..00000000
--- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/ribbon/eureka/RibbonEurekaAutoConfiguration.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.ribbon.eureka;
-
-import org.springframework.boot.autoconfigure.AutoConfigureAfter;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.cloud.netflix.ribbon.RibbonAutoConfiguration;
-import org.springframework.cloud.netflix.ribbon.RibbonClients;
-import org.springframework.context.annotation.Configuration;
-
-/**
- * Spring configuration for configuring Ribbon defaults to be Eureka based
- * if Eureka client is enabled
- *
- * @author Dave Syer
- * @author Biju Kunjummen
- */
-@Configuration
-@EnableConfigurationProperties
-@ConditionalOnRibbonAndEurekaEnabled
-@AutoConfigureAfter(RibbonAutoConfiguration.class)
-@RibbonClients(defaultConfiguration = EurekaRibbonClientConfiguration.class)
-public class RibbonEurekaAutoConfiguration {
-
-
-}
diff --git a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/ribbon/eureka/ZoneUtils.java b/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/ribbon/eureka/ZoneUtils.java
deleted file mode 100644
index fa8677a5..00000000
--- a/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/ribbon/eureka/ZoneUtils.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Copyright 2013-2015 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.eureka;
-
-import org.springframework.util.StringUtils;
-
-/**
- * Utility class for dealing with zones.
- * @author Ryan Baxter
- *
- */
-public class ZoneUtils {
-
- /**
- * Approximates Eureka zones from a host name. This method approximates the zone to be
- * everything after the first "." in the host name.
- * @param host The host name to extract the host name from
- * @return The approximate zone
- */
- public static String extractApproximateZone(String host) {
- String[] split = StringUtils.split(host, ".");
- return split == null ? host : split[1];
- }
-
-}
diff --git a/spring-cloud-netflix-eureka-client/src/main/resources/META-INF/spring.factories b/spring-cloud-netflix-eureka-client/src/main/resources/META-INF/spring.factories
deleted file mode 100644
index e8c77025..00000000
--- a/spring-cloud-netflix-eureka-client/src/main/resources/META-INF/spring.factories
+++ /dev/null
@@ -1,10 +0,0 @@
-org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
-org.springframework.cloud.netflix.eureka.config.EurekaClientConfigServerAutoConfiguration,\
-org.springframework.cloud.netflix.eureka.config.EurekaDiscoveryClientConfigServiceAutoConfiguration,\
-org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration,\
-org.springframework.cloud.netflix.ribbon.eureka.RibbonEurekaAutoConfiguration,\
-org.springframework.cloud.netflix.eureka.EurekaDiscoveryClientConfiguration
-
-org.springframework.cloud.bootstrap.BootstrapConfiguration=\
-org.springframework.cloud.netflix.eureka.config.EurekaDiscoveryClientConfigServiceBootstrapConfiguration
-
diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/ConditionalOnRefreshScopeTests.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/ConditionalOnRefreshScopeTests.java
deleted file mode 100644
index f94d8ce5..00000000
--- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/ConditionalOnRefreshScopeTests.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright 2015 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.eureka;
-
-import org.junit.Test;
-import org.springframework.boot.autoconfigure.AutoConfigurations;
-import org.springframework.boot.test.context.runner.ApplicationContextRunner;
-import org.springframework.cloud.autoconfigure.RefreshAutoConfiguration;
-import org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration.ConditionalOnRefreshScope;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-/**
- * @author Dave Syer
- * @author Biju Kunjummen
- */
-public class ConditionalOnRefreshScopeTests {
-
- @Test
- public void refreshScopeIncluded() {
- new ApplicationContextRunner()
- .withConfiguration(AutoConfigurations.of(RefreshAutoConfiguration.class))
- .withUserConfiguration(Beans.class).run(c -> {
- assertThat(c).hasSingleBean(
- org.springframework.cloud.context.scope.refresh.RefreshScope.class);
- assertThat(c.getBean("foo")).isEqualTo("foo");
- });
- }
-
- @Test
- public void refreshScopeNotIncluded() {
- new ApplicationContextRunner().withUserConfiguration(Beans.class).run(c -> {
- assertThat(c).doesNotHaveBean("foo");
- });
- }
-
- @Configuration
- protected static class Beans {
- @Bean
- @ConditionalOnRefreshScope
- public String foo() {
- return "foo";
- }
- }
-
-}
\ No newline at end of file
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
deleted file mode 100644
index 913f73d9..00000000
--- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaClientAutoConfigurationTests.java
+++ /dev/null
@@ -1,568 +0,0 @@
-/*
- * 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.eureka;
-
-import java.io.IOException;
-import java.util.concurrent.CountDownLatch;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.junit.After;
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
-import org.springframework.boot.autoconfigure.condition.SearchStrategy;
-import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.boot.context.properties.source.ConfigurationPropertySources;
-import org.springframework.boot.test.util.TestPropertyValues;
-import org.springframework.cloud.autoconfigure.RefreshAutoConfiguration;
-import org.springframework.cloud.commons.util.UtilAutoConfiguration;
-import org.springframework.cloud.context.scope.GenericScope;
-import org.springframework.cloud.netflix.eureka.serviceregistry.EurekaRegistration;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.annotation.AnnotationConfigApplicationContext;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Import;
-import org.springframework.core.env.ConfigurableEnvironment;
-import org.springframework.core.env.MutablePropertySources;
-import org.springframework.core.env.SystemEnvironmentPropertySource;
-
-import com.netflix.appinfo.ApplicationInfoManager;
-import com.netflix.discovery.EurekaClient;
-import com.netflix.discovery.EurekaClientConfig;
-import com.netflix.discovery.shared.transport.jersey.EurekaJerseyClient;
-import com.sun.jersey.client.apache4.ApacheHttpClient4;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.verify;
-import static org.springframework.boot.test.util.EnvironmentTestUtils.addEnvironment;
-
-/**
- * @author Spencer Gibb
- * @author Matt Jenkins
- */
-public class EurekaClientAutoConfigurationTests {
- private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
-
- @After
- public void after() {
- if (this.context != null && this.context.isActive()) {
- this.context.close();
- }
- }
-
- private void setupContext(Class>... config) {
- ConfigurationPropertySources.attach(this.context.getEnvironment());
- this.context.register(PropertyPlaceholderAutoConfiguration.class, EurekaDiscoveryClientConfiguration.class);
- for (Class> value : config) {
- this.context.register(value);
- }
- this.context.register(TestConfiguration.class);
- this.context.refresh();
- }
-
- @Test
- public void shouldSetManagementPortInMetadataMapIfEqualToServerPort() throws Exception {
- addEnvironment(this.context, "server.port=8989");
- setupContext(RefreshAutoConfiguration.class);
-
- EurekaInstanceConfigBean instance = this.context
- .getBean(EurekaInstanceConfigBean.class);
-
- assertEquals("8989", instance.getMetadataMap().get("management.port"));
- }
-
- @Test
- public void shouldNotSetManagementAndJmxPortsInMetadataMap() throws Exception {
- addEnvironment(this.context, "server.port=8989", "management.server.port=0");
- setupContext(RefreshAutoConfiguration.class);
-
- EurekaInstanceConfigBean instance = this.context
- .getBean(EurekaInstanceConfigBean.class);
-
- assertEquals(null, instance.getMetadataMap().get("management.port"));
- assertEquals(null, instance.getMetadataMap().get("jmx.port"));
- }
-
- @Test
- public void shouldSetManagementAndJmxPortsInMetadataMap() throws Exception {
- addEnvironment(this.context, "management.server.port=9999",
- "com.sun.management.jmxremote.port=6789");
- setupContext(RefreshAutoConfiguration.class);
-
- EurekaInstanceConfigBean instance = this.context
- .getBean(EurekaInstanceConfigBean.class);
- assertEquals("9999", instance.getMetadataMap().get("management.port"));
- assertEquals("6789", instance.getMetadataMap().get("jmx.port"));
- }
-
- @Test
- public void shouldNotResetManagementAndJmxPortsInMetadataMap() throws Exception {
- addEnvironment(this.context, "management.server.port=9999",
- "eureka.instance.metadata-map.jmx.port=9898",
- "eureka.instance.metadata-map.management.port=7878");
- setupContext(RefreshAutoConfiguration.class);
-
- EurekaInstanceConfigBean instance = this.context
- .getBean(EurekaInstanceConfigBean.class);
- assertEquals("7878", instance.getMetadataMap().get("management.port"));
- assertEquals("9898", instance.getMetadataMap().get("jmx.port"));
- }
-
- @Test
- public void nonSecurePortPeriods() {
- testNonSecurePort("server.port");
- }
-
- @Test
- public void nonSecurePortUnderscores() {
- testNonSecurePortSystemProp("SERVER_PORT");
- }
-
- @Test
- public void nonSecurePort() {
- testNonSecurePortSystemProp("PORT");
- assertEquals("eurekaClient",
- this.context.getBeanDefinition("eurekaClient").getFactoryMethodName());
- }
-
- @Test
- public void securePortPeriods() {
- testSecurePort("server.port");
- }
-
- @Test
- public void securePortUnderscores() {
- TestPropertyValues.of("eureka.instance.secure-port-enabled=true").applyTo(this.context);
- addSystemEnvironment(this.context.getEnvironment(), "SERVER_PORT:8443");
- setupContext();
- assertEquals(8443, getInstanceConfig().getSecurePort());
- }
-
- @Test
- public void securePort() {
- testSecurePort("PORT");
- assertEquals("eurekaClient",
- this.context.getBeanDefinition("eurekaClient").getFactoryMethodName());
- }
-
- @Test
- public void managementPort() {
- TestPropertyValues.of("server.port=8989",
- "management.server.port=9999").applyTo(this.context);
- setupContext(RefreshAutoConfiguration.class);
- EurekaInstanceConfigBean instance = this.context
- .getBean(EurekaInstanceConfigBean.class);
- assertTrue("Wrong status page: " + instance.getStatusPageUrl(),
- instance.getStatusPageUrl().contains("9999"));
- }
-
- @Test
- public void statusPageUrlPathAndManagementPort() {
- TestPropertyValues.of( "server.port=8989",
- "management.server.port=9999",
- "eureka.instance.statusPageUrlPath=/myStatusPage").applyTo(this.context);
- setupContext(RefreshAutoConfiguration.class);
- EurekaInstanceConfigBean instance = this.context
- .getBean(EurekaInstanceConfigBean.class);
- assertTrue("Wrong status page: " + instance.getStatusPageUrl(),
- instance.getStatusPageUrl().contains("/myStatusPage"));
- }
-
- @Test
- public void healthCheckUrlPathAndManagementPort() {
- TestPropertyValues.of( "server.port=8989",
- "management.server.port=9999",
- "eureka.instance.healthCheckUrlPath=/myHealthCheck").applyTo(this.context);
- setupContext(RefreshAutoConfiguration.class);
- EurekaInstanceConfigBean instance = this.context
- .getBean(EurekaInstanceConfigBean.class);
- assertTrue("Wrong health check: " + instance.getHealthCheckUrl(),
- instance.getHealthCheckUrl().contains("/myHealthCheck"));
- }
-
- @Test
- public void statusPageUrl_and_healthCheckUrl_do_not_contain_server_context_path() throws Exception {
- addEnvironment(this.context, "server.port=8989",
- "management.server.port=9999", "server.contextPath=/service");
-
- setupContext(RefreshAutoConfiguration.class);
- EurekaInstanceConfigBean instance = this.context
- .getBean(EurekaInstanceConfigBean.class);
- assertTrue("Wrong status page: " + instance.getStatusPageUrl(),
- instance.getStatusPageUrl().endsWith(":9999/info"));
- assertTrue("Wrong health check: " + instance.getHealthCheckUrl(),
- instance.getHealthCheckUrl().endsWith(":9999/health"));
- }
-
- @Test
- public void statusPageUrl_and_healthCheckUrl_contain_management_context_path() throws Exception {
- addEnvironment(this.context,
- "server.port=8989", "management.server.context-path=/management");
-
- setupContext(RefreshAutoConfiguration.class);
- EurekaInstanceConfigBean instance = this.context
- .getBean(EurekaInstanceConfigBean.class);
- assertTrue("Wrong status page: " + instance.getStatusPageUrl(),
- instance.getStatusPageUrl().endsWith(":8989/management/info"));
- assertTrue("Wrong health check: " + instance.getHealthCheckUrl(),
- instance.getHealthCheckUrl().endsWith(":8989/management/health"));
- }
-
- @Test
- public void statusPageUrlPathAndManagementPortAndContextPath() {
- TestPropertyValues.of( "server.port=8989",
- "management.server.port=9999", "management.server.context-path=/manage",
- "eureka.instance.status-page-url-path=/myStatusPage").applyTo(this.context);
- 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() {
- TestPropertyValues.of( "server.port=8989",
- "management.server.port=9999", "management.server.context-path=/manage",
- "eureka.instance.health-check-url-path=/myHealthCheck").applyTo(this.context);
- 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() {
- TestPropertyValues.of( "server.port=8989",
- "management.server.port=9999", "management.server.context-path=/manage",
- "eureka.instance.status-page-url-path=/myStatusPage").applyTo(this.context);
- 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() {
- TestPropertyValues.of( "server.port=8989",
- "management.server.port=9999", "management.server.context-path=/manage",
- "eureka.instance.health-check-url-path=/myHealthCheck").applyTo(this.context);
- 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() {
- TestPropertyValues.of( "server.port=8989",
- "management.server.port=9999",
- "eureka.instance.status-page-url-path=/myStatusPage").applyTo(this.context);
- setupContext(RefreshAutoConfiguration.class);
- EurekaInstanceConfigBean instance = this.context
- .getBean(EurekaInstanceConfigBean.class);
- assertTrue("Wrong status page: " + instance.getStatusPageUrl(),
- instance.getStatusPageUrl().contains("/myStatusPage"));
- }
-
- @Test
- public void statusPageUrlAndPreferIpAddress() {
- TestPropertyValues.of( "server.port=8989",
- "management.server.port=9999", "eureka.instance.hostname=foo",
- "eureka.instance.preferIpAddress:true").applyTo(this.context);
-
- setupContext(RefreshAutoConfiguration.class);
- EurekaInstanceConfigBean instance = this.context
- .getBean(EurekaInstanceConfigBean.class);
-
- assertEquals("statusPageUrl is wrong", "http://" + instance.getIpAddress() + ":9999/info",
- instance.getStatusPageUrl());
- assertEquals("healthCheckUrl is wrong", "http://" + instance.getIpAddress() + ":9999/health",
- instance.getHealthCheckUrl());
- }
-
- @Test
- public void statusPageAndHealthCheckUrlsShouldSetUserDefinedIpAddress() {
- addEnvironment(this.context, "server.port=8989",
- "management.server.port=9999", "eureka.instance.hostname=foo",
- "eureka.instance.ipAddress:192.168.13.90",
- "eureka.instance.preferIpAddress:true");
-
- setupContext(RefreshAutoConfiguration.class);
- EurekaInstanceConfigBean instance = this.context
- .getBean(EurekaInstanceConfigBean.class);
-
- assertEquals("statusPageUrl is wrong", "http://192.168.13.90:9999/info",
- instance.getStatusPageUrl());
- assertEquals("healthCheckUrl is wrong", "http://192.168.13.90:9999/health",
- instance.getHealthCheckUrl());
- }
-
- @Test
- public void healthCheckUrlPathAndManagementPortKabobCase() {
- TestPropertyValues.of( "server.port=8989",
- "management.server.port=9999",
- "eureka.instance.health-check-url-path=/myHealthCheck").applyTo(this.context);
- setupContext(RefreshAutoConfiguration.class);
- EurekaInstanceConfigBean instance = this.context
- .getBean(EurekaInstanceConfigBean.class);
- assertTrue("Wrong health check: " + instance.getHealthCheckUrl(),
- instance.getHealthCheckUrl().contains("/myHealthCheck"));
- }
-
- @Test
- public void statusPageUrlPathAndManagementPortUpperCase() {
- TestPropertyValues.of( "server.port=8989",
- "management.server.port=9999").applyTo(this.context);
- addSystemEnvironment(this.context.getEnvironment(), "EUREKA_INSTANCE_STATUS_PAGE_URL_PATH=/myStatusPage");
- setupContext(RefreshAutoConfiguration.class);
- EurekaInstanceConfigBean instance = this.context
- .getBean(EurekaInstanceConfigBean.class);
- assertTrue("Wrong status page: " + instance.getStatusPageUrl(),
- instance.getStatusPageUrl().contains("/myStatusPage"));
- }
-
- @Test
- public void healthCheckUrlPathAndManagementPortUpperCase() {
- TestPropertyValues.of( "server.port=8989",
- "management.server.port=9999").applyTo(this.context);
- addSystemEnvironment(this.context.getEnvironment(), "EUREKA_INSTANCE_HEALTH_CHECK_URL_PATH=/myHealthCheck");
- setupContext(RefreshAutoConfiguration.class);
- EurekaInstanceConfigBean instance = this.context
- .getBean(EurekaInstanceConfigBean.class);
- assertTrue("Wrong health check: " + instance.getHealthCheckUrl(),
- instance.getHealthCheckUrl().contains("/myHealthCheck"));
- }
-
- @Test
- public void hostname() {
- TestPropertyValues.of( "server.port=8989",
- "management.server.port=9999", "eureka.instance.hostname=foo").applyTo(this.context);
- setupContext(RefreshAutoConfiguration.class);
- EurekaInstanceConfigBean instance = this.context
- .getBean(EurekaInstanceConfigBean.class);
- assertTrue("Wrong status page: " + instance.getStatusPageUrl(),
- instance.getStatusPageUrl().contains("foo"));
- }
-
- @Test
- public void refreshScopedBeans() {
- setupContext(RefreshAutoConfiguration.class);
- assertThat(this.context.getBeanDefinition("eurekaClient").getBeanClassName())
- .startsWith(GenericScope.class.getName()+"$LockedScopedProxyFactoryBean");
- assertThat(this.context.getBeanDefinition("eurekaApplicationInfoManager").getBeanClassName())
- .startsWith(GenericScope.class.getName()+"$LockedScopedProxyFactoryBean");
- }
-
- @Test
- public void basicAuth() {
- TestPropertyValues.of( "server.port=8989",
- "eureka.client.serviceUrl.defaultZone=http://user:foo@example.com:80/eureka").applyTo(this.context);
- setupContext(MockClientConfiguration.class);
- // ApacheHttpClient4 http = this.context.getBean(ApacheHttpClient4.class);
- // Mockito.verify(http).addFilter(Matchers.any(HTTPBasicAuthFilter.class));
- }
-
- @Test
- public void testDefaultAppName() throws Exception {
- setupContext();
- assertEquals("unknown", getInstanceConfig().getAppname());
- assertEquals("unknown", getInstanceConfig().getVirtualHostName());
- assertEquals("unknown", getInstanceConfig().getSecureVirtualHostName());
- }
-
- @Test
- public void testAppName() throws Exception {
- TestPropertyValues.of( "spring.application.name=mytest").applyTo(this.context);
- setupContext();
- assertEquals("mytest", getInstanceConfig().getAppname());
- assertEquals("mytest", getInstanceConfig().getVirtualHostName());
- assertEquals("mytest", getInstanceConfig().getSecureVirtualHostName());
- }
-
- @Test
- public void testAppNameUpper() throws Exception {
- addSystemEnvironment(this.context.getEnvironment(), "SPRING_APPLICATION_NAME=mytestupper");
- setupContext();
- assertEquals("mytestupper", getInstanceConfig().getAppname());
- assertEquals("mytestupper", getInstanceConfig().getVirtualHostName());
- assertEquals("mytestupper", getInstanceConfig().getSecureVirtualHostName());
- }
-
- private void addSystemEnvironment(ConfigurableEnvironment environment, String... pairs) {
- MutablePropertySources sources = environment.getPropertySources();
- Map map = getOrAdd(sources, "testsysenv");
- for (String pair : pairs) {
- int index = getSeparatorIndex(pair);
- String key = pair.substring(0, index > 0 ? index : pair.length());
- String value = index > 0 ? pair.substring(index + 1) : "";
- map.put(key.trim(), value.trim());
- }
- }
-
- @SuppressWarnings("unchecked")
- private static Map getOrAdd(MutablePropertySources sources,
- String name) {
- if (sources.contains(name)) {
- return (Map) sources.get(name).getSource();
- }
- Map map = new HashMap<>();
- sources.addFirst(new SystemEnvironmentPropertySource(name, map));
- return map;
- }
-
- private static int getSeparatorIndex(String pair) {
- int colonIndex = pair.indexOf(":");
- int equalIndex = pair.indexOf("=");
- if (colonIndex == -1) {
- return equalIndex;
- }
- if (equalIndex == -1) {
- return colonIndex;
- }
- return Math.min(colonIndex, equalIndex);
- }
-
- @Test
- public void testInstanceNamePreferred() throws Exception {
- addSystemEnvironment(this.context.getEnvironment(), "SPRING_APPLICATION_NAME=mytestspringappname");
- TestPropertyValues.of( "eureka.instance.appname=mytesteurekaappname").applyTo(this.context);
- setupContext();
- assertEquals("mytesteurekaappname", getInstanceConfig().getAppname());
- }
-
- @Test
- public void eurekaHealthIndicatorCreated() {
- setupContext();
- this.context.getBean(EurekaHealthIndicator.class);
- }
-
- @Test
- public void eurekaClientClosed() {
- setupContext(TestEurekaClientConfiguration.class);
- if (this.context != null) {
- CountDownLatch latch = this.context.getBean(CountDownLatch.class);
- this.context.close();
- assertThat(latch.getCount()).isEqualTo(0);
- }
- }
-
- @Test
- public void eurekaRegistrationClosed() throws IOException {
- setupContext(TestEurekaRegistrationConfiguration.class);
- if (this.context != null) {
- EurekaRegistration registration = this.context.getBean(EurekaRegistration.class);
- this.context.close();
- verify(registration).close();
- }
- }
-
- private void testNonSecurePortSystemProp(String propName) {
- addSystemEnvironment(this.context.getEnvironment(), propName + ":8888");
- setupContext();
- assertEquals(8888, getInstanceConfig().getNonSecurePort());
- }
-
- private void testNonSecurePort(String propName) {
- TestPropertyValues.of(propName + ":8888").applyTo(this.context);
- setupContext();
- assertEquals(8888, getInstanceConfig().getNonSecurePort());
- }
-
- private void testSecurePort(String propName) {
- TestPropertyValues.of("eureka.instance.secure-port-enabled=true", propName+":8443").applyTo(this.context);
- setupContext();
- assertEquals(8443, getInstanceConfig().getSecurePort());
- }
-
- private EurekaInstanceConfigBean getInstanceConfig() {
- return this.context.getBean(EurekaInstanceConfigBean.class);
- }
-
- @Configuration
- @EnableConfigurationProperties
- @Import({ UtilAutoConfiguration.class, EurekaClientAutoConfiguration.class })
- protected static class TestConfiguration { }
-
- @Configuration
- protected static class TestEurekaClientConfiguration {
-
- @Bean
- public CountDownLatch countDownLatch() {
- return new CountDownLatch(1);
- }
-
- @Bean(destroyMethod = "shutdown")
- @ConditionalOnMissingBean(value = EurekaClient.class, search = SearchStrategy.CURRENT)
- public EurekaClient eurekaClient(ApplicationInfoManager manager, EurekaClientConfig config, ApplicationContext context) {
- return new CloudEurekaClient(manager, config, null, context) {
- @Override
- public synchronized void shutdown() {
- CountDownLatch latch = countDownLatch();
- if (latch.getCount() == 1) {
- latch.countDown();
- }
- super.shutdown();
- }
- };
- }
- }
-
- @Configuration
- protected static class TestEurekaRegistrationConfiguration {
-
- @Bean
- public EurekaRegistration eurekaRegistration(EurekaClient eurekaClient, CloudEurekaInstanceConfig instanceConfig, ApplicationInfoManager applicationInfoManager) {
- return spy(EurekaRegistration.builder(instanceConfig)
- .with(applicationInfoManager)
- .with(eurekaClient)
- .build());
- }
- }
-
- @Configuration
- protected static class MockClientConfiguration {
-
- @Bean
- public MutableDiscoveryClientOptionalArgs mutableDiscoveryClientOptionalArgs() {
- MutableDiscoveryClientOptionalArgs args = new MutableDiscoveryClientOptionalArgs();
- args.setEurekaJerseyClient(jerseyClient());
- return args;
- }
-
- @Bean
- public EurekaJerseyClient jerseyClient() {
- EurekaJerseyClient mock = Mockito.mock(EurekaJerseyClient.class);
- Mockito.when(mock.getClient()).thenReturn(apacheClient());
- return mock;
- }
-
- @Bean
- public ApacheHttpClient4 apacheClient() {
- return Mockito.mock(ApacheHttpClient4.class);
- }
- }
-}
diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaClientConfigBeanTests.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaClientConfigBeanTests.java
deleted file mode 100644
index bedd2c08..00000000
--- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaClientConfigBeanTests.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * 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.eureka;
-
-import java.util.Collections;
-
-import org.junit.After;
-import org.junit.Test;
-import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.boot.test.util.EnvironmentTestUtils;
-import org.springframework.context.annotation.AnnotationConfigApplicationContext;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.core.env.CompositePropertySource;
-import org.springframework.core.env.MapPropertySource;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * @author Dave Syer
- */
-public class EurekaClientConfigBeanTests {
-
- private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
-
- @After
- public void init() {
- if (this.context != null) {
- this.context.close();
- }
- }
-
- @Test
- public void basicBinding() {
- EnvironmentTestUtils.addEnvironment(this.context,
- "eureka.client.proxyHost=example.com");
- this.context.register(PropertyPlaceholderAutoConfiguration.class,
- TestConfiguration.class);
- this.context.refresh();
- assertEquals("example.com", this.context.getBean(EurekaClientConfigBean.class)
- .getProxyHost());
- }
-
- @Test
- public void serviceUrl() {
- EnvironmentTestUtils.addEnvironment(this.context,
- "eureka.client.serviceUrl.defaultZone:http://example.com");
- this.context.register(PropertyPlaceholderAutoConfiguration.class,
- TestConfiguration.class);
- this.context.refresh();
- assertEquals("{defaultZone=http://example.com}",
- this.context.getBean(EurekaClientConfigBean.class).getServiceUrl()
- .toString());
- assertEquals("[http://example.com/]", getEurekaServiceUrlsForDefaultZone());
- }
-
- @Test
- public void serviceUrlWithCompositePropertySource() {
- CompositePropertySource source = new CompositePropertySource("composite");
- this.context.getEnvironment().getPropertySources().addFirst(source);
- source.addPropertySource(new MapPropertySource("config", Collections
- . singletonMap("eureka.client.serviceUrl.defaultZone",
- "http://example.com,http://example2.com")));
- this.context.register(PropertyPlaceholderAutoConfiguration.class,
- TestConfiguration.class);
- this.context.refresh();
- assertEquals("{defaultZone=http://example.com,http://example2.com}",
- this.context.getBean(EurekaClientConfigBean.class).getServiceUrl()
- .toString());
- assertEquals("[http://example.com/, http://example2.com/]",
- getEurekaServiceUrlsForDefaultZone());
- }
-
- @Test
- public void serviceUrlWithDefault() {
- EnvironmentTestUtils.addEnvironment(this.context,
- "eureka.client.serviceUrl.defaultZone:http://example.com");
- this.context.register(PropertyPlaceholderAutoConfiguration.class,
- TestConfiguration.class);
- this.context.refresh();
- assertEquals("[http://example.com/]", getEurekaServiceUrlsForDefaultZone());
- }
-
- @Test
- public void serviceUrlWithCustomZone() {
- EnvironmentTestUtils.addEnvironment(this.context,
- "eureka.client.serviceUrl.customZone:http://custom-example.com");
- this.context.register(PropertyPlaceholderAutoConfiguration.class,
- TestConfiguration.class);
- this.context.refresh();
- assertEquals("[http://custom-example.com/]", getEurekaServiceUrls("customZone"));
- }
-
- @Test
- public void serviceUrlWithEmptyServiceUrls() {
- EnvironmentTestUtils.addEnvironment(this.context,
- "eureka.client.serviceUrl.defaultZone:");
- this.context.register(PropertyPlaceholderAutoConfiguration.class,
- TestConfiguration.class);
- this.context.refresh();
- assertEquals("[]", getEurekaServiceUrlsForDefaultZone());
- }
-
- private String getEurekaServiceUrlsForDefaultZone() {
- return getEurekaServiceUrls("defaultZone");
- }
-
- private String getEurekaServiceUrls(String myZone) {
- return this.context.getBean(EurekaClientConfigBean.class)
- .getEurekaServerServiceUrls(myZone).toString();
- }
-
- @Configuration
- @EnableConfigurationProperties(EurekaClientConfigBean.class)
- protected static class TestConfiguration {
-
- }
-
-}
diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaHealthCheckHandlerTests.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaHealthCheckHandlerTests.java
deleted file mode 100644
index bd1c7ac6..00000000
--- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaHealthCheckHandlerTests.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * 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.eureka;
-
-import java.util.List;
-
-import com.netflix.appinfo.InstanceInfo.InstanceStatus;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.springframework.boot.actuate.health.AbstractHealthIndicator;
-import org.springframework.boot.actuate.health.Health;
-import org.springframework.boot.actuate.health.HealthIndicator;
-import org.springframework.boot.actuate.health.OrderedHealthAggregator;
-import org.springframework.cloud.client.discovery.health.DiscoveryClientHealthIndicator;
-import org.springframework.cloud.client.discovery.health.DiscoveryCompositeHealthIndicator;
-import org.springframework.cloud.client.discovery.health.DiscoveryHealthIndicator;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.annotation.AnnotationConfigApplicationContext;
-import org.springframework.context.annotation.Bean;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * Tests the {@link EurekaHealthCheckHandler} with different health indicator registered.
- *
- * @author Jakub Narloch
- */
-public class EurekaHealthCheckHandlerTests {
-
- private EurekaHealthCheckHandler healthCheckHandler;
-
- @Before
- public void setUp() throws Exception {
-
- healthCheckHandler = new EurekaHealthCheckHandler(new OrderedHealthAggregator());
- }
-
- @Test
- public void testNoHealthCheckRegistered() throws Exception {
-
- InstanceStatus status = healthCheckHandler.getStatus(InstanceStatus.UNKNOWN);
- assertEquals(InstanceStatus.UNKNOWN, status);
- }
-
- @Test
- public void testAllUp() throws Exception {
-
- initialize(UpHealthConfiguration.class);
-
- InstanceStatus status = healthCheckHandler.getStatus(InstanceStatus.UNKNOWN);
- assertEquals(InstanceStatus.UP, status);
- }
-
- @Test
- public void testDown() throws Exception {
-
- initialize(UpHealthConfiguration.class, DownHealthConfiguration.class);
-
- InstanceStatus status = healthCheckHandler.getStatus(InstanceStatus.UNKNOWN);
- assertEquals(InstanceStatus.DOWN, status);
- }
-
- @Test
- public void testUnknown() throws Exception {
-
- initialize(FatalHealthConfiguration.class);
-
- InstanceStatus status = healthCheckHandler.getStatus(InstanceStatus.UNKNOWN);
- assertEquals(InstanceStatus.UNKNOWN, status);
- }
-
- @Test
- public void testEurekaIgnored() throws Exception {
-
- initialize(EurekaDownHealthConfiguration.class);
-
- InstanceStatus status = healthCheckHandler.getStatus(InstanceStatus.UP);
- assertEquals(InstanceStatus.UP, status);
- }
-
- private void initialize(Class>... configurations) throws Exception {
- ApplicationContext applicationContext = new AnnotationConfigApplicationContext(configurations);
- healthCheckHandler.setApplicationContext(applicationContext);
- healthCheckHandler.afterPropertiesSet();
- }
-
- public static class UpHealthConfiguration {
-
- @Bean
- public HealthIndicator healthIndicator() {
- return new AbstractHealthIndicator() {
- @Override
- protected void doHealthCheck(Health.Builder builder) throws Exception {
- builder.up();
- }
- };
- }
- }
-
- public static class DownHealthConfiguration {
-
- @Bean
- public HealthIndicator healthIndicator() {
- return new AbstractHealthIndicator() {
- @Override
- protected void doHealthCheck(Health.Builder builder) throws Exception {
- builder.down();
- }
- };
- }
- }
-
- public static class FatalHealthConfiguration {
-
- @Bean
- public HealthIndicator healthIndicator() {
- return new AbstractHealthIndicator() {
- @Override
- protected void doHealthCheck(Health.Builder builder) throws Exception {
- builder.status("fatal");
- }
- };
- }
- }
-
-
- public static class EurekaDownHealthConfiguration {
- @Bean
- public DiscoveryHealthIndicator discoveryHealthIndicator() {
- return new DiscoveryClientHealthIndicator(null) {
- @Override
- public Health health() {
- return Health.up().build();
- }
- };
- }
-
- @Bean
- public DiscoveryHealthIndicator eurekaHealthIndicator() {
- return new EurekaHealthIndicator(null, null, null) {
- @Override
- public Health health() {
- return Health.down().build();
- }
- };
- }
-
- @Bean
- public DiscoveryCompositeHealthIndicator discoveryCompositeHealthIndicator(List indicators) {
- return new DiscoveryCompositeHealthIndicator(new OrderedHealthAggregator(), indicators);
- }
- }
-}
\ No newline at end of file
diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaInstanceConfigBeanTests.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaInstanceConfigBeanTests.java
deleted file mode 100644
index 17f67964..00000000
--- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaInstanceConfigBeanTests.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- 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.eureka;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.springframework.beans.factory.BeanCreationException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.cloud.commons.util.InetUtils;
-import org.springframework.cloud.commons.util.InetUtilsProperties;
-import org.springframework.context.annotation.AnnotationConfigApplicationContext;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.core.env.ConfigurableEnvironment;
-import org.springframework.test.util.ReflectionTestUtils;
-import org.springframework.util.StringUtils;
-import com.netflix.appinfo.InstanceInfo.InstanceStatus;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.springframework.boot.test.util.EnvironmentTestUtils.addEnvironment;
-
-/**
- * @author Dave Syer
- * @author Spencer Gibb
- * @author Ryan Baxter
- */
-public class EurekaInstanceConfigBeanTests {
-
- private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
- private String hostName;
- private String ipAddress;
-
- @Before
- public void init() throws Exception {
- try (InetUtils utils = new InetUtils(new InetUtilsProperties())) {
- InetUtils.HostInfo hostInfo = utils.findFirstNonLoopbackHostInfo();
- this.hostName = hostInfo.getHostname();
- this.ipAddress = hostInfo.getIpAddress();
- }
- }
-
- @After
- public void clear() {
- if (this.context != null) {
- this.context.close();
- }
- }
-
- @Test
- public void basicBinding() {
- addEnvironment(this.context, "eureka.instance.appGroupName=mygroup");
- setupContext();
- assertEquals("mygroup", getInstanceConfig().getAppGroupName());
- }
-
- @Test
- public void nonSecurePort() {
- addEnvironment(this.context, "eureka.instance.nonSecurePort:8888");
- setupContext();
- assertEquals(8888, getInstanceConfig().getNonSecurePort());
- }
-
- @Test
- public void instanceId() {
- addEnvironment(this.context, "eureka.instance.instanceId:special");
- setupContext();
- EurekaInstanceConfigBean instance = getInstanceConfig();
- assertEquals("special", instance.getInstanceId());
- }
-
- @Test
- public void initialHostName() {
- addEnvironment(this.context, "eureka.instance.appGroupName=mygroup");
- setupContext();
- if (this.hostName != null) {
- assertEquals(this.hostName, getInstanceConfig().getHostname());
- }
- }
-
- @Test
- public void refreshHostName() {
- addEnvironment(this.context, "eureka.instance.appGroupName=mygroup");
- setupContext();
- ReflectionTestUtils.setField(getInstanceConfig(), "hostname", "marvin");
- assertEquals("marvin", getInstanceConfig().getHostname());
- getInstanceConfig().getHostName(true);
- if (this.hostName != null) {
- assertEquals(this.hostName, getInstanceConfig().getHostname());
- }
- }
-
- @Test
- public void refreshHostNameWhenSetByUser() {
- addEnvironment(this.context, "eureka.instance.appGroupName=mygroup");
- setupContext();
- getInstanceConfig().setHostname("marvin");
- assertEquals("marvin", getInstanceConfig().getHostname());
- getInstanceConfig().getHostName(true);
- assertEquals("marvin", getInstanceConfig().getHostname());
- }
-
- @Test
- public void initialIpAddress() {
- addEnvironment(this.context, "eureka.instance.appGroupName=mygroup");
- setupContext();
- if (this.ipAddress != null) {
- assertEquals(this.ipAddress, getInstanceConfig().getIpAddress());
- }
- }
-
- @Test
- public void refreshIpAddress() {
- addEnvironment(this.context, "eureka.instance.appGroupName=mygroup");
- setupContext();
- ReflectionTestUtils.setField(getInstanceConfig(), "ipAddress", "10.0.0.1");
- assertEquals("10.0.0.1", getInstanceConfig().getIpAddress());
- getInstanceConfig().getHostName(true);
- if (this.ipAddress != null) {
- assertEquals(this.ipAddress, getInstanceConfig().getIpAddress());
- }
- }
-
- @Test
- public void refreshIpAddressWhenSetByUser() {
- addEnvironment(this.context, "eureka.instance.appGroupName=mygroup");
- setupContext();
- getInstanceConfig().setIpAddress("10.0.0.1");
- assertEquals("10.0.0.1", getInstanceConfig().getIpAddress());
- getInstanceConfig().getHostName(true);
- assertEquals("10.0.0.1", getInstanceConfig().getIpAddress());
- }
-
- @Test
- public void testDefaultInitialStatus() {
- setupContext();
- assertEquals("initialStatus wrong", InstanceStatus.UP,
- getInstanceConfig().getInitialStatus());
- }
-
- @Test(expected = BeanCreationException.class)
- public void testBadInitialStatus() {
- addEnvironment(this.context, "eureka.instance.initial-status:FOO");
- setupContext();
- }
-
- @Test
- public void testCustomInitialStatus() {
- addEnvironment(this.context, "eureka.instance.initial-status:STARTING");
- setupContext();
- assertEquals("initialStatus wrong", InstanceStatus.STARTING,
- getInstanceConfig().getInitialStatus());
- }
-
- @Test
- public void testPreferIpAddress() throws Exception {
- addEnvironment(this.context, "eureka.instance.preferIpAddress:true");
- setupContext();
- EurekaInstanceConfigBean instance = getInstanceConfig();
- assertTrue("Wrong hostname: " + instance.getHostname(),
- getInstanceConfig().getHostname().equals(instance.getIpAddress()));
-
- }
-
- @Test
- public void testDefaultVirtualHostName() throws Exception {
- addEnvironment(this.context, "spring.application.name:myapp");
- setupContext();
- assertEquals("virtualHostName wrong", "myapp", getInstanceConfig().getVirtualHostName());
- assertEquals("secureVirtualHostName wrong", "myapp", getInstanceConfig().getSecureVirtualHostName());
-
- }
-
- @Test
- public void testCustomVirtualHostName() throws Exception {
- addEnvironment(this.context, "spring.application.name:myapp", "eureka.instance.virtualHostName=myvirthost",
- "eureka.instance.secureVirtualHostName=mysecurevirthost");
- setupContext();
- assertEquals("virtualHostName wrong", "myvirthost", getInstanceConfig().getVirtualHostName());
- assertEquals("secureVirtualHostName wrong", "mysecurevirthost", getInstanceConfig().getSecureVirtualHostName());
-
- }
-
- @Test
- public void testDefaultAppName() throws Exception {
- setupContext();
- assertEquals("default app name is wrong", "unknown", getInstanceConfig().getAppname());
- assertEquals("default virtual hostname is wrong", "unknown", getInstanceConfig().getVirtualHostName());
- assertEquals("default secure virtual hostname is wrong", "unknown", getInstanceConfig().getSecureVirtualHostName());
- }
-
- private void setupContext() {
- this.context.register(PropertyPlaceholderAutoConfiguration.class,
- TestConfiguration.class);
- this.context.refresh();
- }
-
- private EurekaInstanceConfigBean getInstanceConfig() {
- return this.context.getBean(EurekaInstanceConfigBean.class);
- }
-
- @Configuration
- @EnableConfigurationProperties
- protected static class TestConfiguration {
- @Autowired
- ConfigurableEnvironment env;
- @Bean
- public EurekaInstanceConfigBean eurekaInstanceConfigBean() {
- EurekaInstanceConfigBean configBean = new EurekaInstanceConfigBean(new InetUtils(new InetUtilsProperties()));
- String springAppName = this.env.getProperty("spring.application.name", "");
- if(StringUtils.hasText(springAppName)) {
- configBean.setSecureVirtualHostName(springAppName);
- configBean.setVirtualHostName(springAppName);
- configBean.setAppname(springAppName);
- }
- return configBean;
- }
-
- }
-
-}
diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/InstanceInfoFactoryTests.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/InstanceInfoFactoryTests.java
deleted file mode 100644
index d88544bc..00000000
--- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/InstanceInfoFactoryTests.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.springframework.cloud.netflix.eureka;
-
-import java.io.IOException;
-
-import org.junit.Test;
-import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.cloud.commons.util.InetUtils;
-import org.springframework.cloud.commons.util.InetUtilsProperties;
-import org.springframework.context.annotation.AnnotationConfigApplicationContext;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-import com.netflix.appinfo.InstanceInfo;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.springframework.boot.test.util.EnvironmentTestUtils.addEnvironment;
-
-public class InstanceInfoFactoryTests {
- private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
-
- @Test
- public void instanceIdIsHostNameByDefault() throws IOException {
- InstanceInfo instanceInfo = setupInstance();
- try (InetUtils utils = new InetUtils(new InetUtilsProperties())) {
- assertEquals(utils.findFirstNonLoopbackHostInfo().getHostname(),
- instanceInfo.getId());
- }
- }
-
- @Test
- public void instanceIdIsIpWhenIpPreferred() throws Exception {
- InstanceInfo instanceInfo = setupInstance("eureka.instance.preferIpAddress:true");
- assertTrue(instanceInfo.getId().matches("(\\d+\\.){3}\\d+"));
- }
-
- @Test
- public void instanceInfoIdIsInstanceIdWhenSet() {
- InstanceInfo instanceInfo = setupInstance("eureka.instance.instanceId:special");
- assertEquals("special", instanceInfo.getId());
- }
-
- private InstanceInfo setupInstance(String... pairs) {
- for (String pair : pairs) {
- addEnvironment(this.context, pair);
- }
-
- this.context.register(PropertyPlaceholderAutoConfiguration.class,
- TestConfiguration.class);
- this.context.refresh();
-
- EurekaInstanceConfigBean instanceConfig = getInstanceConfig();
- return new InstanceInfoFactory().create(instanceConfig);
- }
-
- private EurekaInstanceConfigBean getInstanceConfig() {
- return this.context.getBean(EurekaInstanceConfigBean.class);
- }
-
- @Configuration
- @EnableConfigurationProperties
- protected static class TestConfiguration {
- @Bean
- public EurekaInstanceConfigBean eurekaInstanceConfigBean() {
- return new EurekaInstanceConfigBean(new InetUtils(new InetUtilsProperties()));
- }
- }
-}
diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/ConfigRefreshTests.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/ConfigRefreshTests.java
deleted file mode 100644
index e5c9e76d..00000000
--- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/ConfigRefreshTests.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- *
- * * 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.eureka.config;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.cloud.context.scope.refresh.RefreshScopeRefreshedEvent;
-import org.springframework.cloud.netflix.eureka.sample.RefreshEurekaSampleApplication;
-import org.springframework.context.ApplicationEventPublisher;
-import org.springframework.test.context.junit4.SpringRunner;
-
-import com.netflix.discovery.EurekaClient;
-
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
-
-/**
- * @author Ryan Baxter
- */
-@RunWith(SpringRunner.class)
-@SpringBootTest(webEnvironment = RANDOM_PORT, classes = RefreshEurekaSampleApplication.class)
-public class ConfigRefreshTests {
-
- @Autowired
- private ApplicationEventPublisher publisher;
-
- @Autowired
- //Mocked in RefreshEurekaSampleApplication
- private EurekaClient client;
-
- @Test
- // This test is used to verify that getApplications is called the correct number of times
- // when a refresh event is fired. The getApplications call in EurekaClientConfigurationRefresher.onApplicationEvent
- // ensures that the EurekaClient bean is recreated after a refresh event and that we reregister the client with
- //the server
- public void verifyGetApplications() {
- if(publisher != null) {
- publisher.publishEvent(new RefreshScopeRefreshedEvent());
- }
- verify(client, times(3)).getApplications();
- }
-}
diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/DiscoveryClientConfigServiceAutoConfigurationTests.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/DiscoveryClientConfigServiceAutoConfigurationTests.java
deleted file mode 100644
index 31de017d..00000000
--- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/DiscoveryClientConfigServiceAutoConfigurationTests.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * 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.eureka.config;
-
-import java.util.Arrays;
-
-import org.junit.After;
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
-import org.springframework.boot.test.util.EnvironmentTestUtils;
-import org.springframework.cloud.commons.util.UtilAutoConfiguration;
-import org.springframework.cloud.config.client.ConfigClientProperties;
-import org.springframework.cloud.config.client.DiscoveryClientConfigServiceBootstrapConfiguration;
-import org.springframework.cloud.netflix.eureka.CloudEurekaClient;
-import org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration;
-import org.springframework.cloud.netflix.eureka.EurekaDiscoveryClientConfiguration;
-import org.springframework.context.annotation.AnnotationConfigApplicationContext;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-import com.netflix.appinfo.ApplicationInfoManager;
-import com.netflix.appinfo.InstanceInfo;
-import com.netflix.discovery.EurekaClient;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.BDDMockito.given;
-import static org.mockito.Mockito.times;
-import static org.springframework.cloud.config.client.ConfigClientProperties.Discovery.DEFAULT_CONFIG_SERVER;
-
-/**
- * @author Dave Syer
- */
-public class DiscoveryClientConfigServiceAutoConfigurationTests {
-
- private AnnotationConfigApplicationContext context;
-
- @After
- public void close() {
- if (this.context != null) {
- if (this.context.getParent() != null) {
- ((AnnotationConfigApplicationContext) this.context.getParent()).close();
- }
- this.context.close();
- }
- }
-
- @Test
- public void onWhenRequested() throws Exception {
- setup("spring.cloud.config.discovery.enabled=true",
- "eureka.instance.metadataMap.foo:bar",
- "eureka.instance.nonSecurePort:7001", "eureka.instance.hostname:foo");
- assertEquals(1, this.context.getBeanNamesForType(
- EurekaDiscoveryClientConfigServiceAutoConfiguration.class).length);
- EurekaClient eurekaClient = this.context.getParent().getBean(EurekaClient.class);
- Mockito.verify(eurekaClient, times(2)).getInstancesByVipAddress(DEFAULT_CONFIG_SERVER,
- false);
- Mockito.verify(eurekaClient, times(1)).shutdown();
- ConfigClientProperties locator = this.context
- .getBean(ConfigClientProperties.class);
- assertEquals("http://foo:7001/", locator.getRawUri());
- ApplicationInfoManager infoManager = this.context
- .getBean(ApplicationInfoManager.class);
- assertEquals("bar", infoManager.getInfo().getMetadata().get("foo"));
- }
-
- private void setup(String... env) {
- AnnotationConfigApplicationContext parent = new AnnotationConfigApplicationContext();
- EnvironmentTestUtils.addEnvironment(parent, env);
- parent.register(UtilAutoConfiguration.class,
- EurekaDiscoveryClientConfiguration.class,
- PropertyPlaceholderAutoConfiguration.class, EnvironmentKnobbler.class,
- EurekaDiscoveryClientConfigServiceBootstrapConfiguration.class,
- DiscoveryClientConfigServiceBootstrapConfiguration.class,
- ConfigClientProperties.class);
- parent.refresh();
- this.context = new AnnotationConfigApplicationContext();
- this.context.setParent(parent);
- this.context.register(PropertyPlaceholderAutoConfiguration.class,
- EurekaDiscoveryClientConfigServiceAutoConfiguration.class,
- EurekaClientAutoConfiguration.class);
- this.context.refresh();
- }
-
- @Configuration
- protected static class EnvironmentKnobbler {
-
- @Bean
- public EurekaClient eurekaClient(ApplicationInfoManager manager) {
- InstanceInfo info = manager.getInfo();
- EurekaClient client = Mockito.mock(CloudEurekaClient.class);
- given(client.getInstancesByVipAddress(DEFAULT_CONFIG_SERVER, false))
- .willReturn(Arrays.asList(info));
- return client;
- }
-
- }
-
-}
diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/EurekaClientConfigServerAutoConfigurationTests.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/EurekaClientConfigServerAutoConfigurationTests.java
deleted file mode 100644
index 4486d1e2..00000000
--- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/EurekaClientConfigServerAutoConfigurationTests.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2013-2018 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.eureka.config;
-
-import org.junit.Test;
-import org.springframework.boot.autoconfigure.AutoConfigurations;
-import org.springframework.boot.test.context.runner.ApplicationContextRunner;
-import org.springframework.cloud.config.server.config.ConfigServerProperties;
-import org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean;
-
-import com.netflix.appinfo.EurekaInstanceConfig;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * @author Dave Syer
- * @author Biju Kunjummen
- */
-public class EurekaClientConfigServerAutoConfigurationTests {
-
- @Test
- public void offByDefault() {
- new ApplicationContextRunner().withConfiguration(
- AutoConfigurations.of(EurekaClientConfigServerAutoConfiguration.class))
- .run(c -> {
- assertEquals(0,
- c.getBeanNamesForType(EurekaInstanceConfigBean.class).length);
- });
- }
-
- @Test
- public void onWhenRequested() {
- new ApplicationContextRunner()
- .withConfiguration(AutoConfigurations.of(
- EurekaClientConfigServerAutoConfiguration.class,
- ConfigServerProperties.class, EurekaInstanceConfigBean.class))
- .withPropertyValues("spring.cloud.config.server.prefix=/config")
- .run(c -> {
- assertEquals(1,
- c.getBeanNamesForType(EurekaInstanceConfig.class).length);
- EurekaInstanceConfig instance = c.getBean(EurekaInstanceConfig.class);
- assertEquals("/config", instance.getMetadataMap().get("configPath"));
- });
- }
-
-}
\ No newline at end of file
diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/JerseyOptionalArgsConfigurationTest.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/JerseyOptionalArgsConfigurationTest.java
deleted file mode 100644
index ed2930a1..00000000
--- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/JerseyOptionalArgsConfigurationTest.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 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.eureka.config;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
-import org.springframework.cloud.netflix.eureka.sample.EurekaSampleApplication;
-import org.springframework.test.annotation.DirtiesContext;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-import com.netflix.discovery.DiscoveryClient.DiscoveryClientOptionalArgs;
-
-/**
- * @author Daniel Lavoie
- */
-@DirtiesContext
-@RunWith(SpringJUnit4ClassRunner.class)
-@SpringBootTest(classes = EurekaSampleApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT)
-public class JerseyOptionalArgsConfigurationTest {
- @Autowired
- private DiscoveryClientOptionalArgs optionalArgs;
-
- @Test
- public void contextLoads() {
- Assert.assertNotNull(optionalArgs);
- }
-}
diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/RestTemplateOptionalArgsConfigurationTest.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/RestTemplateOptionalArgsConfigurationTest.java
deleted file mode 100644
index 32ebc9a7..00000000
--- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/config/RestTemplateOptionalArgsConfigurationTest.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 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.eureka.config;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.boot.WebApplicationType;
-import org.springframework.boot.builder.SpringApplicationBuilder;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
-import org.springframework.cloud.netflix.eureka.http.RestTemplateDiscoveryClientOptionalArgs;
-import org.springframework.cloud.netflix.eureka.sample.EurekaSampleApplication;
-import org.springframework.cloud.test.ClassPathExclusions;
-import org.springframework.cloud.test.ModifiedClassPathRunner;
-import org.springframework.context.ConfigurableApplicationContext;
-
-/**
- * @author Daniel Lavoie
- */
-@RunWith(ModifiedClassPathRunner.class)
-@ClassPathExclusions({ "jersey-client-*", "jersey-core-*", "jersey-apache-client4-*" })
-@SpringBootTest(classes = EurekaSampleApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT)
-public class RestTemplateOptionalArgsConfigurationTest {
- @Test
- public void contextLoads() {
- try (ConfigurableApplicationContext context = new SpringApplicationBuilder()
- .web(WebApplicationType.NONE).sources(EurekaSampleApplication.class).run()) {
- Assert.assertNotNull(
- context.getBean(RestTemplateDiscoveryClientOptionalArgs.class));
- }
- }
-}
diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/healthcheck/EurekaHealthCheckTests.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/healthcheck/EurekaHealthCheckTests.java
deleted file mode 100644
index f9b5e7c2..00000000
--- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/healthcheck/EurekaHealthCheckTests.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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.eureka.healthcheck;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.actuate.health.Health;
-import org.springframework.boot.actuate.health.HealthIndicator;
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.test.annotation.DirtiesContext;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-import com.netflix.appinfo.InstanceInfo;
-import com.netflix.discovery.EurekaClient;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-/**
- * Tests the Eureka health check handler.
- *
- * @author Jakub Narloch
- */
-@RunWith(SpringJUnit4ClassRunner.class)
-@SpringBootTest(classes = EurekaHealthCheckTests.EurekaHealthCheckApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT, value = {
- "eureka.client.healthcheck.enabled=true", "debug=true" })
-@DirtiesContext
-public class EurekaHealthCheckTests {
-
- @Autowired
- private EurekaClient discoveryClient;
-
- @Test
- public void shouldRegisterService() {
-
- InstanceInfo.InstanceStatus status = this.discoveryClient.getHealthCheckHandler()
- .getStatus(InstanceInfo.InstanceStatus.UNKNOWN);
-
- assertNotNull(status);
- assertEquals(InstanceInfo.InstanceStatus.OUT_OF_SERVICE, status);
- }
-
- @Configuration
- @EnableAutoConfiguration
- protected static class EurekaHealthCheckApplication {
-
- @Bean
- public HealthIndicator healthIndicator() {
- return new HealthIndicator() {
- @Override
- public Health health() {
- return new Health.Builder().outOfService().build();
- }
- };
- }
- }
-}
diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/EurekaServerMockApplication.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/EurekaServerMockApplication.java
deleted file mode 100644
index 2c9cbb36..00000000
--- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/EurekaServerMockApplication.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Copyright 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.eureka.http;
-
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.core.Ordered;
-import org.springframework.core.annotation.Order;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
-import org.springframework.security.config.annotation.web.builders.HttpSecurity;
-import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
-import org.springframework.security.core.userdetails.User;
-import org.springframework.security.core.userdetails.UserDetailsService;
-import org.springframework.security.provisioning.InMemoryUserDetailsManager;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.ResponseStatus;
-import org.springframework.web.bind.annotation.RestController;
-
-import com.netflix.appinfo.InstanceInfo;
-import com.netflix.discovery.shared.Application;
-import com.netflix.discovery.shared.Applications;
-
-import static com.netflix.appinfo.InstanceInfo.DEFAULT_PORT;
-import static com.netflix.appinfo.InstanceInfo.DEFAULT_SECURE_PORT;
-import static org.springframework.util.Assert.isTrue;
-
-/**
- * Mocked Eureka Server
- *
- * @author Daniel Lavoie
- */
-@Configuration
-@RestController
-@SpringBootApplication
-public class EurekaServerMockApplication {
- private static final InstanceInfo INFO = new InstanceInfo(null, null, null, null,
- null, null, null, null, null, null, null, null, null, 0, null, null, null,
- null, null, null, null, 0l, 0l, null, null);
-
- /**
- * Simulates Eureka Server own's serialization.
- * @return
- */
- @Bean
- public MappingJackson2HttpMessageConverter mappingJacksonHttpMessageConverter() {
- return new RestTemplateTransportClientFactory()
- .mappingJacksonHttpMessageConverter();
- }
-
- @ResponseStatus(HttpStatus.OK)
- @PostMapping("/apps/{appName}")
- public void register(@PathVariable String appName,
- @RequestBody InstanceInfo instanceInfo) {
- isTrue(instanceInfo.getPort() != DEFAULT_PORT && instanceInfo.getPort() != 0,
- "Port not received from client");
- isTrue(instanceInfo.getSecurePort() != DEFAULT_SECURE_PORT && instanceInfo.getSecurePort() != 0,
- "Secure Port not received from client");
- // Nothing to do
- }
-
- @ResponseStatus(HttpStatus.OK)
- @DeleteMapping("/apps/{appName}/{id}")
- public void cancel(@PathVariable String appName, @PathVariable String id) {
-
- }
-
- @ResponseStatus(HttpStatus.OK)
- @PutMapping(value = "/apps/{appName}/{id}", params = { "status",
- "lastDirtyTimestamp" })
- public InstanceInfo sendHeartBeat(@PathVariable String appName,
- @PathVariable String id, @RequestParam String status,
- @RequestParam String lastDirtyTimestamp,
- @RequestParam(required = false) String overriddenstatus) {
- return new InstanceInfo(null, null, null, null, null, null, null, null, null,
- null, null, null, null, 0, null, null, null, null, null, null, null, 0l,
- 0l, null, null);
- }
-
- @ResponseStatus(HttpStatus.OK)
- @PutMapping(value = "/apps/{appName}/{id}/status", params = { "value",
- "lastDirtyTimestamp" })
- public void statusUpdate(@PathVariable String appName, @PathVariable String id,
- @RequestParam String value, @RequestParam String lastDirtyTimestamp) {
-
- }
-
- @ResponseStatus(HttpStatus.OK)
- @DeleteMapping(value = "/apps/{appName}/{id}/status", params = "lastDirtyTimestamp")
- public void deleteStatusOverride(@PathVariable String appName,
- @PathVariable String id, @RequestParam String lastDirtyTimestamp) {
-
- }
-
- @GetMapping(value = { "/apps", "/apps/delta", "/vips/{address}", "/svips/{address}" })
- public Applications getApplications(@PathVariable(required = false) String address,
- @RequestParam(required = false) String regions) {
- return new Applications();
- }
-
- @GetMapping(value = "/apps/{appName}")
- public Application getApplication(@PathVariable String appName) {
- return new Application();
- }
-
- @GetMapping(value = { "/apps/{appName}/{id}", "/instances/{id}" })
- public InstanceInfo getInstance(@PathVariable(required = false) String appName,
- @PathVariable String id) {
- return INFO;
- }
-
- @Configuration
- @Order(Ordered.HIGHEST_PRECEDENCE)
- protected static class TestSecurityConfiguration extends WebSecurityConfigurerAdapter {
-
-
- TestSecurityConfiguration() {
- super(true);
- }
-
- @Bean
- public UserDetailsService userDetailsService() {
- InMemoryUserDetailsManager manager = new InMemoryUserDetailsManager();
- manager.createUser(User.withUsername("test").password("{noop}test").roles("USER").build());
- return manager;
- }
-
- @Override
- protected void configure(HttpSecurity http) throws Exception {
- // super.configure(http);
- http.antMatcher("/apps/**")
- .httpBasic();
- }
-
- }
-}
diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/RestTemplateEurekaHttpClientTest.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/RestTemplateEurekaHttpClientTest.java
deleted file mode 100644
index 4545d62c..00000000
--- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/RestTemplateEurekaHttpClientTest.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright 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.eureka.http;
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
-import org.springframework.cloud.commons.util.InetUtils;
-import org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean;
-import org.springframework.http.HttpStatus;
-import org.springframework.test.annotation.DirtiesContext;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-import com.netflix.appinfo.InstanceInfo;
-import com.netflix.appinfo.InstanceInfo.InstanceStatus;
-import com.netflix.appinfo.providers.EurekaConfigBasedInstanceInfoProvider;
-import com.netflix.discovery.shared.resolver.DefaultEndpoint;
-import com.netflix.discovery.shared.transport.EurekaHttpClient;
-
-/**
- * @author Daniel Lavoie
- */
-@RunWith(SpringJUnit4ClassRunner.class)
-@SpringBootTest(classes = EurekaServerMockApplication.class, properties = { "debug=true",
- "security.basic.enabled=true" }, webEnvironment = WebEnvironment.RANDOM_PORT)
-@DirtiesContext
-public class RestTemplateEurekaHttpClientTest {
- @Autowired
- private InetUtils inetUtils;
-
- @Value("http://${security.user.name}:${security.user.password}@localhost:${local.server.port}")
- private String serviceUrl;
-
- private EurekaHttpClient eurekaHttpClient;
- private InstanceInfo info;
-
- @Before
- public void setup() {
- eurekaHttpClient = new RestTemplateTransportClientFactory()
- .newClient(new DefaultEndpoint(serviceUrl));
-
- EurekaInstanceConfigBean config = new EurekaInstanceConfigBean(inetUtils);
-
- String appname = "customapp";
- config.setIpAddress("127.0.0.1");
- config.setHostname("localhost");
- config.setAppname(appname);
- config.setVirtualHostName(appname);
- config.setSecureVirtualHostName(appname);
- config.setNonSecurePort(4444);
- config.setSecurePort(8443);
- config.setInstanceId("127.0.0.1:customapp:4444");
-
- info = new EurekaConfigBasedInstanceInfoProvider(config).get();
- }
-
- @Test
- public void testRegister() {
- Assert.assertEquals(HttpStatus.OK.value(),
- eurekaHttpClient.register(info).getStatusCode());
- }
-
- @Test
- public void testCancel() {
- Assert.assertEquals(HttpStatus.OK.value(),
- eurekaHttpClient.cancel("test", "test").getStatusCode());
- }
-
- @Test
- public void testSendHeartBeat() {
- Assert.assertEquals(HttpStatus.OK.value(), eurekaHttpClient
- .sendHeartBeat("test", "test", info, null).getStatusCode());
- }
-
- @Test
- public void testStatusUpdate() {
- Assert.assertEquals(HttpStatus.OK.value(), eurekaHttpClient
- .statusUpdate("test", "test", InstanceStatus.UP, info).getStatusCode());
- }
-
- @Test
- public void testDeleteStatusOverride() {
- Assert.assertEquals(HttpStatus.OK.value(), eurekaHttpClient
- .deleteStatusOverride("test", "test", info).getStatusCode());
- }
-
- @Test
- public void testGetApplications() {
- Assert.assertNotNull(eurekaHttpClient.getApplications().getEntity());
- Assert.assertNotNull(eurekaHttpClient.getApplications("us", "eu").getEntity());
- }
-
- @Test
- public void testGetDelta() {
- eurekaHttpClient.getDelta().getEntity();
- eurekaHttpClient.getDelta("us", "eu").getEntity();
- }
-
- @Test
- public void testGetVips() {
- eurekaHttpClient.getVip("test");
- eurekaHttpClient.getVip("test", "us", "eu");
- }
-
- @Test
- public void testGetSecureVip() {
- eurekaHttpClient.getSecureVip("test");
- eurekaHttpClient.getSecureVip("test", "us", "eu");
- }
-
- @Test
- public void testGetApplication() {
- eurekaHttpClient.getApplication("test");
- }
-
- @Test
- public void testGetInstance() {
- eurekaHttpClient.getInstance("test");
- eurekaHttpClient.getInstance("test", "test");
- }
-}
diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/RestTemplateTransportClientFactoriesTest.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/RestTemplateTransportClientFactoriesTest.java
deleted file mode 100644
index 88d02636..00000000
--- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/RestTemplateTransportClientFactoriesTest.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 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.eureka.http;
-
-import org.junit.Test;
-
-/**
- * @author Daniel Lavoie
- */
-public class RestTemplateTransportClientFactoriesTest {
- @Test(expected = UnsupportedOperationException.class)
- public void testJerseyIsUnsuported() {
- new RestTemplateTransportClientFactories().newTransportClientFactory(null, null);
- }
-}
diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/RestTemplateTransportClientFactoryTest.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/RestTemplateTransportClientFactoryTest.java
deleted file mode 100644
index 50de78ae..00000000
--- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/http/RestTemplateTransportClientFactoryTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright 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.eureka.http;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.netflix.discovery.shared.resolver.DefaultEndpoint;
-
-/**
- * @author Daniel Lavoie
- */
-public class RestTemplateTransportClientFactoryTest {
- private RestTemplateTransportClientFactory transportClientFatory;
-
- @Before
- public void setup() {
- transportClientFatory = new RestTemplateTransportClientFactory();
- }
-
- @Test
- public void testWithoutUserInfo() {
- transportClientFatory.newClient(new DefaultEndpoint("http://localhost:8761"));
- }
-
- @Test
- public void testInvalidUserInfo() {
- transportClientFatory
- .newClient(new DefaultEndpoint("http://test@localhost:8761"));
- }
-
- @Test
- public void testUserInfo() {
- transportClientFatory
- .newClient(new DefaultEndpoint("http://test:test@localhost:8761"));
- }
-
- @After
- public void shutdown() {
- transportClientFatory.shutdown();
- }
-}
diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/metadata/DefaultManagementMetadataProviderTest.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/metadata/DefaultManagementMetadataProviderTest.java
deleted file mode 100644
index 11b028a5..00000000
--- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/metadata/DefaultManagementMetadataProviderTest.java
+++ /dev/null
@@ -1,138 +0,0 @@
-package org.springframework.cloud.netflix.eureka.metadata;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class DefaultManagementMetadataProviderTest {
-
- private static final EurekaInstanceConfigBean INSTANCE = mock(EurekaInstanceConfigBean.class);
- private final ManagementMetadataProvider provider = new DefaultManagementMetadataProvider();
-
- @Before
- public void setUp() throws Exception {
- when(INSTANCE.getHostname()).thenReturn("host");
- when(INSTANCE.getHealthCheckUrlPath()).thenReturn("health");
- when(INSTANCE.getStatusPageUrlPath()).thenReturn("info");
- }
-
- @Test
- public void serverPortIsRandomAndManagementPortIsNull() throws Exception {
- int serverPort = 0;
- String serverContextPath = "/";
- String managementContextPath = null;
- Integer managementPort = null;
- ManagementMetadata actual = provider.get(INSTANCE, serverPort, serverContextPath, managementContextPath, managementPort);
-
- assertThat(actual).isNull();
- }
-
- @Test
- public void managementPortIsRandom() throws Exception {
- int serverPort = 0;
- String serverContextPath = "/";
- String managementContextPath = null;
- Integer managementPort = 0;
- ManagementMetadata actual = provider.get(INSTANCE, serverPort, serverContextPath, managementContextPath, managementPort);
-
- assertThat(actual).isNull();
- }
-
- @Test
- public void serverPort() throws Exception {
- int serverPort = 7777;
- String serverContextPath = "/";
- String managementContextPath = null;
- Integer managementPort = null;
- ManagementMetadata actual = provider.get(INSTANCE, serverPort, serverContextPath, managementContextPath, managementPort);
-
- assertThat(actual.getHealthCheckUrl()).isEqualTo("http://host:7777/health");
- assertThat(actual.getStatusPageUrl()).isEqualTo("http://host:7777/info");
- assertThat(actual.getManagementPort()).isEqualTo(7777);
- }
-
- @Test
- public void serverPortManagementPort() throws Exception {
- int serverPort = 7777;
- String serverContextPath = "/";
- String managementContextPath = null;
- Integer managementPort = 8888;
- ManagementMetadata actual = provider.get(INSTANCE, serverPort, serverContextPath, managementContextPath, managementPort);
-
- assertThat(actual.getHealthCheckUrl()).isEqualTo("http://host:8888/health");
- assertThat(actual.getStatusPageUrl()).isEqualTo("http://host:8888/info");
- assertThat(actual.getManagementPort()).isEqualTo(8888);
- }
-
- @Test
- public void serverPortManagementPortServerContextPath() throws Exception {
- int serverPort = 7777;
- String serverContextPath = "/Server";
- String managementContextPath = null;
- Integer managementPort = 8888;
- ManagementMetadata actual = provider.get(INSTANCE, serverPort, serverContextPath, managementContextPath, managementPort);
-
- assertThat(actual.getHealthCheckUrl()).isEqualTo("http://host:8888/health");
- assertThat(actual.getStatusPageUrl()).isEqualTo("http://host:8888/info");
- assertThat(actual.getManagementPort()).isEqualTo(8888);
- }
-
- @Test
- public void serverPortManagementPortServerContextPathManagementContextPath() throws Exception {
- int serverPort = 7777;
- String serverContextPath = "/Server";
- String managementContextPath = "/Management";
- Integer managementPort = 8888;
- ManagementMetadata actual = provider.get(INSTANCE, serverPort, serverContextPath, managementContextPath, managementPort);
-
- assertThat(actual.getHealthCheckUrl()).isEqualTo("http://host:8888/Management/health");
- assertThat(actual.getStatusPageUrl()).isEqualTo("http://host:8888/Management/info");
- assertThat(actual.getManagementPort()).isEqualTo(8888);
- }
-
- @Test
- public void serverPortServerContextPathManagementContextPath() throws Exception {
- int serverPort = 7777;
- String serverContextPath = "/Server";
- String managementContextPath = "/Management";
- Integer managementPort = null;
- ManagementMetadata actual = provider.get(INSTANCE, serverPort, serverContextPath, managementContextPath, managementPort);
-
- assertThat(actual.getHealthCheckUrl()).isEqualTo("http://host:7777/Management/health");
- assertThat(actual.getStatusPageUrl()).isEqualTo("http://host:7777/Management/info");
- assertThat(actual.getManagementPort()).isEqualTo(7777);
- }
-
- @Test
- public void serverPortServerContextPath() throws Exception {
- int serverPort = 7777;
- String serverContextPath = "/Server";
- String managementContextPath = null;
- Integer managementPort = null;
- ManagementMetadata actual = provider.get(INSTANCE, serverPort, serverContextPath, managementContextPath, managementPort);
-
- assertThat(actual.getHealthCheckUrl()).isEqualTo("http://host:7777/Server/health");
- assertThat(actual.getStatusPageUrl()).isEqualTo("http://host:7777/Server/info");
- assertThat(actual.getManagementPort()).isEqualTo(7777);
- }
-
- @Test
- public void serverPortManagementPortManagementContextPath() throws Exception {
- int serverPort = 7777;
- String serverContextPath = "/";
- String managementContextPath = "/Management";
- Integer managementPort = 8888;
- ManagementMetadata actual = provider.get(INSTANCE, serverPort, serverContextPath, managementContextPath, managementPort);
-
- assertThat(actual.getHealthCheckUrl()).isEqualTo("http://host:8888/Management/health");
- assertThat(actual.getStatusPageUrl()).isEqualTo("http://host:8888/Management/info");
- assertThat(actual.getManagementPort()).isEqualTo(8888);
-
- }
-
-
-}
\ No newline at end of file
diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/sample/ApplicationTests.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/sample/ApplicationTests.java
deleted file mode 100644
index 3b72e97e..00000000
--- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/sample/ApplicationTests.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2013-2015 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.eureka.sample;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
-import org.springframework.test.annotation.DirtiesContext;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@SpringBootTest(classes = EurekaSampleApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT)
-@DirtiesContext
-public class ApplicationTests {
-
- @Test
- public void contextLoads() {
- }
-
-}
diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/sample/EurekaSampleApplication.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/sample/EurekaSampleApplication.java
deleted file mode 100644
index 390e6301..00000000
--- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/sample/EurekaSampleApplication.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright 2013-2015 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.eureka.sample;
-
-import java.io.Closeable;
-import java.io.IOException;
-
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
-import org.springframework.cloud.client.discovery.DiscoveryClient;
-import org.springframework.cloud.client.serviceregistry.ServiceRegistry;
-import org.springframework.cloud.commons.util.InetUtils;
-import org.springframework.cloud.netflix.eureka.EurekaClientConfigBean;
-import org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean;
-import org.springframework.cloud.netflix.eureka.serviceregistry.EurekaRegistration;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.ComponentScan;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import com.netflix.appinfo.HealthCheckHandler;
-import com.netflix.appinfo.InstanceInfo;
-
-import static org.springframework.web.bind.annotation.RequestMethod.POST;
-
-@Configuration
-@ComponentScan
-@EnableAutoConfiguration
-@RestController
-public class EurekaSampleApplication implements ApplicationContextAware, Closeable {
-
- @Autowired
- private DiscoveryClient discoveryClient;
-
- @Autowired
- private ServiceRegistry serviceRegistry;
-
- @Autowired
- private InetUtils inetUtils;
-
- @Autowired
- private EurekaClientConfigBean clientConfig;
-
- private ApplicationContext context;
-
- private EurekaRegistration registration;
-
- @Bean
- public HealthCheckHandler healthCheckHandler() {
- return new HealthCheckHandler() {
- @Override
- public InstanceInfo.InstanceStatus getStatus(
- InstanceInfo.InstanceStatus currentStatus) {
- return InstanceInfo.InstanceStatus.UP;
- }
- };
- }
-
- @RequestMapping("/")
- public String home() {
- return "Hello world "+ registration.getUri();
- }
-
- @Override
- public void setApplicationContext(ApplicationContext context) throws BeansException {
- this.context = context;
- }
-
- @RequestMapping(path = "/register", method = POST)
- public String register() {
- EurekaInstanceConfigBean config = new EurekaInstanceConfigBean(inetUtils);
- String appname = "customapp";
- config.setIpAddress("127.0.0.1");
- config.setHostname("localhost");
- config.setAppname(appname);
- config.setVirtualHostName(appname);
- config.setSecureVirtualHostName(appname);
- config.setNonSecurePort(4444);
- config.setInstanceId("127.0.0.1:customapp:4444");
-
- this.registration = EurekaRegistration.builder(config)
- .with(this.clientConfig, this.context)
- .build();
-
- this.serviceRegistry.register(this.registration);
- return config.getInstanceId();
- }
-
- @RequestMapping(path = "/deregister", method = POST)
- public String deregister() {
- this.serviceRegistry.deregister(this.registration);
- return "deregister";
- }
-
- @Override
- public void close() throws IOException {
- deregister();
- }
-}
diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/sample/RefreshEurekaSampleApplication.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/sample/RefreshEurekaSampleApplication.java
deleted file mode 100644
index 6cbca2ee..00000000
--- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/sample/RefreshEurekaSampleApplication.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- *
- * * 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.eureka.sample;
-
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
-import org.springframework.cloud.netflix.eureka.CloudEurekaClient;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.ComponentScan;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.web.bind.annotation.RestController;
-
-import com.netflix.discovery.EurekaClient;
-
-import static org.mockito.Mockito.mock;
-
-/**
- * @author Ryan Baxter
- */
-@Configuration
-@ComponentScan
-@EnableAutoConfiguration
-@RestController
-public class RefreshEurekaSampleApplication {
-
- @Bean
- public EurekaClient getClient() {
- return mock(CloudEurekaClient.class);
- }
-}
diff --git a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/serviceregistry/EurekaServiceRegistryTests.java b/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/serviceregistry/EurekaServiceRegistryTests.java
deleted file mode 100644
index eba2ce61..00000000
--- a/spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/serviceregistry/EurekaServiceRegistryTests.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright 2013-2018 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.eureka.serviceregistry;
-
-import java.util.Map;
-
-import org.junit.Test;
-import org.springframework.cloud.commons.util.InetUtils;
-import org.springframework.cloud.commons.util.InetUtilsProperties;
-import org.springframework.cloud.netflix.eureka.CloudEurekaClient;
-import org.springframework.cloud.netflix.eureka.EurekaClientConfigBean;
-import org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean;
-import org.springframework.context.ApplicationEventPublisher;
-
-import com.netflix.appinfo.ApplicationInfoManager;
-import com.netflix.appinfo.InstanceInfo;
-
-import static com.netflix.appinfo.InstanceInfo.InstanceStatus.DOWN;
-import static com.netflix.appinfo.InstanceInfo.InstanceStatus.UNKNOWN;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verifyZeroInteractions;
-import static org.mockito.Mockito.when;
-
-/**
- * @author Spencer Gibb
- */
-public class EurekaServiceRegistryTests {
-
- @Test
- public void eurekaClientNotShutdownInDeregister() {
- EurekaServiceRegistry registry = new EurekaServiceRegistry();
-
- CloudEurekaClient eurekaClient = mock(CloudEurekaClient.class);
- ApplicationInfoManager applicationInfoManager = mock(ApplicationInfoManager.class);
-
- when(applicationInfoManager.getInfo()).thenReturn(mock(InstanceInfo.class));
-
- EurekaRegistration registration = EurekaRegistration.builder(new EurekaInstanceConfigBean(new InetUtils(new InetUtilsProperties())))
- .with(eurekaClient)
- .with(applicationInfoManager)
- .with(new EurekaClientConfigBean(), mock(ApplicationEventPublisher.class))
- .build();
-
- registry.deregister(registration);
-
- verifyZeroInteractions(eurekaClient);
- }
-
- @Test
- public void eurekaClientGetStatus() {
- EurekaServiceRegistry registry = new EurekaServiceRegistry();
-
- EurekaInstanceConfigBean config = new EurekaInstanceConfigBean(new InetUtils(new InetUtilsProperties()));
- config.setAppname("myapp");
- config.setInstanceId("1234");
-
- CloudEurekaClient eurekaClient = mock(CloudEurekaClient.class);
-
- InstanceInfo instanceInfo = InstanceInfo.Builder.newBuilder()
- .setAppName("myapp")
- .setInstanceId("1234")
- .setStatus(DOWN)
- .setOverriddenStatus(UNKNOWN)
- .build();
- when(eurekaClient.getInstanceInfo("myapp", "1234"))
- .thenReturn(instanceInfo);
-
- EurekaRegistration registration = EurekaRegistration.builder(config)
- .with(eurekaClient)
- .with(mock(ApplicationInfoManager.class))
- .with(new EurekaClientConfigBean(), mock(ApplicationEventPublisher.class))
- .build();
-
- Object status = registry.getStatus(registration);
-
- assertThat(status).isInstanceOf(Map.class);
-
- Map