Package com.gargoylesoftware.htmlunit

Examples of com.gargoylesoftware.htmlunit.WebClient$BinaryWebResponse


    @Test(groups = INTEGRATION)
    @SpecAssertions({ @SpecAssertion(section = "6.7.1", id = "e"), @SpecAssertion(section = "6.7.1", id = "f") })
    public void testSimplePostConstructCallback() throws Exception {

        WebClient client = new WebClient();

        TextPage page = client.getPage(contextPath + "simple");
        // Context was active
        assertTrue(page.getContent().contains("Active:true"));
        // Not destroyed yet
        assertTrue(page.getContent().contains("Destroyed requests:0"));
    }
View Full Code Here


    @Test(groups = INTEGRATION)
    @SpecAssertions({ @SpecAssertion(section = "6.7.1", id = "e"), @SpecAssertion(section = "6.7.1", id = "f") })
    public void testEagerSingletonPostConstructCallback() throws Exception {

        WebClient client = new WebClient();

        TextPage page = client.getPage(contextPath + "eager");
        // Context was active
        assertTrue(page.getContent().contains("Active:true"));
        // Only singleton callback, current request not destroyed yet
        assertTrue(page.getContent().contains("Destroyed requests:1"));
    }
View Full Code Here

    @Test(groups = { CONTEXTS })
    @SpecAssertions({ @SpecAssertion(section = "6.7.4", id = "l"), @SpecAssertion(section = "2.4.1", id = "ba") })
    public void testConversationPropagated() throws Exception {

        WebClient webClient = new WebClient();

        HtmlPage storm = webClient.getPage(getPath("storm.jsf"));

        // Begin long-running conversation
        HtmlSubmitInput beginConversationButton = getFirstMatchingElement(storm, HtmlSubmitInput.class,
                "beginConversationButton");
        storm = beginConversationButton.click();
View Full Code Here

    @Test(groups = { CONTEXTS })
    @SpecAssertion(section = "6.7.4", id = "m")
    public void testConversationPropagatedOverRedirect() throws Exception {

        WebClient webClient = new WebClient();

        HtmlPage storm = webClient.getPage(getPath("storm.jsf"));

        // Begin long-running conversation
        HtmlSubmitInput beginConversationButton = getFirstMatchingElement(storm, HtmlSubmitInput.class,
                "beginConversationButton");
        storm = beginConversationButton.click();
View Full Code Here

    @Test(groups = { CONTEXTS })
    @SpecAssertions({ @SpecAssertion(section = "6.7.4", id = "l") })
    public void testConversationPropagatedAjax() throws Exception {

        WebClient webClient = new WebClient();
        webClient.setAjaxController(new NicelyResynchronizingAjaxController());

        HtmlPage storm = webClient.getPage(getPath("storm-ajax.jsf"));

        // Begin long-running conversation - note that we use ajax
        HtmlSubmitInput beginConversationButton = getFirstMatchingElement(storm, HtmlSubmitInput.class,
                "beginConversationButton");
        storm = beginConversationButton.click();
        String cid = getFirstMatchingElement(storm, HtmlInput.class, "conversationId").getValueAttribute();
        assertFalse(cid.isEmpty());

        // Set input value
        HtmlTextInput stormStrength = getFirstMatchingElement(storm, HtmlTextInput.class, "stormStrength");
        stormStrength.setValueAttribute(AJAX_STORM_STRENGTH);
        // Submit value - note that we use ajax
        HtmlSubmitInput thunderButton = getFirstMatchingElement(storm, HtmlSubmitInput.class, "thunderButton");
        thunderButton.click();

        HtmlPage thunder = webClient.getPage(getPath("thunder.jsf", cid));
        stormStrength = getFirstMatchingElement(thunder, HtmlTextInput.class, "stormStrength");
        assertEquals(stormStrength.getValueAttribute(), AJAX_STORM_STRENGTH);
    }
View Full Code Here

    @Test(dataProvider = ARQUILLIAN_DATA_PROVIDER)
    @SpecAssertions({ @SpecAssertion(section = "3.7", id = "da"), @SpecAssertion(section = "3.7", id = "db"),
            @SpecAssertion(section = "3.7", id = "dc") })
    public void testBuiltinBeansFromClient(@ArquillianResource URL contextPath) throws Exception {

        WebClient client = new WebClient();

        TextPage requestPage = client.getPage(contextPath + "/convert-request?text=BaR");
        assertEquals(requestPage.getContent(), "bar");

        TextPage sessionPage = client.getPage(contextPath + "/convert-session");
        assertEquals(sessionPage.getContent(), "session");

        TextPage contextPage = client.getPage(contextPath + "/convert-context");
        assertEquals(contextPage.getContent(), "servletcontext");
    }
View Full Code Here

    @Test(groups = { INTEGRATION, CONTEXTS })
    @SpecAssertions({ @SpecAssertion(section = "6.7.4", id = "da"), @SpecAssertion(section = "6.7.4", id = "db"),
            @SpecAssertion(section = "6.7.4", id = "dc"), @SpecAssertion(section = "6.7.4", id = "dd") })
    public void testConversationDetermination() throws Exception {

        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

    @SpecAssertion(section = "6.7.3", id = "f")
    public void testApplicationContextDestroyed(@ArquillianResource @OperateOnDeployment(FOO) URL fooContext,
            @ArquillianResource @OperateOnDeployment(BAR) URL barContext) throws Exception {

        // Init foo - set bar archive deployment url
        WebClient webClient = new WebClient();
        webClient.setThrowExceptionOnFailingStatusCode(true);
        webClient.getPage(fooContext + "init?url=" + URLEncoder.encode(barContext.toExternalForm(), "UTF-8"));

        // Undeploy foo
        deployer.undeploy(FOO);

        // Get bar info
        TextPage info = webClient.getPage(barContext + "info?action=get");
        assertEquals(info.getContent(), "true");

        // Undeploy bar
        deployer.undeploy(BAR);
    }
View Full Code Here

    @Test(groups = { CONTEXTS })
    @SpecAssertion(section = "6.7.4", id = "qa")
    // TODO this test doesn't precisely probe the boundaries of the service() method
    public void testInvalidatingSessionDestroysConversation() throws Exception {

        WebClient webClient = new WebClient();

        resetCloud(webClient);
        webClient.getPage(getPath("clouds.jsf"));

        assertFalse(isCloudDestroyed(webClient));
        invalidateSession(webClient);
        assertTrue(isCloudDestroyed(webClient));
    }
View Full Code Here

    @Test(groups = { CONTEXTS })
    @SpecAssertion(section = "6.7.4", id = "n")
    public void testManualCidPropagation() throws Exception {

        WebClient webClient = new WebClient();

        HtmlPage storm = webClient.getPage(getPath("storm.jsf"));
        HtmlSubmitInput beginConversationButton = getFirstMatchingElement(storm, HtmlSubmitInput.class,
                "beginConversationButton");
        storm = beginConversationButton.click();

        String c1 = getCid(storm);

        HtmlPage cloud = webClient.getPage(getPath("cloud.jsf", c1));

        String c2 = getCid(cloud);

        assert isLongRunning(cloud);
        assert c1.equals(c2);
View Full Code Here

TOP

Related Classes of com.gargoylesoftware.htmlunit.WebClient$BinaryWebResponse

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.