diff --git a/pom.xml b/pom.xml index 5b50b32..5abac5a 100644 --- a/pom.xml +++ b/pom.xml @@ -250,6 +250,12 @@ 4.1.3 test + + dev.vality + testcontainers-annotations + 2.0.3 + test + diff --git a/src/main/java/dev/vality/disputes/polling/PollingInfoService.java b/src/main/java/dev/vality/disputes/polling/PollingInfoService.java index 4bebf6f..d4a6caf 100644 --- a/src/main/java/dev/vality/disputes/polling/PollingInfoService.java +++ b/src/main/java/dev/vality/disputes/polling/PollingInfoService.java @@ -1,7 +1,7 @@ package dev.vality.disputes.polling; import dev.vality.adapter.flow.lib.model.PollingInfo; -import dev.vality.adapter.flow.lib.utils.TimerProperties; +import dev.vality.disputes.config.properties.DisputesTimerProperties; import dev.vality.disputes.domain.tables.pojos.Dispute; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; @@ -18,7 +18,7 @@ import static dev.vality.disputes.utils.OptionsExtractors.extractMaxTimePolling; @RequiredArgsConstructor public class PollingInfoService { - private final TimerProperties timerProperties; + private final DisputesTimerProperties timerProperties; public PollingInfo initPollingInfo(Dispute dispute, Map options) { return initPollingInfo(convert(dispute), options); diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 3ae6633..1d6cd07 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -99,3 +99,7 @@ dispute: time: config: max-time-polling-min: 600 + +testcontainers: + postgresql: + tag: '11.4' diff --git a/src/test/java/dev/vality/disputes/dao/DisputeDaoTest.java b/src/test/java/dev/vality/disputes/dao/DisputeDaoTest.java new file mode 100644 index 0000000..8b5f0a5 --- /dev/null +++ b/src/test/java/dev/vality/disputes/dao/DisputeDaoTest.java @@ -0,0 +1,26 @@ +package dev.vality.disputes.dao; + +import dev.vality.disputes.domain.tables.pojos.Dispute; +import dev.vality.testcontainers.annotations.DefaultSpringBootTest; +import dev.vality.testcontainers.annotations.postgresql.PostgresqlTestcontainerSingleton; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import static dev.vality.testcontainers.annotations.util.RandomBeans.random; +import static org.junit.jupiter.api.Assertions.assertEquals; + +@PostgresqlTestcontainerSingleton +@DefaultSpringBootTest +public class DisputeDaoTest { + + @Autowired + private DisputeDao disputeDao; + + @Test + public void insertAndFindAdjustmentEventTest() { + var random = random(Dispute.class); + disputeDao.save(random); + assertEquals(random, + disputeDao.get(random.getId(), random.getInvoiceId(), random.getPaymentId())); + } +}