summaryrefslogtreecommitdiff
path: root/src/test/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/kotlin')
-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
2 files changed, 34 insertions, 12 deletions
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 =