forked from testcontainers/testcontainers-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for Postgis to JDBC driver (testcontainers#864)
- Loading branch information
Showing
4 changed files
with
33 additions
and
1 deletion.
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
26 changes: 26 additions & 0 deletions
26
modules/postgresql/src/main/java/org/testcontainers/containers/PostgisContainerProvider.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,26 @@ | ||
package org.testcontainers.containers; | ||
|
||
/** | ||
* Factory for PostGIS containers, which are a special flavour of PostgreSQL. | ||
*/ | ||
public class PostgisContainerProvider extends JdbcDatabaseContainerProvider { | ||
|
||
private static final String NAME = "postgis"; | ||
private static final String DEFAULT_TAG = "10"; | ||
private static final String DEFAULT_IMAGE = "mdillon/postgis"; | ||
|
||
@Override | ||
public boolean supports(String databaseType) { | ||
return databaseType.equals(NAME); | ||
} | ||
|
||
@Override | ||
public JdbcDatabaseContainer newInstance() { | ||
return newInstance(DEFAULT_TAG); | ||
} | ||
|
||
@Override | ||
public JdbcDatabaseContainer newInstance(String tag) { | ||
return new PostgreSQLContainer(DEFAULT_IMAGE + ":" + tag); | ||
} | ||
} |
3 changes: 2 additions & 1 deletion
3
...n/resources/META-INF/services/org.testcontainers.containers.JdbcDatabaseContainerProvider
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
org.testcontainers.containers.PostgreSQLContainerProvider | ||
org.testcontainers.containers.PostgreSQLContainerProvider | ||
org.testcontainers.containers.PostgisContainerProvider |