Commit 45e9a620 by Spencer Gibb

Merge branch 'master' of github.com:jlouns/spring-cloud-netflix into jlouns-master

parents 5964d160 51f7dbd7
......@@ -121,10 +121,10 @@ public class ProxyRouteLocator {
}
if (routesMap.get(DEFAULT_ROUTE) != null) {
String defaultServiceId = routesMap.get(DEFAULT_ROUTE).getServiceId();
ZuulRoute defaultRoute = routesMap.get(DEFAULT_ROUTE);
// Move the defaultServiceId to the end
routesMap.remove(DEFAULT_ROUTE);
routesMap.put(DEFAULT_ROUTE, new ZuulRoute(defaultServiceId));
routesMap.put(DEFAULT_ROUTE, defaultRoute);
}
LinkedHashMap<String, ZuulRoute> values = new LinkedHashMap<>();
......
......@@ -144,6 +144,30 @@ public class ProxyRouteLocatorTests {
}
@Test
public void testGetDefaultRoute() {
ProxyRouteLocator routeLocator = new ProxyRouteLocator(this.discovery, this.properties);
this.properties.getRoutes().put(ASERVICE, new ZuulRoute("/", ASERVICE));
Map<String, String> routesMap = routeLocator.getRoutes();
assertNotNull("routesMap was null", routesMap);
assertFalse("routesMap was empty", routesMap.isEmpty());
assertDefaultMapping(routesMap, ASERVICE);
}
@Test
public void testGetDefaultPhysicalRoute() {
ProxyRouteLocator routeLocator = new ProxyRouteLocator(this.discovery, this.properties);
this.properties.getRoutes().put(ASERVICE, new ZuulRoute("/", "http://" + ASERVICE));
Map<String, String> routesMap = routeLocator.getRoutes();
assertNotNull("routesMap was null", routesMap);
assertFalse("routesMap was empty", routesMap.isEmpty());
assertDefaultMapping(routesMap, "http://" + ASERVICE);
}
@Test
public void testIgnoreRoutes() {
ProxyRouteLocator routeLocator = new ProxyRouteLocator(this.discovery, this.properties);
this.properties.setIgnoredServices(Lists.newArrayList(IGNOREDSERVICE));
......@@ -199,4 +223,11 @@ public class ProxyRouteLocatorTests {
private String getMapping(String serviceId) {
return "/" + serviceId + "/**";
}
protected void assertDefaultMapping(Map<String, String> routesMap, String expectedRoute) {
String mapping = "/";
String route = routesMap.get(mapping);
assertEquals("routesMap had wrong value for " + mapping, expectedRoute,
route);
}
}
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