// Path: src/main/java/com/pgasync/Connection.java
// public interface Connection extends QueryExecutor {
// 
//     CompletableFuture<PreparedStatement> prepareStatement(String sql, Oid... parametersTypes);
// 
//     /**
//      * The typical scenario of using notifications is as follows:
//      * - {@link #subscribe(String, Consumer)}
//      * - Some calls of @onNotification callback
//      * - {@link Listening#unlisten()}
//      *
//      * @param channel Channel name to listen to.
//      * @param onNotification Callback, thar is cinvoked every time notification arrives.
//      * @return CompletableFuture instance, completed when subscription will be registered at the backend.
//      */
//     CompletableFuture<Listening> subscribe(String channel, Consumer<String> onNotification);
// 
//     CompletableFuture<Void> close();
// }
// 
// Path: src/main/java/com/pgasync/Connectible.java
// public interface Connectible extends QueryExecutor {
// 
//     CompletableFuture<Connection> getConnection();
// 
//     CompletableFuture<Void> close();
// }
// 
// Path: src/test/java/com/github/pgasync/DatabaseRule.java
// static NettyConnectibleBuilder createPoolBuilder(int size) {
//     String db = getenv("PG_DATABASE");
//     String user = getenv("PG_USERNAME");
//     String pass = getenv("PG_PASSWORD");
// 
//     if (db == null && user == null && pass == null) {
//         return new EmbeddedConnectionPoolBuilder().maxConnections(size);
//     } else {
//         return new EmbeddedConnectionPoolBuilder()
//                 .database(envOrDefault("PG_DATABASE", "postgres"))
//                 .username(envOrDefault("PG_USERNAME", "postgres"))
//                 .password(envOrDefault("PG_PASSWORD", "postgres"))
//                 .ssl(true)
//                 .maxConnections(size);
//     }
// }


import static java.lang.System.currentTimeMillis;
import static java.lang.System.out;
import com.pgasync.Connection;
import com.pgasync.Connectible;
import org.junit.*;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import java.util.*;
import java.util.concurrent.*;
import java.util.function.Function;
import java.util.function.IntFunction;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.LongStream;
import static com.github.pgasync.DatabaseRule.createPoolBuilder;
/*
 * 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.
 */

package com.github.pgasync;




@RunWith(Parameterized.class)
public class PerformanceTest {

    private static DatabaseRule dbr;

    static {
        System.setProperty("io.netty.eventLoopThreads", "1");
// Path: src/main/java/com/pgasync/Connection.java
// public interface Connection extends QueryExecutor {
// 
//     CompletableFuture<PreparedStatement> prepareStatement(String sql, Oid... parametersTypes);
// 
//     /**
//      * The typical scenario of using notifications is as follows:
//      * - {@link #subscribe(String, Consumer)}
//      * - Some calls of @onNotification callback
//      * - {@link Listening#unlisten()}
//      *
//      * @param channel Channel name to listen to.
//      * @param onNotification Callback, thar is cinvoked every time notification arrives.
//      * @return CompletableFuture instance, completed when subscription will be registered at the backend.
//      */
//     CompletableFuture<Listening> subscribe(String channel, Consumer<String> onNotification);
// 
//     CompletableFuture<Void> close();
// }
// 
// Path: src/main/java/com/pgasync/Connectible.java
// public interface Connectible extends QueryExecutor {
// 
//     CompletableFuture<Connection> getConnection();
// 
//     CompletableFuture<Void> close();
// }
// 
// Path: src/test/java/com/github/pgasync/DatabaseRule.java
// static NettyConnectibleBuilder createPoolBuilder(int size) {
//     String db = getenv("PG_DATABASE");
//     String user = getenv("PG_USERNAME");
//     String pass = getenv("PG_PASSWORD");
// 
//     if (db == null && user == null && pass == null) {
//         return new EmbeddedConnectionPoolBuilder().maxConnections(size);
//     } else {
//         return new EmbeddedConnectionPoolBuilder()
//                 .database(envOrDefault("PG_DATABASE", "postgres"))
//                 .username(envOrDefault("PG_USERNAME", "postgres"))
//                 .password(envOrDefault("PG_PASSWORD", "postgres"))
//                 .ssl(true)
//                 .maxConnections(size);
//     }
// }


// Path: src/test/java/com/github/pgasync/PerformanceTest.java
import static java.lang.System.currentTimeMillis;
import static java.lang.System.out;
import com.pgasync.Connection;
import com.pgasync.Connectible;
import org.junit.*;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import java.util.*;
import java.util.concurrent.*;
import java.util.function.Function;
import java.util.function.IntFunction;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.LongStream;
import static com.github.pgasync.DatabaseRule.createPoolBuilder;

/*
 * 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.
 */

package com.github.pgasync;




@RunWith(Parameterized.class)
public class PerformanceTest {

    private static DatabaseRule dbr;

    static {
        System.setProperty("io.netty.eventLoopThreads", "1");
        dbr = new DatabaseRule(createPoolBuilder(1));