actionRuntime -> actionRuntime.getActionPath() + ' ' + actionRuntime.getActionMethod())) .forEach(ar -> { final String actionMethod = ar.getActionMethod(); actionRuntime -> actionRuntime.getActionPath() + ' ' + actionRuntime.getActionMethod())) .forEach(ar -> {
/** * Registers manually created {@link ActionRuntime action runtime configurations}. * Optionally, if action path with the same name already exist, * exception will be thrown. */ public ActionRuntime registerActionRuntime(final ActionRuntime actionRuntime) { final String actionPath = actionRuntime.getActionPath(); final String method = actionRuntime.getActionMethod(); log.debug(() -> "Madvoc action: " + ifNotNull(method, m -> m + " ") + actionRuntime.getActionPath() + " => " + actionRuntime.createActionString()); final RouteChunk routeChunk = routes.registerPath(method, actionPath); if (routeChunk.value() != null) { // existing chunk if (detectDuplicatePathsEnabled) { throw new MadvocException("Duplicate action path for [" + actionRuntime + "] occupied by: [" + routeChunk.value() + "]"); } } else { actionsCount++; } routeChunk.bind(actionRuntime); // finally runtimes.put(actionRuntime.createActionString(), actionRuntime); // async check if (actionRuntime.isAsync()) { asyncMode = true; } return actionRuntime; }
assertNull(cfg.getActionMethod()); assertEquals("DELETE", cfg.getActionMethod()); assertEquals("POST", cfg.getActionMethod());
@Test void testMethod() { WebApp webapp = new WebApp(); webapp.start(); ActionMethodParser actionMethodParser = webapp.madvocContainer().lookupComponent(ActionMethodParser.class); ActionRuntime cfg = parse(actionMethodParser, "fixtures.tst.BooAction#foo"); assertNotNull(cfg); assertEquals(BooAction.class, cfg.getActionClass()); assertEquals("/boo.foo", cfg.getActionPath()); cfg = parse(actionMethodParser, "fixtures.tst.BooAction#foo1"); assertEquals("/boo.xxx", cfg.getActionPath()); cfg = parse(actionMethodParser, "fixtures.tst.BooAction#foo2"); assertEquals("/boo.foo2.xxx", cfg.getActionPath()); cfg = parse(actionMethodParser, "fixtures.tst.BooAction#foo3"); assertEquals("/boo", cfg.getActionPath()); cfg = parse(actionMethodParser, "fixtures.tst.BooAction#foo4"); assertEquals("/xxx", cfg.getActionPath()); assertNull(cfg.getActionMethod()); cfg = parse(actionMethodParser, "fixtures.tst.BooAction#foo41"); assertEquals("/xxx", cfg.getActionPath()); assertEquals("DELETE", cfg.getActionMethod()); cfg = parse(actionMethodParser, "fixtures.tst.BooAction#foo5"); assertEquals("/xxx.html", cfg.getActionPath()); assertEquals("POST", cfg.getActionMethod()); ActionsManager actionsManager = webapp.madvocContainer().lookupComponent(ActionsManager.class); assertEquals("/xxx.html", actionsManager.lookupPathAlias("dude")); }
assertEquals(ReAction.class, cfg.getActionClass()); assertEquals("/re/wild{id}dog", cfg.getActionPath()); assertEquals("POST", cfg.getActionMethod()); chunk = cfg.getRouteChunk(); assertEquals(1, chunk.pathMacros().macrosCount());
assertEquals(ReAction.class, cfg.getActionClass()); assertEquals("/re/users/{id}/macro3", cfg.getActionPath()); assertEquals("POST", cfg.getActionMethod()); chunk = cfg.getRouteChunk(); assertNull(chunk.pathMacros());
actionRuntime -> actionRuntime.getActionPath() + ' ' + actionRuntime.getActionMethod())) .forEach(ar -> { final String actionMethod = ar.getActionMethod(); actionRuntime -> actionRuntime.getActionPath() + ' ' + actionRuntime.getActionMethod())) .forEach(ar -> {