public class EmbeddedPostgres extends Object implements AutoCloseable
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_DB_NAME |
static String |
DEFAULT_HOST |
static String |
DEFAULT_PASSWORD |
static String |
DEFAULT_USER |
| Constructor and Description |
|---|
EmbeddedPostgres() |
EmbeddedPostgres(de.flapdoodle.embed.process.distribution.IVersion version) |
EmbeddedPostgres(de.flapdoodle.embed.process.distribution.IVersion version,
String dataDir) |
EmbeddedPostgres(String dataDir) |
| Modifier and Type | Method and Description |
|---|---|
static de.flapdoodle.embed.process.config.IRuntimeConfig |
cachedRuntimeConfig(Path cachedPath)
Initializes runtime configuration for cached directory.
|
void |
close() |
static de.flapdoodle.embed.process.config.IRuntimeConfig |
defaultRuntimeConfig()
Initializes the default runtime configuration using the temporary directory.
|
Optional<PostgresConfig> |
getConfig()
Returns the configuration of started process
|
Optional<String> |
getConnectionUrl()
Returns the connection url for the running postgres instance
|
Optional<PostgresProcess> |
getProcess()
Returns the process if started
|
String |
start() |
String |
start(de.flapdoodle.embed.process.config.IRuntimeConfig runtimeConfig) |
String |
start(de.flapdoodle.embed.process.config.IRuntimeConfig runtimeConfig,
String host,
int port,
String dbName,
String user,
String password,
List<String> additionalParams)
Starts up the embedded postgres
|
String |
start(de.flapdoodle.embed.process.config.IRuntimeConfig runtimeConfig,
String host,
int port,
String dbName,
String user,
String password,
List<String> additionalInitDbParams,
List<String> additionalPostgresParams)
Starts up the embedded postgres
|
String |
start(String host,
int port,
String dbName) |
String |
start(String host,
int port,
String dbName,
String user,
String password) |
String |
start(String host,
int port,
String dbName,
String user,
String password,
List<String> additionalParams) |
void |
stop() |
public static final String DEFAULT_USER
public static final String DEFAULT_PASSWORD
public static final String DEFAULT_DB_NAME
public static final String DEFAULT_HOST
public EmbeddedPostgres()
public EmbeddedPostgres(de.flapdoodle.embed.process.distribution.IVersion version)
public EmbeddedPostgres(String dataDir)
public EmbeddedPostgres(de.flapdoodle.embed.process.distribution.IVersion version,
String dataDir)
public static de.flapdoodle.embed.process.config.IRuntimeConfig defaultRuntimeConfig()
public static de.flapdoodle.embed.process.config.IRuntimeConfig cachedRuntimeConfig(Path cachedPath)
cachedPath - path where postgres is supposed to be extractedpublic String start() throws IOException
IOExceptionpublic String start(String host, int port, String dbName) throws IOException
IOExceptionpublic String start(String host, int port, String dbName, String user, String password) throws IOException
IOExceptionpublic String start(String host, int port, String dbName, String user, String password, List<String> additionalParams) throws IOException
IOExceptionpublic String start(de.flapdoodle.embed.process.config.IRuntimeConfig runtimeConfig) throws IOException
IOExceptionpublic String start(de.flapdoodle.embed.process.config.IRuntimeConfig runtimeConfig, String host, int port, String dbName, String user, String password, List<String> additionalParams) throws IOException
runtimeConfig - required runtime configurationhost - host to bind toport - port to bind todbName - name of the database to initializeuser - username to connectpassword - password for the provided usernameadditionalParams - additional database init params (if required)IOException - if an I/O error occurs during the process startuppublic String start(de.flapdoodle.embed.process.config.IRuntimeConfig runtimeConfig, String host, int port, String dbName, String user, String password, List<String> additionalInitDbParams, List<String> additionalPostgresParams) throws IOException
runtimeConfig - required runtime configurationhost - host to bind toport - port to bind todbName - name of the database to initializeuser - username to connectpassword - password for the provided usernameadditionalInitDbParams - additional database init params (if required)additionalPostgresParams - additional postgresql params (if required)IOException - if an I/O error occurs during the process startuppublic Optional<PostgresConfig> getConfig()
public Optional<PostgresProcess> getProcess()
public Optional<String> getConnectionUrl()
public void stop()
public void close()
close in interface AutoCloseableCopyright © 2018 Yandex. All rights reserved.