use of com.gargoylesoftware.htmlunit.Page in project core by weld.
the class AbstractDispatchingTestCase method getResponseAsString.
private String getResponseAsString(String urlSuffix) throws FailingHttpStatusCodeException, MalformedURLException, IOException {
Page page = client.getPage(contextPath + urlSuffix);
assertEquals(200, page.getWebResponse().getStatusCode());
return page.getWebResponse().getContentAsString();
}
use of com.gargoylesoftware.htmlunit.Page in project core by weld.
the class RemoteScopeTest method testScopeOfProducerMethod.
/*
* description = "WELD-311"
*/
@Test
public void testScopeOfProducerMethod(@ArquillianResource URL baseURL) throws Exception {
WebClient client = new WebClient();
Page page = client.getPage(new URL(baseURL, "request1"));
assertEquals(page.getWebResponse().getStatusCode(), HttpServletResponse.SC_OK);
page = client.getPage(new URL(baseURL, "request2"));
assertEquals(page.getWebResponse().getStatusCode(), HttpServletResponse.SC_OK);
}
use of com.gargoylesoftware.htmlunit.Page in project core by weld.
the class EMFFactoryTest method testInstanceManagedBeanEMFProducerField.
/*
* description = "WELD-632"
*/
@Test
public void testInstanceManagedBeanEMFProducerField() throws Exception {
WebClient client = new WebClient();
client.setThrowExceptionOnFailingStatusCode(false);
Page page = client.getPage(getPath("emfconsumer2"));
assertEquals(200, page.getWebResponse().getStatusCode());
}
use of com.gargoylesoftware.htmlunit.Page in project core by weld.
the class ClientConversationContextTest method testExceptionInPostConstruct.
@Test
public void testExceptionInPostConstruct() throws Exception {
WebClient client = new WebClient();
// First, try a transient conversation
client.setThrowExceptionOnFailingStatusCode(false);
// Access a page that throws an exception
client.getPage(getPath("/hailstorm.jsf"));
// Then access another page that doesn't and check the contexts are ok
HtmlPage cloud = client.getPage(getPath("/cloud.jsf"));
String cloudName = getFirstMatchingElement(cloud, HtmlSpan.class, "cloudName").getTextContent();
assertEquals(Cloud.NAME, cloudName);
// Now start a conversation and access the page that throws an exception
// again
Page hailstorm = getFirstMatchingElement(cloud, HtmlSubmitInput.class, "hail").click();
String cid = getCid(hailstorm);
cloud = client.getPage(getPath("/cloud.jsf", cid));
// And navigate to another page, checking the conversation exists by
// verifying that state is maintained
cloudName = getFirstMatchingElement(cloud, HtmlSpan.class, "cloudName").getTextContent();
assertEquals("gavin", cloudName);
}
use of com.gargoylesoftware.htmlunit.Page in project core by weld.
the class ClientConversationContextTest method testConversationPropagationToNonExistentConversationLeadsException.
@Test
public void testConversationPropagationToNonExistentConversationLeadsException() throws Exception {
WebClient client = new WebClient();
client.setThrowExceptionOnFailingStatusCode(false);
Page page = client.getPage(getPath("/cloud.jsf", "org.jboss.jsr299"));
Assert.assertEquals(500, page.getWebResponse().getStatusCode());
}
Aggregations