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
07c4604c
Unverified
Commit
07c4604c
authored
Nov 28, 2017
by
Spencer Gibb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish test
parent
ef755f3a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
LazyLoadOfZuulConfigurationTests.java
.../zuul/filters/route/LazyLoadOfZuulConfigurationTests.java
+13
-13
No files found.
spring-cloud-netflix-zuul/src/test/java/org/springframework/cloud/netflix/zuul/filters/route/LazyLoadOfZuulConfigurationTests.java
View file @
07c4604c
...
...
@@ -18,18 +18,13 @@ package org.springframework.cloud.netflix.zuul.filters.route;
import
java.util.concurrent.atomic.AtomicInteger
;
import
com.netflix.loadbalancer.Server
;
import
com.netflix.loadbalancer.ServerList
;
import
com.netflix.zuul.context.RequestContext
;
import
org.junit.After
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Value
;
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.netflix.ribbon.RibbonClient
;
import
org.springframework.cloud.netflix.ribbon.RibbonClients
;
import
org.springframework.cloud.netflix.ribbon.StaticServerList
;
...
...
@@ -43,15 +38,20 @@ import org.springframework.test.context.junit4.SpringRunner;
import
org.springframework.web.bind.annotation.RequestMapping
;
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
.
assertj
.
core
.
api
.
Assertions
.
assertThat
;
import
static
org
.
springframework
.
boot
.
test
.
context
.
SpringBootTest
.
WebEnvironment
.
RANDOM_PORT
;
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
(
webEnvironment
=
SpringBootTest
.
WebEnvironment
.
RANDOM_PORT
,
value
=
{
"zuul.routes.myroute.service-id=
eager"
,
"zuul.routes.myroute.path=/eager
/**"
})
@SpringBootTest
(
webEnvironment
=
RANDOM_PORT
,
value
=
{
"zuul.routes.myroute.service-id=
lazy"
,
"zuul.routes.myroute.path=/lazy
/**"
})
@DirtiesContext
public
class
LazyLoadOfZuulConfigurationTests
{
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
protected
int
port
;
@After
...
...
@@ -60,11 +60,11 @@ public class LazyLoadOfZuulConfigurationTests {
}
@Test
public
void
test
Eager
Loading
()
{
public
void
test
Lazy
Loading
()
{
// Child context FooConfig should be lazily created..
assertThat
(
Foo
.
getInstanceCount
()).
isEqualTo
(
0
);
String
uri
=
String
.
format
(
"http://localhost:%d/
eager
/sample"
,
this
.
port
);
String
uri
=
String
.
format
(
"http://localhost:%d/
lazy
/sample"
,
this
.
port
);
ResponseEntity
<
String
>
result
=
new
TestRestTemplate
().
getForEntity
(
uri
,
String
.
class
);
...
...
@@ -79,7 +79,7 @@ public class LazyLoadOfZuulConfigurationTests {
@EnableAutoConfiguration
@Configuration
@EnableZuulProxy
@RibbonClients
(
@RibbonClient
(
name
=
"
eager
"
,
configuration
=
FooConfig
.
class
))
@RibbonClients
(
@RibbonClient
(
name
=
"
lazy
"
,
configuration
=
FooConfig
.
class
))
static
class
TestConfig
{
}
...
...
@@ -103,7 +103,7 @@ public class LazyLoadOfZuulConfigurationTests {
return
new
Foo
();
}
@
Value
(
"${local.server.port}"
)
@
LocalServerPort
private
int
port
;
@Bean
...
...
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