rename potential conflicting ribbon contexts
This commit is contained in:
@@ -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.simplefzpat:/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("/simplefzpat/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("/simplefzpat/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("/simplefzpat/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("/simplefzpat/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("/simplefzpat/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("/simplefzpat/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("/simplefzpat/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("/simplefzpat/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.simplefzpat:/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 "simplefzpat" pointing to localhost
|
||||
@Configuration
|
||||
class FormRibbonClientConfiguration {
|
||||
|
||||
|
||||
@@ -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.simplefzspat:/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/simplefzspat/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/simplefzspat/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/simplefzspat/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/simplefzspat/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 = "simplefzspat", 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.simplefzspat:/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 "simplefzspat" pointing to localhost
|
||||
@Configuration
|
||||
class ServletFormRibbonClientConfiguration {
|
||||
|
||||
|
||||
@@ -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.simplerzpat.path: /simplerzpat/**", "zuul.routes.simplerzpat.retryable: true",
|
||||
"ribbon.OkToRetryOnAllOperations: true",
|
||||
"simple.ribbon.retryableStatusCodes: 404" })
|
||||
"simplerzpat.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("/simplerzpat/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 = "simplerzpat", 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 "simplerzpat" pointing to localhost
|
||||
@Configuration
|
||||
class RetryableRibbonClientConfiguration {
|
||||
|
||||
|
||||
@@ -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.simplezpat:/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 + "/simplezpat/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 + "/simplezpat/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 = "simplezpat", 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 "simplezpat" pointing to localhost
|
||||
@Configuration
|
||||
static class TestRibbonClientConfiguration {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user