Class AbstractPostgreSqlJUnit
- java.lang.Object
-
- net.officefloor.jdbc.postgresql.test.AbstractPostgreSqlJUnit
-
- Direct Known Subclasses:
PostgreSqlExtension
,PostgreSqlRule
public abstract class AbstractPostgreSqlJUnit extends java.lang.Object
Abstract JUnit PostgreSql functionality.- Author:
- Daniel Sagenschneider
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractPostgreSqlJUnit.Configuration
Configuration of the PostgreSql database.
-
Constructor Summary
Constructors Constructor Description AbstractPostgreSqlJUnit()
Instantiate with defaultAbstractPostgreSqlJUnit.Configuration
.AbstractPostgreSqlJUnit(AbstractPostgreSqlJUnit.Configuration configuration)
Instantiate.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.sql.Connection
getConnection()
Obtains aConnection
.static void
pullDockerImage(java.lang.String imageName, com.github.dockerjava.api.DockerClient client)
Pulls the docker image.void
startPostgreSql()
Starts PostgreSql.void
stopPostgreSql()
Stops PostgreSql.
-
-
-
Constructor Detail
-
AbstractPostgreSqlJUnit
public AbstractPostgreSqlJUnit()
Instantiate with defaultAbstractPostgreSqlJUnit.Configuration
.
-
AbstractPostgreSqlJUnit
public AbstractPostgreSqlJUnit(AbstractPostgreSqlJUnit.Configuration configuration)
Instantiate.- Parameters:
configuration
-AbstractPostgreSqlJUnit.Configuration
.
-
-
Method Detail
-
pullDockerImage
public static void pullDockerImage(java.lang.String imageName, com.github.dockerjava.api.DockerClient client) throws java.lang.Exception
Pulls the docker image.- Parameters:
imageName
- Docker image name.client
-DockerClient
.- Throws:
java.lang.Exception
- If fails to pull image.
-
startPostgreSql
public void startPostgreSql() throws java.lang.Exception
Starts PostgreSql.- Throws:
java.lang.Exception
- If fails to start PostgreSql.
-
getConnection
public java.sql.Connection getConnection() throws java.lang.Exception
Obtains aConnection
.- Returns:
Connection
.- Throws:
java.lang.Exception
- If fails to obtainConnection
.
-
stopPostgreSql
public void stopPostgreSql() throws java.lang.Exception
Stops PostgreSql.- Throws:
java.lang.Exception
- If fails to stop PostgreSql.
-
-