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
cf576055
Unverified
Commit
cf576055
authored
Oct 27, 2017
by
Spencer Gibb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename potential conflicting ribbon contexts
parent
0d84e72d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
31 deletions
+30
-31
FormZuulProxyApplicationTests.java
...ork/cloud/netflix/zuul/FormZuulProxyApplicationTests.java
+12
-13
FormZuulServletProxyApplicationTests.java
...ud/netflix/zuul/FormZuulServletProxyApplicationTests.java
+8
-8
RetryableZuulProxyApplicationTests.java
...loud/netflix/zuul/RetryableZuulProxyApplicationTests.java
+5
-5
ZuulProxyApplicationTests.java
...amework/cloud/netflix/zuul/ZuulProxyApplicationTests.java
+5
-5
No files found.
spring-cloud-netflix-zuul/src/test/java/org/springframework/cloud/netflix/zuul/FormZuulProxyApplicationTests.java
View file @
cf576055
...
...
@@ -69,7 +69,7 @@ import static org.springframework.util.StreamUtils.copyToString;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@SpringBootTest
(
classes
=
FormZuulProxyApplication
.
class
,
webEnvironment
=
WebEnvironment
.
RANDOM_PORT
,
value
=
{
"zuul.routes.simple
:/simple
/**"
})
"zuul.routes.simple
fzpat:/simplefzpat
/**"
})
@DirtiesContext
public
class
FormZuulProxyApplicationTests
{
...
...
@@ -93,7 +93,7 @@ public class FormZuulProxyApplicationTests {
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
APPLICATION_FORM_URLENCODED
);
ResponseEntity
result
=
sendPost
(
"/simple/form"
,
form
,
headers
);
ResponseEntity
result
=
sendPost
(
"/simple
fzpat
/form"
,
form
,
headers
);
assertEquals
(
HttpStatus
.
OK
,
result
.
getStatusCode
());
assertEquals
(
"Posted! {foo=[bar]}"
,
result
.
getBody
());
...
...
@@ -106,7 +106,7 @@ public class FormZuulProxyApplicationTests {
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
MULTIPART_FORM_DATA
);
ResponseEntity
result
=
sendPost
(
"/simple/form"
,
form
,
headers
);
ResponseEntity
result
=
sendPost
(
"/simple
fzpat
/form"
,
form
,
headers
);
assertEquals
(
HttpStatus
.
OK
,
result
.
getStatusCode
());
assertEquals
(
"Posted! {foo=[bar]}"
,
result
.
getBody
());
...
...
@@ -125,7 +125,7 @@ public class FormZuulProxyApplicationTests {
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
MULTIPART_FORM_DATA
);
ResponseEntity
result
=
sendPost
(
"/simple/file"
,
form
,
headers
);
ResponseEntity
result
=
sendPost
(
"/simple
fzpat
/file"
,
form
,
headers
);
assertEquals
(
HttpStatus
.
OK
,
result
.
getStatusCode
());
assertEquals
(
"Posted! bar"
,
result
.
getBody
());
...
...
@@ -145,7 +145,7 @@ public class FormZuulProxyApplicationTests {
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
MULTIPART_FORM_DATA
);
ResponseEntity
result
=
sendPost
(
"/simple/fileandform"
,
form
,
headers
);
ResponseEntity
result
=
sendPost
(
"/simple
fzpat
/fileandform"
,
form
,
headers
);
assertEquals
(
HttpStatus
.
OK
,
result
.
getStatusCode
());
assertEquals
(
"Posted! bar!field!data"
,
result
.
getBody
());
...
...
@@ -162,7 +162,7 @@ public class FormZuulProxyApplicationTests {
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
MULTIPART_FORM_DATA
);
ResponseEntity
result
=
sendPost
(
"/simple/json"
,
form
,
headers
);
ResponseEntity
result
=
sendPost
(
"/simple
fzpat
/json"
,
form
,
headers
);
assertEquals
(
HttpStatus
.
OK
,
result
.
getStatusCode
());
assertEquals
(
"Posted! {foo=[bar]} as application/json"
,
result
.
getBody
());
...
...
@@ -178,7 +178,7 @@ public class FormZuulProxyApplicationTests {
headers
.
setContentType
(
MediaType
.
valueOf
(
MediaType
.
APPLICATION_FORM_URLENCODED_VALUE
+
"; charset=UTF-8"
));
ResponseEntity
result
=
sendPost
(
"/simple/form"
,
form
,
headers
);
ResponseEntity
result
=
sendPost
(
"/simple
fzpat
/form"
,
form
,
headers
);
assertEquals
(
HttpStatus
.
OK
,
result
.
getStatusCode
());
assertEquals
(
"Posted! {foo=[bar]}"
,
result
.
getBody
());
...
...
@@ -194,7 +194,7 @@ public class FormZuulProxyApplicationTests {
headers
.
setContentType
(
MediaType
.
valueOf
(
MediaType
.
APPLICATION_FORM_URLENCODED_VALUE
+
"; charset=UTF-8"
));
ResponseEntity
result
=
sendPost
(
"/simple/form?uriParam=uriValue"
,
form
,
headers
);
ResponseEntity
result
=
sendPost
(
"/simple
fzpat
/form?uriParam=uriValue"
,
form
,
headers
);
assertEquals
(
HttpStatus
.
OK
,
result
.
getStatusCode
());
assertEquals
(
"Posted! {uriParam=[uriValue], foo=[bar]}"
,
result
.
getBody
());
...
...
@@ -202,7 +202,7 @@ public class FormZuulProxyApplicationTests {
@Test
public
void
getWithUrlParams
()
throws
Exception
{
ResponseEntity
<
String
>
result
=
sendGet
(
"/simple/form?uriParam=uriValue"
);
ResponseEntity
<
String
>
result
=
sendGet
(
"/simple
fzpat
/form?uriParam=uriValue"
);
assertEquals
(
HttpStatus
.
OK
,
result
.
getStatusCode
());
assertEquals
(
"Posted! {uriParam=[uriValue]}"
,
result
.
getBody
());
...
...
@@ -225,8 +225,7 @@ public class FormZuulProxyApplicationTests {
@RestController
@EnableZuulProxy
@RibbonClients
({
@RibbonClient
(
name
=
"simple"
,
configuration
=
FormRibbonClientConfiguration
.
class
),
@RibbonClient
(
name
=
"psimple"
,
configuration
=
FormRibbonClientConfiguration
.
class
)
})
@RibbonClient
(
name
=
"simplefzpat"
,
configuration
=
FormRibbonClientConfiguration
.
class
)
})
class
FormZuulProxyApplication
{
@RequestMapping
(
value
=
"/form"
,
method
=
RequestMethod
.
POST
)
...
...
@@ -306,7 +305,7 @@ class FormZuulProxyApplication {
public
static
void
main
(
String
[]
args
)
{
new
SpringApplicationBuilder
(
FormZuulProxyApplication
.
class
)
.
properties
(
"zuul.routes.simple
:/simple
/**"
,
.
properties
(
"zuul.routes.simple
fzpat:/simplefzpat
/**"
,
"zuul.routes.direct.url:http://localhost:9999"
,
"multipart.maxFileSize:4096MB"
,
"multipart.maxRequestSize:4096MB"
)
.
run
(
args
);
...
...
@@ -314,7 +313,7 @@ class FormZuulProxyApplication {
}
// Load balancer with fixed server list for "simple" pointing to localhost
// Load balancer with fixed server list for "simple
fzpat
" pointing to localhost
@Configuration
class
FormRibbonClientConfiguration
{
...
...
spring-cloud-netflix-zuul/src/test/java/org/springframework/cloud/netflix/zuul/FormZuulServletProxyApplicationTests.java
View file @
cf576055
...
...
@@ -67,7 +67,7 @@ import static org.junit.Assert.assertEquals;
import
static
org
.
springframework
.
cloud
.
netflix
.
zuul
.
filters
.
support
.
FilterConstants
.
PRE_TYPE
;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@SpringBootTest
(
classes
=
FormZuulServletProxyApplication
.
class
,
webEnvironment
=
WebEnvironment
.
RANDOM_PORT
,
value
=
"zuul.routes.simple
:/simple
/**"
)
@SpringBootTest
(
classes
=
FormZuulServletProxyApplication
.
class
,
webEnvironment
=
WebEnvironment
.
RANDOM_PORT
,
value
=
"zuul.routes.simple
fzspat:/simplefzspat
/**"
)
@DirtiesContext
public
class
FormZuulServletProxyApplicationTests
{
...
...
@@ -91,7 +91,7 @@ public class FormZuulServletProxyApplicationTests {
form
.
set
(
"foo"
,
"bar"
);
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
APPLICATION_FORM_URLENCODED
);
ResponseEntity
<
String
>
result
=
testRestTemplate
.
exchange
(
"/zuul/simple/form"
,
ResponseEntity
<
String
>
result
=
testRestTemplate
.
exchange
(
"/zuul/simple
fzspat
/form"
,
HttpMethod
.
POST
,
new
HttpEntity
<>(
form
,
headers
),
String
.
class
);
assertEquals
(
HttpStatus
.
OK
,
result
.
getStatusCode
());
assertEquals
(
"Posted! {foo=[bar]}"
,
result
.
getBody
());
...
...
@@ -103,7 +103,7 @@ public class FormZuulServletProxyApplicationTests {
form
.
set
(
"foo"
,
"bar"
);
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
MULTIPART_FORM_DATA
);
ResponseEntity
<
String
>
result
=
testRestTemplate
.
exchange
(
"/zuul/simple/form"
,
ResponseEntity
<
String
>
result
=
testRestTemplate
.
exchange
(
"/zuul/simple
fzspat
/form"
,
HttpMethod
.
POST
,
new
HttpEntity
<>(
form
,
headers
),
String
.
class
);
assertEquals
(
HttpStatus
.
OK
,
result
.
getStatusCode
());
assertEquals
(
"Posted! {foo=[bar]}"
,
result
.
getBody
());
...
...
@@ -120,7 +120,7 @@ public class FormZuulServletProxyApplicationTests {
headers
.
setContentType
(
MediaType
.
MULTIPART_FORM_DATA
);
headers
.
set
(
"Transfer-Encoding"
,
"chunked"
);
headers
.
setContentLength
(-
1
);
ResponseEntity
<
String
>
result
=
testRestTemplate
.
exchange
(
"/zuul/simple/file"
,
ResponseEntity
<
String
>
result
=
testRestTemplate
.
exchange
(
"/zuul/simple
fzspat
/file"
,
HttpMethod
.
POST
,
new
HttpEntity
<>(
form
,
headers
),
String
.
class
);
assertEquals
(
HttpStatus
.
OK
,
result
.
getStatusCode
());
assertEquals
(
"Posted! bar"
,
result
.
getBody
());
...
...
@@ -133,7 +133,7 @@ public class FormZuulServletProxyApplicationTests {
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
valueOf
(
MediaType
.
APPLICATION_FORM_URLENCODED_VALUE
+
"; charset=UTF-8"
));
ResponseEntity
<
String
>
result
=
testRestTemplate
.
exchange
(
"/zuul/simple/form"
,
ResponseEntity
<
String
>
result
=
testRestTemplate
.
exchange
(
"/zuul/simple
fzspat
/form"
,
HttpMethod
.
POST
,
new
HttpEntity
<>(
form
,
headers
),
String
.
class
);
assertEquals
(
HttpStatus
.
OK
,
result
.
getStatusCode
());
assertEquals
(
"Posted! {foo=[bar]}"
,
result
.
getBody
());
...
...
@@ -145,7 +145,7 @@ public class FormZuulServletProxyApplicationTests {
@EnableAutoConfiguration
@RestController
@EnableZuulProxy
@RibbonClients
(
@RibbonClient
(
name
=
"simple"
,
configuration
=
ServletFormRibbonClientConfiguration
.
class
))
@RibbonClients
(
@RibbonClient
(
name
=
"simple
fzspat
"
,
configuration
=
ServletFormRibbonClientConfiguration
.
class
))
class
FormZuulServletProxyApplication
{
private
static
final
Log
log
=
LogFactory
.
getLog
(
FormZuulServletProxyApplication
.
class
);
...
...
@@ -220,7 +220,7 @@ class FormZuulServletProxyApplication {
public
static
void
main
(
String
[]
args
)
{
new
SpringApplicationBuilder
(
FormZuulProxyApplication
.
class
)
.
properties
(
"zuul.routes.simple
:/zuul/simple
/**"
,
.
properties
(
"zuul.routes.simple
fzspat:/zuul/simplefzspat
/**"
,
"zuul.routes.direct.url:http://localhost:9999"
,
"zuul.routes.direct.path:/zuul/direct/**"
,
"multipart.maxFileSize:4096MB"
,
"multipart.maxRequestSize:4096MB"
)
...
...
@@ -229,7 +229,7 @@ class FormZuulServletProxyApplication {
}
// Load balancer with fixed server list for "simple" pointing to localhost
// Load balancer with fixed server list for "simple
fzspat
" pointing to localhost
@Configuration
class
ServletFormRibbonClientConfiguration
{
...
...
spring-cloud-netflix-zuul/src/test/java/org/springframework/cloud/netflix/zuul/RetryableZuulProxyApplicationTests.java
View file @
cf576055
...
...
@@ -58,9 +58,9 @@ import static org.springframework.cloud.netflix.zuul.filters.support.FilterConst
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@SpringBootTest
(
classes
=
RetryableZuulProxyApplication
.
class
,
webEnvironment
=
WebEnvironment
.
RANDOM_PORT
,
value
=
{
"zuul.routes.simple
.path: /simple/**"
,
"zuul.routes.simple
.retryable: true"
,
"zuul.routes.simple
rzpat.path: /simplerzpat/**"
,
"zuul.routes.simplerzpat
.retryable: true"
,
"ribbon.OkToRetryOnAllOperations: true"
,
"simple.ribbon.retryableStatusCodes: 404"
})
"simple
rzpat
.ribbon.retryableStatusCodes: 404"
})
@DirtiesContext
public
class
RetryableZuulProxyApplicationTests
{
...
...
@@ -92,7 +92,7 @@ public class RetryableZuulProxyApplicationTests {
form
.
set
(
"foo"
,
"bar"
);
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
APPLICATION_FORM_URLENCODED
);
ResponseEntity
<
String
>
result
=
testRestTemplate
.
exchange
(
"/simple/poster"
,
ResponseEntity
<
String
>
result
=
testRestTemplate
.
exchange
(
"/simple
rzpat
/poster"
,
HttpMethod
.
POST
,
new
HttpEntity
<>(
form
,
headers
),
String
.
class
);
assertEquals
(
HttpStatus
.
OK
,
result
.
getStatusCode
());
assertEquals
(
"Posted! {foo=[bar]}"
,
result
.
getBody
());
...
...
@@ -105,7 +105,7 @@ public class RetryableZuulProxyApplicationTests {
@EnableAutoConfiguration
@RestController
@EnableZuulProxy
@RibbonClient
(
name
=
"simple"
,
configuration
=
RetryableRibbonClientConfiguration
.
class
)
@RibbonClient
(
name
=
"simple
rzpat
"
,
configuration
=
RetryableRibbonClientConfiguration
.
class
)
class
RetryableZuulProxyApplication
{
@RequestMapping
(
value
=
"/poster"
,
method
=
RequestMethod
.
POST
)
...
...
@@ -140,7 +140,7 @@ class RetryableZuulProxyApplication {
}
// Load balancer with fixed server list for "simple" pointing to localhost
// Load balancer with fixed server list for "simple
rzpat
" pointing to localhost
@Configuration
class
RetryableRibbonClientConfiguration
{
...
...
spring-cloud-netflix-zuul/src/test/java/org/springframework/cloud/netflix/zuul/ZuulProxyApplicationTests.java
View file @
cf576055
...
...
@@ -50,7 +50,7 @@ import static org.junit.Assert.assertEquals;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@SpringBootTest
(
classes
=
ZuulProxyApplicationTests
.
ZuulProxyApplication
.
class
,
webEnvironment
=
WebEnvironment
.
RANDOM_PORT
,
properties
=
{
"zuul.routes.simple
:/simple
/**"
,
"logging.level.org.apache.http: DEBUG"
})
"zuul.routes.simple
zpat:/simplezpat
/**"
,
"logging.level.org.apache.http: DEBUG"
})
@DirtiesContext
public
class
ZuulProxyApplicationTests
{
...
...
@@ -71,7 +71,7 @@ public class ZuulProxyApplicationTests {
@Test
public
void
getHasCorrectTransferEncoding
()
{
ResponseEntity
<
String
>
result
=
new
TestRestTemplate
().
getForEntity
(
"http://localhost:"
+
this
.
port
+
"/simple/transferencoding"
,
"http://localhost:"
+
this
.
port
+
"/simple
zpat
/transferencoding"
,
String
.
class
);
assertEquals
(
HttpStatus
.
OK
,
result
.
getStatusCode
());
assertEquals
(
"missing"
,
result
.
getBody
());
...
...
@@ -80,7 +80,7 @@ public class ZuulProxyApplicationTests {
@Test
public
void
postHasCorrectTransferEncoding
()
{
ResponseEntity
<
String
>
result
=
new
TestRestTemplate
().
postForEntity
(
"http://localhost:"
+
this
.
port
+
"/simple/transferencoding"
,
"http://localhost:"
+
this
.
port
+
"/simple
zpat
/transferencoding"
,
new
HttpEntity
<>(
"hello"
),
String
.
class
);
assertEquals
(
HttpStatus
.
OK
,
result
.
getStatusCode
());
assertEquals
(
"missing"
,
result
.
getBody
());
...
...
@@ -91,7 +91,7 @@ public class ZuulProxyApplicationTests {
@EnableAutoConfiguration
@RestController
@EnableZuulProxy
@RibbonClient
(
name
=
"simple"
,
configuration
=
TestRibbonClientConfiguration
.
class
)
@RibbonClient
(
name
=
"simple
zpat
"
,
configuration
=
TestRibbonClientConfiguration
.
class
)
static
class
ZuulProxyApplication
{
@RequestMapping
(
value
=
"/transferencoding"
,
method
=
RequestMethod
.
GET
)
...
...
@@ -115,7 +115,7 @@ public class ZuulProxyApplicationTests {
}
// Load balancer with fixed server list for "simple" pointing to localhost
// Load balancer with fixed server list for "simple
zpat
" pointing to localhost
@Configuration
static
class
TestRibbonClientConfiguration
{
...
...
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