Search in sources :

Example 1 with RootPackages

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

Example 2 with RootPackages

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

Example 3 with RootPackages

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

Example 4 with RootPackages

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());
}
Also used : ActionsManager(jodd.madvoc.component.ActionsManager) RootPackages(jodd.madvoc.component.RootPackages) ActionRuntime(jodd.madvoc.config.ActionRuntime) Test(org.junit.jupiter.api.Test)

Example 5 with RootPackages

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

Aggregations

RootPackages (jodd.madvoc.component.RootPackages)12 Test (org.junit.jupiter.api.Test)12 ActionRuntime (jodd.madvoc.config.ActionRuntime)9 ActionMethodParser (jodd.madvoc.component.ActionMethodParser)6 ActionsManager (jodd.madvoc.component.ActionsManager)3 RouteChunk (jodd.madvoc.config.RouteChunk)2