Examples of TextPage


Examples of com.gargoylesoftware.htmlunit.TextPage

    }

    @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

Examples of com.gargoylesoftware.htmlunit.TextPage

    }

    @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

Examples of com.gargoylesoftware.htmlunit.TextPage

    }

    @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

Examples of com.gargoylesoftware.htmlunit.TextPage

    @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

Examples of com.gargoylesoftware.htmlunit.TextPage

        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

Examples of com.gargoylesoftware.htmlunit.TextPage

    @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

Examples of com.gargoylesoftware.htmlunit.TextPage

    @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

Examples of com.gargoylesoftware.htmlunit.TextPage

    @Test
    public void testShiroLoginAsFeatureAdmin() throws Exception {

        WebClient client = new WebClient();

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

        TextPage loginPage = client.getPage(url + "login?user=ck");
        assertTrue(loginPage.getContent().contains("SUCCESS"));

        TextPage afterLogin = client.getPage(url + "user");
        assertTrue(afterLogin.getContent().contains("USER = ck"));
        assertTrue(afterLogin.getContent().contains("ADMIN = true"));

        TextPage logoutPage = client.getPage(url + "logout");
        assertTrue(logoutPage.getContent().contains("SUCCESS"));

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

    }
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.TextPage

    @Test
    public void testShiroLoginAsNormalUser() throws Exception {

        WebClient client = new WebClient();

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

        TextPage loginPage = client.getPage(url + "login?user=somebody");
        assertTrue(loginPage.getContent().contains("SUCCESS"));

        TextPage afterLogin = client.getPage(url + "user");
        assertTrue(afterLogin.getContent().contains("USER = somebody"));
        assertTrue(afterLogin.getContent().contains("ADMIN = false"));

        TextPage logoutPage = client.getPage(url + "logout");
        assertTrue(logoutPage.getContent().contains("SUCCESS"));

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

    }
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.TextPage

    @Test
    public void testShiroWithCorrectUser() throws Exception {

        WebClient client = new WebClient();

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

        TextPage loginPage = client.getPage(url + "login?user=ck");
        assertTrue(loginPage.getContent().contains("SUCCESS"));

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

        TextPage logoutPage = client.getPage(url + "logout");
        assertTrue(logoutPage.getContent().contains("SUCCESS"));

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

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.