use of jodd.madvoc.component.ActionMethodParser in project jodd by oblac.
the class ActionMethodParserTest method testMarkerClass.
@Test
public void testMarkerClass() {
WebApplication webapp = new WebApplication(true);
webapp.registerMadvocComponents();
ActionMethodParser actionMethodParser = webapp.getComponent(ActionMethodParser.class);
MadvocConfig madvocConfig = webapp.getComponent(MadvocConfig.class);
RootPackages rootPackages = madvocConfig.getRootPackages();
String thisPackageName = this.getClass().getPackage().getName();
assertNull(rootPackages.getPackageActionPath(thisPackageName + ".tst3"));
ActionConfig cfg = parse(actionMethodParser, "tst3.JohnAction#hello");
assertEquals("/root", rootPackages.getPackageActionPath(thisPackageName + ".tst3"));
assertEquals("/root/john.hello.html", cfg.actionPath);
cfg = parse(actionMethodParser, "tst3.JimAction#hello");
assertEquals("/my-root/jim.my-hello.html", cfg.actionPath);
assertNull(rootPackages.getPackageActionPath(thisPackageName + ".tst3.lvl1"));
cfg = parse(actionMethodParser, "tst3.lvl1.EmaAction#hello");
assertEquals("/root/lvl1/ema.hello.html", cfg.actionPath);
assertEquals("/root/lvl1", rootPackages.getPackageActionPath(thisPackageName + ".tst3.lvl1"));
assertNull(rootPackages.getPackageActionPath(thisPackageName + ".tst3.lvl2"));
cfg = parse(actionMethodParser, "tst3.lvl2.DidyAction#hello");
assertEquals("/gig/didy.hello.html", cfg.actionPath);
assertEquals("/gig", rootPackages.getPackageActionPath(thisPackageName + ".tst3.lvl2"));
}
use of jodd.madvoc.component.ActionMethodParser in project jodd by oblac.
the class ActionMethodParserTest method testMethod.
@Test
public void testMethod() {
WebApplication webapp = new WebApplication(true);
webapp.registerMadvocComponents();
ActionMethodParser actionMethodParser = webapp.getComponent(ActionMethodParser.class);
ActionConfig cfg = parse(actionMethodParser, "tst.BooAction#foo");
assertNotNull(cfg);
assertEquals(BooAction.class, cfg.actionClass);
assertEquals("/boo.foo.html", cfg.actionPath);
cfg = parse(actionMethodParser, "tst.BooAction#foo1");
assertEquals("/boo.xxx.html", cfg.actionPath);
cfg = parse(actionMethodParser, "tst.BooAction#foo2");
assertEquals("/boo.foo2.xxx", cfg.actionPath);
cfg = parse(actionMethodParser, "tst.BooAction#foo3");
assertEquals("/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);
ActionsManager actionsManager = webapp.getComponent(ActionsManager.class);
assertEquals("/xxx.html", actionsManager.lookupPathAlias("dude"));
}
Aggregations