Skip to content

Files

Latest commit

 

History

History
88 lines (63 loc) · 3.27 KB

README.adoc

File metadata and controls

88 lines (63 loc) · 3.27 KB

The Reactive PostgreSQL Client

Documentation:

Features

  • Event driven

  • Lightweight

  • Built-in connection pooling

  • Prepared queries caching

  • Publish / subscribe using Postgres LISTEN/NOTIFY

  • Batch and cursor support

  • Row streaming

  • java.util.stream.Collector row set transformation

  • Command pipeling

  • RxJava API

  • Direct memory to object without unnecessary copies

  • Java 8 Date and Time

  • SSL/TLS

  • Unix domain socket

  • HTTP/1.x CONNECT, SOCKS4a or SOCKS5 proxy

  • Request cancellation

Developers

Testing

Out of the box, the test suite uses Docker to run Postgres by default.

You can change the version of the embedded Postgres by passing a property embedded.postgres.version like this:

> mvn test -Dembedded.postgres.version=9.6

The following versions of embedded Postgres are supported:

  • 9.6

  • 10.6 (default)

  • 11.x (Unix Domain Socket Test are ignored)

The embedded Postgres database binds to an arbitrary port by default to avoid conflicts. Nevertheless, you can force the usage of the standard PostgreSQL port (5432) with a flag:

mvn test -DcontainerFixedPort

Testing with an external database

You can run tests with an external database:

  • the script src/test/resources/create-postgres.sql creates the test data

  • the TLSTest expects the database to be configured with SSL with src/test/resources/tls/server.key / src/test/resources/tls/server.cert src/test/resources/tls/pg_hba.conf as an example how to force SSL

You need to add some properties for testing:

> mvn test -Dconnection.uri=postgres://$username:$password@$host:$port/$database -Dtls.connection.uri=postgres://$username:$password@$host:$port/$database -Dunix.socket.directory=$path
  • connection.uri(mandatory): configure the client to connect the specified database

  • tls.connection.uri(mandatory): configure the client to run TLSTest with the specified Postgres with SSL enabled

  • tls.force.connection.uri(mandatory): configure the client to run TLSTest with the specified Postgres with SSL forced (only option)

  • unix.socket.directory(optional): the single unix socket directory(multiple socket directories are not supported) to test Unix domain socket with a specified database, domain socket tests will be skipped if this property is not specified (Note: Make sure you can access the unix domain socket with this directory under your host machine)

  • unix.socket.port(optional): unix socket file is named .s.PGSQL.nnnn and nnnn is the server’s port number, this property is mostly used when you test with Docker, when you publish your Postgres container port other than 5432 in your host but Postgres may actually listen on a different port in the container, you will then need this property to help you connect the Postgres with Unix domain socket

Testing with Docker

Run the Postgres containers with docker compose:

> cd docker/postgres
> docker compose up --build -V

Run tests:

> mvn test -Dconnection.uri=postgres://$username:$password@$host:$port/$database -Dtls.connection.uri=postgres://$username:$password@$host:$port/$database -Dtls.force.connection.uri=postgres://$username:$password@$host:$port/$database -Dunix.socket.directory=$path -Dunix.socket.port=$port