use of jodd.madvoc.config.ActionRuntime in project jodd by oblac.
the class ActionRequestRecursionTest method createMyActionRequest.
private MyActionRequest createMyActionRequest(ActionFilter[] actionFilters, ActionInterceptor[] actionInterceptors) {
SimpleMadvocController madvocController = new SimpleMadvocController();
Action action = new Action();
ActionRuntime actionRuntime = new ActionRuntime(null, Action.class, ClassUtil.findMethod(Action.class, "view"), actionFilters, actionInterceptors, new ActionDefinition("path", "method"), ServletDispatcherActionResult.class, null, false, false, null, null);
return new MyActionRequest(madvocController, "actionPath", actionRuntime, action, null, null);
}
use of jodd.madvoc.config.ActionRuntime in project jodd by oblac.
the class ManualRegistrationTest method testManualAction_asArgument.
@Test
void testManualAction_asArgument() {
WebApp webApp = WebApp.createWebApp().start(madvoc -> madvoc.route().path("/hello").mapTo(BooAction.class, "foo1").bind().route().path("/world").mapTo(BooAction.class, "foo2").interceptBy(EchoInterceptor.class).bind().interceptor(EchoInterceptor.class, i -> i.setPrefixIn("====> ")));
ActionsManager actionsManager = webApp.madvocContainer().requestComponent(ActionsManager.class);
assertEquals(2, actionsManager.getActionsCount());
ActionRuntime actionRuntime = actionsManager.lookup("GET", MadvocUtil.splitPathToChunks("/hello"));
assertNotNull(actionRuntime);
assertEquals(BooAction.class, actionRuntime.getActionClass());
assertEquals("foo1", actionRuntime.getActionClassMethod().getName());
actionRuntime = actionsManager.lookup("GET", MadvocUtil.splitPathToChunks("/world"));
assertNotNull(actionRuntime);
assertEquals(BooAction.class, actionRuntime.getActionClass());
assertEquals("foo2", actionRuntime.getActionClassMethod().getName());
}
use of jodd.madvoc.config.ActionRuntime in project jodd by oblac.
the class ActionsManagerTest method testActionPathMacros_679.
@Test
void testActionPathMacros_679() {
WebApp webapp = new WebApp();
webapp.start();
ActionsManager actionsManager = webapp.madvocContainer().lookupComponent(ActionsManager.class);
actionsManager.setPathMacroClass(RegExpPathMacros.class);
ActionRuntime a1 = actionsManager.registerAction(FooAction.class, "one", new ActionDefinition("/hello/{id}"));
ActionRuntime a2 = actionsManager.registerAction(FooAction.class, "two", new ActionDefinition("/hello/default"));
ActionRuntime actionRuntime = actionsManager.routes.lookup(null, MadvocUtil.splitPathToChunks("/hello/123"));
assertSame(a1, actionRuntime);
actionRuntime = actionsManager.routes.lookup(null, MadvocUtil.splitPathToChunks("/hello/default"));
assertSame(a2, actionRuntime);
}
use of jodd.madvoc.config.ActionRuntime in project jodd by oblac.
the class ActionsManagerTest method testActionPathMacrosWildcard.
@Test
void testActionPathMacrosWildcard() {
WebApp webapp = new WebApp();
webapp.start();
ActionsManager actionsManager = webapp.madvocContainer().lookupComponent(ActionsManager.class);
actionsManager.setPathMacroClass(WildcardPathMacros.class);
actionsManager.registerAction(FooAction.class, "one", new ActionDefinition("/{one:a?a}"));
ActionRuntime actionRuntime = actionsManager.routes.lookup(null, MadvocUtil.splitPathToChunks("/aaa"));
assertNotNull(actionRuntime);
actionRuntime = actionsManager.routes.lookup(null, MadvocUtil.splitPathToChunks("/aab"));
assertNull(actionRuntime);
}
use of jodd.madvoc.config.ActionRuntime in project jodd by oblac.
the class ActionsManagerTest method testActionPathMacros1.
@Test
void testActionPathMacros1() {
WebApp webapp = new WebApp();
webapp.start();
ActionsManager actionsManager = webapp.madvocContainer().lookupComponent(ActionsManager.class);
actionsManager.registerAction(FooAction.class, "one", new ActionDefinition("/{one}"));
ActionRuntime actionRuntime = actionsManager.routes.lookup(null, MadvocUtil.splitPathToChunks("/foo"));
assertNotNull(actionRuntime);
actionRuntime = actionsManager.routes.lookup(null, MadvocUtil.splitPathToChunks("/foo/boo"));
assertNull(actionRuntime);
actionRuntime = actionsManager.routes.lookup(null, MadvocUtil.splitPathToChunks("/foo/boo/zoo"));
assertNull(actionRuntime);
}
Aggregations