Search in sources :

Example 1 with TrackerMessage

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
}
Also used : TrackerMessage(org.hisp.dhis.tracker.job.TrackerMessage)

Example 2 with TrackerMessage

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());
}
Also used : TrackerImportReportRequest(org.hisp.dhis.webapi.controller.tracker.TrackerImportReportRequest) TrackerMessage(org.hisp.dhis.tracker.job.TrackerMessage) JobConfiguration(org.hisp.dhis.scheduling.JobConfiguration) Test(org.junit.jupiter.api.Test)

Aggregations

TrackerMessage (org.hisp.dhis.tracker.job.TrackerMessage)2 JobConfiguration (org.hisp.dhis.scheduling.JobConfiguration)1 TrackerImportReportRequest (org.hisp.dhis.webapi.controller.tracker.TrackerImportReportRequest)1 Test (org.junit.jupiter.api.Test)1