mirror of
https://github.com/valitydev/alert-tg-bot.git
synced 2024-11-06 01:55:23 +00:00
parent
e35c7734a7
commit
a586b4bb0a
28
pom.xml
28
pom.xml
@ -27,8 +27,22 @@
|
||||
<db.password>postgres</db.password>
|
||||
<db.schema>alert_tg_bot</db.schema>
|
||||
<testcontainers.annotations.version>1.4.3</testcontainers.annotations.version>
|
||||
<spring-cloud.version>2021.0.7</spring-cloud.version>
|
||||
</properties>
|
||||
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-dependencies</artifactId>
|
||||
<version>${spring-cloud.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
<!--vality-->
|
||||
<dependency>
|
||||
@ -61,11 +75,6 @@
|
||||
<groupId>dev.vality.geck</groupId>
|
||||
<artifactId>migrator</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>dev.vality</groupId>
|
||||
<artifactId>adapter-common-lib</artifactId>
|
||||
<version>1.2.8</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>dev.vality</groupId>
|
||||
<artifactId>damsel</artifactId>
|
||||
@ -73,11 +82,6 @@
|
||||
</dependency>
|
||||
|
||||
<!--spring-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.vault</groupId>
|
||||
<artifactId>spring-vault-core</artifactId>
|
||||
<version>2.3.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
@ -109,6 +113,10 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-jooq</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-vault-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--third party-->
|
||||
<dependency>
|
||||
|
@ -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
|
||||
|
@ -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}
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user