Package com.gargoylesoftware.htmlunit

Examples of com.gargoylesoftware.htmlunit.TextPage


    public void testSessionContextActiveOnComplete() throws Exception {

        WebClient webClient = new WebClient();
        webClient.setThrowExceptionOnFailingStatusCode(true);

        TextPage page01 = webClient.getPage(getPath(AsyncServlet.TEST_COMPLETE));
        assertTrue(page01.getContent().contains("onTimeout: null"));
        assertTrue(page01.getContent().contains("onError: null"));
        assertFalse(page01.getContent().contains("onComplete: null"));
        String id = extractSimpleSessionBeanId(page01.getContent());
        assertNotNull(id);
        assertFalse(id.isEmpty());
    }
View Full Code Here


    @Test(groups = {INTEGRATION, ASYNC_SERVLET})
    @SpecAssertions({ @SpecAssertion(section = SESSION_CONTEXT, id = "ad") })
    public void testSessionContextActiveOnTimeout() throws Exception {
        WebClient webClient = new WebClient();
        webClient.setThrowExceptionOnFailingStatusCode(false);
        TextPage page = webClient.getPage(getPath(AsyncServlet.TEST_TIMEOUT));
        assertTrue(page.getContent().contains("onTimeout:"));
        assertFalse(page.getContent().contains("onTimeout: null"));
    }
View Full Code Here

    @Test(groups = {INTEGRATION, ASYNC_SERVLET})
    @SpecAssertions({ @SpecAssertion(section = SESSION_CONTEXT, id = "ad") })
    public void testSessionContextActiveOnError() throws Exception {
        WebClient webClient = new WebClient();
        webClient.setThrowExceptionOnFailingStatusCode(false);
        TextPage page = webClient.getPage(getPath(AsyncServlet.TEST_ERROR));
        assertTrue(page.getContent().contains("onError:"));
        assertFalse(page.getContent().contains("onError: null"));
    }
View Full Code Here

    @Test(groups = {INTEGRATION, ASYNC_SERVLET})
    @SpecAssertions({ @SpecAssertion(section = SESSION_CONTEXT, id = "ad") })
    public void testSessionContextActiveOnStartAsync() throws Exception {
        WebClient webClient = new WebClient();
        webClient.setThrowExceptionOnFailingStatusCode(true);
        TextPage page = webClient.getPage(getPath(AsyncServlet.TEST_LOOP));
        assertFalse(page.getContent().contains("onStartAsync: null"));
        assertFalse(page.getContent().contains("onComplete: null"));
    }
View Full Code Here

        assertNotEquals(id01, id02);

        WebClient webClient = new WebClient();
        webClient.setThrowExceptionOnFailingStatusCode(true);

        TextPage info = webClient.getPage(contextPath + "info");

        Matcher matcher = Pattern.compile("(Foo destroyed:)(\\w+)").matcher(info.getContent());
        if (matcher.find()) {
            String value = matcher.group(2);
            assertEquals(value, "2");
        } else {
            fail();
View Full Code Here

    public void testRequestContextActiveOnComplete() throws Exception {

        WebClient webClient = new WebClient();
        webClient.setThrowExceptionOnFailingStatusCode(true);

        TextPage page01 = webClient.getPage(getPath(AsyncServlet.TEST_COMPLETE));
        assertTrue(page01.getContent().contains("onTimeout: null"));
        assertTrue(page01.getContent().contains("onError: null"));
        assertFalse(page01.getContent().contains("onComplete: null"));

        // Indirectly test request context is destroyed after onComplete()
        TextPage page02 = webClient.getPage(getPath(AsyncServlet.TEST_COMPLETE));
        assertNotEquals(extractSimpleRequestBeanIdString(page01.getContent()),
                extractSimpleRequestBeanIdString(page02.getContent()));
    }
View Full Code Here

    @Test(groups = {INTEGRATION, ASYNC_SERVLET})
    @SpecAssertion(section = REQUEST_CONTEXT, id = "ad")
    public void testRequestContextActiveOnTimeout() throws Exception {
        WebClient webClient = new WebClient();
        webClient.setThrowExceptionOnFailingStatusCode(false);
        TextPage page = webClient.getPage(getPath(AsyncServlet.TEST_TIMEOUT));
        assertTrue(page.getContent().contains("onTimeout:"));
        assertFalse(page.getContent().contains("onTimeout: null"));
    }
View Full Code Here

    @Test(groups = {INTEGRATION, ASYNC_SERVLET})
    @SpecAssertion(section = REQUEST_CONTEXT, id = "ad")
    public void testRequestContextActiveOnError() throws Exception {
        WebClient webClient = new WebClient();
        webClient.setThrowExceptionOnFailingStatusCode(false);
        TextPage page = webClient.getPage(getPath(AsyncServlet.TEST_ERROR));
        assertTrue(page.getContent().contains("onError:"));
        assertFalse(page.getContent().contains("onError: null"));
    }
View Full Code Here

    @Test(groups = {INTEGRATION, ASYNC_SERVLET})
    @SpecAssertion(section = REQUEST_CONTEXT, id = "ad")
    public void testRequestContextActiveOnStartAsync() throws Exception {
        WebClient webClient = new WebClient();
        webClient.setThrowExceptionOnFailingStatusCode(true);
        TextPage page = webClient.getPage(getPath(AsyncServlet.TEST_LOOP));
        assertFalse(page.getContent().contains("onStartAsync: null"));
        assertFalse(page.getContent().contains("onComplete: null"));
    }
View Full Code Here

    @Test(groups = {INTEGRATION, ASYNC_SERVLET})
    @SpecAssertion(section = APPLICATION_CONTEXT, id = "ae")
    public void testApplicationContextActiveOnComplete() throws Exception {
        WebClient webClient = new WebClient();
        webClient.setThrowExceptionOnFailingStatusCode(true);
        TextPage page = webClient.getPage(getPath(AsyncServlet.TEST_COMPLETE));
        assertTrue(page.getContent().contains("onTimeout: null"));
        assertTrue(page.getContent().contains("onError: null"));
        assertFalse(page.getContent().contains("onComplete: null"));
    }
View Full Code Here

TOP

Related Classes of com.gargoylesoftware.htmlunit.TextPage

Copyright © 2018 www.massapicom. 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.