Java 类org.apache.http.cookie.CookieIdentityComparator 实例源码

项目:purecloud-iot    文件:TestCookieIdentityComparator.java   
@Test
public void testCookieIdentityComparasionByNameDomainAndPath() {
    final CookieIdentityComparator comparator = new CookieIdentityComparator();
    final BasicClientCookie c1 = new BasicClientCookie("name", "value1");
    c1.setDomain("www.domain.com");
    c1.setPath("/whatever");
    final BasicClientCookie c2 = new BasicClientCookie("name", "value2");
    c2.setDomain("www.domain.com");
    c2.setPath("/whatever");
    Assert.assertTrue(comparator.compare(c1, c2) == 0);

    final BasicClientCookie c3 = new BasicClientCookie("name", "value1");
    c3.setDomain("www.domain.com");
    c3.setPath("/whatever");
    final BasicClientCookie c4 = new BasicClientCookie("name", "value2");
    c4.setDomain("domain.com");
    c4.setPath("/whatever-not");
    Assert.assertFalse(comparator.compare(c3, c4) == 0);
}
项目:purecloud-iot    文件:TestCookieIdentityComparator.java   
@Test
public void testCookieIdentityComparasionByNameDomainAndNullPath() {
    final CookieIdentityComparator comparator = new CookieIdentityComparator();
    final BasicClientCookie c1 = new BasicClientCookie("name", "value1");
    c1.setDomain("www.domain.com");
    c1.setPath("/");
    final BasicClientCookie c2 = new BasicClientCookie("name", "value2");
    c2.setDomain("www.domain.com");
    c2.setPath(null);
    Assert.assertTrue(comparator.compare(c1, c2) == 0);

    final BasicClientCookie c3 = new BasicClientCookie("name", "value1");
    c3.setDomain("www.domain.com");
    c3.setPath("/whatever");
    final BasicClientCookie c4 = new BasicClientCookie("name", "value2");
    c4.setDomain("domain.com");
    c4.setPath(null);
    Assert.assertFalse(comparator.compare(c3, c4) == 0);
}
项目:purecloud-iot    文件:TestCookieIdentityComparator.java   
@Test
public void testCookieIdentityComparasionByName() {
    final CookieIdentityComparator comparator = new CookieIdentityComparator();
    final BasicClientCookie c1 = new BasicClientCookie("name", "value1");
    final BasicClientCookie c2 = new BasicClientCookie("name", "value2");
    Assert.assertTrue(comparator.compare(c1, c2) == 0);

    final BasicClientCookie c3 = new BasicClientCookie("name1", "value");
    final BasicClientCookie c4 = new BasicClientCookie("name2", "value");
    Assert.assertFalse(comparator.compare(c3, c4) == 0);
}
项目:purecloud-iot    文件:TestCookieIdentityComparator.java   
@Test
public void testCookieIdentityComparasionByNameAndDomain() {
    final CookieIdentityComparator comparator = new CookieIdentityComparator();
    final BasicClientCookie c1 = new BasicClientCookie("name", "value1");
    c1.setDomain("www.domain.com");
    final BasicClientCookie c2 = new BasicClientCookie("name", "value2");
    c2.setDomain("www.domain.com");
    Assert.assertTrue(comparator.compare(c1, c2) == 0);

    final BasicClientCookie c3 = new BasicClientCookie("name", "value1");
    c3.setDomain("www.domain.com");
    final BasicClientCookie c4 = new BasicClientCookie("name", "value2");
    c4.setDomain("domain.com");
    Assert.assertFalse(comparator.compare(c3, c4) == 0);
}
项目:purecloud-iot    文件:TestCookieIdentityComparator.java   
@Test
public void testCookieIdentityComparasionByNameAndNullDomain() {
    final CookieIdentityComparator comparator = new CookieIdentityComparator();
    final BasicClientCookie c1 = new BasicClientCookie("name", "value1");
    c1.setDomain(null);
    final BasicClientCookie c2 = new BasicClientCookie("name", "value2");
    c2.setDomain(null);
    Assert.assertTrue(comparator.compare(c1, c2) == 0);

    final BasicClientCookie c3 = new BasicClientCookie("name", "value1");
    c3.setDomain("www.domain.com");
    final BasicClientCookie c4 = new BasicClientCookie("name", "value2");
    c4.setDomain(null);
    Assert.assertFalse(comparator.compare(c3, c4) == 0);
}
项目:purecloud-iot    文件:TestCookieIdentityComparator.java   
@Test
public void testCookieIdentityComparasionByNameAndLocalHost() {
    final CookieIdentityComparator comparator = new CookieIdentityComparator();
    final BasicClientCookie c1 = new BasicClientCookie("name", "value1");
    c1.setDomain("localhost");
    final BasicClientCookie c2 = new BasicClientCookie("name", "value2");
    c2.setDomain("localhost");
    Assert.assertTrue(comparator.compare(c1, c2) == 0);

    final BasicClientCookie c3 = new BasicClientCookie("name", "value1");
    c3.setDomain("localhost.local");
    final BasicClientCookie c4 = new BasicClientCookie("name", "value2");
    c4.setDomain("localhost");
    Assert.assertTrue(comparator.compare(c3, c4) == 0);
}
项目:jspider    文件:BarrierCookieStore.java   
public BarrierCookieStore() {
    super();
    this.cookies = new TreeSet<Cookie>(new CookieIdentityComparator());
}
项目:jspider    文件:BarrierCookieStore.java   
public BarrierCookieStore(long maxExpiresMillis) {
    super();
    this.maxExpiresMillis = maxExpiresMillis;
    this.cookies = new TreeSet<Cookie>(new CookieIdentityComparator());
}
项目:lams    文件:BasicCookieStore.java   
public BasicCookieStore() {
    super();
    this.cookies = new TreeSet<Cookie>(new CookieIdentityComparator());
}
项目:remote-files-sync    文件:BasicCookieStoreHC4.java   
public BasicCookieStoreHC4() {
    super();
    this.cookies = new TreeSet<Cookie>(new CookieIdentityComparator());
}
项目:http-fetcher    文件:LocalCookieStore.java   
public LocalCookieStore() {
    super();
    this.cookies = new TreeSet<Cookie>(new CookieIdentityComparator());
}
项目:purecloud-iot    文件:BasicCookieStore.java   
public BasicCookieStore() {
    super();
    this.cookies = new TreeSet<Cookie>(new CookieIdentityComparator());
}
项目:Visit    文件:BasicCookieStoreHC4.java   
public BasicCookieStoreHC4() {
    super();
    this.cookies = new TreeSet<Cookie>(new CookieIdentityComparator());
}
项目:ache    文件:LocalCookieStore.java   
public LocalCookieStore() {
    super();
    this.cookies = new TreeSet<Cookie>(new CookieIdentityComparator());
}
项目:libgdx-chat-example    文件:CustomCookieStore.java   
public CustomCookieStore()
{
    super();
    this.cookies = new TreeSet<Cookie>(new CookieIdentityComparator());
}
项目:cJUnit-mc626    文件:BasicCookieStore.java   
/**
 * Default constructor.
 */
public BasicCookieStore() {
    super();
    this.cookies = new ArrayList<Cookie>();
    this.cookieComparator = new CookieIdentityComparator();
}
项目:ZTLib    文件:BasicCookieStoreHC4.java   
public BasicCookieStoreHC4() {
    super();
    this.cookies = new TreeSet<Cookie>(new CookieIdentityComparator());
}