Package jodd.madvoc

Examples of jodd.madvoc.WebApplication


public class MadvocParamsInjectorTest {

  @Test
  public void testInjection() {
    WebApplication webapp = new WebApplication(true);
    webapp.registerMadvocComponents();

    PetiteContainer madpc = (PetiteContainer) webapp.getComponent(WebApplication.MADVOC_CONTAINER_NAME);
    MadvocConfig madvocConfig = new MadvocConfig();

    String baseName = FooBean.class.getName();

    madpc.defineParameter("foo", "1");
View Full Code Here


public class ServletDispatcherResultTest {

  @Test
  public void testServletDispatcherLookup() throws Exception {
    WebApplication webapp = new WebApplication(true);
    webapp.registerMadvocComponents();

    final List<String> targets = new ArrayList<String>();

    ServletDispatcherResult sdr = new ServletDispatcherResult() {
      @Override
      protected boolean targetExists(ActionRequest actionRequest, String target) {
        targets.add(target);
        return false;
      }
    };

    ResultMapper resultMapper = webapp.getComponent(ResultMapper.class);
    BeanUtil.setDeclaredProperty(sdr, "resultMapper", resultMapper);

    ActionRequest actionRequest = createActionRequest("/hello.world.html");
    sdr.render(actionRequest, "ok");
View Full Code Here

    }
  }

  @Test
  public void testActionPathMacros1() {
    WebApplication webapp = new WebApplication(true);
    webapp.registerMadvocComponents();
    ActionsManager actionsManager = webapp.getComponent(ActionsManager.class);

    actionsManager.register(FooAction.class, "one", new ActionDef("/${one}"));

    ActionConfig actionConfig = actionsManager.lookup("/foo", null);
    assertNotNull(actionConfig);
View Full Code Here

    assertNull(actionConfig);
  }

  @Test
  public void testActionPathMacros2() {
    WebApplication webapp = new WebApplication(true);
    webapp.registerMadvocComponents();
    ActionsManager actionsManager = webapp.getComponent(ActionsManager.class);

    actionsManager.register(FooAction.class, "one", new ActionDef("/${one}"));
    actionsManager.register(FooAction.class, "two", new ActionDef("/xxx-${two}"));

    ActionConfig actionConfig = actionsManager.lookup("/foo", null);
View Full Code Here

  }

  @Test
  public void testActionPathMacros3() {
    WebApplication webapp = new WebApplication(true);
    webapp.registerMadvocComponents();
    ActionsManager actionsManager = webapp.getComponent(ActionsManager.class);

    actionsManager.register(FooAction.class, "one", new ActionDef("/yyy-${one}"));
    actionsManager.register(FooAction.class, "two", new ActionDef("/xxx-${two}"));

    assertEquals(2, actionsManager.getActionsCount());
View Full Code Here

    }
  }

  @Test
  public void testActionPathMacros4() {
    WebApplication webapp = new WebApplication(true);
    webapp.registerMadvocComponents();
    ActionsManager actionsManager = webapp.getComponent(ActionsManager.class);

    actionsManager.register(FooAction.class, "one", new ActionDef("/${one}"));
    actionsManager.register(FooAction.class, "one", new ActionDef("/dummy"));    // no macro
    actionsManager.register(FooAction.class, "two", new ActionDef("/${two}/${three}"));
    actionsManager.register(FooAction.class, "three", new ActionDef("/life/${three}"));
View Full Code Here

    assertNull(actionConfig);
  }

  @Test
  public void testActionPathMacrosRegexp() {
    WebApplication webapp = new WebApplication(true);
    webapp.registerMadvocComponents();
    ActionsManager actionsManager = webapp.getComponent(ActionsManager.class);

    MadvocConfig madvocConfig = webapp.getComponent(MadvocConfig.class);
    madvocConfig.setPathMacroClass(RegExpPathMacros.class);

    actionsManager.register(FooAction.class, "one", new ActionDef("/${one:[ab]+}"));

    ActionConfig actionConfig = actionsManager.lookup("/a", null);
View Full Code Here

    assertNull(actionConfig);
  }

  @Test
  public void testActionPathMacrosWildcard() {
    WebApplication webapp = new WebApplication(true);
    webapp.registerMadvocComponents();
    ActionsManager actionsManager = webapp.getComponent(ActionsManager.class);

    MadvocConfig madvocConfig = webapp.getComponent(MadvocConfig.class);
    madvocConfig.setPathMacroClass(WildcardPathMacros.class);

    actionsManager.register(FooAction.class, "one", new ActionDef("/${one:a?a}"));

    ActionConfig actionConfig = actionsManager.lookup("/aaa", null);
View Full Code Here

TOP

Related Classes of jodd.madvoc.WebApplication

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.