use of com.linkedin.restli.internal.server.PathKeysImpl in project rest.li by linkedin.
the class TestRestLiResponseHandler method testGetRequestCookies.
@Test
public void testGetRequestCookies() throws URISyntaxException, RestLiSyntaxException {
List<HttpCookie> cookies = Arrays.asList(new HttpCookie("cook1", "value1"), new HttpCookie("cook2", "value2"));
RestRequest request = new RestRequestBuilder(new URI("http://www.abc.org/")).setMethod("DONT_CARE").setHeaders(new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER)).setCookies(CookieUtil.encodeCookies(cookies)).build();
ServerResourceContext resourceContext = new ResourceContextImpl(new PathKeysImpl(), request, new RequestContext());
Assert.assertEquals(resourceContext.getRequestCookies(), cookies);
}
use of com.linkedin.restli.internal.server.PathKeysImpl in project rest.li by linkedin.
the class RestLiArgumentBuilderTestHelper method getMockResourceContext.
public static ResourceContext getMockResourceContext() {
ResourceContext context = createMock(ResourceContext.class);
PathKeysImpl pathKeys = new PathKeysImpl();
expect(context.getPathKeys()).andReturn(pathKeys);
replay(context);
return context;
}
use of com.linkedin.restli.internal.server.PathKeysImpl in project rest.li by linkedin.
the class RestLiArgumentBuilderTestHelper method getMockResourceContext.
static ServerResourceContext getMockResourceContext(Set<Object> batchKeys, boolean attachmentReaderGetExpected, boolean hasAlternateKeyParam) {
ServerResourceContext context = createMock(ServerResourceContext.class);
if (batchKeys != null) {
PathKeysImpl pathKeys = new PathKeysImpl();
if (batchKeys != null) {
pathKeys.setBatchKeys(batchKeys);
}
expect(context.getPathKeys()).andReturn(pathKeys);
}
if (attachmentReaderGetExpected) {
expect(context.getRequestAttachmentReader()).andReturn(null);
}
expect(context.getParameter(RestConstants.ALT_KEY_PARAM)).andReturn(hasAlternateKeyParam ? "" : null).anyTimes();
replay(context);
return context;
}
use of com.linkedin.restli.internal.server.PathKeysImpl in project rest.li by linkedin.
the class RestLiArgumentBuilderTestHelper method getMockResourceContext.
public static ServerResourceContext getMockResourceContext(String keyName, Object keyValue, Set<Object> batchKeys, Map<String, String> headers, boolean attachmentReaderGetExpected) {
ServerResourceContext context = createMock(ServerResourceContext.class);
if (keyName != null || batchKeys != null) {
PathKeysImpl pathKeys = new PathKeysImpl();
if (keyName != null) {
pathKeys.append(keyName, keyValue);
}
if (batchKeys != null) {
pathKeys.setBatchKeys(batchKeys);
}
expect(context.getPathKeys()).andReturn(pathKeys);
}
if (headers != null) {
expect(context.getRequestHeaders()).andReturn(headers);
}
if (attachmentReaderGetExpected) {
expect(context.getRequestAttachmentReader()).andReturn(null);
}
replay(context);
return context;
}
Aggregations