public abstract class JdbcDatabaseContainer extends GenericContainer implements LinkableContainer
GenericContainer.BindMode
Modifier and Type | Field and Description |
---|---|
protected Map<String,String> |
parameters |
ports
containerId, containerName, dockerClient, dockerHostIpAddress, tag
Constructor and Description |
---|
JdbcDatabaseContainer(String dockerImageName) |
Modifier and Type | Method and Description |
---|---|
void |
addParameter(String paramName,
String value) |
Connection |
createConnection(String queryString)
Creates a connection to the underlying containerized database instance.
|
protected abstract String |
getDriverClassName()
Get the name of the actual JDBC driver to use
|
Driver |
getJdbcDriverInstance()
Obtain an instance of the correct JDBC driver for this particular database container type
|
abstract String |
getJdbcUrl()
Get a JDBC URL that may be used to connect to the dockerized DB
|
protected abstract String |
getLivenessCheckPort() |
abstract String |
getName()
Get the name of the database type, to be matched against the DB type part of the JDBC query string (i.e.
|
abstract String |
getPassword()
Get the standard password that should be used for connections
|
protected abstract String |
getTestQueryString()
Get a test query string suitable for testing that this particular database type is alive
|
abstract String |
getUsername()
Get the standard database username that should be used for connections
|
protected void |
optionallyMapResourceParameterAsVolume(String paramName,
String pathNameInContainer) |
void |
setParameters(Map<String,String> parameters) |
protected void |
waitUntilContainerStarted() |
addEnv, addFileSystemBind, containerIsStarting, customizeHostConfigBuilder, getContainerConfig, getDockerImageName, getIpAddress, getMappedPort, setCommand, setCommand, setExposedPorts
checkContainerNotAborted, createVolumeDirectory, getContainerName, logger, setTag, start, stop, waitForListeningPort
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getContainerName
public JdbcDatabaseContainer(String dockerImageName)
public abstract String getName()
protected abstract String getDriverClassName()
public abstract String getJdbcUrl()
public abstract String getUsername()
public abstract String getPassword()
protected abstract String getTestQueryString()
protected void waitUntilContainerStarted()
waitUntilContainerStarted
in class AbstractContainer
public Driver getJdbcDriverInstance()
public Connection createConnection(String queryString) throws SQLException
queryString
- any special query string parameters that should be appended to the JDBC connection URL. The
'?' character must be includedSQLException
protected void optionallyMapResourceParameterAsVolume(String paramName, String pathNameInContainer)
protected abstract String getLivenessCheckPort()
getLivenessCheckPort
in class GenericContainer
Copyright © 2015. All rights reserved.