Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@
*/
package io.vertx.db2client;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.function.Predicate;

import io.vertx.codegen.annotations.DataObject;
import io.vertx.codegen.annotations.GenIgnore;
import io.vertx.codegen.json.annotations.JsonGen;
import io.vertx.core.json.JsonObject;
import io.vertx.core.net.*;
import io.vertx.core.net.ClientSSLOptions;
import io.vertx.core.tracing.TracingPolicy;
import io.vertx.db2client.impl.DB2ConnectionUriParser;
import io.vertx.db2client.impl.drda.SQLState;
import io.vertx.db2client.impl.drda.SqlCode;
import io.vertx.sqlclient.SqlConnectOptions;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.function.Predicate;

/**
* Connect options for configuring {@link DB2Connection} or {@link DB2Builder}.
*/
Expand Down Expand Up @@ -229,7 +229,9 @@ public DB2ConnectOptions setSslOptions(ClientSSLOptions sslOptions) {
/**
* Initialize with the default options.
*/
@Override
protected void init() {
super.init();
this.setHost(DEFAULT_HOST);
this.setPort(DEFAULT_PORT);
this.setMetricsName(DEFAULT_METRICS_NAME);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import io.vertx.codegen.annotations.GenIgnore;
import io.vertx.codegen.json.annotations.JsonGen;
import io.vertx.core.json.JsonObject;
import io.vertx.core.net.*;
import io.vertx.core.net.ClientSSLOptions;
import io.vertx.mssqlclient.impl.MSSQLConnectionUriParser;
import io.vertx.sqlclient.SqlConnectOptions;

Expand Down Expand Up @@ -223,7 +223,9 @@ public MSSQLConnectOptions setSslOptions(ClientSSLOptions sslOptions) {
/**
* Initialize with the default options.
*/
@Override
protected void init() {
super.init();
this.setHost(DEFAULT_HOST);
this.setPort(DEFAULT_PORT);
this.setUser(DEFAULT_USER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ public JsonObject toJson() {

@Override
protected void init() {
super.init();
this.setHost(DEFAULT_HOST);
this.setPort(DEFAULT_PORT);
this.setUser(DEFAULT_USER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@

package io.vertx.pgclient;

import io.vertx.codegen.annotations.DataObject;
import io.vertx.codegen.annotations.GenIgnore;
import io.vertx.codegen.annotations.Unstable;
import io.vertx.codegen.json.annotations.JsonGen;
import io.vertx.core.json.JsonObject;
import io.vertx.core.net.ClientSSLOptions;
import io.vertx.core.net.SocketAddress;
import io.vertx.core.tracing.TracingPolicy;
import io.vertx.pgclient.impl.PgConnectionUriParser;
import io.vertx.codegen.annotations.DataObject;
import io.vertx.core.json.JsonObject;
import io.vertx.core.net.*;
import io.vertx.sqlclient.SqlConnectOptions;

import java.util.Collections;
Expand Down Expand Up @@ -188,6 +189,7 @@ public PgConnectOptions setPipeliningLimit(int pipeliningLimit) {
return this;
}

@Override
public PgConnectOptions setCachePreparedStatements(boolean cachePreparedStatements) {
return (PgConnectOptions) super.setCachePreparedStatements(cachePreparedStatements);
}
Expand Down Expand Up @@ -281,7 +283,9 @@ public PgConnectOptions setSslOptions(ClientSSLOptions sslOptions) {
/**
* Initialize with the default options.
*/
@Override
protected void init() {
super.init();
this.setHost(DEFAULT_HOST);
this.setPort(DEFAULT_PORT);
this.setUser(DEFAULT_USER);
Expand All @@ -298,6 +302,7 @@ public JsonObject toJson() {
return json;
}

@Override
@GenIgnore
public SocketAddress getSocketAddress() {
if (!isUsingDomainSocket()) {
Expand Down Expand Up @@ -329,6 +334,7 @@ public int hashCode() {
return result;
}

@Override
public boolean isUsingDomainSocket() {
return this.getHost().startsWith("/");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,12 @@
import io.vertx.codegen.annotations.GenIgnore;
import io.vertx.codegen.json.annotations.JsonGen;
import io.vertx.core.json.JsonObject;
import io.vertx.core.net.ClientOptionsBase;
import io.vertx.core.net.ClientSSLOptions;
import io.vertx.core.net.SocketAddress;
import io.vertx.core.tracing.TracingPolicy;
import io.vertx.sqlclient.spi.Driver;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.ServiceConfigurationError;
import java.util.ServiceLoader;
import java.util.*;
import java.util.function.Predicate;

/**
Expand Down Expand Up @@ -78,10 +71,10 @@ public static SqlConnectOptions fromUri(String connectionUri) throws IllegalArgu
private String user;
private String password;
private String database;
private boolean cachePreparedStatements = DEFAULT_CACHE_PREPARED_STATEMENTS;
private int preparedStatementCacheMaxSize = DEFAULT_PREPARED_STATEMENT_CACHE_MAX_SIZE;
private Predicate<String> preparedStatementCacheSqlFilter = DEFAULT_PREPARED_STATEMENT_CACHE_FILTER;
private Map<String, String> properties = new HashMap<>(4);
private boolean cachePreparedStatements;
private int preparedStatementCacheMaxSize;
private Predicate<String> preparedStatementCacheSqlFilter;
private Map<String, String> properties;
private TracingPolicy tracingPolicy;
private int reconnectAttempts;
private long reconnectInterval;
Expand Down Expand Up @@ -440,6 +433,12 @@ public JsonObject toJson() {
* Initialize with the default options.
*/
protected void init() {
cachePreparedStatements = DEFAULT_CACHE_PREPARED_STATEMENTS;
preparedStatementCacheMaxSize = DEFAULT_PREPARED_STATEMENT_CACHE_MAX_SIZE;
preparedStatementCacheSqlFilter = DEFAULT_PREPARED_STATEMENT_CACHE_FILTER;
properties = new HashMap<>(4);
reconnectAttempts = DEFAULT_RECONNECT_ATTEMPTS;
reconnectInterval = DEFAULT_RECONNECT_INTERVAL;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@
import org.junit.Test;
import org.junit.runner.RunWith;

import java.util.*;
import java.util.ArrayDeque;
import java.util.HashMap;
import java.util.Map;
import java.util.Queue;
import java.util.concurrent.atomic.AtomicInteger;

@RunWith(VertxUnitRunner.class)
Expand All @@ -57,7 +60,6 @@ public void tearDown(TestContext ctx) {
@Test
public void testConnSuccessWithoutRetry(TestContext ctx) {
options.setReconnectAttempts(3);
options.setReconnectInterval(1000);
UnstableProxyServer unstableProxyServer = new UnstableProxyServer(0);
unstableProxyServer.initialize(options, ctx.asyncAssertSuccess(v -> {
initialConnector(unstableProxyServer.port());
Expand All @@ -71,7 +73,6 @@ public void testConnSuccessWithoutRetry(TestContext ctx) {
@Test
public void testPoolSuccessWithoutRetry(TestContext ctx) {
options.setReconnectAttempts(3);
options.setReconnectInterval(1000);
UnstableProxyServer unstableProxyServer = new UnstableProxyServer(0);
unstableProxyServer.initialize(options, ctx.asyncAssertSuccess(v -> {
initialConnector(unstableProxyServer.port());
Expand All @@ -84,7 +85,6 @@ public void testPoolSuccessWithoutRetry(TestContext ctx) {
@Test
public void testConnExceedingRetryLimit(TestContext ctx) {
options.setReconnectAttempts(1);
options.setReconnectInterval(1000);
UnstableProxyServer unstableProxyServer = new UnstableProxyServer(2);
unstableProxyServer.initialize(options, ctx.asyncAssertSuccess(v -> {
initialConnector(unstableProxyServer.port());
Expand All @@ -96,7 +96,6 @@ public void testConnExceedingRetryLimit(TestContext ctx) {
@Test
public void testPoolExceedingRetryLimit(TestContext ctx) {
options.setReconnectAttempts(1);
options.setReconnectInterval(1000);
UnstableProxyServer unstableProxyServer = new UnstableProxyServer(2);
unstableProxyServer.initialize(options, ctx.asyncAssertSuccess(v -> {
initialConnector(unstableProxyServer.port());
Expand All @@ -108,7 +107,6 @@ public void testPoolExceedingRetryLimit(TestContext ctx) {
@Test
public void testConnRetrySuccess(TestContext ctx) {
options.setReconnectAttempts(1);
options.setReconnectInterval(1000);
UnstableProxyServer unstableProxyServer = new UnstableProxyServer(1);
unstableProxyServer.initialize(options, ctx.asyncAssertSuccess(v -> {
initialConnector(unstableProxyServer.port());
Expand All @@ -121,7 +119,6 @@ public void testConnRetrySuccess(TestContext ctx) {
@Test
public void testPoolRetrySuccess(TestContext ctx) {
options.setReconnectAttempts(1);
options.setReconnectInterval(1000);
UnstableProxyServer unstableProxyServer = new UnstableProxyServer(1);
unstableProxyServer.initialize(options, ctx.asyncAssertSuccess(v -> {
initialConnector(unstableProxyServer.port());
Expand Down