Package org.apache.tapestry5.test

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


        };
      }
    });
       
       
        TestableResponse response = tester.renderPageAndReturnResponse("AllRolesPage");
        if (response.getStatus() != 200) {
          fail(response.getErrorMessage());
        }
        System.err.println(response.getOutput());
       
View Full Code Here


      fail(e.getMessage());
    }
        EasyMock.expectLastCall();
       
        EasyMock.replay(MockFactory.getInstance().getMockedObjects());
        TestableResponse  resp = tester.renderPageAndReturnResponse("SecuredPage");
       
        assertEquals(200,resp.getStatus());
       
        EasyMock.verify(MockFactory.getInstance().getMockedObjects());
        EasyMock.reset(MockFactory.getInstance().getMockedObjects());
View Full Code Here

        };
      }
    });
       
       
        TestableResponse response = tester.renderPageAndReturnResponse("RolePage");
        if (response.getStatus() != 200) {
          fail(response.getErrorMessage());
        }
        assertTrue(response.getOutput().contains("Welcome guest user"));
        SecurityContextHolder.clearContext();
View Full Code Here

    String appPackage = "nu.localhost.testsite";
        String appName = "test";
        PageTester tester = new PageTester(appPackage, appName, "src/test/resources/webapp");
       
        EasyMock.replay(MockFactory.getInstance().getMockedObjects());
        TestableResponse resp = tester.renderPageAndReturnResponse("SecuredMethod");
        EasyMock.verify(MockFactory.getInstance().getMockedObjects());
        assertEquals(500,resp.getStatus()); //err not allowed!

        // login..! (wrong role)
        SecurityContextHolder.getContext().setAuthentication(new TestingAuthenticationToken("user1","user1","ROLE_DENIED"));
View Full Code Here

    @SuppressWarnings("unchecked")
    @Test
    public void cache_control_header()
    {
        PageTester tester = new PageTester("kaptcha.demo", "app");
        final TestableResponse response = tester.renderPageAndReturnResponse("KaptchaDemo");
        final List<String> headers = (List<String>) response.getHeaders("Cache-Control");
        assert "no-store, no-cache, must-revalidate".equals(headers.get(0));
        assert "post-check=0, pre-check=0".equals(headers.get(1));
    }
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.