-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
closes #474 Here are some things you should have thought about: **Multi-Tenancy** - [ ] Extended new entities with `AbstractTenantAwareEntity`? - [ ] New entity added to `TenantAwareDatabaseConfiguration`? - [ ] Tested with `dev-multitenant` profile? <!-- Thanks for contributing to the zeiterfassung. Please review the following notes before submitting you pull request. Please look for other issues or pull requests which already work on this topic. Is somebody already on it? Do you need to synchronize? # Security Vulnerabilities 🛑 STOP! 🛑 If your contribution fixes a security vulnerability, please do not submit it. Instead, please write an E-Mail to [email protected] with all the information to recreate the security vulnerability. # Describing Your Changes If, having reviewed the notes above, you're ready to submit your pull request, please provide a brief description of the proposed changes. If they: 🐞 fix a bug, please describe the broken behaviour and how the changes fix it. Please label with 'type: bug' and 'status: new' 🎁 make an enhancement, please describe the new functionality and why you believe it's useful. Please label with 'type: enhancement' and 'status: new' If your pull request relates to any existing issues, please reference them by using the issue number prefixed with #. -->
- Loading branch information
Showing
6 changed files
with
48 additions
and
12 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
40 changes: 40 additions & 0 deletions
40
src/test/java/de/focusshift/zeiterfassung/TestPostgreSQLContainer.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,40 @@ | ||
package de.focusshift.zeiterfassung; | ||
|
||
import org.springframework.test.context.DynamicPropertyRegistry; | ||
import org.springframework.test.context.DynamicPropertySource; | ||
import org.testcontainers.containers.PostgreSQLContainer; | ||
|
||
public class TestPostgreSQLContainer extends PostgreSQLContainer<TestPostgreSQLContainer> { | ||
|
||
private static final String VERSION = "16.1"; | ||
|
||
public TestPostgreSQLContainer() { | ||
super(IMAGE + ":" + VERSION); | ||
this.withDatabaseName("zeiterfassung"); | ||
this.withCommand("--max_connections=1000", "--shared_buffers=240MB"); | ||
this.withInitScript("init-user-db.sql"); | ||
} | ||
|
||
/** | ||
* Sets the spring datasource configuration properties. | ||
* | ||
* <p>Usage:</p> | ||
* <pre><code> | ||
* static final TestPostgreContainer postgre = new TestPostgreContainer(); | ||
* @DynamicPropertySource | ||
* static void setupDataSource(DynamicPropertySource registry) { | ||
* postgre.start(); | ||
* postgre.configureSpringDataSource(registry); | ||
* } | ||
* </code> | ||
* </pre> | ||
* | ||
* @param registry | ||
*/ | ||
public void configureSpringDataSource(DynamicPropertyRegistry registry) { | ||
registry.add("spring.datasource.url", this::getJdbcUrl); | ||
registry.add("spring.liquibase.parameters.database", this::getDatabaseName); | ||
registry.add("admin.datasource.username", this::getUsername); | ||
registry.add("admin.datasource.password", this::getPassword); | ||
} | ||
} |
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