use of org.hisp.dhis.tracker.job.TrackerMessage in project dhis2-core by dhis2.
the class TrackerImportAsyncStrategyImpl method importReport.
@Override
public TrackerImportReport importReport(TrackerImportReportRequest trackerImportReportRequest) {
TrackerMessage trackerMessage = TrackerMessage.builder().trackerImportParams(trackerImportReportRequest.getTrackerImportParams()).authentication(AuthenticationSerializer.serialize(trackerImportReportRequest.getAuthentication())).uid(trackerImportReportRequest.getUid()).build();
messageManager.sendQueue(Topics.TRACKER_IMPORT_JOB_TOPIC_NAME, trackerMessage);
// empty report is not
return null;
// returned
// in async creation
}
use of org.hisp.dhis.tracker.job.TrackerMessage in project dhis2-core by dhis2.
the class TrackerImportStrategyHandlerImplTest method shouldSendMessageToQueueAsync.
@Test
void shouldSendMessageToQueueAsync() {
ArgumentCaptor<String> queueNameCaptor = ArgumentCaptor.forClass(String.class);
ArgumentCaptor<TrackerMessage> trackerMessageCaptor = ArgumentCaptor.forClass(TrackerMessage.class);
doNothing().when(messageManager).sendQueue(queueNameCaptor.capture(), trackerMessageCaptor.capture());
TrackerImportReportRequest trackerImportReportRequest = TrackerImportReportRequest.builder().trackerImportParams(TrackerImportParams.builder().jobConfiguration(new JobConfiguration("", JobType.TRACKER_IMPORT_JOB, "userId", true)).build()).build();
importAsyncStrategy.importReport(trackerImportReportRequest);
verify(trackerImportService, times(0)).importTracker(any());
verify(messageManager).sendQueue(any(), any());
assertEquals(Topics.TRACKER_IMPORT_JOB_TOPIC_NAME, queueNameCaptor.getValue());
assertEquals(trackerImportReportRequest.getTrackerImportParams(), trackerMessageCaptor.getValue().getTrackerImportParams());
}
Aggregations