use of jakarta.ws.rs.core.NewCookie in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method getCookiesTest.
/*
* @testName: getCookiesTest
*
* @assertion_ids: JAXRS:JAVADOC:844;
*
* @test_Strategy: Get any new cookies set on the response message.
*/
@Test
public void getCookiesTest() throws Fault {
NewCookie cookie1 = new NewCookie("c1", "v1");
NewCookie cookie2 = new NewCookie("c2", "v2");
List<String> cookies = Arrays.asList(cookie1.toString().toLowerCase(), cookie2.toString().toLowerCase());
Response response = Response.ok().cookie(cookie1).cookie(cookie2).build();
// verifyCookies style test
VerificationResult result = verifyCookies(response, cookies);
logMsg(result);
assertResultTrue(result);
// getCookies test
Map<String, NewCookie> map = response.getCookies();
for (Entry<String, NewCookie> entry : map.entrySet()) if (entry.getKey().equals("c1"))
assertTrue(entry.getValue().equals(cookie1), cookie1.toString() + "not match" + entry.getValue());
else if (entry.getKey().equals("c2"))
assertTrue(entry.getValue().equals(cookie2), cookie2.toString() + "not match" + entry.getValue());
else
assertTrue(false, "Got unknown cookie" + entry.getKey());
logMsg("#getCookies returned expected cookies");
}
use of jakarta.ws.rs.core.NewCookie in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method checkCreatedHeaderDelegateNewCookieTest.
/*
* @testName: checkCreatedHeaderDelegateNewCookieTest
*
* @assertion_ids: JAXRS:JAVADOC:287; JAXRS:JAVADOC:294; JAXRS:JAVADOC:296;
*
* @test_Strategy: Check that RuntimeDelegate.createHeaderDelegate<NewCookie>
* makes no exception and is not null
*
*/
@Test
public void checkCreatedHeaderDelegateNewCookieTest() throws Fault {
String cookieName = "cookieName";
String cookieValue = "cookieValue";
HeaderDelegate<NewCookie> hdnc = delegate.createHeaderDelegate(NewCookie.class);
assertTrue(hdnc != null, "HeaderDelegate<NewCookie> has not been created");
NewCookie cookie = new NewCookie(cookieName, cookieValue);
String result = hdnc.toString(cookie);
NewCookie serialized = hdnc.fromString(result);
assertTrue(cookieName.equals(serialized.getName()), "HeaderDelegate<NewCookie> fromString(),toString() failed");
}
use of jakarta.ws.rs.core.NewCookie in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method constructorTest15.
/*
* @testName: constructorTest15
*
* @assertion_ids: JAXRS:JAVADOC:106; JAXRS:JAVADOC:100; JAXRS:JAVADOC:101;
* JAXRS:JAVADOC:103; JAXRS:JAVADOC:53; JAXRS:JAVADOC:54; JAXRS:JAVADOC:55;
* JAXRS:JAVADOC:56;
*
* @test_Strategy: Create a version 1 NewCookie instance using constructor
* NewCookie(java.lang.String name, java.lang.String value, java.lang.String
* path, java.lang.String domain, int version, java.lang.String comment, int
* maxAge, boolean secure)
*/
@Test
public void constructorTest15() throws Fault {
String name = "name_1";
String value = "value_1";
String path = "/acme";
String domain = "y.x.foo.com";
int version = 0;
String comment = "cts test comment";
int maxage = jakarta.ws.rs.core.NewCookie.DEFAULT_MAX_AGE;
boolean secure = true;
NewCookie nck15 = new NewCookie(name, value, path, domain, version, comment, maxage, secure);
verifyNewCookie(nck15, name, value, path, domain, version, comment, maxage, secure);
}
use of jakarta.ws.rs.core.NewCookie in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method constructorTest6.
/*
* @testName: constructorTest6
*
* @assertion_ids: JAXRS:JAVADOC:104; JAXRS:JAVADOC:100; JAXRS:JAVADOC:101;
* JAXRS:JAVADOC:103; JAXRS:JAVADOC:53; JAXRS:JAVADOC:54; JAXRS:JAVADOC:55;
* JAXRS:JAVADOC:56;
*
* @test_Strategy: Create a version 0 NewCookie instance using constructor
* NewCookie(String, String)
*/
@Test
public void constructorTest6() throws Fault {
String name = "name_1";
String value = "value_1";
String comment = "";
String domain = "";
String path = "";
int maxage = jakarta.ws.rs.core.NewCookie.DEFAULT_MAX_AGE;
int version = 1;
boolean secure = false;
NewCookie nck6 = new NewCookie(name, value);
verifyNewCookie(nck6, name, value, path, domain, version, comment, maxage, secure);
}
use of jakarta.ws.rs.core.NewCookie in project jaxrs-api by eclipse-ee4j.
the class JAXRSClientIT method constructorTest20.
/*
* @testName: constructorTest20
*
* @assertion_ids: JAXRS:JAVADOC:108; JAXRS:JAVADOC:100; JAXRS:JAVADOC:101;
* JAXRS:JAVADOC:103; JAXRS:JAVADOC:50; JAXRS:JAVADOC:53; JAXRS:JAVADOC:54;
* JAXRS:JAVADOC:55; JAXRS:JAVADOC:56;
*
* @test_Strategy: Create a NewCookie instance using constructor
* Cookie(String, String, String, String) NewCookie(Cookie, String comment,
* int maxAge, boolean secure)
*/
@Test
public void constructorTest20() throws Fault {
String name = "name_1";
String value = "value_1";
String path = "";
String domain = "y.x.foo.com";
String comment = "";
int maxage = jakarta.ws.rs.core.NewCookie.DEFAULT_MAX_AGE;
int version = 1;
boolean secure = false;
Cookie ck20 = new Cookie(name, value, path, domain);
NewCookie nck20 = new NewCookie(ck20, comment, maxage, secure);
verifyNewCookie(nck20, name, value, path, domain, version, comment, maxage, secure);
}
Aggregations