Search in sources :

Example 1 with DefaultTrackerImportService

use of org.hisp.dhis.tracker.DefaultTrackerImportService in project dhis2-core by dhis2.

the class TrackerImporterServiceTest method setUp.

@BeforeEach
public void setUp() {
    subject = new DefaultTrackerImportService(trackerBundleService, trackerValidationService, trackerPreprocessService, trackerUserService, notifier);
    final List<Event> events = rnd.objects(Event.class, 3).collect(Collectors.toList());
    params = TrackerImportParams.builder().events(events).enrollments(new ArrayList<>()).relationships(new ArrayList<>()).trackedEntities(new ArrayList<>()).userId("123").build();
    TrackerBundleReport trackerBundleReport = TrackerBundleReport.builder().build();
    when(trackerUserService.getUser(anyString())).thenReturn(getUser());
    when(trackerBundleService.commit(any(TrackerBundle.class))).thenReturn(trackerBundleReport);
    when(trackerValidationService.validate(any(TrackerBundle.class))).thenReturn(new TrackerValidationReport());
    when(trackerValidationService.validateRuleEngine(any(TrackerBundle.class))).thenReturn(new TrackerValidationReport());
    when(trackerPreprocessService.preprocess(any(TrackerBundle.class))).thenReturn(ParamsConverter.convert(params));
}
Also used : TrackerValidationReport(org.hisp.dhis.tracker.report.TrackerValidationReport) ArrayList(java.util.ArrayList) Event(org.hisp.dhis.tracker.domain.Event) DefaultTrackerImportService(org.hisp.dhis.tracker.DefaultTrackerImportService) TrackerBundleReport(org.hisp.dhis.tracker.report.TrackerBundleReport) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

ArrayList (java.util.ArrayList)1 DefaultTrackerImportService (org.hisp.dhis.tracker.DefaultTrackerImportService)1 Event (org.hisp.dhis.tracker.domain.Event)1 TrackerBundleReport (org.hisp.dhis.tracker.report.TrackerBundleReport)1 TrackerValidationReport (org.hisp.dhis.tracker.report.TrackerValidationReport)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1