Package com.gargoylesoftware.htmlunit

Examples of com.gargoylesoftware.htmlunit.TextPage


    @Test(groups = {INTEGRATION, ASYNC_SERVLET})
    @SpecAssertion(section = APPLICATION_CONTEXT, id = "ae")
    public void testApplicationContextActiveOnTimeout() 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 = APPLICATION_CONTEXT, id = "ae")
    public void testApplicationContextActiveOnError() 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 = APPLICATION_CONTEXT, id = "ae")
    public void testApplicationContextActiveOnStartAsync() 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

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

        // Begin long-running conversation
        TextPage cidPage = webClient.getPage(contextPath + "foo?action=begin");
        String cid = cidPage.getContent().substring(cidPage.getContent().indexOf("cid: [") + 6,
                cidPage.getContent().indexOf("]"));
        assertTrue(cidPage.getContent().contains("transient: false"));

        // Test built-in conversation bean is available
        TextPage resultPage = webClient.getPage(contextPath + "foo?action=test&cid=" + cid.trim());
        assertTrue(resultPage.getContent().contains("testServlet=true"));
        assertTrue(resultPage.getContent().contains("testFilter=true"));
        assertTrue(resultPage.getContent().contains("testListener=true"));

        // Async listener
        resultPage = webClient.getPage(contextPath + "foo-async?action=test&cid=" + cid.trim());
        assertTrue(resultPage.getContent().contains("testAsyncListener=true"));
    }
View Full Code Here

    @SpecAssertions({ @SpecAssertion(section = REQUEST_CONTEXT, id = "jd") })
    public void testEventsFired() throws Exception {

        WebClient client = new WebClient();

        TextPage page = client.getPage(contextPath + "info");
        String content = page.getContent();

        checkContent(content, "(Initialized:)(\\w+)", "true");
        // Timeout request only
        checkContent(content, "(Destroyed:)(\\w+)", "true");
    }
View Full Code Here

    @Test
    public void testRequestIsBoundToHolder() throws IOException {

        // send a request to the servlet with a query string part
        String url = baseUrl + HttpServletRequestHolderServlet.URL_PATTERN + "?number=42";
        TextPage page = new WebClient().getPage(url);

        // verify the servlet sends back the query string
        assertThat(page.getWebResponse().getStatusCode()).isEqualTo(200);
        assertThat(page.getContent()).contains("number=42");

    }
View Full Code Here

    @Test
    public void testCDIBasicFeatures() throws IOException {

        WebClient client = new WebClient();
        TextPage page = client.getPage(url + "features");
        assertTrue(page.getContent().contains("FEATURE1 = false"));
        assertTrue(page.getContent().contains("FEATURE2 = true"));

    }
View Full Code Here

    private URL url;

    @Test
    public void testDisabledForAllUsers() throws IOException {
        WebClient client = new WebClient();
        TextPage page = client.getPage(url + "features?user=ck");
        assertTrue(page.getContent().contains("DISABLED = false"));
    }
View Full Code Here

    }

    @Test
    public void testEnabledForAllUsers() throws IOException {
        WebClient client = new WebClient();
        TextPage page = client.getPage(url + "features?user=ck");
        assertTrue(page.getContent().contains("ENABLED_FOR_ALL = true"));
    }
View Full Code Here

    }

    @Test
    public void testEnabledForOneUserWithCorrectUser() throws IOException {
        WebClient client = new WebClient();
        TextPage page = client.getPage(url + "features?user=ck");
        assertTrue(page.getContent().contains("ENABLED_FOR_CK = true"));
    }
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.