Skip to content
This repository has been archived by the owner on Sep 21, 2018. It is now read-only.

Commit

Permalink
Disable useSSL query param for Oracle/SQL Server modules
Browse files Browse the repository at this point in the history
  • Loading branch information
rnorth committed Jan 30, 2018
1 parent 9f947be commit bf30c4f
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion src/main/java/org/testcontainers/containers/OracleContainer.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
package org.testcontainers.containers;

import org.rnorth.ducttape.ratelimits.RateLimiter;
import org.rnorth.ducttape.ratelimits.RateLimiterBuilder;
import org.rnorth.ducttape.unreliables.Unreliables;
import org.testcontainers.utility.TestcontainersConfiguration;

import java.sql.Connection;
import java.sql.Driver;
import java.sql.SQLException;
import java.util.Properties;
import java.util.concurrent.TimeUnit;

/**
* @author gusohal
*/
Expand All @@ -13,6 +22,11 @@ public class OracleContainer<SELF extends JdbcDatabaseContainer<SELF>> extends J
private static final int ORACLE_PORT = 1521;
private static final int APEX_HTTP_PORT = 8080;

private static final RateLimiter DB_CONNECT_RATE_LIMIT = RateLimiterBuilder.newBuilder()
.withRate(10, TimeUnit.SECONDS)
.withConstantThroughput()
.build();

public OracleContainer() {
super(IMAGE + ":latest");
}
Expand All @@ -28,7 +42,6 @@ protected Integer getLivenessCheckPort() {

@Override
protected void configure() {

addExposedPorts(ORACLE_PORT, APEX_HTTP_PORT);
}

Expand Down Expand Up @@ -70,4 +83,21 @@ public Integer getWebPort() {
public String getTestQueryString() {
return "SELECT 1 FROM DUAL";
}

// TODO: Replace with permanent solution to https://github.com/testcontainers/testcontainers-java/issues/568
@Override
public Connection createConnection(String queryString) throws SQLException {
final Properties info = new Properties();
info.put("user", this.getUsername());
info.put("password", this.getPassword());
final String url = this.getJdbcUrl() + queryString;

final Driver jdbcDriverInstance = getJdbcDriverInstance();

try {
return Unreliables.retryUntilSuccess(120, TimeUnit.SECONDS, () -> jdbcDriverInstance.connect(url, info));
} catch (Exception e) {
throw new SQLException("Could not create new connection", e);
}
}
}

0 comments on commit bf30c4f

Please sign in to comment.