use of org.hisp.dhis.dxf2.metadata.jobs.MetadataRetryContext in project dhis2-core by dhis2.
the class MetadataSyncPreProcessorTest method testHandleCurrentMetadataVersionShouldReturnCurrentVersionOfSystem.
@Test
void testHandleCurrentMetadataVersionShouldReturnCurrentVersionOfSystem() {
MetadataRetryContext mockRetryContext = mock(MetadataRetryContext.class);
MetadataVersion currentVersion = new MetadataVersion();
currentVersion.setType(VersionType.BEST_EFFORT);
currentVersion.setName("test_version");
currentVersion.setCreated(new Date());
currentVersion.setHashCode("samplehashcode");
when(metadataVersionService.getCurrentVersion()).thenReturn(currentVersion);
MetadataVersion actualVersion = metadataSyncPreProcessor.handleCurrentMetadataVersion(mockRetryContext);
assertEquals(currentVersion, actualVersion);
}
use of org.hisp.dhis.dxf2.metadata.jobs.MetadataRetryContext in project dhis2-core by dhis2.
the class MetadataSyncPreProcessorTest method testhandleAggregateDataPushShouldNotThrowExceptionWhenDataPushIsSuccessful.
@Test
void testhandleAggregateDataPushShouldNotThrowExceptionWhenDataPushIsSuccessful() {
MetadataRetryContext mockRetryContext = mock(MetadataRetryContext.class);
ImportSummary expectedSummary = new ImportSummary();
expectedSummary.setStatus(ImportStatus.SUCCESS);
AvailabilityStatus availabilityStatus = new AvailabilityStatus(true, "test_message", null);
when(synchronizationManager.isRemoteServerAvailable()).thenReturn(availabilityStatus);
doNothing().when(metadataSyncPreProcessor).handleDataValuePush(mockRetryContext, metadataSyncJobParameters);
metadataSyncPreProcessor.handleDataValuePush(mockRetryContext, metadataSyncJobParameters);
verify(metadataSyncPreProcessor, times(1)).handleDataValuePush(mockRetryContext, metadataSyncJobParameters);
}
Aggregations