Search in sources :

Example 1 with ConnectionConfig

use of com.palantir.nexus.db.pool.config.ConnectionConfig in project atlasdb by palantir.

the class PostgresConfigLoadingTest method testPasswordIsMasked.

@Test
public void testPasswordIsMasked() throws IOException {
    ConnectionConfig connectionConfig = getConnectionConfig();
    assertThat(connectionConfig.getDbPassword().unmasked(), equalTo("testpassword"));
    assertThat(connectionConfig.getHikariProperties().getProperty("password"), equalTo("testpassword"));
    assertThat(connectionConfig.toString(), not(containsString("testpassword")));
    assertThat(connectionConfig.toString(), containsString("REDACTED"));
}
Also used : ConnectionConfig(com.palantir.nexus.db.pool.config.ConnectionConfig) Test(org.junit.Test)

Example 2 with ConnectionConfig

use of com.palantir.nexus.db.pool.config.ConnectionConfig in project atlasdb by palantir.

the class PostgresConfigLoadingTest method testHikariLoginTimeout.

@Test
public void testHikariLoginTimeout() throws IOException {
    ConnectionConfig connectionConfig = getConnectionConfig();
    verifyHikariProperty(connectionConfig, "loginTimeout", connectionConfig.getConnectionTimeoutSeconds());
}
Also used : ConnectionConfig(com.palantir.nexus.db.pool.config.ConnectionConfig) Test(org.junit.Test)

Example 3 with ConnectionConfig

use of com.palantir.nexus.db.pool.config.ConnectionConfig in project atlasdb by palantir.

the class PostgresConfigLoadingTest method testAdditionalConnectionParameters.

@Test
public void testAdditionalConnectionParameters() throws IOException {
    ConnectionConfig connectionConfig = getConnectionConfig();
    Properties props = connectionConfig.getHikariProperties();
    assertThat(props.getProperty("foo"), equalTo("100"));
    assertThat(props.getProperty("bar"), equalTo("baz"));
}
Also used : Properties(java.util.Properties) ConnectionConfig(com.palantir.nexus.db.pool.config.ConnectionConfig) Test(org.junit.Test)

Example 4 with ConnectionConfig

use of com.palantir.nexus.db.pool.config.ConnectionConfig in project atlasdb by palantir.

the class PostgresConfigLoadingTest method testHikariConnectionTimeout.

@Test
public void testHikariConnectionTimeout() throws IOException {
    // Hikari uses "connectionTimeout" for how long the client will wait for a connection from the pool.
    // In our parlance, this is checkoutTimeout
    // Our connectionTimeout is instead translated to "connectTimeout", which is how long a connection
    // can be open for.
    ConnectionConfig connectionConfig = getConnectionConfig();
    assertThat(connectionConfig.getHikariConfig().getConnectionTimeout(), is((long) connectionConfig.getCheckoutTimeout()));
}
Also used : ConnectionConfig(com.palantir.nexus.db.pool.config.ConnectionConfig) Test(org.junit.Test)

Example 5 with ConnectionConfig

use of com.palantir.nexus.db.pool.config.ConnectionConfig in project atlasdb by palantir.

the class PostgresConfigLoadingTest method testHikariSocketTimeout.

@Test
public void testHikariSocketTimeout() throws IOException {
    ConnectionConfig connectionConfig = getConnectionConfig();
    verifyHikariProperty(connectionConfig, "socketTimeout", connectionConfig.getSocketTimeoutSeconds());
}
Also used : ConnectionConfig(com.palantir.nexus.db.pool.config.ConnectionConfig) Test(org.junit.Test)

Aggregations

ConnectionConfig (com.palantir.nexus.db.pool.config.ConnectionConfig)7 Test (org.junit.Test)6 DockerPort (com.palantir.docker.compose.connection.DockerPort)1 ImmutablePostgresConnectionConfig (com.palantir.nexus.db.pool.config.ImmutablePostgresConnectionConfig)1 InetSocketAddress (java.net.InetSocketAddress)1 Properties (java.util.Properties)1