1 | assertEquals("/sub1",man.get(1).getPath());↵ | | 1 | assertEquals("/sub1",man.get(1).getPath());↵
|
2 | assertEquals("/",man.get(2).getPath());↵ | | 2 | assertEquals("/",man.get(2).getPath());↵
|
3 | String s = man.getCookieHeaderForURL(url);↵ | | 3 | String s = man.getCookieHeaderForURL(url);↵
|
4 | assertNotNull(s);↵ | | 4 | assertNotNull(s);↵
|
5 | org.apache.commons.httpclient.Cookie[] c = man.getCookiesForUrl(url);↵ | | 5 | org.apache.commons.httpclient.Cookie[] c = man.getCookiesForUrl(url);↵
|
6 | assertEquals("/sub1",c[0].getPath());↵ | | 6 | assertEquals("/sub1",c[0].getPath());↵
|
7 | assertFalse(c[0].isPathAttributeSpecified());↵ | | 7 | assertFalse(c[0].isPathAttributeSpecified());↵
|
8 | assertEquals("/sub1",c[1].getPath());↵ | | 8 | assertEquals("/sub1",c[1].getPath());↵
|
9 | assertTrue(c[1].isPathAttributeSpecified());↵ | | 9 | assertTrue(c[1].isPathAttributeSpecified());↵
|
10 | assertEquals("/",c[2].getPath());↵ | | 10 | assertEquals("/",c[2].getPath());↵
|
11 | assertTrue(c[2].isPathAttributeSpecified());↵ | | 11 | assertTrue(c[2].isPathAttributeSpecified());↵
|
12 | assertEquals("$Version=0; test1=moo1; test2=moo2; $Path=/sub1; test2=moo3; $Path=/", s);↵ | | 12 | assertEquals("test1=moo1; test2=moo2; test2=moo3", s);↵
|
13 | }↵ | | 13 | }↵
|
|
14 | public void testCookiePolicyNetscape() throws Exception {↵ | | 14 | public void testCookiePolicyIgnore() throws Exception {↵
|
15 | man.setCookiePolicy(CookiePolicy.NETSCAPE);↵ | | 15 | man.setCookiePolicy(CookiePolicy.IGNORE_COOKIES);↵
|
16 | URL url = new URL("http://order.now/sub1/moo.html");↵ | | 16 | URL url = new URL("http://order.now/sub1/moo.html");↵
|
17 | man.addCookieFromHeader("test1=moo1;", url);↵ | | 17 | man.addCookieFromHeader("test1=moo1;", url);↵
|
18 | man.addCookieFromHeader("test2=moo2;path=/sub1", url);↵ | | 18 | man.addCookieFromHeader("test2=moo2;path=/sub1", url);↵
|
19 | man.addCookieFromHeader("test2=moo3;path=/", url);↵ | | 19 | man.addCookieFromHeader("test2=moo3;path=/", url);↵
|
20 | assertEquals(3,man.getCookieCount()); | | 20 | assertEquals(0,man.getCookieCount());
|