use of com.yahoo.elide.async.operation.JSONAPIAsyncQueryOperation in project elide by yahoo.
the class AsyncExecutorServiceTest method testExecuteQueryComplete.
// Test for executor hook execution
@Test
public void testExecuteQueryComplete() {
AsyncQuery queryObj = mock(AsyncQuery.class);
String query = "/group?sort=commonName&fields%5Bgroup%5D=commonName,description";
String id = "edc4a871-dff2-4054-804e-d80075cf827d";
when(queryObj.getQuery()).thenReturn(query);
when(queryObj.getId()).thenReturn(id);
when(queryObj.getRequestId()).thenReturn(id);
when(queryObj.getQueryType()).thenReturn(QueryType.JSONAPI_V1_0);
when(queryObj.getAsyncAfterSeconds()).thenReturn(10);
when(scope.getApiVersion()).thenReturn(NO_VERSION);
when(scope.getUser()).thenReturn(testUser);
JSONAPIAsyncQueryOperation jsonOperation = new JSONAPIAsyncQueryOperation(service, queryObj, scope);
service.executeQuery(queryObj, jsonOperation);
verify(queryObj, times(1)).setStatus(QueryStatus.PROCESSING);
verify(queryObj, times(1)).setStatus(QueryStatus.COMPLETE);
}
Aggregations