-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(jooq): Allow to choose Flyway migrations location
fix #11
- Loading branch information
Showing
10 changed files
with
213 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
testy-jooq-box/src/test/java/fr/irun/testy/jooq/WithDatabaseLoadedWithLocationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package fr.irun.testy.jooq; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import javax.sql.DataSource; | ||
import java.sql.Connection; | ||
import java.sql.ResultSet; | ||
import java.sql.SQLException; | ||
import java.sql.Statement; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
class WithDatabaseLoadedWithLocationTest { | ||
@RegisterExtension | ||
static WithInMemoryDatasource wDs = WithInMemoryDatasource.builder() | ||
.setCatalog("dummy").build(); | ||
|
||
@RegisterExtension | ||
static WithDatabaseLoaded wDbLoadedLocation = WithDatabaseLoaded.builder() | ||
.setMigrationsLocation("db/migration/dummy_legacy") | ||
.setDatasourceExtension(wDs).build(); | ||
|
||
@Test | ||
void should_get_data_form_loaded_db(DataSource ds) throws SQLException { | ||
List<String> actuals = new ArrayList<>(); | ||
try (Connection conn = ds.getConnection(); | ||
Statement stmt = conn.createStatement()) { | ||
ResultSet rs = stmt.executeQuery("SELECT * FROM GUNGAN"); | ||
|
||
while (rs.next()) { | ||
actuals.add(rs.getString(1) + " " + rs.getString(2)); | ||
} | ||
rs.close(); | ||
} | ||
|
||
assertThat(actuals).contains("Jar Jar Binks"); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
testy-jooq-box/src/test/java/fr/irun/testy/jooq/WithDatabaseLoadedWithoutCatalogTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package fr.irun.testy.jooq; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import javax.sql.DataSource; | ||
import java.sql.Connection; | ||
import java.sql.ResultSet; | ||
import java.sql.SQLException; | ||
import java.sql.Statement; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
class WithDatabaseLoadedWithoutCatalogTest { | ||
@RegisterExtension | ||
static WithInMemoryDatasource wDs = WithInMemoryDatasource.builder().build(); | ||
|
||
@RegisterExtension | ||
static WithDatabaseLoaded wDbLoaded = WithDatabaseLoaded.builder() | ||
.setDatasourceExtension(wDs) | ||
.useFlywayDefaultLocation() | ||
.build(); | ||
|
||
@Test | ||
void should_get_data_form_loaded_db(DataSource ds) throws SQLException { | ||
List<String> actuals = new ArrayList<>(); | ||
try (Connection conn = ds.getConnection(); | ||
Statement stmt = conn.createStatement()) { | ||
ResultSet rs = stmt.executeQuery("SELECT * FROM JEDI"); | ||
|
||
while (rs.next()) { | ||
actuals.add(rs.getString(1) + " " + rs.getString(2)); | ||
} | ||
rs.close(); | ||
} | ||
|
||
assertThat(actuals).contains("Obiwan Kenobi", "Dark Vador"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.