Package org.apache.tapestry5.test

Examples of org.apache.tapestry5.test.PageTester.renderPage()


        EasyMock.reset(MockFactory.getInstance().getMockedObjects());
        EasyMock.replay(MockFactory.getInstance().getMockedObjects());
       
       
        try {
          tester.renderPage("securedmethod");
          fail("Should not render a document");
        } catch (Exception e) {
         
        }
        EasyMock.verify(MockFactory.getInstance().getMockedObjects());
View Full Code Here


        SecurityContextHolder.getContext().setAuthentication(new TestingAuthenticationToken("user1","user1","ROLE_LOGGEDIN"));
       
        EasyMock.reset(MockFactory.getInstance().getMockedObjects());
        EasyMock.replay(MockFactory.getInstance().getMockedObjects());
       
        assertTrue(tester.renderPage("securedmethod").toString().contains("Welcome back user !"));
        EasyMock.verify(MockFactory.getInstance().getMockedObjects());
       
        assertEquals(200,resp.getStatus()); //err not allowed!
       
  }
View Full Code Here

        PageTester tester = new PageTester(appPackage, appName, "src/test/resources/webapp");
       
        EasyMock.expect(MockFactory.getInstance().getMockedServletRequest().getUserPrincipal()).andReturn(null).times(2);
       
        EasyMock.replay(MockFactory.getInstance().getMockedObjects());
        Document dom = tester.renderPage("LoggedIn");
        EasyMock.verify(MockFactory.getInstance().getMockedObjects());
       
        assertTrue(dom.toString().contains("Welcome back anonymous"));
       
        EasyMock.reset(MockFactory.getInstance().getMockedObjects());
View Full Code Here

      public String getName() {
        return "User1";
      }}).times(2);
       
        EasyMock.replay(MockFactory.getInstance().getMockedObjects());
        dom = tester.renderPage("LoggedIn");
        EasyMock.verify(MockFactory.getInstance().getMockedObjects());
        EasyMock.reset(MockFactory.getInstance().getMockedObjects());
         assertTrue(dom.toString().contains("Welcome back user"));
       
  }
View Full Code Here

    /** TAP5-901 */
    @Test
    public void override_abstract_methods() {
      PageTester tester = new PageTester(TestConstants.APP2_PACKAGE, TestConstants.APP2_NAME);
      try {
          Document doc = tester.renderPage("OverrideAbstractMethods");
          assertEquals("6", doc.getElementById("length").getChildMarkup());
      } finally {
        tester.shutdown();
      }
    }
View Full Code Here

    @Test(dataProvider = "dtd_page_provider")
    public void verify_correct_dtds(String pageName, String expectedDTD, String checkText)
    {
        PageTester tester = new PageTester(TestConstants.APP2_PACKAGE, TestConstants.APP2_NAME);

        Document doc = tester.renderPage(pageName);
        String txt = doc.toString();
        // use startsWith to make sure the DTD is getting into the right spot.
        assertTrue(txt.startsWith(expectedDTD));
        // we should also make sure that the other DTD's don't appear anywhere else...
        checkOtherDTD(txt, expectedDTD);
View Full Code Here

    @Test
    public void on_activate_chain_is_followed()
    {
        PageTester tester = new PageTester(PACKAGE, "", "src/test/app2");

        Document launchDoc = tester.renderPage("Launch");

        Map<String, String> parameters = Collections.emptyMap();

        // Submit the form, which will then skip through Intermediate and
        // arrive at Final.
View Full Code Here

    public void verify_correct_dtds(String pageName, String expectedDTD, String checkText)
    {
        String appPackage = "org.apache.tapestry5.integration.app2";
        String appName = "";
        PageTester tester = new PageTester(appPackage, appName);
        Document doc = tester.renderPage(pageName);
        String txt = doc.toString();
        // use startsWith to make sure the DTD is getting into the right spot.
        assertTrue(txt.startsWith(expectedDTD));
        // we should also make sure that the other DTD's don't appear anywhere else...
        checkOtherDTD(txt, expectedDTD);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.