Commit f79166cb by Spencer Gibb

fixed test broken by change in functionality in ZuulHandlerMapping.reset

parent c0903c5a
......@@ -46,7 +46,7 @@ public class ZuulHandlerMapping extends AbstractUrlHandlerMapping implements
registerHandlers(routeLocator.getRoutes());
}
private void registerHandlers(Map<String, String> routes) {
protected void registerHandlers(Map<String, String> routes) {
if (routes.isEmpty()) {
logger.warn("Neither 'urlMap' nor 'mappings' set on SimpleUrlHandlerMapping");
}
......
package org.springframework.cloud.netflix.zuul.sample;
package org.springframework.cloud.netflix.zuul;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
......@@ -12,7 +11,7 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@EnableZuulProxy
@EnableEurekaClient
public class ZuulProxyApplication {
public class SampleZuulProxyApplication {
@RequestMapping("/testing123")
public String testing123() {
......@@ -35,7 +34,7 @@ public class ZuulProxyApplication {
}
public static void main(String[] args) {
SpringApplication.run(ZuulProxyApplication.class, args);
SpringApplication.run(SampleZuulProxyApplication.class, args);
}
}
package org.springframework.cloud.netflix.zuul.sample;
package org.springframework.cloud.netflix.zuul;
import static org.junit.Assert.assertEquals;
......@@ -9,8 +9,6 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.IntegrationTest;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.TestRestTemplate;
import org.springframework.cloud.netflix.zuul.RouteLocator;
import org.springframework.cloud.netflix.zuul.ZuulHandlerMapping;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
......@@ -19,10 +17,10 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = ZuulProxyApplication.class)
@SpringApplicationConfiguration(classes = SampleZuulProxyApplication.class)
@WebAppConfiguration
@IntegrationTest("server.port=0")
public class ZuulProxyApplicationTests {
public class SampleZuulProxyApplicationTests {
@Value("${local.server.port}")
private int port;
......@@ -36,7 +34,7 @@ public class ZuulProxyApplicationTests {
@Test
public void deleteOnSelf() {
routes.getRoutes().put("/self/**", "http://localhost:" + port + "/local");
mapping.reset();
mapping.registerHandlers(routes.getRoutes());
ResponseEntity<String> result = new TestRestTemplate().exchange("http://localhost:" + port + "/self/1",
HttpMethod.DELETE, new HttpEntity<Void>((Void) null), String.class);
assertEquals(HttpStatus.OK, result.getStatusCode());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment