@Test
public void testLifecycleEventFiredForLongRunningConversation() throws Exception {
WebClient client = new WebClient();
{
TextPage page = client.getPage(url + "/begin");
assertTrue(page.getContent(), page.getContent().contains("Initialized conversations:1")); // the current transient conversation
assertTrue(page.getContent(), page.getContent().contains("Destroyed conversations:0")); // not destroyed yet
}
{
TextPage page = client.getPage(url + "/display?cid=org.jboss.weld");
assertTrue(page.getContent(), page.getContent().contains("Initialized conversations:1"));
assertTrue(page.getContent(), page.getContent().contains("Destroyed conversations:0"));
}
{
TextPage page = client.getPage(url + "/display?cid=org.jboss.weld");
assertTrue(page.getContent(), page.getContent().contains("Initialized conversations:1"));
assertTrue(page.getContent(), page.getContent().contains("Destroyed conversations:0"));
}
{
TextPage page = client.getPage(url + "/end?cid=org.jboss.weld");
assertTrue(page.getContent(), page.getContent().contains("Initialized conversations:1"));
assertTrue(page.getContent(), page.getContent().contains("Destroyed conversations:0"));
}
{
TextPage page = client.getPage(url + "/display");
assertTrue(page.getContent(), page.getContent().contains("Initialized conversations:2"));
assertTrue(page.getContent(), page.getContent().contains("Destroyed conversations:1"));
}
}