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
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2020 Contributors to the Eclipse Foundation
* Copyright (c) 2011-2026 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
Expand All @@ -21,7 +21,7 @@
public class PgMetricsTest extends MetricsTestBase {

@ClassRule
public static ContainerPgRule rule = new ContainerPgRule();
public static final ContainerPgRule rule = ContainerPgRule.SHARED_INSTANCE;

@Override
protected SqlConnectOptions connectOptions() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,41 +1,34 @@
/*
* Copyright (C) 2017 Julien Viet
* Copyright (c) 2011-2026 Contributors to the Eclipse Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
* which is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
*/

package io.vertx.pgclient;

import static org.junit.Assume.assumeTrue;

import io.vertx.core.Vertx;
import io.vertx.ext.unit.Async;
import io.vertx.ext.unit.TestContext;
import io.vertx.ext.unit.junit.VertxUnitRunner;
import io.vertx.pgclient.junit.ContainerPgRule;
import org.junit.After;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.runner.RunWith;

import io.vertx.core.Vertx;
import io.vertx.ext.unit.Async;
import io.vertx.ext.unit.TestContext;
import io.vertx.ext.unit.junit.VertxUnitRunner;
import io.vertx.pgclient.junit.ContainerPgRule;
import static org.junit.Assume.assumeTrue;

@RunWith(VertxUnitRunner.class)
public class PgScramConnectionTest {

@ClassRule
public static ContainerPgRule rule = new ContainerPgRule();
public static final ContainerPgRule rule = ContainerPgRule.SHARED_INSTANCE;

private Vertx vertx;

Expand Down
20 changes: 7 additions & 13 deletions vertx-pg-client/src/test/java/io/vertx/pgclient/PgTestBase.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
/*
* Copyright (C) 2017 Julien Viet
* Copyright (c) 2011-2026 Contributors to the Eclipse Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
* which is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
*/

package io.vertx.pgclient;
Expand All @@ -37,7 +31,7 @@ public abstract class PgTestBase {
protected static final String ERRCODE_QUERY_CANCELED = "57014";

@ClassRule
public static ContainerPgRule rule = new ContainerPgRule();
public static final ContainerPgRule rule = ContainerPgRule.SHARED_INSTANCE;

protected PgConnectOptions options;
protected PoolOptions poolOptions;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
/*
* Copyright (c) 2011-2026 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
* which is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
*/

package io.vertx.pgclient.data;

import io.vertx.ext.unit.Async;
import io.vertx.ext.unit.TestContext;
import io.vertx.pgclient.PgConnection;
import io.vertx.sqlclient.ColumnChecker;
import io.vertx.sqlclient.Row;
import io.vertx.sqlclient.Tuple;
import io.vertx.ext.unit.Async;
import io.vertx.ext.unit.TestContext;
import org.junit.Test;

public class EnumeratedTypesExtendedCodecTest extends ExtendedQueryDataTypeCodecTestBase {
Expand Down Expand Up @@ -116,7 +127,7 @@ public void testEncodeEnumArrayMultipleValues(TestContext ctx) {
public void testEncodeEnumArrayEmptyValues(TestContext ctx) {
Async async = ctx.async();
PgConnection.connect(vertx, options, ctx.asyncAssertSuccess(conn -> {
conn.prepare("UPDATE \"ArrayDataType\" SET \"Enum\" = $1 WHERE \"id\" = $2 RETURNING \"Enum\", \"Boolean\"",
conn.prepare("UPDATE \"ArrayDataType\" SET \"Enum\" = $1 WHERE \"id\" = $2 RETURNING \"Enum\"",
ctx.asyncAssertSuccess(p -> {
p.query().execute(Tuple.tuple()
.addArrayOfString(new String[]{})
Expand All @@ -126,10 +137,6 @@ public void testEncodeEnumArrayEmptyValues(TestContext ctx) {
.returns(Tuple::getValue, Row::getValue, new String[]{})
.returns(Tuple::getArrayOfStrings, Row::getArrayOfStrings, new String[]{})
.forRow(result.iterator().next());
ColumnChecker.checkColumn(1, "Boolean")
.returns(Tuple::getValue, Row::getValue, new Boolean[]{true})
.returns(Tuple::getArrayOfBooleans, Row::getArrayOfBooleans, new Boolean[]{true})
.forRow(result.iterator().next());
async.complete();
}));
}));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
/*
* Copyright (c) 2011-2026 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
* which is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
*/

package io.vertx.pgclient.it;

import io.vertx.core.Vertx;
Expand All @@ -19,7 +30,7 @@
public class MissingScramTest {

@ClassRule
public static ContainerPgRule rule = new ContainerPgRule();
public static final ContainerPgRule rule = ContainerPgRule.SHARED_INSTANCE;

private Vertx vertx;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
/*
* Copyright (C) 2017 Julien Viet
* Copyright (c) 2011-2026 Contributors to the Eclipse Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
* which is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
*/
package io.vertx.pgclient.junit;

Expand All @@ -38,6 +32,8 @@ public class ContainerPgRule extends ExternalResource {
private static final String tlsConnectionUri = System.getProperty("tls.connection.uri");
private static final String tlsForceConnectionUri = System.getProperty("tls.force.connection.uri");

public static final ContainerPgRule SHARED_INSTANCE = new ContainerPgRule();

private ServerContainer<?> server;
private PgConnectOptions options;
private String databaseVersion;
Expand Down Expand Up @@ -174,7 +170,7 @@ public static boolean isAtLeastPg10() {

@Override
protected void after() {
if (!isTestingWithExternalDatabase()) {
if (!isTestingWithExternalDatabase() && this != SHARED_INSTANCE) {
try {
stopServer();
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2021 Contributors to the Eclipse Foundation
* Copyright (c) 2011-2026 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
Expand All @@ -23,7 +23,7 @@
@RunWith(VertxUnitRunner.class)
public class PgBinaryDataTypeDecodeTest extends BinaryDataTypeDecodeTestBase {
@ClassRule
public static ContainerPgRule rule = new ContainerPgRule();
public static final ContainerPgRule rule = ContainerPgRule.SHARED_INSTANCE;

@Override
protected JDBCType getNumericJDBCType() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2021 Contributors to the Eclipse Foundation
* Copyright (c) 2011-2026 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
Expand All @@ -23,7 +23,7 @@
@RunWith(VertxUnitRunner.class)
public class PgBinaryDataTypeEncodeTest extends BinaryDataTypeEncodeTestBase {
@ClassRule
public static ContainerPgRule rule = new ContainerPgRule();
public static final ContainerPgRule rule = ContainerPgRule.SHARED_INSTANCE;

@Override
protected JDBCType getNumericJDBCType() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
package io.vertx.pgclient.tck;
/*
* Copyright (c) 2011-2026 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
* which is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
*/

import org.junit.ClassRule;
import org.junit.runner.RunWith;
package io.vertx.pgclient.tck;

import io.vertx.ext.unit.junit.VertxUnitRunner;
import io.vertx.pgclient.junit.ContainerPgRule;
import io.vertx.sqlclient.tck.CollectorTestBase;
import org.junit.ClassRule;
import org.junit.runner.RunWith;

@RunWith(VertxUnitRunner.class)
public class PgCollectorTest extends CollectorTestBase {
@ClassRule
public static ContainerPgRule rule = new ContainerPgRule();
public static final ContainerPgRule rule = ContainerPgRule.SHARED_INSTANCE;

@Override
protected void initConnector() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2020 Contributors to the Eclipse Foundation
* Copyright (c) 2011-2026 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
Expand All @@ -23,7 +23,7 @@
@RunWith(VertxUnitRunner.class)
public class PgConnectionAutoRetryTest extends ConnectionAutoRetryTestBase {
@ClassRule
public static ContainerPgRule rule = new ContainerPgRule();
public static final ContainerPgRule rule = ContainerPgRule.SHARED_INSTANCE;

@Override
public void setUp() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
/*
* Copyright (c) 2011-2026 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
* which is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
*/

package io.vertx.pgclient.tck;

import io.vertx.ext.unit.TestContext;
import io.vertx.ext.unit.junit.VertxUnitRunner;
import io.vertx.pgclient.junit.ContainerPgRule;
import io.vertx.sqlclient.spi.DatabaseMetadata;
import io.vertx.sqlclient.tck.ConnectionTestBase;
import io.vertx.ext.unit.TestContext;
import io.vertx.ext.unit.junit.VertxUnitRunner;
import org.junit.ClassRule;
import org.junit.runner.RunWith;

@RunWith(VertxUnitRunner.class)
public class PgConnectionTest extends ConnectionTestBase {
@ClassRule
public static ContainerPgRule rule = new ContainerPgRule();
public static final ContainerPgRule rule = ContainerPgRule.SHARED_INSTANCE;

@Override
public void setUp() throws Exception {
Expand All @@ -25,7 +36,7 @@ public void tearDown(TestContext ctx) {
connector.close();
super.tearDown(ctx);
}

@Override
protected void validateDatabaseMetaData(TestContext ctx, DatabaseMetadata md) {
ctx.assertTrue(md.majorVersion() >= 9);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +1,27 @@
/*
* Copyright (C) 2020 IBM Corporation
* Copyright (c) 2011-2026 Contributors to the Eclipse Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
* which is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
*/
package io.vertx.pgclient.tck;

import io.vertx.ext.unit.junit.VertxUnitRunner;
import io.vertx.pgclient.junit.ContainerPgRule;
import io.vertx.sqlclient.SqlConnectOptions;
import io.vertx.sqlclient.tck.DriverTestBase;
import io.vertx.ext.unit.junit.VertxUnitRunner;
import org.junit.ClassRule;
import org.junit.runner.RunWith;

@RunWith(VertxUnitRunner.class)
public class PgDriverTest extends DriverTestBase {

@ClassRule
public static ContainerPgRule rule = new ContainerPgRule();
public static final ContainerPgRule rule = ContainerPgRule.SHARED_INSTANCE;

@Override
protected SqlConnectOptions defaultOptions() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2021 Contributors to the Eclipse Foundation
* Copyright (c) 2011-2026 Contributors to the Eclipse Foundation
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
Expand All @@ -24,7 +24,7 @@
public class PgNullValueEncodeTest extends NullValueEncodeTestBase {

@ClassRule
public static ContainerPgRule rule = new ContainerPgRule();
public static final ContainerPgRule rule = ContainerPgRule.SHARED_INSTANCE;

@Override
protected void initConnector() {
Expand Down
Loading