use of jodd.madvoc.component.ActionMethodParser in project jodd by oblac.
the class ActionMethodParserTest method testMethodWithPackage.
@Test
public void testMethodWithPackage() {
WebApplication webapp = new WebApplication(true);
webapp.registerMadvocComponents();
ActionMethodParser actionMethodParser = webapp.getComponent(ActionMethodParser.class);
MadvocConfig madvocConfig = webapp.getComponent(MadvocConfig.class);
madvocConfig.getRootPackages().addRootPackageOf(this.getClass());
ActionConfig cfg = parse(actionMethodParser, "tst.BooAction#foo");
assertNotNull(cfg);
assertEquals(BooAction.class, cfg.actionClass);
assertEquals("/tst/boo.foo.html", cfg.actionPath);
cfg = parse(actionMethodParser, "tst.BooAction#foo1");
assertEquals("/tst/boo.xxx.html", cfg.actionPath);
cfg = parse(actionMethodParser, "tst.BooAction#foo2");
assertEquals("/tst/boo.foo2.xxx", cfg.actionPath);
cfg = parse(actionMethodParser, "tst.BooAction#foo3");
assertEquals("/tst/boo.html", cfg.actionPath);
cfg = parse(actionMethodParser, "tst.BooAction#foo4");
assertEquals("/xxx", cfg.actionPath);
assertNull(cfg.actionMethod);
cfg = parse(actionMethodParser, "tst.BooAction#foo41");
assertEquals("/xxx", cfg.actionPath);
assertEquals("DELETE", cfg.actionMethod);
cfg = parse(actionMethodParser, "tst.BooAction#foo5");
assertEquals("/xxx.html", cfg.actionPath);
assertEquals("POST", cfg.actionMethod);
cfg = parse(actionMethodParser, "tst.BooAction#foo6");
assertEquals("/tst/boo.qfoo62.html", cfg.actionPath);
cfg = parse(actionMethodParser, "tst.BooAction#foo7");
assertEquals("/foo7.html", cfg.actionPath);
}
use of jodd.madvoc.component.ActionMethodParser in project jodd by oblac.
the class ActionMethodParserTest method testEndSlashClassName.
@Test
public void testEndSlashClassName() {
WebApplication webapp = new WebApplication(true);
webapp.registerMadvocComponents();
ActionMethodParser actionMethodParser = webapp.getComponent(ActionMethodParser.class);
MadvocConfig madvocConfig = webapp.getComponent(MadvocConfig.class);
madvocConfig.getRootPackages().addRootPackageOf(this.getClass());
ActionConfig cfg = parse(actionMethodParser, "tst2.ReAction#hello");
assertNotNull(cfg);
assertEquals(ReAction.class, cfg.actionClass);
assertEquals("/re/hello.html", cfg.actionPath);
cfg = parse(actionMethodParser, "tst2.ReAction#macro");
assertNotNull(cfg);
assertEquals(ReAction.class, cfg.actionClass);
assertEquals("/re/user/${id}/macro.html", cfg.actionPath);
}
use of jodd.madvoc.component.ActionMethodParser in project jodd by oblac.
the class ActionMethodParserTest method testClasses.
@Test
public void testClasses() {
WebApplication webapp = new WebApplication(true);
webapp.registerMadvocComponents();
ActionMethodParser actionMethodParser = webapp.getComponent(ActionMethodParser.class);
ActionConfig cfg = parse(actionMethodParser, "tst.Boo1Action#foo");
assertNotNull(cfg);
assertEquals(Boo1Action.class, cfg.actionClass);
assertEquals("/boo1.foo.html", cfg.actionPath);
cfg = parse(actionMethodParser, "tst.Boo2Action#foo");
assertNotNull(cfg);
assertEquals(Boo2Action.class, cfg.actionClass);
assertEquals("/bbb.foo.html", cfg.actionPath);
cfg = parse(actionMethodParser, "tst.Boo2Action#foo1");
assertEquals("/bbb.xxx.html", cfg.actionPath);
cfg = parse(actionMethodParser, "tst.Boo2Action#foo2");
assertEquals("/bbb.foo2.xxx", cfg.actionPath);
cfg = parse(actionMethodParser, "tst.Boo2Action#foo3");
assertEquals("/bbb.html", cfg.actionPath);
}
use of jodd.madvoc.component.ActionMethodParser in project jodd by oblac.
the class ActionMethodParserTest method testPackage.
@Test
public void testPackage() {
WebApplication webapp = new WebApplication(true);
webapp.registerMadvocComponents();
ActionMethodParser actionMethodParser = webapp.getComponent(ActionMethodParser.class);
MadvocConfig madvocConfig = webapp.getComponent(MadvocConfig.class);
madvocConfig.getRootPackages().addRootPackageOf(this.getClass());
ActionConfig cfg = parse(actionMethodParser, "tst2.Boo4Action#foo");
assertNotNull(cfg);
assertEquals(Boo4Action.class, cfg.actionClass);
assertEquals("/ttt/www.foo.html", cfg.actionPath);
cfg = parse(actionMethodParser, "tst2.Boo4Action#foo1");
assertEquals("/ttt/www.xxx.html", cfg.actionPath);
cfg = parse(actionMethodParser, "tst2.Boo4Action#foo2");
assertEquals("/ttt/www.foo2.xxx", cfg.actionPath);
cfg = parse(actionMethodParser, "tst2.Boo4Action#foo3");
assertEquals("/ttt/www.html", cfg.actionPath);
}
use of jodd.madvoc.component.ActionMethodParser in project jodd by oblac.
the class ActionMethodParserTest method testClassesWithoutPackage.
@Test
public void testClassesWithoutPackage() {
WebApplication webapp = new WebApplication(true);
webapp.registerMadvocComponents();
ActionMethodParser actionMethodParser = webapp.getComponent(ActionMethodParser.class);
MadvocConfig madvocConfig = webapp.getComponent(MadvocConfig.class);
madvocConfig.getRootPackages().addRootPackageOf(this.getClass());
ActionConfig cfg = parse(actionMethodParser, "tst.Boo3Action#foo");
assertNotNull(cfg);
assertEquals(Boo3Action.class, cfg.actionClass);
assertEquals("/bbb.foo.html", cfg.actionPath);
cfg = parse(actionMethodParser, "tst.Boo3Action#foo1");
assertEquals("/bbb.xxx.html", cfg.actionPath);
cfg = parse(actionMethodParser, "tst.Boo3Action#foo2");
assertEquals("/bbb.foo2.xxx", cfg.actionPath);
cfg = parse(actionMethodParser, "tst.Boo3Action#foo3");
assertEquals("/bbb.html", cfg.actionPath);
}
Aggregations