use of org.hisp.dhis.webapi.strategy.old.tracker.imports.request.TrackerEntityInstanceRequest in project dhis2-core by dhis2.
the class TrackedEntityInstanceStrategyHandlerImplTest method shouldCallAsyncTrackedEntityJsonAsyncStrategy.
@Test
void shouldCallAsyncTrackedEntityJsonAsyncStrategy() throws BadRequestException, IOException {
when(trackedEntityInstanceService.getTrackedEntityInstancesJson(any())).thenReturn(trackedEntityInstanceList);
TrackerEntityInstanceRequest trackerEntityInstanceRequest = TrackerEntityInstanceRequest.builder().mediaType(MediaType.APPLICATION_JSON_VALUE).importOptions(importOptions).jobConfiguration(jobConfiguration).inputStream(inputStream).build();
trackedEntityInstanceAsyncStrategy.mergeOrDeleteTrackedEntityInstances(trackerEntityInstanceRequest);
verify(trackedEntityInstanceService, times(1)).getTrackedEntityInstancesJson(inputStream);
verify(taskExecutor, times(1)).executeTask(trackedEntitiesTaskArgumentCaptor.capture());
}
use of org.hisp.dhis.webapi.strategy.old.tracker.imports.request.TrackerEntityInstanceRequest in project dhis2-core by dhis2.
the class TrackedEntityInstanceStrategyHandlerTest method shouldCallSyncTrackedEntitySyncStrategy.
@Test
void shouldCallSyncTrackedEntitySyncStrategy() throws BadRequestException, IOException {
when(importOptions.isAsync()).thenReturn(false);
TrackerEntityInstanceRequest trackerEntityInstanceRequest = TrackerEntityInstanceRequest.builder().mediaType(MediaType.APPLICATION_JSON).importOptions(importOptions).build();
trackedEntityInstanceStrategyHandler.mergeOrDeleteTrackedEntityInstances(trackerEntityInstanceRequest);
verify(trackedEntityInstanceAsyncStrategy, times(0)).mergeOrDeleteTrackedEntityInstances(any());
verify(trackedEntityInstanceSyncStrategy, times(1)).mergeOrDeleteTrackedEntityInstances(any());
}
use of org.hisp.dhis.webapi.strategy.old.tracker.imports.request.TrackerEntityInstanceRequest in project dhis2-core by dhis2.
the class TrackedEntityInstanceStrategyHandlerTest method shouldCallAsyncTrackedEntitySyncStrategy.
@Test
void shouldCallAsyncTrackedEntitySyncStrategy() throws BadRequestException, IOException {
when(importOptions.isAsync()).thenReturn(true);
TrackerEntityInstanceRequest trackerEntityInstanceRequest = TrackerEntityInstanceRequest.builder().mediaType(MediaType.APPLICATION_JSON).importOptions(importOptions).build();
trackedEntityInstanceStrategyHandler.mergeOrDeleteTrackedEntityInstances(trackerEntityInstanceRequest);
verify(trackedEntityInstanceAsyncStrategy, times(1)).mergeOrDeleteTrackedEntityInstances(any());
verify(trackedEntityInstanceSyncStrategy, times(0)).mergeOrDeleteTrackedEntityInstances(any());
}
Aggregations