use of org.apache.commons.httpclient.Cookie in project ecf by eclipse.
the class TestCookieCompatibilitySpec method testParseAttributeInvalidMaxAge.
public void testParseAttributeInvalidMaxAge() throws Exception {
CookieSpec cookiespec = new CookieSpecBase();
Cookie cookie = new Cookie();
try {
cookiespec.parseAttribute(new NameValuePair("max-age", "crap"), cookie);
fail("MalformedCookieException must have been thrown");
} catch (MalformedCookieException expected) {
}
}
use of org.apache.commons.httpclient.Cookie in project ecf by eclipse.
the class TestCookieCompatibilitySpec method testValidateNullHost.
public void testValidateNullHost() throws Exception {
CookieSpec cookiespec = new CookieSpecBase();
Cookie cookie = new Cookie();
try {
cookiespec.validate(null, 80, "/", false, cookie);
fail("IllegalArgumentException must have been thrown");
} catch (IllegalArgumentException expected) {
}
}
use of org.apache.commons.httpclient.Cookie in project ecf by eclipse.
the class TestCookieCompatibilitySpec method testQuotedExpiresAttribute.
// see issue #5279
public void testQuotedExpiresAttribute() throws Exception {
String headerValue = "custno=12345;Expires='Thu, 01-Jan-2070 00:00:10 GMT'";
Header header = new Header("set-cookie", headerValue);
CookieSpec cookiespec = new CookieSpecBase();
Cookie[] cookies = cookieParse(cookiespec, "www.apache.org", 80, "/", true, header);
assertNotNull("Expected some cookies", cookies);
assertEquals("Expected 1 cookie", 1, cookies.length);
assertNotNull("Expected cookie to have getExpiryDate", cookies[0].getExpiryDate());
}
use of org.apache.commons.httpclient.Cookie in project ecf by eclipse.
the class TestCookieCompatibilitySpec method testMatchNullCookiePath.
public void testMatchNullCookiePath() throws Exception {
CookieSpec cookiespec = new CookieSpecBase();
Cookie cookie = new Cookie("host", "name", "value", null, null, false);
assertFalse(cookiespec.match("host", 80, "/", false, cookie));
}
use of org.apache.commons.httpclient.Cookie in project ecf by eclipse.
the class TestCookieCompatibilitySpec method testCookieMatch4.
public void testCookieMatch4() throws Exception {
CookieSpec cookiespec = new CookieSpecBase();
Cookie cookie = new Cookie("host", "name", "value", "/", null, false);
assertTrue(cookiespec.match("host", 80, "/foobar", false, cookie));
}
Aggregations