Package de.odysseus.calyxo.base.test

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


  }

  public void testPath() throws Exception {
    DefaultDispatcher dispatcher = new DefaultDispatcher(module1);
    DispatchConfig dispatch = new DynamicDispatchConfig("/path", false);
    TestResponse response = new TestResponse(false);
    dispatcher.dispatch(request, response, dispatch);
    assertEquals("/path", request.getRecentRequestDispatchPath());
    assertNull(response.getRedirectURL());
  }
View Full Code Here


  }

  public void testPathRedirect() throws Exception {
    DefaultDispatcher dispatcher = new DefaultDispatcher(module1);
    DispatchConfig dispatch = new DynamicDispatchConfig("/path", true);
    TestResponse response = new TestResponse(false);
    dispatcher.dispatch(request, response, dispatch);
    assertNull(request.getRecentRequestDispatchPath());
    assertEquals("encodeRedirect(/context/path)", response.getRedirectURL());
  }
View Full Code Here

  }

  public void testQuery() throws Exception {
    DefaultDispatcher dispatcher = new DefaultDispatcher(module1);
    DispatchConfig dispatch = new DynamicDispatchConfig("/path?foo=bar", false);
    TestResponse response = new TestResponse(false);
    dispatcher.dispatch(request, response, dispatch);
    assertEquals("/path?foo=bar", request.getRecentRequestDispatchPath());
    assertNull(response.getRedirectURL());
  }
View Full Code Here

  }

  public void testParamConfigs() throws Exception {
    DefaultDispatcher dispatcher = new DefaultDispatcher(module1);
    DynamicDispatchConfig dispatch = new DynamicDispatchConfig("/path", false);
    TestResponse response = new TestResponse(false);

    dispatch.addParam("foo", "bar");
    dispatcher.dispatch(request, response, dispatch);
    assertEquals("/path?foo=bar", request.getRecentRequestDispatchPath());
    assertNull(response.getRedirectURL());

    dispatch.addParam("foo2", "bar2");
    dispatcher.dispatch(request, response, dispatch);
    assertEquals("/path?foo=bar&foo2=bar2", request.getRecentRequestDispatchPath());
    assertNull(response.getRedirectURL());
  }
View Full Code Here

  }

  public void testQueryAndParamConfig() throws Exception {
    DefaultDispatcher dispatcher = new DefaultDispatcher(module1);
    DynamicDispatchConfig dispatch = new DynamicDispatchConfig("/path?foo=bar", false);
    TestResponse response = new TestResponse(false);

    dispatch.addParam("foo2", "bar2");
    dispatcher.dispatch(request, response, dispatch);
    assertEquals("/path?foo=bar&foo2=bar2", request.getRecentRequestDispatchPath());
    assertNull(response.getRedirectURL());
  }
View Full Code Here

  }

  public void testAnchor() throws Exception {
    DefaultDispatcher dispatcher = new DefaultDispatcher(module1);
    DispatchConfig dispatch = new DynamicDispatchConfig("/path#abc", false);
    TestResponse response = new TestResponse(false);
    dispatcher.dispatch(request, response, dispatch);
    assertEquals("/path#abc", request.getRecentRequestDispatchPath());
    assertNull(response.getRedirectURL());
  }
View Full Code Here

  }

  public void testQueryAndAnchorAndParamConfig() throws Exception {
    DefaultDispatcher dispatcher = new DefaultDispatcher(module1);
    DynamicDispatchConfig dispatch = new DynamicDispatchConfig("/path?foo=bar#abc", false);
    TestResponse response = new TestResponse(false);

    dispatch.addParam("foo2", "bar2");
    dispatcher.dispatch(request, response, dispatch);
    assertEquals("/path?foo=bar&foo2=bar2#abc", request.getRecentRequestDispatchPath());
    assertNull(response.getRedirectURL());
  }
View Full Code Here

  }

  public void testAction() throws Exception {
    DefaultDispatcher dispatcher = new DefaultDispatcher(module1);
    DispatchConfig dispatch = new DynamicDispatchConfig(null, "/action", false);
    TestResponse response = new TestResponse(false);
    dispatcher.dispatch(request, response, dispatch);
    assertEquals("/module1/action", request.getRecentRequestDispatchPath());
    assertNull(response.getRedirectURL());
  }
View Full Code Here

  }

  public void testActionRedirect() throws Exception {
    DefaultDispatcher dispatcher = new DefaultDispatcher(module1);
    DispatchConfig dispatch = new DynamicDispatchConfig(null, "/action", true);
    TestResponse response = new TestResponse(false);
    dispatcher.dispatch(request, response, dispatch);
    assertNull(request.getRecentRequestDispatchPath());
    assertEquals("encodeRedirect(/context/module1/action)", response.getRedirectURL());
  }
View Full Code Here

    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");
View Full Code Here

TOP

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

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.