use of org.hisp.dhis.dxf2.metadata.sync.MetadataSyncSummary in project dhis2-core by dhis2.
the class MetadataSyncImportHandlerTest method testShouldReturnDefaultSummaryWhenImportStatusIsError.
@Test
void testShouldReturnDefaultSummaryWhenImportStatusIsError() {
syncParams.setImportParams(new MetadataImportParams());
syncParams.setVersion(metadataVersion);
MetadataSyncSummary metadataSyncSummary = new MetadataSyncSummary();
metadataSyncSummary.setImportReport(new ImportReport());
metadataSyncSummary.setMetadataVersion(metadataVersion);
importReport.setStatus(Status.ERROR);
when(metadataImportService.importMetadata(syncParams.getImportParams())).thenReturn(importReport);
MetadataSyncSummary actualMetadataSyncSummary = metadataSyncImportHandler.importMetadata(syncParams, expectedMetadataSnapshot);
verify(metadataVersionDelegate, never()).addNewMetadataVersion(metadataVersion);
assertEquals(metadataSyncSummary.getImportReport().toString(), actualMetadataSyncSummary.getImportReport().toString());
assertEquals(metadataSyncSummary.getImportSummary(), actualMetadataSyncSummary.getImportSummary());
assertEquals(metadataSyncSummary.getMetadataVersion(), actualMetadataSyncSummary.getMetadataVersion());
}
use of org.hisp.dhis.dxf2.metadata.sync.MetadataSyncSummary in project dhis2-core by dhis2.
the class MetadataSyncPostProcessorTest method testShouldSendSuccessEmailIfSyncSummaryIsOk.
@Test
void testShouldSendSuccessEmailIfSyncSummaryIsOk() {
metadataSyncSummary.setImportReport(new ImportReport());
metadataSyncSummary.getImportReport().setStatus(Status.OK);
metadataSyncSummary.setMetadataVersion(dataVersion);
MetadataRetryContext mockRetryContext = mock(MetadataRetryContext.class);
boolean status = metadataSyncPostProcessor.handleSyncNotificationsAndAbortStatus(metadataSyncSummary, mockRetryContext, dataVersion);
assertFalse(status);
}
use of org.hisp.dhis.dxf2.metadata.sync.MetadataSyncSummary in project dhis2-core by dhis2.
the class MetadataSyncPostProcessorTest method testShouldSendEmailToAdminWithProperSubjectAndBody.
@Test
void testShouldSendEmailToAdminWithProperSubjectAndBody() {
ImportReport importReport = mock(ImportReport.class);
metadataSyncSummary.setImportReport(importReport);
metadataSyncSummary.getImportReport().setStatus(Status.OK);
metadataSyncSummary.setMetadataVersion(dataVersion);
MetadataRetryContext mockRetryContext = mock(MetadataRetryContext.class);
boolean status = metadataSyncPostProcessor.handleSyncNotificationsAndAbortStatus(metadataSyncSummary, mockRetryContext, dataVersion);
assertFalse(status);
}
Aggregations