public void assertRoutes(Iterable<Route> expected, String path) { Iterator<RouteMatch> matches = matcher(path, Collections.<String, String[]>emptyMap()); List<Route> routes = new ArrayList<Route>(); while (matches.hasNext()) { routes.add(matches.next().getRoute()); } AbstractTestCase.assertEquals(expected, routes); }
public void assertRoutes(Iterable<Route> expected, String path) { Iterator<RouteMatch> matches = matcher(path, Collections.<String, String[]>emptyMap()); List<Route> routes = new ArrayList<Route>(); while (matches.hasNext()) { routes.add(matches.next().getRoute()); } AbstractTestCase.assertEquals(expected, routes); }
public Map<String, String> assertRoute(Route expectedRoute, String path, Map<String, String> parameters) { // HashMap<String, String[]> tmp = new HashMap<String, String[]>(); for (Map.Entry<String, String> entry : parameters.entrySet()) { tmp.put(entry.getKey(), new String[]{entry.getValue()}); } // Iterator<RouteMatch> result = matcher(path, tmp); // Assert.assertTrue(result.hasNext()); RouteMatch match = result.next(); Assert.assertSame(expectedRoute, match.getRoute()); // Map<String, String> ret = new HashMap<String, String>(); for (Map.Entry<PathParam, String> entry : match.getMatched().entrySet()) { ret.put(entry.getKey().getName(), entry.getValue()); } // return ret; }
public Map<String, String> assertRoute(Route expectedRoute, String path, Map<String, String> parameters) { // HashMap<String, String[]> tmp = new HashMap<String, String[]>(); for (Map.Entry<String, String> entry : parameters.entrySet()) { tmp.put(entry.getKey(), new String[]{entry.getValue()}); } // Iterator<RouteMatch> result = matcher(path, tmp); // Assert.assertTrue(result.hasNext()); RouteMatch match = result.next(); Assert.assertSame(expectedRoute, match.getRoute()); // Map<String, String> ret = new HashMap<String, String>(); for (Map.Entry<PathParam, String> entry : match.getMatched().entrySet()) { ret.put(entry.getKey().getName(), entry.getValue()); } // return ret; }
RouteDescriptor routeDesc = getMethods(match.getRoute()); if (routeDesc != null) { ControllerHandler target = this.bridge.getApplication().resolveBean(ControllerService.class).getDescriptor().getMethodByHandle(routeDesc.handle);
RouteDescriptor routeDesc = getMethods(match.getRoute()); if (routeDesc != null) { ControllerHandler target = this.bridge.getApplication().resolveBean(ControllerService.class).getDescriptor().getMethodByHandle(routeDesc.handle);
@Test public void testClear() throws Exception { Router router = new Router(); Route foo = router.append("/foo"); RouteMatch match = router.route("/foo"); assertNotNull(match); assertSame(foo, match.getRoute()); Route bar = foo.append("/bar"); // /*RouteMatch*/ match = router.route("/foo/bar"); assertNotNull(match); assertSame(bar, match.getRoute()); // foo.clearChildren(); match = router.route("/foo/bar"); assertNull(match); match = router.route("/foo"); assertNotNull(match); assertSame(foo, match.getRoute()); }
@Test public void testClear() throws Exception { Router router = new Router(); Route foo = router.append("/foo"); RouteMatch match = router.route("/foo"); assertNotNull(match); assertSame(foo, match.getRoute()); Route bar = foo.append("/bar"); // /*RouteMatch*/ match = router.route("/foo/bar"); assertNotNull(match); assertSame(bar, match.getRoute()); // foo.clearChildren(); match = router.route("/foo/bar"); assertNull(match); match = router.route("/foo"); assertNotNull(match); assertSame(foo, match.getRoute()); }