Search in sources :

Example 6 with RetryContext

use of org.springframework.retry.RetryContext in project dhis2-core by dhis2.

the class MetadataSyncPostProcessorTest method testShouldSendSuccessEmailIfSyncSummaryIsError.

@Test
void testShouldSendSuccessEmailIfSyncSummaryIsError() {
    metadataSyncSummary.setImportReport(new ImportReport());
    metadataSyncSummary.getImportReport().setStatus(Status.ERROR);
    metadataSyncSummary.setMetadataVersion(dataVersion);
    MetadataRetryContext mockMetadataRetryContext = mock(MetadataRetryContext.class);
    RetryContext mockRetryContext = mock(RetryContext.class);
    when(mockMetadataRetryContext.getRetryContext()).thenReturn(mockRetryContext);
    boolean status = metadataSyncPostProcessor.handleSyncNotificationsAndAbortStatus(metadataSyncSummary, mockMetadataRetryContext, dataVersion);
    assertTrue(status);
}
Also used : ImportReport(org.hisp.dhis.dxf2.metadata.feedback.ImportReport) MetadataRetryContext(org.hisp.dhis.dxf2.metadata.jobs.MetadataRetryContext) RetryContext(org.springframework.retry.RetryContext) MetadataRetryContext(org.hisp.dhis.dxf2.metadata.jobs.MetadataRetryContext) Test(org.junit.jupiter.api.Test)

Example 7 with RetryContext

use of org.springframework.retry.RetryContext in project dhis2-core by dhis2.

the class MetadataRetryContextTest method testShouldSetRetryContextCorrectly.

@Test
void testShouldSetRetryContextCorrectly() {
    RetryContext newMock = mock(RetryContext.class);
    metadataRetryContext.setRetryContext(newMock);
    assertEquals(newMock, metadataRetryContext.getRetryContext());
}
Also used : RetryContext(org.springframework.retry.RetryContext) Test(org.junit.jupiter.api.Test) DhisSpringTest(org.hisp.dhis.DhisSpringTest)

Aggregations

RetryContext (org.springframework.retry.RetryContext)7 DhisSpringTest (org.hisp.dhis.DhisSpringTest)2 Test (org.junit.Test)2 Test (org.junit.jupiter.api.Test)2 Test (org.testng.annotations.Test)2 URI (java.net.URI)1 ArrayList (java.util.ArrayList)1 OkHttpClient (okhttp3.OkHttpClient)1 Request (okhttp3.Request)1 Response (okhttp3.Response)1 ResponseBody (okhttp3.ResponseBody)1 Advice (org.aopalliance.aop.Advice)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1 ImportReport (org.hisp.dhis.dxf2.metadata.feedback.ImportReport)1 MetadataRetryContext (org.hisp.dhis.dxf2.metadata.jobs.MetadataRetryContext)1 MolgenisDataException (org.molgenis.data.MolgenisDataException)1 BeanFactory (org.springframework.beans.factory.BeanFactory)1 ServiceInstance (org.springframework.cloud.client.ServiceInstance)1 LoadBalancedRetryContext (org.springframework.cloud.client.loadbalancer.LoadBalancedRetryContext)1 LoadBalancedRetryPolicy (org.springframework.cloud.client.loadbalancer.LoadBalancedRetryPolicy)1