use of io.crnk.legacy.internal.RepositoryMethodParameterProvider in project crnk-framework by crnk-project.
the class FilterTest method test.
@Test
public void test() throws Exception {
// WHEN
ArgumentCaptor<DocumentFilterContext> captor = ArgumentCaptor.forClass(DocumentFilterContext.class);
when(collectionGet.isAcceptable(any(JsonPath.class), eq(requestType))).thenCallRealMethod();
when(filter.filter(any(DocumentFilterContext.class), any(DocumentFilterChain.class))).thenCallRealMethod();
Map<String, Set<String>> queryParams = new HashMap<>();
RepositoryMethodParameterProvider parameterProvider = new NewInstanceRepositoryMethodParameterProvider();
Document requestBody = new Document();
dispatcher.dispatchRequest(path, requestType, queryParams, parameterProvider, requestBody);
// THEN
verify(filter).filter(captor.capture(), any(DocumentFilterChain.class));
verify(collectionGet, times(1)).handle(any(JsonPath.class), any(QueryAdapter.class), any(RepositoryMethodParameterProvider.class), any(Document.class));
verify(filter, times(1)).filter(any(DocumentFilterContext.class), any(DocumentFilterChain.class));
DocumentFilterContext value = captor.getValue();
Assert.assertEquals("tasks", value.getJsonPath().getElementName());
Assert.assertEquals(parameterProvider, value.getParameterProvider());
Assert.assertEquals(requestBody, value.getRequestBody());
Assert.assertEquals("GET", value.getMethod());
}
use of io.crnk.legacy.internal.RepositoryMethodParameterProvider in project crnk-framework by crnk-project.
the class ClientResourceUpsert method setRelations.
public void setRelations(List<Resource> resources) {
for (Resource resource : resources) {
String uid = getUID(resource);
Object object = resourceMap.get(uid);
RegistryEntry registryEntry = resourceRegistry.getEntry(resource.getType());
// no need for any query parameters when doing POST/PATCH
QueryAdapter queryAdapter = null;
// no in use on the client side
RepositoryMethodParameterProvider parameterProvider = null;
setRelations(object, registryEntry, resource, queryAdapter, parameterProvider, true);
}
}
Aggregations