-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DevDB allows for zero configuration databases in dev and test mode, either starting the databases using testcontainers, or creating them in process.
- Loading branch information
1 parent
006741f
commit ce9a38c
Showing
65 changed files
with
2,094 additions
and
108 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
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
45 changes: 45 additions & 0 deletions
45
...l/deployment/src/test/java/io/quarkus/agroal/test/MultipleDevDBDataSourcesConfigTest.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,45 @@ | ||
package io.quarkus.agroal.test; | ||
|
||
import static io.quarkus.agroal.test.MultipleDataSourcesTestUtil.testDataSource; | ||
|
||
import java.sql.SQLException; | ||
|
||
import javax.inject.Inject; | ||
|
||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.agroal.api.AgroalDataSource; | ||
import io.quarkus.agroal.DataSource; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
public class MultipleDevDBDataSourcesConfigTest { | ||
|
||
//tag::injection[] | ||
@Inject | ||
AgroalDataSource defaultDataSource; | ||
|
||
@Inject | ||
@DataSource("users") | ||
AgroalDataSource dataSource1; | ||
|
||
@Inject | ||
@DataSource("inventory") | ||
AgroalDataSource dataSource2; | ||
//end::injection[] | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest config = new QuarkusUnitTest() | ||
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) | ||
.addClass(MultipleDataSourcesTestUtil.class)) | ||
.withConfigurationResource("application-multiple-devdb-datasources.properties"); | ||
|
||
@Test | ||
public void testDataSourceInjection() throws SQLException { | ||
testDataSource("default", defaultDataSource, "jdbc:h2:tcp://localhost/mem:default;DB_CLOSE_DELAY=-1", "sa", 20); | ||
testDataSource("users", dataSource1, "jdbc:h2:tcp://localhost/mem:users;DB_CLOSE_DELAY=-1", "sa", 20); | ||
testDataSource("inventory", dataSource2, "jdbc:h2:tcp://localhost/mem:inventory;DB_CLOSE_DELAY=-1", "sa", 20); | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
...ns/agroal/deployment/src/test/resources/application-multiple-devdb-datasources.properties
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,2 @@ | ||
quarkus.datasource.users.devdb=true | ||
quarkus.datasource.inventory.devdb=true |
Oops, something went wrong.