use of jodd.madvoc.component.RootPackages in project jodd by oblac.
the class ActionMethodParserTest method testClassesWithoutPackage.
@Test
void testClassesWithoutPackage() {
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.tst.Boo3Action#foo");
assertNotNull(cfg);
assertEquals(Boo3Action.class, cfg.getActionClass());
assertEquals("/bbb.foo", cfg.getActionPath());
cfg = parse(actionMethodParser, "fixtures.tst.Boo3Action#foo1");
assertEquals("/bbb.xxx", cfg.getActionPath());
cfg = parse(actionMethodParser, "fixtures.tst.Boo3Action#foo2");
assertEquals("/bbb.foo2.xxx", cfg.getActionPath());
cfg = parse(actionMethodParser, "fixtures.tst.Boo3Action#foo3");
assertEquals("/bbb", cfg.getActionPath());
}
use of jodd.madvoc.component.RootPackages in project jodd by oblac.
the class ActionMethodParserTest method testEndSlashClassName.
@Test
void testEndSlashClassName() {
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.ReAction#hello");
assertNotNull(cfg);
assertEquals(ReAction.class, cfg.getActionClass());
assertEquals("/re/hello", cfg.getActionPath());
cfg = parse(actionMethodParser, "fixtures.tst2.ReAction#macro");
assertNotNull(cfg);
assertEquals(ReAction.class, cfg.getActionClass());
assertEquals("/re/user/{id}/macro", cfg.getActionPath());
}
use of jodd.madvoc.component.RootPackages in project jodd by oblac.
the class ActionMethodParserTest method testClassesWithPackage.
@Test
void testClassesWithPackage() {
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.tst.Boo1Action#foo");
assertNotNull(cfg);
assertEquals(Boo1Action.class, cfg.getActionClass());
assertEquals("/fixtures/tst/boo1.foo", cfg.getActionPath());
cfg = parse(actionMethodParser, "fixtures.tst.Boo2Action#foo");
assertNotNull(cfg);
assertEquals(Boo2Action.class, cfg.getActionClass());
assertEquals("/fixtures/tst/bbb.foo", cfg.getActionPath());
cfg = parse(actionMethodParser, "fixtures.tst.Boo2Action#foo1");
assertEquals("/fixtures/tst/bbb.xxx", cfg.getActionPath());
cfg = parse(actionMethodParser, "fixtures.tst.Boo2Action#foo2");
assertEquals("/fixtures/tst/bbb.foo2.xxx", cfg.getActionPath());
cfg = parse(actionMethodParser, "fixtures.tst.Boo2Action#foo3");
assertEquals("/fixtures/tst/bbb", cfg.getActionPath());
}
use of jodd.madvoc.component.RootPackages 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.component.RootPackages 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