Package org.apache.http.impl.cookie

Examples of org.apache.http.impl.cookie.BasicClientCookie


        assertTrue(comparator.compare(cookie1, cookie2) == 0);
        assertTrue(comparator.compare(cookie2, cookie1) == 0);
    }

    public void testEquality3() {
        BasicClientCookie cookie1 = new BasicClientCookie("name1", "value");
        cookie1.setPath(null);
        BasicClientCookie cookie2 = new BasicClientCookie("name1", "value");
        cookie2.setPath("/");
        Comparator<Cookie> comparator = new CookiePathComparator();
        assertTrue(comparator.compare(cookie1, cookie2) == 0);
        assertTrue(comparator.compare(cookie2, cookie1) == 0);
    }
View Full Code Here


        assertTrue(comparator.compare(cookie1, cookie2) == 0);
        assertTrue(comparator.compare(cookie2, cookie1) == 0);
    }

    public void testEquality4() {
        BasicClientCookie cookie1 = new BasicClientCookie("name1", "value");
        cookie1.setPath("/this");
        BasicClientCookie cookie2 = new BasicClientCookie("name1", "value");
        cookie2.setPath("/that");
        Comparator<Cookie> comparator = new CookiePathComparator();
        assertTrue(comparator.compare(cookie1, cookie2) == 0);
        assertTrue(comparator.compare(cookie2, cookie1) == 0);
    }
View Full Code Here

        DefaultHttpClient client = new DefaultHttpClient();

        CookieStore cookieStore = new BasicCookieStore();
        client.setCookieStore(cookieStore);

        BasicClientCookie cookie = new BasicClientCookie("name", "value");
        cookie.setDomain(host);
        cookie.setPath("/");

        cookieStore.addCookie(cookie);

        HttpContext context = new BasicHttpContext();
        HttpGet httpget = new HttpGet("/oldlocation/");
View Full Code Here

    public static Test suite() {
        return new TestSuite(TestCookiePathComparator.class);
    }

    public void testUnequality1() {
        BasicClientCookie cookie1 = new BasicClientCookie("name1", "value");
        cookie1.setPath("/a/b/");
        BasicClientCookie cookie2 = new BasicClientCookie("name1", "value");
        cookie2.setPath("/a/");
        Comparator<Cookie> comparator = new CookiePathComparator();
        assertTrue(comparator.compare(cookie1, cookie2) < 0);
        assertTrue(comparator.compare(cookie2, cookie1) > 0);
    }
View Full Code Here

        assertTrue(comparator.compare(cookie1, cookie2) < 0);
        assertTrue(comparator.compare(cookie2, cookie1) > 0);
    }

    public void testUnequality2() {
        BasicClientCookie cookie1 = new BasicClientCookie("name1", "value");
        cookie1.setPath("/a/b");
        BasicClientCookie cookie2 = new BasicClientCookie("name1", "value");
        cookie2.setPath("/a");
        Comparator<Cookie> comparator = new CookiePathComparator();
        assertTrue(comparator.compare(cookie1, cookie2) < 0);
        assertTrue(comparator.compare(cookie2, cookie1) > 0);
    }
View Full Code Here

        assertTrue(comparator.compare(cookie1, cookie2) < 0);
        assertTrue(comparator.compare(cookie2, cookie1) > 0);
    }

    public void testEquality1() {
        BasicClientCookie cookie1 = new BasicClientCookie("name1", "value");
        cookie1.setPath("/a");
        BasicClientCookie cookie2 = new BasicClientCookie("name1", "value");
        cookie2.setPath("/a");
        Comparator<Cookie> comparator = new CookiePathComparator();
        assertTrue(comparator.compare(cookie1, cookie2) == 0);
        assertTrue(comparator.compare(cookie2, cookie1) == 0);
    }
View Full Code Here

        assertTrue(comparator.compare(cookie1, cookie2) == 0);
        assertTrue(comparator.compare(cookie2, cookie1) == 0);
    }

    public void testEquality2() {
        BasicClientCookie cookie1 = new BasicClientCookie("name1", "value");
        cookie1.setPath("/a/");
        BasicClientCookie cookie2 = new BasicClientCookie("name1", "value");
        cookie2.setPath("/a");
        Comparator<Cookie> comparator = new CookiePathComparator();
        assertTrue(comparator.compare(cookie1, cookie2) == 0);
        assertTrue(comparator.compare(cookie2, cookie1) == 0);
    }
View Full Code Here

        assertTrue(comparator.compare(cookie1, cookie2) == 0);
        assertTrue(comparator.compare(cookie2, cookie1) == 0);
    }

    public void testEquality3() {
        BasicClientCookie cookie1 = new BasicClientCookie("name1", "value");
        cookie1.setPath(null);
        BasicClientCookie cookie2 = new BasicClientCookie("name1", "value");
        cookie2.setPath("/");
        Comparator<Cookie> comparator = new CookiePathComparator();
        assertTrue(comparator.compare(cookie1, cookie2) == 0);
        assertTrue(comparator.compare(cookie2, cookie1) == 0);
    }
View Full Code Here

        assertTrue(comparator.compare(cookie1, cookie2) == 0);
        assertTrue(comparator.compare(cookie2, cookie1) == 0);
    }

    public void testEquality4() {
        BasicClientCookie cookie1 = new BasicClientCookie("name1", "value");
        cookie1.setPath("/this");
        BasicClientCookie cookie2 = new BasicClientCookie("name1", "value");
        cookie2.setPath("/that");
        Comparator<Cookie> comparator = new CookiePathComparator();
        assertTrue(comparator.compare(cookie1, cookie2) == 0);
        assertTrue(comparator.compare(cookie2, cookie1) == 0);
    }
View Full Code Here

        String[] testCaseName = { TestBasicCookieAttribHandlers.class.getName() };
        junit.textui.TestRunner.main(testCaseName);
    }

    public void testBasicDomainParse() throws Exception {
        BasicClientCookie cookie = new BasicClientCookie("name", "value");
        CookieAttributeHandler h = new BasicDomainHandler();
        h.parse(cookie, "www.somedomain.com");
        assertEquals("www.somedomain.com", cookie.getDomain());
    }
View Full Code Here

TOP

Related Classes of org.apache.http.impl.cookie.BasicClientCookie

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.