use of jodd.madvoc.component.ActionMethodParser in project jodd by oblac.
the class ActionMethodParserTest method testDefaultMethods.
@Test
public void testDefaultMethods() {
WebApplication webapp = new WebApplication(true);
webapp.registerMadvocComponents();
ActionMethodParser actionMethodParser = webapp.getComponent(ActionMethodParser.class);
ActionConfig cfg = parse(actionMethodParser, "tst.BooAction#foo");
assertEquals("/boo.foo.html", cfg.actionPath);
cfg = parse(actionMethodParser, "tst.BooAction#view");
assertEquals("/boo.html", cfg.actionPath);
cfg = parse(actionMethodParser, "tst.BooAction#execute");
assertEquals("/boo.html", cfg.actionPath);
}
use of jodd.madvoc.component.ActionMethodParser in project jodd by oblac.
the class ActionMethodParserTest method testClassesWithPackage.
@Test
public void testClassesWithPackage() {
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.Boo1Action#foo");
assertNotNull(cfg);
assertEquals(Boo1Action.class, cfg.actionClass);
assertEquals("/tst/boo1.foo.html", cfg.actionPath);
cfg = parse(actionMethodParser, "tst.Boo2Action#foo");
assertNotNull(cfg);
assertEquals(Boo2Action.class, cfg.actionClass);
assertEquals("/tst/bbb.foo.html", cfg.actionPath);
cfg = parse(actionMethodParser, "tst.Boo2Action#foo1");
assertEquals("/tst/bbb.xxx.html", cfg.actionPath);
cfg = parse(actionMethodParser, "tst.Boo2Action#foo2");
assertEquals("/tst/bbb.foo2.xxx", cfg.actionPath);
cfg = parse(actionMethodParser, "tst.Boo2Action#foo3");
assertEquals("/tst/bbb.html", cfg.actionPath);
}
use of jodd.madvoc.component.ActionMethodParser in project jodd by oblac.
the class ActionResultTest method testAlias2.
@Test
public void testAlias2() {
WebApplication webapp = new WebApplication(true);
webapp.registerMadvocComponents();
ActionsManager actionsManager = webapp.getComponent(ActionsManager.class);
actionsManager.register(BooAction.class, "foo2");
actionsManager.registerPathAlias("/boo.foo2.xxx", "/aliased");
ResultMapper resultMapper = webapp.getComponent(ResultMapper.class);
ActionMethodParser actionMethodParser = webapp.getComponent(ActionMethodParser.class);
ActionConfig cfg = parse(actionMethodParser, "tst.BooAction#foo2");
String path = cfg.getActionPath();
String resultPath = resultMapper.resolveResultPathString(path, null);
assertEquals("/aliased", resultPath);
}
use of jodd.madvoc.component.ActionMethodParser in project jodd by oblac.
the class AnnArgTest method testDefaultMethods.
@Test
public void testDefaultMethods() {
WebApplication webapp = new WebApplication(true);
webapp.registerMadvocComponents();
ActionMethodParser actionMethodParser = webapp.getComponent(ActionMethodParser.class);
ActionConfig cfg = parse(actionMethodParser, "tst.SuperAction#add");
assertNotNull(cfg);
}
use of jodd.madvoc.component.ActionMethodParser in project jodd by oblac.
the class ActionMethodParserTest method testNoPackage.
@Test
public void testNoPackage() {
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.Boo5Action#foo");
assertNotNull(cfg);
assertEquals(Boo5Action.class, cfg.actionClass);
assertEquals("/www.foo.html", cfg.actionPath);
cfg = parse(actionMethodParser, "tst2.Boo5Action#foo1");
assertEquals("/www.xxx.html", cfg.actionPath);
cfg = parse(actionMethodParser, "tst2.Boo5Action#foo2");
assertEquals("/www.foo2.xxx", cfg.actionPath);
cfg = parse(actionMethodParser, "tst2.Boo5Action#foo3");
assertEquals("/www.html", cfg.actionPath);
}
Aggregations