use of com.gargoylesoftware.htmlunit.html.HtmlPage in project javaee7-samples by javaee-samples.
the class LoginServletTest method testUnauthenticatedRequest.
@Test
public void testUnauthenticatedRequest() throws IOException, SAXException {
HtmlPage page = webClient.getPage(base + "/LoginServlet");
String responseText = page.asText();
System.out.println("testUnauthenticatedRequest:\n" + responseText + "\n");
assertTrue(responseText.contains("isUserInRole?false"));
assertTrue(responseText.contains("getRemoteUser?null"));
assertTrue(responseText.contains("getUserPrincipal?null"));
assertTrue(responseText.contains("getAuthType?null"));
}
use of com.gargoylesoftware.htmlunit.html.HtmlPage in project javaee7-samples by javaee-samples.
the class EventListenerTest method testRequestAttributeListener.
@Test
public void testRequestAttributeListener() throws IOException {
HtmlPage page = webClient.getPage(base + "TestServlet");
assertTrue(page.asText().contains("MyServletRequestAttributeListener.attributeAdded: attribute1"));
assertTrue(page.asText().contains("MyServletRequestAttributeListener.attributeReplaced: attribute1"));
assertTrue(page.asText().contains("MyServletRequestAttributeListener.attributeRemoved: attribute1"));
}
use of com.gargoylesoftware.htmlunit.html.HtmlPage in project javaee7-samples by javaee-samples.
the class EventListenerTest method testContextAttributeListener.
@Test
public void testContextAttributeListener() throws IOException {
HtmlPage page = webClient.getPage(base + "TestServlet");
System.out.println(page.asText());
assertTrue(page.asText().contains("MyContextAttributeListener.attributeAdded: attribute1"));
assertTrue(page.asText().contains("MyContextAttributeListener.attributeReplaced: attribute1"));
assertTrue(page.asText().contains("MyContextAttributeListener.attributeRemoved: attribute1"));
}
use of com.gargoylesoftware.htmlunit.html.HtmlPage in project javaee7-samples by javaee-samples.
the class EventListenerTest method testSessionListener.
@Test
public void testSessionListener() throws IOException {
HtmlPage page = webClient.getPage(base + "TestServlet");
assertTrue(page.asText().contains("MySessionListener.sessionCreated:"));
assertTrue(page.asText().contains("MySessionListener.sessionDestroyed:"));
}
use of com.gargoylesoftware.htmlunit.html.HtmlPage in project javaee7-samples by javaee-samples.
the class EventListenerTest method testSessionAttributeListener.
@Test
public void testSessionAttributeListener() throws IOException {
HtmlPage page = webClient.getPage(base + "TestServlet");
assertTrue(page.asText().contains("MyHttpSessionAttributeListener.attributeAdded: attribute1"));
assertTrue(page.asText().contains("MyHttpSessionAttributeListener.attributeReplaced: attribute1"));
assertTrue(page.asText().contains("MyHttpSessionAttributeListener.attributeRemoved: attribute1"));
}
Aggregations