Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-cloud-netflix
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
spring-cloud-netflix
Commits
5cfe0f07
Unverified
Commit
5cfe0f07
authored
Sep 12, 2017
by
Spencer Gibb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix compile errors
parent
fa9a8bbf
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
119 additions
and
195 deletions
+119
-195
ArchaiusAutoConfiguration.java
...ork/cloud/netflix/archaius/ArchaiusAutoConfiguration.java
+12
-13
ArchaiusEndpoint.java
...ingframework/cloud/netflix/archaius/ArchaiusEndpoint.java
+5
-7
ServletWrappingEndpoint.java
...ework/cloud/netflix/endpoint/ServletWrappingEndpoint.java
+6
-5
HystrixAutoConfiguration.java
...ework/cloud/netflix/hystrix/HystrixAutoConfiguration.java
+2
-2
HystrixCircuitBreakerConfiguration.java
...d/netflix/hystrix/HystrixCircuitBreakerConfiguration.java
+2
-2
ServoMetricsAutoConfiguration.java
.../netflix/metrics/servo/ServoMetricsAutoConfiguration.java
+2
-2
RoutesEndpoint.java
...rg/springframework/cloud/netflix/zuul/RoutesEndpoint.java
+37
-14
RoutesMvcEndpoint.java
...springframework/cloud/netflix/zuul/RoutesMvcEndpoint.java
+0
-83
ZuulProxyAutoConfiguration.java
...mework/cloud/netflix/zuul/ZuulProxyAutoConfiguration.java
+4
-8
HystrixStreamEndpointTests.java
...ork/cloud/netflix/hystrix/HystrixStreamEndpointTests.java
+2
-1
NoServoMetricsAutoConfigurationTests.java
...x/metrics/servo/NoServoMetricsAutoConfigurationTests.java
+4
-4
ServoMetricsAutoConfigurationTests.java
...lix/metrics/servo/ServoMetricsAutoConfigurationTests.java
+1
-1
ContextPathZuulProxyApplicationTests.java
...ud/netflix/zuul/ContextPathZuulProxyApplicationTests.java
+3
-4
RoutesEndpointTests.java
...ringframework/cloud/netflix/zuul/RoutesEndpointTests.java
+4
-2
RoutesMvcEndpointTests.java
...gframework/cloud/netflix/zuul/RoutesMvcEndpointTests.java
+8
-10
ServletPathZuulProxyApplicationTests.java
...ud/netflix/zuul/ServletPathZuulProxyApplicationTests.java
+3
-4
SimpleZuulProxyApplicationTests.java
...k/cloud/netflix/zuul/SimpleZuulProxyApplicationTests.java
+2
-6
CustomHostRoutingFilterTests.java
...ud/netflix/zuul/filters/CustomHostRoutingFilterTests.java
+4
-9
PatternServiceRouteMapperIntegrationTests.java
.../discovery/PatternServiceRouteMapperIntegrationTests.java
+6
-7
ZuulProxyTestBase.java
...netflix/zuul/filters/route/support/ZuulProxyTestBase.java
+7
-8
EurekaClientAutoConfiguration.java
...k/cloud/netflix/eureka/EurekaClientAutoConfiguration.java
+4
-2
SpectatorMetricsAutoConfiguration.java
.../metrics/spectator/SpectatorMetricsAutoConfiguration.java
+1
-1
No files found.
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/archaius/ArchaiusAutoConfiguration.java
View file @
5cfe0f07
...
...
@@ -24,26 +24,17 @@ import java.util.concurrent.atomic.AtomicBoolean;
import
javax.annotation.PreDestroy
;
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
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.
condition
.ConditionalOnEnabledEndpoint
;
import
org.springframework.boot.actuate.
endpoint.Endpoint
;
import
org.springframework.boot.actuate.
autoconfigure.endpoint
.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
;
...
...
@@ -57,6 +48,14 @@ 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
;
...
...
@@ -109,10 +108,10 @@ public class ArchaiusAutoConfiguration {
}
@Configuration
@ConditionalOnClass
(
Endpoint
.
class
)
@ConditionalOnEnabledEndpoint
(
"archaius"
)
@ConditionalOnClass
(
Health
.
class
)
protected
static
class
ArchaiusEndpointConfiguration
{
@Bean
@ConditionalOnEnabledEndpoint
protected
ArchaiusEndpoint
archaiusEndpoint
()
{
return
new
ArchaiusEndpoint
();
}
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/archaius/ArchaiusEndpoint.java
View file @
5cfe0f07
...
...
@@ -24,7 +24,8 @@ 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.AbstractEndpoint
;
import
org.springframework.boot.endpoint.Endpoint
;
import
org.springframework.boot.endpoint.ReadOperation
;
import
com.netflix.config.ConcurrentCompositeConfiguration
;
import
com.netflix.config.ConfigurationManager
;
...
...
@@ -32,13 +33,10 @@ import com.netflix.config.ConfigurationManager;
/**
* @author Dave Syer
*/
public
class
ArchaiusEndpoint
extends
AbstractEndpoint
<
Map
<
String
,
Object
>>
{
@Endpoint
(
id
=
"archaius"
)
public
class
ArchaiusEndpoint
{
public
ArchaiusEndpoint
()
{
super
(
"archaius"
);
}
@Override
@ReadOperation
public
Map
<
String
,
Object
>
invoke
()
{
Map
<
String
,
Object
>
map
=
new
LinkedHashMap
<
String
,
Object
>();
AbstractConfiguration
config
=
ConfigurationManager
.
getConfigInstance
();
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/endpoint/ServletWrappingEndpoint.java
View file @
5cfe0f07
...
...
@@ -23,8 +23,8 @@ import javax.servlet.http.HttpServletResponse;
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.boot.actuate.endpoint.Endpoint
;
import
org.springframework.boot.actuate.endpoint.mvc.MvcEndpoint
;
//
import org.springframework.boot.actuate.endpoint.Endpoint;
//
import org.springframework.boot.actuate.endpoint.mvc.MvcEndpoint;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContextAware
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
...
@@ -32,8 +32,9 @@ import org.springframework.web.context.ServletContextAware;
import
org.springframework.web.servlet.ModelAndView
;
import
org.springframework.web.servlet.mvc.ServletWrappingController
;
//FIXME 2.0.x
public
abstract
class
ServletWrappingEndpoint
implements
InitializingBean
,
ApplicationContextAware
,
ServletContextAware
,
MvcEndpoint
{
ApplicationContextAware
,
ServletContextAware
/*, MvcEndpoint*/
{
// TODO: move to spring-boot?
...
...
@@ -84,7 +85,7 @@ public abstract class ServletWrappingEndpoint implements InitializingBean,
return
this
.
controller
;
}
@Override
/*
@Override
public String getPath() {
return this.path;
}
...
...
@@ -97,6 +98,6 @@ public abstract class ServletWrappingEndpoint implements InitializingBean,
@Override
public Class<? extends Endpoint<?>> getEndpointType() {
return null;
}
}
*/
}
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixAutoConfiguration.java
View file @
5cfe0f07
...
...
@@ -16,8 +16,8 @@
package
org
.
springframework
.
cloud
.
netflix
.
hystrix
;
import
org.springframework.boot.actuate.autoconfigure.ConditionalOnEnabledHealthIndicator
;
import
org.springframework.boot.actuate.autoconfigure.HealthIndicatorAutoConfiguration
;
import
org.springframework.boot.actuate.autoconfigure.
health.
ConditionalOnEnabledHealthIndicator
;
import
org.springframework.boot.actuate.autoconfigure.
health.
HealthIndicatorAutoConfiguration
;
import
org.springframework.boot.actuate.health.HealthIndicator
;
import
org.springframework.boot.autoconfigure.AutoConfigureAfter
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/hystrix/HystrixCircuitBreakerConfiguration.java
View file @
5cfe0f07
...
...
@@ -27,7 +27,7 @@ import org.apache.commons.logging.Log;
import
org.apache.commons.logging.LogFactory
;
import
org.springframework.beans.factory.DisposableBean
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.actuate.
endpoint.Endpoint
;
import
org.springframework.boot.actuate.
health.Health
;
import
org.springframework.boot.actuate.metrics.GaugeService
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
;
...
...
@@ -73,7 +73,7 @@ public class HystrixCircuitBreakerConfiguration {
@Configuration
@ConditionalOnProperty
(
value
=
"hystrix.stream.endpoint.enabled"
,
matchIfMissing
=
true
)
@ConditionalOnWebApplication
@ConditionalOnClass
({
Endpoint
.
class
,
HystrixMetricsStreamServlet
.
class
})
@ConditionalOnClass
({
Health
.
class
,
HystrixMetricsStreamServlet
.
class
})
protected
static
class
HystrixWebConfiguration
{
@Bean
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/metrics/servo/ServoMetricsAutoConfiguration.java
View file @
5cfe0f07
...
...
@@ -13,8 +13,8 @@
package
org
.
springframework
.
cloud
.
netflix
.
metrics
.
servo
;
import
org.springframework.boot.actuate.autoconfigure.ExportMetricReader
;
import
org.springframework.boot.actuate.autoconfigure.MetricRepositoryAutoConfiguration
;
import
org.springframework.boot.actuate.autoconfigure.
metrics.
ExportMetricReader
;
import
org.springframework.boot.actuate.autoconfigure.
metrics.
MetricRepositoryAutoConfiguration
;
import
org.springframework.boot.actuate.endpoint.MetricReaderPublicMetrics
;
import
org.springframework.boot.actuate.metrics.CounterService
;
import
org.springframework.boot.actuate.metrics.GaugeService
;
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/RoutesEndpoint.java
View file @
5cfe0f07
...
...
@@ -21,16 +21,16 @@ import java.util.Map;
import
java.util.Objects
;
import
java.util.Set
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonPropertyOrder
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.actuate.endpoint.AbstractEndpoint
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.boot.endpoint.Endpoint
;
import
org.springframework.boot.endpoint.ReadOperation
;
import
org.springframework.boot.endpoint.WriteOperation
;
import
org.springframework.cloud.netflix.zuul.filters.Route
;
import
org.springframework.cloud.netflix.zuul.filters.RouteLocator
;
import
org.springframework.context.ApplicationEventPublisher
;
import
org.springframework.jmx.export.annotation.ManagedAttribute
;
import
org.springframework.jmx.export.annotation.ManagedResource
;
import
org.springframework.context.ApplicationEventPublisherAware
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonPropertyOrder
;
/**
* Endpoint to display the zuul proxy routes
...
...
@@ -40,23 +40,25 @@ import org.springframework.jmx.export.annotation.ManagedResource;
* @author Ryan Baxter
* @author Gregor Zurowski
*/
@ManagedResource
(
description
=
"Can be used to list the reverse proxy routes"
)
@ConfigurationProperties
(
prefix
=
"endpoints.routes"
)
public
class
RoutesEndpoint
extends
AbstractEndpoint
<
Map
<
String
,
String
>>
{
@Endpoint
(
id
=
RoutesEndpoint
.
ID
)
public
class
RoutesEndpoint
implements
ApplicationEventPublisherAware
{
private
static
final
String
ID
=
"routes"
;
static
final
String
ID
=
"routes"
;
private
RouteLocator
routes
;
private
ApplicationEventPublisher
publisher
;
@Autowired
public
RoutesEndpoint
(
RouteLocator
routes
)
{
super
(
ID
,
true
);
this
.
routes
=
routes
;
}
@ManagedAttribute
@Override
public
void
setApplicationEventPublisher
(
ApplicationEventPublisher
publisher
)
{
this
.
publisher
=
publisher
;
}
@ReadOperation
public
Map
<
String
,
String
>
invoke
()
{
Map
<
String
,
String
>
map
=
new
LinkedHashMap
<>();
for
(
Route
route
:
this
.
routes
.
getRoutes
())
{
...
...
@@ -73,6 +75,27 @@ public class RoutesEndpoint extends AbstractEndpoint<Map<String, String>> {
return
map
;
}
@WriteOperation
public
Object
reset
()
{
this
.
publisher
.
publishEvent
(
new
RoutesRefreshedEvent
(
this
.
routes
));
return
invoke
();
}
/**
* Expose Zuul {@link Route} information with details.
*/
//FIXME 2.0.x
/*@GetMapping(params = "format", produces = { ActuatorMediaTypes.APPLICATION_ACTUATOR_V1_JSON_VALUE,
MediaType.APPLICATION_JSON_VALUE })
@ResponseBody
public Object invokeRouteDetails(@RequestParam String format) {
if (FORMAT_DETAILS.equalsIgnoreCase(format)) {
return endpoint.invokeRouteDetails();
} else {
return super.invoke();
}
}*/
/**
* Container for exposing Zuul {@link Route} details as JSON.
*/
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/RoutesMvcEndpoint.java
deleted
100644 → 0
View file @
fa9a8bbf
/*
*
* * 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
.
zuul
;
import
org.springframework.boot.actuate.endpoint.mvc.ActuatorMediaTypes
;
import
org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter
;
import
org.springframework.cloud.netflix.zuul.filters.Route
;
import
org.springframework.cloud.netflix.zuul.filters.RouteLocator
;
import
org.springframework.context.ApplicationEventPublisher
;
import
org.springframework.context.ApplicationEventPublisherAware
;
import
org.springframework.http.MediaType
;
import
org.springframework.jmx.export.annotation.ManagedOperation
;
import
org.springframework.jmx.export.annotation.ManagedResource
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.ResponseBody
;
/**
* Endpoint used to reset the reverse proxy routes
* @author Ryan Baxter
* @author Gregor Zurowski
*/
@ManagedResource
(
description
=
"Can be used to reset the reverse proxy routes"
)
public
class
RoutesMvcEndpoint
extends
EndpointMvcAdapter
implements
ApplicationEventPublisherAware
{
static
final
String
FORMAT_DETAILS
=
"details"
;
private
final
RoutesEndpoint
endpoint
;
private
RouteLocator
routes
;
private
ApplicationEventPublisher
publisher
;
public
RoutesMvcEndpoint
(
RoutesEndpoint
endpoint
,
RouteLocator
routes
)
{
super
(
endpoint
);
this
.
endpoint
=
endpoint
;
this
.
routes
=
routes
;
}
@Override
public
void
setApplicationEventPublisher
(
ApplicationEventPublisher
applicationEventPublisher
)
{
this
.
publisher
=
applicationEventPublisher
;
}
@RequestMapping
(
method
=
RequestMethod
.
POST
)
@ResponseBody
@ManagedOperation
public
Object
reset
()
{
this
.
publisher
.
publishEvent
(
new
RoutesRefreshedEvent
(
this
.
routes
));
return
super
.
invoke
();
}
/**
* Expose Zuul {@link Route} information with details.
*/
@GetMapping
(
params
=
"format"
,
produces
=
{
ActuatorMediaTypes
.
APPLICATION_ACTUATOR_V1_JSON_VALUE
,
MediaType
.
APPLICATION_JSON_VALUE
})
@ResponseBody
public
Object
invokeRouteDetails
(
@RequestParam
String
format
)
{
if
(
FORMAT_DETAILS
.
equalsIgnoreCase
(
format
))
{
return
endpoint
.
invokeRouteDetails
();
}
else
{
return
super
.
invoke
();
}
}
}
\ No newline at end of file
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/ZuulProxyAutoConfiguration.java
View file @
5cfe0f07
...
...
@@ -22,7 +22,8 @@ import java.util.List;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.actuate.endpoint.Endpoint
;
import
org.springframework.boot.actuate.autoconfigure.endpoint.ConditionalOnEnabledEndpoint
;
import
org.springframework.boot.actuate.health.Health
;
import
org.springframework.boot.actuate.trace.TraceRepository
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
...
...
@@ -153,24 +154,19 @@ public class ZuulProxyAutoConfiguration extends ZuulServerAutoConfiguration {
}
@Configuration
@ConditionalOnClass
(
Endpoint
.
class
)
@ConditionalOnClass
(
Health
.
class
)
protected
static
class
RoutesEndpointConfiguration
{
@Autowired
(
required
=
false
)
private
TraceRepository
traces
;
@Bean
@ConditionalOnEnabledEndpoint
public
RoutesEndpoint
zuulEndpoint
(
RouteLocator
routeLocator
)
{
return
new
RoutesEndpoint
(
routeLocator
);
}
@Bean
public
RoutesMvcEndpoint
zuulMvcEndpoint
(
RouteLocator
routeLocator
,
RoutesEndpoint
endpoint
)
{
return
new
RoutesMvcEndpoint
(
endpoint
,
routeLocator
);
}
@Bean
public
ProxyRequestHelper
proxyRequestHelper
(
ZuulProperties
zuulProperties
)
{
TraceProxyRequestHelper
helper
=
new
TraceProxyRequestHelper
();
if
(
this
.
traces
!=
null
)
{
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/hystrix/HystrixStreamEndpointTests.java
View file @
5cfe0f07
...
...
@@ -66,7 +66,8 @@ public class HystrixStreamEndpointTests {
@Test
public
void
pathStartsWithSlash
()
{
HystrixStreamEndpoint
endpoint
=
new
HystrixStreamEndpoint
();
assertEquals
(
"/hystrix.stream"
,
endpoint
.
getPath
());
// FIXME: 2.0.x
// assertEquals("/hystrix.stream", endpoint.getPath());
}
@Test
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/metrics/servo/NoServoMetricsAutoConfigurationTests.java
View file @
5cfe0f07
...
...
@@ -16,19 +16,19 @@
package
org
.
springframework
.
cloud
.
netflix
.
metrics
.
servo
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertNull
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.actuate.autoconfigure.ExportMetricReader
;
import
org.springframework.boot.actuate.autoconfigure.
metrics.
ExportMetricReader
;
import
org.springframework.boot.actuate.metrics.reader.MetricReader
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertNull
;
/**
* @author Dave Syer
*/
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/metrics/servo/ServoMetricsAutoConfigurationTests.java
View file @
5cfe0f07
...
...
@@ -21,7 +21,7 @@ import static org.junit.Assert.assertNotNull;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.actuate.autoconfigure.ExportMetricReader
;
import
org.springframework.boot.actuate.autoconfigure.
metrics.
ExportMetricReader
;
import
org.springframework.boot.actuate.metrics.reader.MetricReader
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.test.context.SpringBootTest
;
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/ContextPathZuulProxyApplicationTests.java
View file @
5cfe0f07
...
...
@@ -17,13 +17,10 @@
package
org
.
springframework
.
cloud
.
netflix
.
zuul
;
import
com.netflix.zuul.context.RequestContext
;
import
org.junit.After
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.test.context.SpringBootTest
;
...
...
@@ -44,6 +41,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.netflix.zuul.context.RequestContext
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
...
...
@@ -62,7 +61,7 @@ public class ContextPathZuulProxyApplicationTests {
private
DiscoveryClientRouteLocator
routes
;
@Autowired
private
Routes
Mvc
Endpoint
endpoint
;
private
RoutesEndpoint
endpoint
;
@Before
public
void
setTestRequestContext
()
{
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/RoutesEndpointTests.java
View file @
5cfe0f07
...
...
@@ -83,7 +83,8 @@ public class RoutesEndpointTests {
assertEquals
(
results
,
endpoint
.
invokeRouteDetails
());
}
@Test
//FIXME 2.0.x
/*@Test
public void testId() {
RoutesEndpoint endpoint = new RoutesEndpoint(locator);
assertEquals("routes", endpoint.getId());
...
...
@@ -93,5 +94,5 @@ public class RoutesEndpointTests {
public void testIsSensitive() {
RoutesEndpoint endpoint = new RoutesEndpoint(locator);
assertTrue(endpoint.isSensitive());
}
}
*/
}
\ No newline at end of file
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/RoutesMvcEndpointTests.java
View file @
5cfe0f07
...
...
@@ -21,9 +21,8 @@ package org.springframework.cloud.netflix.zuul;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
...
...
@@ -34,11 +33,7 @@ import org.springframework.cloud.netflix.zuul.filters.Route;
import
org.springframework.cloud.netflix.zuul.filters.RouteLocator
;
import
org.springframework.context.ApplicationEventPublisher
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
mockito
.
Matchers
.
isA
;
import
static
org
.
mockito
.
Mockito
.
spy
;
import
static
org
.
mockito
.
Mockito
.
times
;
import
static
org
.
mockito
.
Mockito
.
verify
;
/**
* @author Ryan Baxter
...
...
@@ -78,7 +73,8 @@ public class RoutesMvcEndpointTests {
@Test
public
void
reset
()
throws
Exception
{
RoutesMvcEndpoint
mvcEndpoint
=
new
RoutesMvcEndpoint
(
endpoint
,
locator
);
//FIXME: 2.0.x
/*RoutesMvcEndpoint mvcEndpoint = new RoutesMvcEndpoint(endpoint, locator);
mvcEndpoint.setApplicationEventPublisher(publisher);
Map<String, String> result = new HashMap<String, String>();
for(Route r : locator.getRoutes()) {
...
...
@@ -86,18 +82,19 @@ public class RoutesMvcEndpointTests {
}
assertEquals(result , mvcEndpoint.reset());
verify(endpoint, times(1)).invoke();
verify
(
publisher
,
times
(
1
)).
publishEvent
(
isA
(
RoutesRefreshedEvent
.
class
));
verify(publisher, times(1)).publishEvent(isA(RoutesRefreshedEvent.class));
*/
}
@Test
public
void
routeDetails
()
throws
Exception
{
RoutesMvcEndpoint
mvcEndpoint
=
new
RoutesMvcEndpoint
(
endpoint
,
locator
);
//FIXME: 2.0.x
/*RoutesMvcEndpoint mvcEndpoint = new RoutesMvcEndpoint(endpoint, locator);
Map<String, RoutesEndpoint.RouteDetails> results = new HashMap<>();
for (Route route : locator.getRoutes()) {
results.put(route.getFullPath(), new RoutesEndpoint.RouteDetails(route));
}
assertEquals(results, mvcEndpoint.invokeRouteDetails(RoutesMvcEndpoint.FORMAT_DETAILS));
verify
(
endpoint
,
times
(
1
)).
invokeRouteDetails
();
verify(endpoint, times(1)).invokeRouteDetails();
*/
}
}
\ No newline at end of file
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/ServletPathZuulProxyApplicationTests.java
View file @
5cfe0f07
...
...
@@ -19,13 +19,10 @@ package org.springframework.cloud.netflix.zuul;
import
java.net.URI
;
import
com.netflix.zuul.context.RequestContext
;
import
org.junit.After
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.test.context.SpringBootTest
;
...
...
@@ -49,6 +46,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.netflix.zuul.context.RequestContext
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
...
...
@@ -67,7 +66,7 @@ public class ServletPathZuulProxyApplicationTests {
private
DiscoveryClientRouteLocator
routes
;
@Autowired
private
Routes
Mvc
Endpoint
endpoint
;
private
RoutesEndpoint
endpoint
;
@Before
public
void
setTestRequestContext
()
{
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/SimpleZuulProxyApplicationTests.java
View file @
5cfe0f07
...
...
@@ -22,14 +22,10 @@ import java.net.URISyntaxException;
import
javax.servlet.http.HttpServletRequest
;
import
com.netflix.zuul.context.RequestContext
;
import
org.junit.After
;
import
org.junit.Before
;
import
org.junit.Ignore
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.boot.test.context.SpringBootTest
;
...
...
@@ -49,7 +45,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
com.netflix.zuul.context.RequestContext
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
...
...
@@ -69,7 +65,7 @@ public class SimpleZuulProxyApplicationTests {
private
DiscoveryClientRouteLocator
routes
;
@Autowired
private
Routes
Mvc
Endpoint
endpoint
;
private
RoutesEndpoint
endpoint
;
@Before
public
void
setTestRequestContext
()
{
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/filters/CustomHostRoutingFilterTests.java
View file @
5cfe0f07
...
...
@@ -20,21 +20,15 @@ package org.springframework.cloud.netflix.zuul.filters;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpSession
;
import
com.netflix.zuul.context.RequestContext
;
import
org.apache.http.client.config.CookieSpecs
;
import
org.apache.http.client.config.RequestConfig
;
import
org.apache.http.conn.HttpClientConnectionManager
;
import
org.apache.http.impl.client.BasicCookieStore
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.apache.http.impl.client.HttpClientBuilder
;
import
org.apache.http.impl.client.HttpClients
;
import
org.apache.http.impl.conn.PoolingHttpClientConnectionManager
;
import
org.junit.After
;
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.SpringApplication
;
...
...
@@ -43,12 +37,11 @@ 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.cloud.commons.httpclient.ApacheHttpClientConnectionManagerFactory
;
import
org.springframework.cloud.commons.httpclient.ApacheHttpClientFactory
;
import
org.springframework.cloud.commons.httpclient.DefaultApacheHttpClientFactory
;
import
org.springframework.cloud.netflix.feign.ribbon.FeignRibbonClientAutoConfiguration
;
import
org.springframework.cloud.netflix.zuul.EnableZuulProxy
;
import
org.springframework.cloud.netflix.zuul.Routes
Mvc
Endpoint
;
import
org.springframework.cloud.netflix.zuul.RoutesEndpoint
;
import
org.springframework.cloud.netflix.zuul.filters.discovery.DiscoveryClientRouteLocator
;
import
org.springframework.cloud.netflix.zuul.filters.route.SimpleHostRoutingFilter
;
import
org.springframework.context.annotation.Bean
;
...
...
@@ -68,6 +61,8 @@ import org.springframework.web.bind.annotation.RequestParam;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.client.RestTemplate
;
import
com.netflix.zuul.context.RequestContext
;
import
static
junit
.
framework
.
TestCase
.
assertFalse
;
import
static
junit
.
framework
.
TestCase
.
assertTrue
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
...
...
@@ -85,7 +80,7 @@ public class CustomHostRoutingFilterTests {
private
DiscoveryClientRouteLocator
routes
;
@Autowired
private
Routes
Mvc
Endpoint
endpoint
;
private
RoutesEndpoint
endpoint
;
@Before
public
void
setTestRequestcontext
()
{
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/filters/discovery/PatternServiceRouteMapperIntegrationTests.java
View file @
5cfe0f07
...
...
@@ -3,15 +3,10 @@ package org.springframework.cloud.netflix.zuul.filters.discovery;
import
java.util.ArrayList
;
import
java.util.List
;
import
com.netflix.loadbalancer.Server
;
import
com.netflix.loadbalancer.ServerList
;
import
com.netflix.zuul.context.RequestContext
;
import
org.junit.After
;
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.SpringApplication
;
...
...
@@ -23,7 +18,7 @@ import org.springframework.cloud.client.discovery.DiscoveryClient;
import
org.springframework.cloud.netflix.ribbon.RibbonClient
;
import
org.springframework.cloud.netflix.ribbon.StaticServerList
;
import
org.springframework.cloud.netflix.zuul.EnableZuulProxy
;
import
org.springframework.cloud.netflix.zuul.Routes
Mvc
Endpoint
;
import
org.springframework.cloud.netflix.zuul.RoutesEndpoint
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.http.HttpEntity
;
...
...
@@ -37,6 +32,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.netflix.loadbalancer.Server
;
import
com.netflix.loadbalancer.ServerList
;
import
com.netflix.zuul.context.RequestContext
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
when
;
...
...
@@ -61,7 +60,7 @@ public class PatternServiceRouteMapperIntegrationTests {
private
DiscoveryClientRouteLocator
routes
;
@Autowired
private
Routes
Mvc
Endpoint
endpoint
;
private
RoutesEndpoint
endpoint
;
@Before
public
void
setTestRequestcontext
()
{
...
...
spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/zuul/filters/route/support/ZuulProxyTestBase.java
View file @
5cfe0f07
...
...
@@ -30,17 +30,11 @@ import java.util.concurrent.atomic.AtomicBoolean;
import
javax.servlet.http.HttpServletRequest
;
import
com.netflix.loadbalancer.Server
;
import
com.netflix.loadbalancer.ServerList
;
import
com.netflix.zuul.ZuulFilter
;
import
com.netflix.zuul.context.RequestContext
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.junit.After
;
import
org.junit.Before
;
import
org.junit.Test
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.autoconfigure.web.ErrorProperties
;
...
...
@@ -48,7 +42,7 @@ import org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorContro
import
org.springframework.boot.autoconfigure.web.servlet.error.ErrorAttributes
;
import
org.springframework.boot.test.web.client.TestRestTemplate
;
import
org.springframework.cloud.netflix.ribbon.StaticServerList
;
import
org.springframework.cloud.netflix.zuul.Routes
Mvc
Endpoint
;
import
org.springframework.cloud.netflix.zuul.RoutesEndpoint
;
import
org.springframework.cloud.netflix.zuul.filters.Route
;
import
org.springframework.cloud.netflix.zuul.filters.ZuulProperties
;
import
org.springframework.cloud.netflix.zuul.filters.discovery.DiscoveryClientRouteLocator
;
...
...
@@ -78,6 +72,11 @@ import org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfigu
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
;
import
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
;
import
com.netflix.loadbalancer.Server
;
import
com.netflix.loadbalancer.ServerList
;
import
com.netflix.zuul.ZuulFilter
;
import
com.netflix.zuul.context.RequestContext
;
import
static
org
.
hamcrest
.
Matchers
.
is
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
...
...
@@ -97,7 +96,7 @@ public abstract class ZuulProxyTestBase {
protected
DiscoveryClientRouteLocator
routes
;
@Autowired
protected
Routes
Mvc
Endpoint
endpoint
;
protected
RoutesEndpoint
endpoint
;
@Autowired
protected
RibbonCommandFactory
<?>
ribbonCommandFactory
;
...
...
spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaClientAutoConfiguration.java
View file @
5cfe0f07
...
...
@@ -30,7 +30,8 @@ import java.net.URL;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.actuate.endpoint.Endpoint
;
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
;
...
...
@@ -282,10 +283,11 @@ public class EurekaClientAutoConfiguration {
}
@Configuration
@ConditionalOnClass
(
Endpoint
.
class
)
@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
);
...
...
spring-cloud-netflix-spectator/src/main/java/org/springframework/cloud/netflix/metrics/spectator/SpectatorMetricsAutoConfiguration.java
View file @
5cfe0f07
...
...
@@ -13,7 +13,7 @@
package
org
.
springframework
.
cloud
.
netflix
.
metrics
.
spectator
;
import
org.springframework.boot.actuate.autoconfigure.MetricRepositoryAutoConfiguration
;
import
org.springframework.boot.actuate.autoconfigure.
metrics.
MetricRepositoryAutoConfiguration
;
import
org.springframework.boot.actuate.endpoint.MetricReaderPublicMetrics
;
import
org.springframework.boot.actuate.metrics.CounterService
;
import
org.springframework.boot.actuate.metrics.GaugeService
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment