Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Jotschi committed Apr 6, 2023
1 parent 57bf69c commit 49ab404
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ A dedicated provider daemon will constantly maintain a specified level of free d

> Currently **only** PostgreSQL is supported.
## Recommendation

This testdb provider is aims to solve test performance issues in larger projects. For smaller projects it makes more sense to just use a testcontainer to provide a database for your tests. It is easier to setup and less complicated. For larger projects it may be suitable to setup a tmpfs backed database that can very quickly allocate database copies.

## Maven

[Plugin Documentation](https://metaloom.github.io/testdatabase-provider/)
Expand Down Expand Up @@ -166,6 +170,9 @@ The use of this setup may also be suitable when running tests in a test environm

## [Dedicated (Without Maven Plugin) Example](examples/dedicated-no-maven-plugin)

It is also possible to setup a dedicated provider and database and reference the service without the use of the maven plugin.
In this case the provider connection details must be specified in code. The `TestDatabaseProvider#localConfig` method can be used to set a provider configuration which supersedes any configuration file or environment variables.

```java
ProviderConfig config = new ProviderConfig();
config.setProviderHost("localhost");
Expand All @@ -178,11 +185,14 @@ config.getPostgresql().setPort(15432);
TestDatabaseProvider.localConfig(config);
```

Additionally the JUnit rules/extensions can reference the server as well.

```java
// Junit 4
// JUnit 4
@Rule
public DatabaseProviderRule provider = DatabaseProviderRule.create("localhost", 7543, "dummy");
// Junit 5

// JUnit 5
@RegisterExtension
public static ProviderExtension ext = ProviderExtension.create("localhost", 7543, "dummy");
```
Expand Down

0 comments on commit 49ab404

Please sign in to comment.