Package de.odysseus.calyxo.base.test

Examples of de.odysseus.calyxo.base.test.TestRequest


    assertEquals("/test/action?foo=bar", mapping.getPath("/action?foo=bar"));
  }

  public void testPrefixAction() throws ConfigException {
    ControlModuleMapping mapping = new ControlModuleMapping("/test", null);
    TestRequest request = new TestRequest();
    request.setAttribute(INCLUDE_SERVLET_PATH, "/test");
    request.setAttribute(INCLUDE_PATH_INFO, "/action");
    assertEquals("/action", mapping.getAction(request));
  }
View Full Code Here


    assertEquals("/action.test?foo=bar", mapping.getPath("/action?foo=bar"));
  }

  public void testExtensionAction() throws ConfigException {
    ControlModuleMapping mapping = new ControlModuleMapping(null, ".test");
    TestRequest request = new TestRequest();
    request.setAttribute(INCLUDE_SERVLET_PATH, "/action.test");
    request.removeAttribute(INCLUDE_PATH_INFO);
    assertEquals("/action", mapping.getAction(request));
  }
View Full Code Here

    assertEquals("/action", mapping.getAction(request));
  }

  public void testPrefixExtensionAction() throws ConfigException {
    ControlModuleMapping mapping = new ControlModuleMapping("/test", ".do");
    TestRequest request = new TestRequest();
    request.setAttribute(INCLUDE_SERVLET_PATH, "/test/action.do");
    request.removeAttribute(INCLUDE_PATH_INFO);
    assertEquals("/action", mapping.getAction(request));
  }
View Full Code Here

    ControlModuleContext module = new ControlModuleContext(config, mapping, null);
    assertTrue(group.isEmpty());
    group.add(module);
    assertFalse(group.isEmpty());
    assertSame(module, group.getControlModuleContext("test"));
    TestRequest request = new TestRequest(new TestSession(module.getServletContext()));
    group.setControlModuleContext(request, module);
    assertSame(module, ModuleSupport.getInstance(context).getModuleContext(request));
    group.remove(module);
    assertTrue(group.isEmpty());
  }
View Full Code Here

  public static void main(String[] args) {
    junit.textui.TestRunner.run(DefaultI18nSupportTest.class);
  }

  public void testLocale() {
    TestRequest request = new TestRequest();
    Locale locale = new Locale("cc", "");
    DefaultI18nSupport support = new DefaultI18nSupport();
    support.setLocale(request, locale);
    assertSame(locale, support.getLocale(request));
    assertSame(locale, support.getLocale(new TestPageContext(request)));
View Full Code Here

  public DefaultDispatcherTest(String arg0) {
    super(arg0);
  }

  protected void setUp() throws ServletException {
    request = new TestRequest();
    // configure module support
    ServletContext context = request.getSession().getServletContext();
    TestModuleGroup group = TestModuleGroup.getInstance(context);
    // configure test modules
    module1 = new TestModuleContext("module1", context);
View Full Code Here

    ControlModuleGroup group = ControlModuleGroup.getInstance(context);
    DefaultModule module1 = createModule(context, "module1", "/module1/*", params);
    DefaultModule module2 = createModule(context, "module2", "/module2/*", params);
    group.add((ControlModuleContext)module1.getContext());
    group.add((ControlModuleContext)module2.getContext());
    TestRequest request = new TestRequest(new TestSession(context));
    TestResponse response = new TestResponse();

    module1.process(request, response, "/index");
    assertEquals("/module1/index.jsp", request.getRecentRequestDispatchPath());

    module2.process(request, response, "/index");
    assertEquals("/module2/index.jsp", request.getRecentRequestDispatchPath());

    module1.process(request, response, "/module2");
    assertEquals("/module2/index", request.getRecentRequestDispatchPath());

  }
View Full Code Here

    request.setAttribute("test", "request");
    assertEquals("request", map.get("requestScope.test"));
  }

  public void testParam() throws ELException {
    TestRequest request =
      (TestRequest)pageContext.getRequest();
    EvalAccessor accessor = new EvalAccessor(module);
    Map map = (Map)accessor.get(request);
    request.setParameter("test", "param");
    assertEquals("param", map.get("param.test"));
  }
View Full Code Here

  public PanelsSupportTest(String arg0) {
    super(arg0);
  }

  protected void setUp() throws ServletException, ConfigException {
    request = new TestRequest();
    // configure module container
    ServletContext context = request.getSession().getServletContext();
    TestModuleGroup group = TestModuleGroup.getInstance(context);
    // configure test module
    module = new TestModuleContext("test", context);
View Full Code Here

  public I18nSupportTest(String arg0) {
    super(arg0);
  }

  protected void setUp() throws ServletException {
    request = new TestRequest();
    ServletContext context = request.getSession().getServletContext();
    // configure test module
    module = new TestModuleContext("test", context);
    // configure module container
    TestModuleGroup group = TestModuleGroup.getInstance(context);
View Full Code Here

TOP

Related Classes of de.odysseus.calyxo.base.test.TestRequest

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.