Search in sources :

Example 6 with ActionMethodParser

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);
}
Also used : ActionMethodParser(jodd.madvoc.component.ActionMethodParser) Test(org.junit.Test)

Example 7 with ActionMethodParser

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);
}
Also used : MadvocConfig(jodd.madvoc.component.MadvocConfig) ActionMethodParser(jodd.madvoc.component.ActionMethodParser) Test(org.junit.Test)

Example 8 with ActionMethodParser

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);
}
Also used : ActionsManager(jodd.madvoc.component.ActionsManager) ResultMapper(jodd.madvoc.component.ResultMapper) ActionMethodParser(jodd.madvoc.component.ActionMethodParser) Test(org.junit.Test)

Example 9 with ActionMethodParser

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);
}
Also used : ActionMethodParser(jodd.madvoc.component.ActionMethodParser) Test(org.junit.Test)

Example 10 with ActionMethodParser

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);
}
Also used : MadvocConfig(jodd.madvoc.component.MadvocConfig) ActionMethodParser(jodd.madvoc.component.ActionMethodParser) Test(org.junit.Test)

Aggregations

ActionMethodParser (jodd.madvoc.component.ActionMethodParser)12 Test (org.junit.Test)12 MadvocConfig (jodd.madvoc.component.MadvocConfig)7 ActionsManager (jodd.madvoc.component.ActionsManager)2 ResultMapper (jodd.madvoc.component.ResultMapper)1