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
d76416f0
Unverified
Commit
d76416f0
authored
Oct 04, 2017
by
Spencer Gibb
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into 2.0.x
parents
070e4b5c
6b6889b8
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
67 additions
and
20 deletions
+67
-20
spring-cloud-netflix.adoc
docs/src/main/asciidoc/spring-cloud-netflix.adoc
+1
-1
EurekaClientAutoConfigurationTests.java
...ud/netflix/eureka/EurekaClientAutoConfigurationTests.java
+7
-7
HystrixDashboardConfiguration.java
...flix/hystrix/dashboard/HystrixDashboardConfiguration.java
+9
-5
HystrixDashboardProperties.java
...netflix/hystrix/dashboard/HystrixDashboardProperties.java
+15
-1
HystrixDashboardConfigurationTests.java
...hystrix/dashboard/HystrixDashboardConfigurationTests.java
+35
-6
No files found.
docs/src/main/asciidoc/spring-cloud-netflix.adoc
View file @
d76416f0
...
...
@@ -1540,7 +1540,7 @@ This means that a serviceId "myusers-v1" will be mapped to route
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 disable by
"/myusers/{all}" (no version detected) This feature is disable
d
by
default and only applies to discovered services.
To add a prefix to all mappings, set `zuul.prefix` to a value, such as
...
...
spring-cloud-netflix-eureka-client/src/test/java/org/springframework/cloud/netflix/eureka/EurekaClientAutoConfigurationTests.java
View file @
d76416f0
...
...
@@ -22,11 +22,9 @@ import java.util.concurrent.CountDownLatch;
import
java.util.HashMap
;
import
java.util.Map
;
import
org.assertj.core.api.Assertions
;
import
org.junit.After
;
import
org.junit.Test
;
import
org.mockito.Mockito
;
import
org.springframework.aop.scope.ScopedProxyFactoryBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
;
import
org.springframework.boot.autoconfigure.condition.SearchStrategy
;
import
org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration
;
...
...
@@ -35,6 +33,7 @@ import org.springframework.boot.context.properties.source.ConfigurationPropertyS
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
;
...
...
@@ -51,6 +50,7 @@ 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
;
...
...
@@ -257,10 +257,10 @@ public class EurekaClientAutoConfigurationTests {
@Test
public
void
refreshScopedBeans
()
{
setupContext
(
RefreshAutoConfiguration
.
class
);
assert
Equals
(
ScopedProxyFactoryBean
.
class
.
getName
(),
this
.
context
.
getBeanDefinition
(
"eurekaClient"
).
getBeanClassName
()
);
assert
Equals
(
ScopedProxyFactoryBean
.
class
.
getName
(),
this
.
context
.
getBeanDefinition
(
"eurekaApplicationInfoManager"
).
getBeanClassName
()
);
assert
That
(
this
.
context
.
getBeanDefinition
(
"eurekaClient"
).
getBeanClassName
())
.
startsWith
(
GenericScope
.
class
.
getName
()+
"$LockedScopedProxyFactoryBean"
);
assert
That
(
this
.
context
.
getBeanDefinition
(
"eurekaApplicationInfoManager"
).
getBeanClassName
())
.
startsWith
(
GenericScope
.
class
.
getName
()+
"$LockedScopedProxyFactoryBean"
);
}
@Test
...
...
@@ -352,7 +352,7 @@ public class EurekaClientAutoConfigurationTests {
if
(
this
.
context
!=
null
)
{
CountDownLatch
latch
=
this
.
context
.
getBean
(
CountDownLatch
.
class
);
this
.
context
.
close
();
Assertions
.
assertThat
(
latch
.
getCount
()).
isEqualTo
(
0
);
assertThat
(
latch
.
getCount
()).
isEqualTo
(
0
);
}
}
...
...
spring-cloud-netflix-hystrix-dashboard/src/main/java/org/springframework/cloud/netflix/hystrix/dashboard/HystrixDashboardConfiguration.java
View file @
d76416f0
/*
* Copyright 2013-201
5
the original author or authors.
* Copyright 2013-201
7
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.
...
...
@@ -52,6 +52,7 @@ import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;
/**
* @author Dave Syer
* @author Roy Clarkson
* @author Fahim Farook
*/
@Configuration
@EnableConfigurationProperties
(
HystrixDashboardProperties
.
class
)
...
...
@@ -87,10 +88,13 @@ public class HystrixDashboardConfiguration {
@Bean
public
ServletRegistrationBean
proxyStreamServlet
()
{
ProxyStreamServlet
proxyStreamServlet
=
new
ProxyStreamServlet
();
proxyStreamServlet
.
setEnableIgnoreConnectionCloseHeader
(
dashboardProperties
.
isEnableIgnoreConnectionCloseHeader
());
return
new
ServletRegistrationBean
(
proxyStreamServlet
,
"/proxy.stream"
);
final
ProxyStreamServlet
proxyStreamServlet
=
new
ProxyStreamServlet
();
proxyStreamServlet
.
setEnableIgnoreConnectionCloseHeader
(
this
.
dashboardProperties
.
isEnableIgnoreConnectionCloseHeader
());
final
ServletRegistrationBean
registration
=
new
ServletRegistrationBean
(
proxyStreamServlet
,
"/proxy.stream"
);
registration
.
setInitParameters
(
this
.
dashboardProperties
.
getInitParameters
());
return
registration
;
}
@Bean
...
...
spring-cloud-netflix-hystrix-dashboard/src/main/java/org/springframework/cloud/netflix/hystrix/dashboard/HystrixDashboardProperties.java
View file @
d76416f0
/*
* Copyright 2013-201
5
the original author or authors.
* Copyright 2013-201
7
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.
...
...
@@ -15,10 +15,14 @@
*/
package
org
.
springframework
.
cloud
.
netflix
.
hystrix
.
dashboard
;
import
java.util.HashMap
;
import
java.util.Map
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
/**
* @author Roy Clarkson
* @author Fahim Farook
*/
@ConfigurationProperties
(
"hystrix.dashboard"
)
public
class
HystrixDashboardProperties
{
...
...
@@ -29,6 +33,13 @@ public class HystrixDashboardProperties {
*/
private
boolean
enableIgnoreConnectionCloseHeader
=
false
;
/**
* Initialization parameters for {@link ProxyStreamServlet}. ProxyStreamServlet itself
* is not dependent on any initialization parameters, but could be used for adding web
* container specific configurations. i.e. wl-dispatch-policy for WebLogic.
*/
private
Map
<
String
,
String
>
initParameters
=
new
HashMap
<>();
public
boolean
isEnableIgnoreConnectionCloseHeader
()
{
return
enableIgnoreConnectionCloseHeader
;
}
...
...
@@ -38,4 +49,7 @@ public class HystrixDashboardProperties {
this
.
enableIgnoreConnectionCloseHeader
=
enableIgnoreConnectionCloseHeader
;
}
public
Map
<
String
,
String
>
getInitParameters
()
{
return
this
.
initParameters
;
}
}
spring-cloud-netflix-hystrix-dashboard/src/test/java/org/springframework/cloud/netflix/hystrix/dashboard/HystrixDashboardConfigurationTests.java
View file @
d76416f0
/*
* Copyright 2013-201
5
the original author or authors.
* Copyright 2013-201
7
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.
...
...
@@ -16,22 +16,39 @@
package
org
.
springframework
.
cloud
.
netflix
.
hystrix
.
dashboard
;
import
static
org
.
hamcrest
.
Matchers
.
is
;
import
static
org
.
junit
.
Assert
.
assertNotNull
;
import
static
org
.
junit
.
Assert
.
assertNull
;
import
static
org
.
junit
.
Assert
.
assertThat
;
import
java.util.Map
;
import
org.apache.http.Header
;
import
org.apache.http.message.BasicHeader
;
import
org.junit.After
;
import
org.junit.Test
;
import
org.springframework.boot.Banner.Mode
;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
import
org.springframework.boot.web.servlet.ServletRegistrationBean
;
import
org.springframework.context.ConfigurableApplicationContext
;
import
org.springframework.mock.web.MockHttpServletResponse
;
import
org.springframework.test.util.ReflectionTestUtils
;
import
static
org
.
hamcrest
.
Matchers
.
is
;
import
static
org
.
junit
.
Assert
.
assertNull
;
import
static
org
.
junit
.
Assert
.
assertThat
;
/**
* @author Roy Clarkson
* @author Fahim Farook
*/
public
class
HystrixDashboardConfigurationTests
{
private
ConfigurableApplicationContext
context
;
@After
public
void
close
()
{
if
(
this
.
context
!=
null
)
{
this
.
context
.
close
();
}
}
@Test
public
void
normal
()
{
MockHttpServletResponse
response
=
new
MockHttpServletResponse
();
...
...
@@ -88,4 +105,16 @@ public class HystrixDashboardConfigurationTests {
assertThat
(
response
.
getHeader
(
"Connection"
),
is
(
"close"
));
}
@Test
public
void
initParameters
()
{
this
.
context
=
new
SpringApplicationBuilder
(
HystrixDashboardConfiguration
.
class
)
.
properties
(
"hystrix.dashboard.init-parameters.wl-dispatch-polixy=work-manager-hystrix"
)
.
web
(
false
).
bannerMode
(
Mode
.
OFF
).
run
();
final
ServletRegistrationBean
registration
=
this
.
context
.
getBean
(
ServletRegistrationBean
.
class
);
assertNotNull
(
registration
);
final
Map
<
String
,
String
>
initParameters
=
registration
.
getInitParameters
();
assertNotNull
(
initParameters
);
assertThat
(
initParameters
.
get
(
"wl-dispatch-polixy"
),
is
(
"work-manager-hystrix"
));
}
}
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