Search in sources :

Example 6 with Cookie

use of javax.ws.rs.core.Cookie in project jersey by jersey.

the class CookieParamAsCookieTest method testCookieParam.

@Test
public void testCookieParam() throws ExecutionException, InterruptedException {
    initiateWebApplication(CookieTypeResource.class);
    Cookie one = new Cookie("one", "value_one");
    Cookie two = new Cookie("two", "value_two");
    assertEquals("content", apply(RequestContextBuilder.from("/", "POST").cookie(one).cookie(two).build()).getEntity());
}
Also used : Cookie(javax.ws.rs.core.Cookie) Test(org.junit.Test)

Example 7 with Cookie

use of javax.ws.rs.core.Cookie in project jersey by jersey.

the class CookieParamAsPrimitiveTest method testBadPrimitiveListValue.

@Test
public void testBadPrimitiveListValue() throws ExecutionException, InterruptedException {
    final ContainerResponse responseContext = apply(RequestContextBuilder.from("/wrappers", "GET").accept("application/int").cookie(new Cookie("int", "abcdef")).build());
    assertEquals(400, responseContext.getStatus());
}
Also used : Cookie(javax.ws.rs.core.Cookie) ContainerResponse(org.glassfish.jersey.server.ContainerResponse) Test(org.junit.Test)

Example 8 with Cookie

use of javax.ws.rs.core.Cookie in project jersey by jersey.

the class CookieParamAsPrimitiveTest method _test.

void _test(String type, String value) throws ExecutionException, InterruptedException {
    assertEquals("content", apply(RequestContextBuilder.from("/", "GET").accept("application/" + type).cookie(new Cookie(type, value)).build()).getEntity());
    assertEquals("content", apply(RequestContextBuilder.from("/wrappers", "GET").accept("application/" + type).cookie(new Cookie(type, value)).build()).getEntity());
    assertEquals("content", apply(RequestContextBuilder.from("/list", "GET").accept("application/" + type).cookie(new Cookie(type, value)).build()).getEntity());
}
Also used : Cookie(javax.ws.rs.core.Cookie)

Example 9 with Cookie

use of javax.ws.rs.core.Cookie in project jersey by jersey.

the class CookieParamAsPrimitiveTest method testBadPrimitiveWrapperValue.

@Test
public void testBadPrimitiveWrapperValue() throws ExecutionException, InterruptedException {
    final ContainerResponse responseContext = apply(RequestContextBuilder.from("/wrappers", "GET").accept("application/int").cookie(new Cookie("int", "abcdef")).build());
    assertEquals(400, responseContext.getStatus());
}
Also used : Cookie(javax.ws.rs.core.Cookie) ContainerResponse(org.glassfish.jersey.server.ContainerResponse) Test(org.junit.Test)

Example 10 with Cookie

use of javax.ws.rs.core.Cookie in project jersey by jersey.

the class CookieParamAsStringTest method testListDefaultOverride.

@Test
public void testListDefaultOverride() throws ExecutionException, InterruptedException {
    initiateWebApplication(ResourceStringListDefaultOverride.class);
    _test("/", "application/list", new Cookie("args", "b"));
}
Also used : Cookie(javax.ws.rs.core.Cookie) Test(org.junit.Test)

Aggregations

Cookie (javax.ws.rs.core.Cookie)49 Test (org.junit.Test)28 HashMap (java.util.HashMap)7 ContainerResponse (org.glassfish.jersey.server.ContainerResponse)7 NewCookie (javax.ws.rs.core.NewCookie)6 Entitlement (com.sun.identity.entitlement.Entitlement)4 EntitlementSubject (com.sun.identity.entitlement.EntitlementSubject)4 Privilege (com.sun.identity.entitlement.Privilege)4 PrivilegeManager (com.sun.identity.entitlement.PrivilegeManager)4 ClientResponse (com.sun.jersey.api.client.ClientResponse)4 BeforeClass (org.testng.annotations.BeforeClass)4 SSOToken (com.iplanet.sso.SSOToken)3 Form (javax.ws.rs.core.Form)3 AuthenticatedUsers (org.forgerock.openam.entitlement.conditions.subject.AuthenticatedUsers)3 JSONEntitlement (com.sun.identity.entitlement.JSONEntitlement)2 UniformInterfaceException (com.sun.jersey.api.client.UniformInterfaceException)2 MalformedURLException (java.net.MalformedURLException)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Consumes (javax.ws.rs.Consumes)2