Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-4045

Calling wicketTester.clickLink(...) on a StatelessLink causes "PageExpiredException" with Wicket 1.5.0

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 1.5.0
    • Fix Version/s: None
    • Component/s: wicket
    • Labels:
      None
    • Environment:
      Ubuntu Linux 11.04
      Java 1.7

      Description

      When running a JUnit test and I call wicketTester.clickLink(...) on a StatlessLink in a 1.5.0 project, will cause a PageExpiredException, if I change the code back to Wicket 1.4.18 the code does NOT throw any exception and the test works as expected. This is marked BLOCKER because this bug causes all of our unit tests to fail when we migrate over to Wicket 1.5.0

      Reproduce
      1. I created a new Maven archetype project:
      mvn archetype:generate -DarchetypeGroupId=org.apache.wicket -DarchetypeArtifactId=wicket-archetype-quickstart -DarchetypeVersion=1.5.0 -DgroupId=com.mycompany -DartifactId=myproject -DarchetypeRepository=https://repository.apache.org/ -DinteractiveMode=false

      2. Add a link to HomePage.html
      <a wicket:id="clickMeLink" href="#">Click Me</a>

      3. Add a StatelessLink to HomePage.java
      add(new StatelessLink("clickMeLink") {
      @Override
      public void onClick()

      { System.out.println("Clicked!!"); setResponsePage(OtherPage.class); }

      });

      4. Add a blank OtherPage.java and OtherPage.html

      5. Add a JUnit test:

      @Test
      public void homepageRendersSuccessfully()

      { //start and render the test page tester.startPage(HomePage.class); //assert rendered page class tester.assertRenderedPage(HomePage.class); tester.clickLink("clickMeLink"); // !!!!! "PageExpiredException" with Wicket 1.5.0 tester.assertRenderedPage(OtherPage.class); }

      6. Run "mvn install"

      Results
      An Test failure occurs with:
      org.apache.wicket.protocol.http.PageExpiredException: Page expired.
      at org.apache.wicket.request.handler.PageProvider.getPageInstance(PageProvider.java:171)
      at org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.getPage(ListenerInterfaceRequestHandler.java:89)
      at org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:149)
      at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:719)
      at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:63)
      at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:210)
      at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:253)
      at org.apache.wicket.util.tester.BaseWicketTester.processRequest(BaseWicketTester.java:596)
      at org.apache.wicket.util.tester.BaseWicketTester.processRequest(BaseWicketTester.java:516)
      at org.apache.wicket.util.tester.BaseWicketTester.executeListener(BaseWicketTester.java:988)
      at org.apache.wicket.util.tester.BaseWicketTester.clickLink(BaseWicketTester.java:1795)
      at org.apache.wicket.util.tester.BaseWicketTester.clickLink(BaseWicketTester.java:1677)
      at com.mycompany.TestHomePage.homepageRendersSuccessfully(TestHomePage.java:29)

      Expected Results
      No Test failures

      Other Notes:
      If I change the link from "StatelessLink" to "Link" then the Test will succeed (although this is NOT what we want to do... we want our pages to be Stateless)

        Attachments

        1. myproject.zip
          21 kB
          Jeff Campbell

          Issue Links

            Activity

              People

              • Assignee:
                mgrigorov Martin Tzvetanov Grigorov
                Reporter:
                jeffdcamp Jeff Campbell
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: