use of jodd.madvoc.config.ActionRuntime in project jodd by oblac.
the class ActionMethodParserTest method testMacrosDups.
@Test
void testMacrosDups() {
WebApp webapp = new WebApp();
webapp.start();
ActionsManager actionsManager = webapp.madvocContainer().lookupComponent(ActionsManager.class);
webapp.madvocContainer().lookupComponent(RootPackages.class).addRootPackageOf(this.getClass());
actionsManager.setPathMacroClass(RegExpPathMacros.class);
actionsManager.registerAction(ReAction.class, "duplo2", null);
actionsManager.registerAction(ReAction.class, "duplo1", null);
ActionRuntime cfg = actionsManager.lookup("GET", MadvocUtil.splitPathToChunks("/re/duplo/123"));
assertNotNull(cfg);
assertEquals(ReAction.class, cfg.getActionClass());
assertEquals("/re/duplo/{id:^[0-9]+}", cfg.getActionPath());
RouteChunk chunk = cfg.getRouteChunk();
assertEquals(1, chunk.pathMacros().macrosCount());
assertEquals("id", chunk.pathMacros().names()[0]);
cfg = actionsManager.lookup("GET", MadvocUtil.splitPathToChunks("/re/duplo/aaa"));
assertNotNull(cfg);
assertEquals(ReAction.class, cfg.getActionClass());
assertEquals("/re/duplo/{sid}", cfg.getActionPath());
chunk = cfg.getRouteChunk();
assertEquals(1, chunk.pathMacros().macrosCount());
assertEquals("sid", chunk.pathMacros().names()[0]);
assertEquals(2, actionsManager.getActionsCount());
}
use of jodd.madvoc.config.ActionRuntime in project jodd by oblac.
the class ActionMethodParserTest method testDefaultMethods.
@Test
void testDefaultMethods() {
WebApp webapp = new WebApp();
webapp.start();
ActionMethodParser actionMethodParser = webapp.madvocContainer().lookupComponent(ActionMethodParser.class);
ActionRuntime cfg = parse(actionMethodParser, "fixtures.tst.BooAction#foo");
assertEquals("/boo.foo", cfg.getActionPath());
cfg = parse(actionMethodParser, "fixtures.tst.BooAction#view");
assertEquals("/boo", cfg.getActionPath());
cfg = parse(actionMethodParser, "fixtures.tst.BooAction#execute");
assertEquals("/boo", cfg.getActionPath());
}
use of jodd.madvoc.config.ActionRuntime in project jodd by oblac.
the class ActionMethodParserTest method testZqq.
@Test
void testZqq() {
WebApp webapp = new WebApp();
webapp.start();
ActionsManager actionsManager = webapp.madvocContainer().lookupComponent(ActionsManager.class);
RootPackages rootPackages = webapp.madvocContainer().lookupComponent(RootPackages.class);
rootPackages.addRootPackageOf(this.getClass());
actionsManager.registerAction(ReAction.class, "zqq1", null);
actionsManager.registerAction(ReAction.class, "zqq2", null);
ActionRuntime cfg = actionsManager.lookup("GET", MadvocUtil.splitPathToChunks("/config/dba.delete_multi.do"));
assertNotNull(cfg);
assertEquals("/{entityName}/dba.delete_multi.do", cfg.getActionPath());
}
use of jodd.madvoc.config.ActionRuntime in project jodd by oblac.
the class ActionMethodParserTest method testClasses.
@Test
void testClasses() {
WebApp webapp = new WebApp();
webapp.start();
ActionMethodParser actionMethodParser = webapp.madvocContainer().lookupComponent(ActionMethodParser.class);
ActionRuntime cfg = parse(actionMethodParser, "fixtures.tst.Boo1Action#foo");
assertNotNull(cfg);
assertEquals(Boo1Action.class, cfg.getActionClass());
assertEquals("/boo1.foo", cfg.getActionPath());
cfg = parse(actionMethodParser, "fixtures.tst.Boo2Action#foo");
assertNotNull(cfg);
assertEquals(Boo2Action.class, cfg.getActionClass());
assertEquals("/bbb.foo", cfg.getActionPath());
cfg = parse(actionMethodParser, "fixtures.tst.Boo2Action#foo1");
assertEquals("/bbb.xxx", cfg.getActionPath());
cfg = parse(actionMethodParser, "fixtures.tst.Boo2Action#foo2");
assertEquals("/bbb.foo2.xxx", cfg.getActionPath());
cfg = parse(actionMethodParser, "fixtures.tst.Boo2Action#foo3");
assertEquals("/bbb", cfg.getActionPath());
}
use of jodd.madvoc.config.ActionRuntime in project jodd by oblac.
the class ActionMethodParserTest method testPackage.
@Test
void testPackage() {
WebApp webapp = new WebApp();
webapp.start();
ActionMethodParser actionMethodParser = webapp.madvocContainer().lookupComponent(ActionMethodParser.class);
RootPackages rootPackages = webapp.madvocContainer().lookupComponent(RootPackages.class);
rootPackages.addRootPackageOf(this.getClass());
ActionRuntime cfg = parse(actionMethodParser, "fixtures.tst2.Boo4Action#foo");
assertNotNull(cfg);
assertEquals(Boo4Action.class, cfg.getActionClass());
assertEquals("/ttt/www.foo", cfg.getActionPath());
cfg = parse(actionMethodParser, "fixtures.tst2.Boo4Action#foo1");
assertEquals("/ttt/www.xxx", cfg.getActionPath());
cfg = parse(actionMethodParser, "fixtures.tst2.Boo4Action#foo2");
assertEquals("/ttt/www.foo2.xxx", cfg.getActionPath());
cfg = parse(actionMethodParser, "fixtures.tst2.Boo4Action#foo3");
assertEquals("/ttt/www", cfg.getActionPath());
}
Aggregations