diff --git a/pom.xml b/pom.xml
index 03dfd73..89e6d6e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -27,8 +27,22 @@
postgres
alert_tg_bot
1.4.3
+ 2021.0.7
+
+
+
+
+ org.springframework.cloud
+ spring-cloud-dependencies
+ ${spring-cloud.version}
+ pom
+ import
+
+
+
+
@@ -61,11 +75,6 @@
dev.vality.geck
migrator
-
- dev.vality
- adapter-common-lib
- 1.2.8
-
dev.vality
damsel
@@ -73,11 +82,6 @@
-
- org.springframework.vault
- spring-vault-core
- 2.3.2
-
org.springframework.boot
spring-boot-starter
@@ -109,6 +113,10 @@
org.springframework.boot
spring-boot-starter-jooq
+
+ org.springframework.cloud
+ spring-cloud-starter-vault-config
+
diff --git a/src/main/java/dev/vality/alert/tg/bot/config/properties/AlertBotProperties.java b/src/main/java/dev/vality/alert/tg/bot/config/properties/AlertBotProperties.java
index cfbe1d9..a466e98 100644
--- a/src/main/java/dev/vality/alert/tg/bot/config/properties/AlertBotProperties.java
+++ b/src/main/java/dev/vality/alert/tg/bot/config/properties/AlertBotProperties.java
@@ -1,18 +1,14 @@
package dev.vality.alert.tg.bot.config.properties;
-import lombok.Getter;
-import lombok.Setter;
+import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
-import org.springframework.validation.annotation.Validated;
import javax.validation.constraints.NotNull;
+@Data
@Configuration
@ConfigurationProperties(prefix = "bot")
-@Validated
-@Getter
-@Setter
public class AlertBotProperties {
@NotNull
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index eab9f4e..61a2833 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -35,6 +35,14 @@ spring:
url: jdbc:postgresql://localhost:5432/alert_tg_bot
username: postgres
password: postgres
+ cloud:
+ vault:
+ kv:
+ enabled: true
+ uri: https://vault.empayre.com:443
+ authentication: TOKEN
+ scheme: http
+ token: "123456"
info:
version: '@project.version@'
@@ -45,6 +53,6 @@ mayday:
networkTimeout: 5000
bot:
- token: test
+ token: ${botToken}
name: AlertBot
- chatId: test
+ chatId: ${chatId}
diff --git a/src/test/java/dev/vality/alert/tg/bot/handler/CallbackHandlerTest.java b/src/test/java/dev/vality/alert/tg/bot/handler/CallbackHandlerTest.java
index e39c70a..88106f0 100644
--- a/src/test/java/dev/vality/alert/tg/bot/handler/CallbackHandlerTest.java
+++ b/src/test/java/dev/vality/alert/tg/bot/handler/CallbackHandlerTest.java
@@ -13,6 +13,7 @@ import dev.vality.alerting.mayday.ParameterType;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.ContextConfiguration;
@@ -35,6 +36,7 @@ import static org.mockito.Mockito.*;
@Import(ExcludeDataSourceConfiguration.class)
@ContextConfiguration(classes = {CallbackHandler.class, MenuCallbackMapper.class, ParametersCallbackMapper.class,
JsonMapper.class})
+@SpringBootTest(properties = {"spring.config.location=classpath:/application.yml"})
public class CallbackHandlerTest {
@MockBean
private ParametersDao parametersDao;
diff --git a/src/test/java/dev/vality/alert/tg/bot/handler/MainMenuHandlerTest.java b/src/test/java/dev/vality/alert/tg/bot/handler/MainMenuHandlerTest.java
index 04f5f45..0b0ac70 100644
--- a/src/test/java/dev/vality/alert/tg/bot/handler/MainMenuHandlerTest.java
+++ b/src/test/java/dev/vality/alert/tg/bot/handler/MainMenuHandlerTest.java
@@ -4,6 +4,7 @@ import dev.vality.alert.tg.bot.config.ExcludeDataSourceConfiguration;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit.jupiter.SpringExtension;
@@ -18,6 +19,7 @@ import static org.junit.jupiter.api.Assertions.*;
@ExtendWith(SpringExtension.class)
@Import(ExcludeDataSourceConfiguration.class)
@ContextConfiguration(classes = {MainMenuHandler.class})
+@SpringBootTest(properties = {"spring.config.location=classpath:/application.yml"})
public class MainMenuHandlerTest {
@Autowired
diff --git a/src/test/java/dev/vality/alert/tg/bot/handler/MessageHandlerTest.java b/src/test/java/dev/vality/alert/tg/bot/handler/MessageHandlerTest.java
index dd67fc8..bc656f3 100644
--- a/src/test/java/dev/vality/alert/tg/bot/handler/MessageHandlerTest.java
+++ b/src/test/java/dev/vality/alert/tg/bot/handler/MessageHandlerTest.java
@@ -5,6 +5,7 @@ import dev.vality.alert.tg.bot.dao.StateDataDao;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.ContextConfiguration;
@@ -23,6 +24,7 @@ import static org.mockito.Mockito.verify;
@ExtendWith(SpringExtension.class)
@Import(ExcludeDataSourceConfiguration.class)
@ContextConfiguration(classes = {MessageHandler.class})
+@SpringBootTest(properties = {"spring.config.location=classpath:/application.yml"})
public class MessageHandlerTest {
@MockBean
diff --git a/src/test/java/dev/vality/alert/tg/bot/handler/ReplyHandlerTest.java b/src/test/java/dev/vality/alert/tg/bot/handler/ReplyHandlerTest.java
index c683a6b..95101d5 100644
--- a/src/test/java/dev/vality/alert/tg/bot/handler/ReplyHandlerTest.java
+++ b/src/test/java/dev/vality/alert/tg/bot/handler/ReplyHandlerTest.java
@@ -9,6 +9,7 @@ import dev.vality.alert.tg.bot.service.MayDayService;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.ContextConfiguration;
@@ -27,6 +28,7 @@ import static org.mockito.Mockito.*;
@ExtendWith(SpringExtension.class)
@Import(ExcludeDataSourceConfiguration.class)
@ContextConfiguration(classes = {ReplyHandler.class, ReplyMessagesMapper.class, JsonMapper.class})
+@SpringBootTest(properties = {"spring.config.location=classpath:/application.yml"})
public class ReplyHandlerTest {
@MockBean
diff --git a/src/test/java/dev/vality/alert/tg/bot/mapper/MenuCallbackMapperTest.java b/src/test/java/dev/vality/alert/tg/bot/mapper/MenuCallbackMapperTest.java
index 4bf03aa..1eafff7 100644
--- a/src/test/java/dev/vality/alert/tg/bot/mapper/MenuCallbackMapperTest.java
+++ b/src/test/java/dev/vality/alert/tg/bot/mapper/MenuCallbackMapperTest.java
@@ -8,6 +8,7 @@ import org.apache.thrift.TException;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.ContextConfiguration;
@@ -26,6 +27,7 @@ import static org.mockito.Mockito.*;
@ExtendWith(SpringExtension.class)
@Import(ExcludeDataSourceConfiguration.class)
@ContextConfiguration(classes = {MenuCallbackMapper.class})
+@SpringBootTest(properties = {"spring.config.location=classpath:/application.yml"})
public class MenuCallbackMapperTest {
@MockBean
diff --git a/src/test/java/dev/vality/alert/tg/bot/mapper/ParametersCallbackMapperTest.java b/src/test/java/dev/vality/alert/tg/bot/mapper/ParametersCallbackMapperTest.java
index 6797b61..cedcf82 100644
--- a/src/test/java/dev/vality/alert/tg/bot/mapper/ParametersCallbackMapperTest.java
+++ b/src/test/java/dev/vality/alert/tg/bot/mapper/ParametersCallbackMapperTest.java
@@ -10,6 +10,7 @@ import dev.vality.alerting.mayday.ParameterType;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.ContextConfiguration;
@@ -28,6 +29,7 @@ import static org.mockito.Mockito.*;
@ExtendWith(SpringExtension.class)
@Import(ExcludeDataSourceConfiguration.class)
@ContextConfiguration(classes = {ParametersCallbackMapper.class, JsonMapper.class})
+@SpringBootTest(properties = {"spring.config.location=classpath:/application.yml"})
public class ParametersCallbackMapperTest {
@MockBean
diff --git a/src/test/java/dev/vality/alert/tg/bot/mapper/ReplyMessageMapperTest.java b/src/test/java/dev/vality/alert/tg/bot/mapper/ReplyMessageMapperTest.java
index 7b3b111..1fb1d83 100644
--- a/src/test/java/dev/vality/alert/tg/bot/mapper/ReplyMessageMapperTest.java
+++ b/src/test/java/dev/vality/alert/tg/bot/mapper/ReplyMessageMapperTest.java
@@ -10,6 +10,7 @@ import dev.vality.alerting.mayday.ParameterType;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.ContextConfiguration;
@@ -31,6 +32,7 @@ import static org.mockito.Mockito.*;
@ExtendWith(SpringExtension.class)
@Import(ExcludeDataSourceConfiguration.class)
@ContextConfiguration(classes = {ReplyMessagesMapper.class, JsonMapper.class})
+@SpringBootTest(properties = {"spring.config.location=classpath:/application.yml"})
public class ReplyMessageMapperTest {
@MockBean