use of com.gargoylesoftware.htmlunit.WebClient in project core by weld.
the class ProbeDefaultConfigurationPropertiesTest method testEmbededInfoSnippetAvailable.
@Test
public void testEmbededInfoSnippetAvailable() throws IOException {
WebClient client = new WebClient();
HtmlPage page = client.getPage(url.toString() + "test");
assertTrue(page.getBody().asXml().toString().contains("Probe Development Tool"));
assertTrue(page.getBody().asXml().toString().contains(TEST_ARCHIVE_NAME));
assertTrue(page.getBody().asXml().toString().contains("The following snippet was automatically added by Weld"));
}
use of com.gargoylesoftware.htmlunit.WebClient in project core by weld.
the class ProbeDefaultConfigurationPropertiesTest method getChildInvocations.
private JsonArray getChildInvocations() throws IOException {
WebClient webClient = invokeSimpleAction(url);
JsonObject invocations = getPageAsJSONObject(INVOCATIONS_PATH, url, webClient);
JsonArray invocationData = invocations.getJsonArray(DATA);
int id = invocationData.getJsonObject(0).getInt(ID);
JsonObject invocationTree = getPageAsJSONObject(INVOCATIONS_PATH + "/" + id, url, webClient);
return invocationTree.getJsonArray(CHILDREN);
}
use of com.gargoylesoftware.htmlunit.WebClient in project core by weld.
the class ProbeEventsTest method testEventsEndpoint.
@Test
public void testEventsEndpoint() throws IOException {
WebClient client = invokeSimpleAction(url);
JsonObject events = getPageAsJSONObject(JSONTestUtil.EVENTS_PATH + "?filters=kind:\"APPLICATION\"", url, client);
ReadContext ctx = JsonPath.parse(events.toString());
List<String> eventInfos = ctx.read("$." + DATA + "[*]." + EVENT_INFO, List.class);
List<String> qualifiers = ctx.read("$." + DATA + "[*]." + QUALIFIERS + "[*]", List.class);
assertTrue("No events found !", eventInfos.size() > 0);
// check events
assertTrue(eventInfos.contains(SessionScopedBean.MESSAGE_A));
assertTrue(eventInfos.contains(SessionScopedBean.MESSAGE_B));
assertTrue(eventInfos.contains(SessionScopedBean.MESSAGE_AB));
// check event qualifiers
assertTrue(qualifiers.contains("@" + Collector.class.getName().concat("(value=\"B\")")));
assertTrue(qualifiers.contains("@" + Collector.class.getName().concat("(value=\"A\")")));
}
use of com.gargoylesoftware.htmlunit.WebClient in project core by weld.
the class ProbeIntegrationTest method invokeSimpleAction.
protected WebClient invokeSimpleAction(URL url) throws IOException {
WebClient client = new WebClient();
client.getPage(url.toString() + "test");
return client;
}
use of com.gargoylesoftware.htmlunit.WebClient in project core by weld.
the class EnhancedListenerShutdownTest method testEnhancedListenerNotDestroyingWeldIfListenerRegistered.
@Test
@InSequence(2)
public void testEnhancedListenerNotDestroyingWeldIfListenerRegistered(@ArquillianResource @OperateOnDeployment(TEST) URL testContext, @ArquillianResource @OperateOnDeployment(ASSERT) URL assertContext) throws IOException {
// Init foo - set info archive deployment url
WebClient webClient = new WebClient();
webClient.setThrowExceptionOnFailingStatusCode(true);
webClient.getPage(testContext + "init?url=" + URLEncoder.encode(assertContext.toExternalForm(), "UTF-8"));
// Undeploy TEST
deployer.undeploy(TEST);
// Test that Foo is destroyed after TestListener is notified
TextPage info = webClient.getPage(assertContext + "info?action=get");
List<String> data = ActionSequence.buildFromCsvData(info.getContent()).getData();
assertEquals(2, data.size());
assertEquals(TestListener.class.getSimpleName(), data.get(0));
assertEquals(Foo.class.getSimpleName(), data.get(1));
// Undeploy ASSERT
deployer.undeploy(ASSERT);
}
Aggregations