feature/admin #6
|
|
@ -0,0 +1,9 @@
|
|||
package com.bpgroup.poc.admin.env;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
|
||||
@SpringBootTest
|
||||
@ActiveProfiles("test")
|
||||
public class IntegrateTestEnv {
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package com.bpgroup.poc.admin.env;
|
||||
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.test.context.DynamicPropertyRegistry;
|
||||
import org.springframework.test.context.DynamicPropertySource;
|
||||
import org.testcontainers.containers.MariaDBContainer;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class MariaDBTestEnv extends IntegrateTestEnv {
|
||||
|
||||
private static final String MARIA_DB_IMAGE = "mariadb:10.11.7";
|
||||
|
||||
static MariaDBContainer mariadb = new MariaDBContainer<>(MARIA_DB_IMAGE)
|
||||
.withDatabaseName("admin-system")
|
||||
.withUsername("admin")
|
||||
.withPassword("1234");
|
||||
|
||||
static {
|
||||
mariadb.start();
|
||||
}
|
||||
|
||||
@DynamicPropertySource
|
||||
static void configureProperties(DynamicPropertyRegistry registry) {
|
||||
registry.add("spring.datasource.url", mariadb::getJdbcUrl);
|
||||
registry.add("spring.datasource.username", mariadb::getUsername);
|
||||
registry.add("spring.datasource.password", mariadb::getPassword);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("DB 실행 테스트")
|
||||
void test() {
|
||||
assertThat(mariadb.isRunning()).isTrue();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
spring:
|
||||
jpa:
|
||||
hibernate:
|
||||
ddl-auto: create
|
||||
show-sql: true
|
||||
properties:
|
||||
hibernate:
|
||||
format_sql: true
|
||||
|
||||
datasource:
|
||||
url: jdbc:mariadb://localhost:3307/admin-system
|
||||
username: admin
|
||||
password: 1234
|
||||
driver-class-name: org.mariadb.jdbc.Driver
|
||||
|
||||
server:
|
||||
port: 8080
|
||||
Loading…
Reference in New Issue