50.4 Tests with Embedded H2 with MySQL compitability mode (#50)

This commit is contained in:
Art
2023-01-13 14:51:04 +02:00
parent b643a21ff0
commit 3aa359022c
2 changed files with 14 additions and 0 deletions

View File

@ -115,6 +115,12 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.javafaker</groupId>
<artifactId>javafaker</artifactId>

View File

@ -7,6 +7,7 @@ import net.shyshkin.study.fullstack.supportportal.backend.repository.UserReposit
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.TestPropertySource;
import org.springframework.web.util.UriComponentsBuilder;
import java.time.LocalDateTime;
@ -17,6 +18,13 @@ import static net.shyshkin.study.fullstack.supportportal.backend.domain.Role.ROL
@SpringBootTest
@ActiveProfiles("local")
@TestPropertySource(properties = {
"spring.datasource.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;MODE=MYSQL",
"spring.datasource.driverClassName=org.h2.Driver",
"spring.datasource.username=sa",
"spring.datasource.password=",
"spring.jpa.database-platform=org.hibernate.dialect.H2Dialect"
})
public abstract class BaseUserTest {
public static final Faker FAKER = Faker.instance();