Package com.gargoylesoftware.htmlunit

Examples of com.gargoylesoftware.htmlunit.WebClient$CurrentWindowTracker


        assertTrue(page.getContent().contains("DISABLED = false"));
    }

    @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


        assertTrue(page.getContent().contains("ENABLED_FOR_ALL = true"));
    }

    @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

    private URL url;

    @Test
    public void testSerlvetBasicFeatures() 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

        assertTrue(page.getContent().contains("ENABLED_FOR_CK = true"));
    }

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

        assertTrue(page.getContent().contains("ENABLED_FOR_CK = false"));
    }

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

        assertTrue(userPage.getContent().contains("ADMIN = true"));
    }

    @Test
    public void testFeatureAdminFlagForOtherUser() throws IOException {
        WebClient client = new WebClient();
        TextPage userPage = client.getPage(url + "user?user=other");
        assertTrue(userPage.getContent().contains("USER = other"));
        assertTrue(userPage.getContent().contains("ADMIN = false"));
    }
View Full Code Here

    private URL url;

    @Test
    public void testCachingOfFeatureState() throws IOException {

        WebClient client = new WebClient();

        long start = System.currentTimeMillis();
        for (int i = 0; i < 10; i++) {
            TextPage page = client.getPage(url + "features?user=ck");
            assertTrue(page.getContent().contains("F1 = false"));
        }
        long duration = System.currentTimeMillis() - start;

        assertTrue(duration < 4000); // without cache: 500ms * 10 = 5000ms
View Full Code Here

    private URL url;

    @Test
    public void testSpringBasicFeatures() 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 testShiroAsAnonymousUser() throws Exception {

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

        TextPage userPage = client.getPage(url + "user");
        assertTrue(userPage.getContent().contains("USER = null"));
        assertTrue(userPage.getContent().contains("ADMIN = null"));

    }
View Full Code Here

      treeLogger.log(TreeLogger.WARN, message);
    }

    @Override
    public void run() {
      WebClient webClient = new WebClient(browser);
      webClient.setAlertHandler(this);
      webClient.setIncorrectnessListener(this);
      webClient.setThrowExceptionOnFailingStatusCode(false);
      webClient.setThrowExceptionOnScriptError(true);
      webClient.setOnbeforeunloadHandler(this);
      setupWebClient(webClient);
      try {
        Page page = webClient.getPage(url);
        webClient.waitForBackgroundJavaScriptStartingBefore(2000);
        treeLogger.log(TreeLogger.SPAM, "getPage returned "
            + ((HtmlPage) page).asXml());
        // TODO(amitmanjhi): call webClient.closeAllWindows()
      } catch (FailingHttpStatusCodeException e) {
        treeLogger.log(TreeLogger.ERROR, "HTTP request failed", e);
View Full Code Here

TOP

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

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.