Skip to content

Commit

Permalink
#105 - added multiple script files.
Browse files Browse the repository at this point in the history
  • Loading branch information
grabdoc committed Jan 10, 2024
1 parent 68b90a2 commit 3dade96
Show file tree
Hide file tree
Showing 6 changed files with 31,152 additions and 383 deletions.
12 changes: 10 additions & 2 deletions src/test/java/com/homihq/db2rest/MySQLBaseIntegrationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,25 @@
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
import org.springframework.test.context.jdbc.Sql;
import org.testcontainers.containers.MySQLContainer;
import org.testcontainers.ext.ScriptUtils;

@Sql(scripts = {"classpath:mysql/mysql-sakila-schema.sql", "classpath:mysql/mysql-sakila-insert-data.sql"})
public class MySQLBaseIntegrationTest extends BaseIntegrationTest{

@ServiceConnection
private static final MySQLContainer mySQLContainer = new MySQLContainer("mysql:8.2");

static {
mySQLContainer.withUrlParam("serverTimezone", "UTC")
.withReuse(true)
mySQLContainer
.withDatabaseName("sakila")
.withUsername("mysql")
.withPassword("mysql")
.withUrlParam("serverTimezone", "UTC")

.start();

}

@BeforeAll
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
import org.springframework.test.context.jdbc.Sql;
import org.testcontainers.containers.MySQLContainer;
import org.testcontainers.containers.PostgreSQLContainer;

@Sql(scripts = {"classpath:pg/postgres-sakila-schema.sql", "classpath:pg/postgres-sakila-insert-data.sql"})
public class PostgreSQLBaseIntegrationTest extends BaseIntegrationTest{

@ServiceConnection
Expand All @@ -14,7 +16,6 @@ public class PostgreSQLBaseIntegrationTest extends BaseIntegrationTest{
static {
postgreSQLContainer.withUsername("postgres")
.withPassword("postgres")
.withInitScript("pg/postgres-sakila-schema.sql") // inside src/test/resources
.withDatabaseName("postgres");
}

Expand Down
Loading

0 comments on commit 3dade96

Please sign in to comment.