summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/dev/dnpm/etl/processor/consent/GicsConsentServiceTest.java12
-rw-r--r--src/test/java/dev/dnpm/etl/processor/consent/GicsGetBroadConsentServiceTest.java10
-rw-r--r--src/test/kotlin/dev/dnpm/etl/processor/output/KafkaMtbFileSenderTest.kt28
-rw-r--r--src/test/kotlin/dev/dnpm/etl/processor/output/RestDipMtbFileSenderTest.kt18
4 files changed, 45 insertions, 23 deletions
diff --git a/src/test/java/dev/dnpm/etl/processor/consent/GicsConsentServiceTest.java b/src/test/java/dev/dnpm/etl/processor/consent/GicsConsentServiceTest.java
index 90c0734..7e392da 100644
--- a/src/test/java/dev/dnpm/etl/processor/consent/GicsConsentServiceTest.java
+++ b/src/test/java/dev/dnpm/etl/processor/consent/GicsConsentServiceTest.java
@@ -51,8 +51,9 @@ import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.restclient.test.autoconfigure.RestClientTest;
+import org.springframework.core.retry.RetryPolicy;
+import org.springframework.core.retry.RetryTemplate;
import org.springframework.http.MediaType;
-import org.springframework.retry.support.RetryTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.web.client.MockRestServiceServer;
@@ -88,13 +89,12 @@ class GicsConsentServiceTest {
var restTemplate = new RestTemplate();
+ var retryTemplate = new RetryTemplate(RetryPolicy.builder().maxRetries(0).build());
+
this.mockRestServiceServer = MockRestServiceServer.createServer(restTemplate);
this.gicsConsentService =
new GicsConsentService(
- this.gIcsConfigProperties,
- RetryTemplate.builder().maxAttempts(1).build(),
- restTemplate,
- this.appFhirConfig);
+ this.gIcsConfigProperties, retryTemplate, restTemplate, this.appFhirConfig);
}
@Test
@@ -277,7 +277,7 @@ class GicsConsentServiceTest {
() ->
new GicsConsentService(
testConfigProperties,
- RetryTemplate.builder().maxAttempts(1).build(),
+ new RetryTemplate(RetryPolicy.builder().maxRetries(0).build()),
new RestTemplate(),
new AppFhirConfig()));
diff --git a/src/test/java/dev/dnpm/etl/processor/consent/GicsGetBroadConsentServiceTest.java b/src/test/java/dev/dnpm/etl/processor/consent/GicsGetBroadConsentServiceTest.java
index e97a8d4..01d05b8 100644
--- a/src/test/java/dev/dnpm/etl/processor/consent/GicsGetBroadConsentServiceTest.java
+++ b/src/test/java/dev/dnpm/etl/processor/consent/GicsGetBroadConsentServiceTest.java
@@ -42,8 +42,9 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.restclient.test.autoconfigure.RestClientTest;
+import org.springframework.core.retry.RetryPolicy;
+import org.springframework.core.retry.RetryTemplate;
import org.springframework.http.MediaType;
-import org.springframework.retry.support.RetryTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.web.client.MockRestServiceServer;
@@ -87,13 +88,12 @@ class GicsGetBroadConsentServiceTest {
var restTemplate = new RestTemplate();
+ var retryTemplyte = new RetryTemplate(RetryPolicy.builder().maxRetries(0).build());
+
this.mockRestServiceServer = MockRestServiceServer.createServer(restTemplate);
this.service =
new GicsGetBroadConsentService(
- this.gIcsConfigProperties,
- RetryTemplate.builder().maxAttempts(1).build(),
- restTemplate,
- this.appFhirConfig);
+ this.gIcsConfigProperties, retryTemplyte, restTemplate, this.appFhirConfig);
}
@Test
diff --git a/src/test/kotlin/dev/dnpm/etl/processor/output/KafkaMtbFileSenderTest.kt b/src/test/kotlin/dev/dnpm/etl/processor/output/KafkaMtbFileSenderTest.kt
index 9384aae..b2a9bcd 100644
--- a/src/test/kotlin/dev/dnpm/etl/processor/output/KafkaMtbFileSenderTest.kt
+++ b/src/test/kotlin/dev/dnpm/etl/processor/output/KafkaMtbFileSenderTest.kt
@@ -43,10 +43,10 @@ import org.junit.jupiter.params.provider.MethodSource
import org.mockito.Mock
import org.mockito.junit.jupiter.MockitoExtension
import org.mockito.kotlin.*
+import org.springframework.core.retry.RetryPolicy
+import org.springframework.core.retry.RetryTemplate
import org.springframework.kafka.core.KafkaTemplate
import org.springframework.kafka.support.SendResult
-import org.springframework.retry.policy.SimpleRetryPolicy
-import org.springframework.retry.support.RetryTemplateBuilder
import tools.jackson.databind.json.JsonMapper
import java.time.Instant
import java.util.*
@@ -68,7 +68,11 @@ class KafkaMtbFileSenderTest {
@BeforeEach
fun setup(@Mock kafkaTemplate: KafkaTemplate<String, String>) {
val kafkaProperties = KafkaProperties("testtopic")
- val retryTemplate = RetryTemplateBuilder().customPolicy(SimpleRetryPolicy(1)).build()
+ val retryTemplate = RetryTemplate(
+ RetryPolicy.builder()
+ .maxRetries(0)
+ .build()
+ )
this.jsonMapper = JsonMapper.builder().build()
this.kafkaTemplate = kafkaTemplate
@@ -97,7 +101,11 @@ class KafkaMtbFileSenderTest {
@MethodSource("dev.dnpm.etl.processor.output.KafkaMtbFileSenderTest#requestWithResponseSource")
fun shouldRetryOnDeleteKafkaSendError(testData: TestData) {
val kafkaProperties = KafkaProperties("testtopic")
- val retryTemplate = RetryTemplateBuilder().customPolicy(SimpleRetryPolicy(3)).build()
+ val retryTemplate = RetryTemplate(
+ RetryPolicy.builder()
+ .maxRetries(2)
+ .build()
+ )
this.kafkaMtbFileSender =
KafkaMtbFileSender(this.kafkaTemplate, kafkaProperties, retryTemplate, this.jsonMapper)
@@ -136,7 +144,11 @@ class KafkaMtbFileSenderTest {
@BeforeEach
fun setup(@Mock kafkaTemplate: KafkaTemplate<String, String>) {
val kafkaProperties = KafkaProperties("testtopic")
- val retryTemplate = RetryTemplateBuilder().customPolicy(SimpleRetryPolicy(1)).build()
+ val retryTemplate = RetryTemplate(
+ RetryPolicy.builder()
+ .maxRetries(0)
+ .build()
+ )
this.jsonMapper = JsonMapper()
this.kafkaTemplate = kafkaTemplate
@@ -215,7 +227,11 @@ class KafkaMtbFileSenderTest {
@MethodSource("dev.dnpm.etl.processor.output.KafkaMtbFileSenderTest#requestWithResponseSource")
fun shouldRetryOnMtbFileKafkaSendError(testData: TestData) {
val kafkaProperties = KafkaProperties("testtopic")
- val retryTemplate = RetryTemplateBuilder().customPolicy(SimpleRetryPolicy(3)).build()
+ val retryTemplate = RetryTemplate(
+ RetryPolicy.builder()
+ .maxRetries(2)
+ .build()
+ )
this.kafkaMtbFileSender =
KafkaMtbFileSender(this.kafkaTemplate, kafkaProperties, retryTemplate, this.jsonMapper)
diff --git a/src/test/kotlin/dev/dnpm/etl/processor/output/RestDipMtbFileSenderTest.kt b/src/test/kotlin/dev/dnpm/etl/processor/output/RestDipMtbFileSenderTest.kt
index a13c001..0899c63 100644
--- a/src/test/kotlin/dev/dnpm/etl/processor/output/RestDipMtbFileSenderTest.kt
+++ b/src/test/kotlin/dev/dnpm/etl/processor/output/RestDipMtbFileSenderTest.kt
@@ -39,12 +39,11 @@ import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Nested
import org.junit.jupiter.params.ParameterizedTest
import org.junit.jupiter.params.provider.MethodSource
+import org.springframework.core.retry.RetryPolicy
+import org.springframework.core.retry.RetryTemplate
import org.springframework.http.HttpHeaders
import org.springframework.http.HttpMethod
import org.springframework.http.HttpStatus
-import org.springframework.retry.backoff.NoBackOffPolicy
-import org.springframework.retry.policy.SimpleRetryPolicy
-import org.springframework.retry.support.RetryTemplateBuilder
import org.springframework.test.web.client.ExpectedCount
import org.springframework.test.web.client.MockRestServiceServer
import org.springframework.test.web.client.match.MockRestRequestMatchers.*
@@ -70,7 +69,11 @@ class RestDipMtbFileSenderTest {
fun setup() {
val restTemplate = RestTemplate()
val restTargetProperties = RestTargetProperties("http://localhost:9000/api", null, null)
- val retryTemplate = RetryTemplateBuilder().customPolicy(SimpleRetryPolicy(1)).build()
+ val retryTemplate = RetryTemplate(
+ RetryPolicy.builder()
+ .maxRetries(0)
+ .build()
+ )
this.mockRestServiceServer = MockRestServiceServer.createServer(restTemplate)
@@ -118,7 +121,11 @@ class RestDipMtbFileSenderTest {
fun setup() {
val restTemplate = RestTemplate()
val restTargetProperties = RestTargetProperties("http://localhost:9000/api", null, null)
- val retryTemplate = RetryTemplateBuilder().customPolicy(SimpleRetryPolicy(1)).build()
+ val retryTemplate = RetryTemplate(
+ RetryPolicy.builder()
+ .maxRetries(0)
+ .build()
+ )
this.mockRestServiceServer = MockRestServiceServer.createServer(restTemplate)
@@ -155,7 +162,6 @@ class RestDipMtbFileSenderTest {
val restTemplate = RestTemplate()
val restTargetProperties = RestTargetProperties("http://localhost:9000/api", null, null)
val retryTemplate = AppConfiguration().retryTemplate(AppConfigProperties())
- retryTemplate.setBackOffPolicy(NoBackOffPolicy())
this.mockRestServiceServer = MockRestServiceServer.createServer(restTemplate)
this.restMtbFileSender =