Package org.apache.wicket.util.tester

Examples of org.apache.wicket.util.tester.WicketTester


   * @param app
   * @return WIcketTester
   */
  protected WicketTester newWicketTester(final WebApplication app)
  {
    return new WicketTester(app);
  }
View Full Code Here


   * Test case for <a href="https://issues.apache.org/jira/browse/WICKET-3719">WICKET-3719</a>
   */
  @Test
  public void ajaxUpdate()
  {
    WicketTester wicketTester = new WicketTester()
    {
      @Override
      protected IPageManagerProvider newTestPageManagerProvider()
      {
        return new IPageManagerProvider()
        {
          @Override
          public IPageManager get(IPageManagerContext context)
          {
            return new MockPageManager()
            {
              @Override
              public void touchPage(IManageablePage page)
              {
                page = WicketObjects.cloneObject(page);
                super.touchPage(page);
              }
            };
          }
        };
      }

    };

    wicketTester.startPage(TransparentWithAjaxUpdatePage.class);
    wicketTester.clickLink("link", true);
    wicketTester.destroy();
  }
View Full Code Here

   */
  @Before
  public void setUp()
  {
    application = new RedirectApplication();
    tester = new WicketTester(application);
    tester.startPage(RedirectHomePage.class);
    tester.assertRenderedPage(RedirectHomePage.class);
  }
View Full Code Here

   * @throws Exception
   */
  @Before
  public void before() throws Exception
  {
    tester = new WicketTester()
    {
      @Override
      protected Response newServletWebResponse(ServletWebRequest servletWebRequest)
      {
        return new ProblematicResponse(servletWebRequest, getResponse());
View Full Code Here

   */
  @Test
  public void callsOnFailure()
  {

    WicketTester tester = new WicketTester(new DummyApplication()
    {

      /**
       * @see org.apache.wicket.protocol.http.WebApplication#init()
       */
      @Override
      protected void init()
      {
        super.init();

        getExceptionSettings().setAjaxErrorHandlingStrategy(
          ExceptionSettings.AjaxErrorStrategy.INVOKE_FAILURE_HANDLER);
      }

    });
    tester.setExposeExceptions(false);
    tester.startPage(InternalErrorCallsAjaxOnFailurePage.class);

    tester.clickLink("failure-link", true);

    MockHttpServletResponse errorPageResponse = tester.getLastResponse();
    assertEquals(500, errorPageResponse.getStatus());

    // assert that the original page is still the last rendered one
    tester.assertRenderedPage(InternalErrorCallsAjaxOnFailurePage.class);
    tester.destroy();
  }
View Full Code Here

   * @throws Exception
   */
  @Test
  public void testRenderPage13() throws Exception
  {
    tester = new WicketTester(new MockApplication()
    {
      @Override
      protected void init()
      {
        super.init();
View Full Code Here

   */
  @Before
  public void before()
  {
    final IAuthorizationStrategy strategy = new CustomStrategy();
    tester = new WicketTester(new MockApplication()
    {
      @Override
      public Session newSession(Request request, Response response)
      {
        return new WebSession(request)
View Full Code Here

@Category(SlowTests.class)
public class ComponentQueueingPerformanceTest extends WicketTestCase
{
  private void run(Class<? extends Page> pageClass)
  {
    WicketTester tester = new WicketTester(new MockApplication());
    try
    {
      tester.startPage(pageClass);
    }
    finally
    {
      tester.destroy();
    }
  }
View Full Code Here

  }

  @Test
  public void testUrlVersionStoredInRequestCycle()
  {
    WicketTester tester = new WicketTester();
    tester.getApplication().getResourceSettings().setCachingStrategy(strategy);

    try
    {
      PageParameters urlParameters = new PageParameters();
      urlParameters.add(versionParameter, "9A0364B9E99BB480DD25E1F0284C8555", INamedParameters.Type.QUERY_STRING);
      ResourceUrl resourceUrl = new ResourceUrl("some-resource.txt", urlParameters);
      strategy.undecorateUrl(resourceUrl);

      String version = tester.getRequestCycle().getMetaData(IResourceCachingStrategy.URL_VERSION);

      assertEquals("9A0364B9E99BB480DD25E1F0284C8555", version);
    }
    finally
    {
      tester.destroy();
    }
  }
View Full Code Here

public class MockHttpServletRequestTest extends WicketTestCase
{
  @Test
  public void setAbsoluteUrlWithHost()
  {
    WicketTester tester = new WicketTester();
    MockHttpServletRequest request = tester.getRequest();
    assertEquals("http", request.getScheme());
    assertEquals("localhost", request.getServerName());
    assertEquals(80, request.getServerPort());

    request.setURL("https://myhost.mydomain.org:1234/foo/bar/baz.html?a=123&b=456");
View Full Code Here

TOP

Related Classes of org.apache.wicket.util.tester.WicketTester

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.