Skip to content

Commit 416a6b6

Browse files
authored
Merge pull request zonkyio#46 from hgschmie/master
Add pg-embedded to the list of supported projects
2 parents 1f38ed3 + 7e99af2 commit 416a6b6

File tree

1 file changed

+8
-50
lines changed

1 file changed

+8
-50
lines changed

README.md

Lines changed: 8 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -4,63 +4,21 @@
44

55
This project provides lightweight bundles of PostgreSQL binaries with reduced size that are intended for testing purposes.
66
It is a supporting project for the primary [io.zonky.test:embedded-database-spring-test](https://github.com/zonkyio/embedded-database-spring-test) and [io.zonky.test:embedded-postgres](https://github.com/zonkyio/embedded-postgres) projects.
7-
However, with a little effort it can be also applicable with [com.opentable:otj-pg-embedded](https://github.com/opentable/otj-pg-embedded) and maybe some other projects.
7+
However, with a little effort, the embedded binaries can also be integrated with other projects.
88

9-
## Provides
9+
## Provided features
1010

1111
* Lightweight bundles of PostgreSQL binaries with reduced size (~10MB)
1212
* Embedded PostgreSQL 11+ binaries even for Linux platform
1313
* Configurable version of PostgreSQL binaries
1414

15-
## Use with [embedded-database-spring-test](https://github.com/zonkyio/embedded-database-spring-test) or [embedded-postgres](https://github.com/zonkyio/embedded-postgres) project
15+
## Projects using embedded binaries
1616

17-
All necessary dependencies are already included in these projects, so no further action is required.
18-
However, you can change the version of the postgres binaries by following the instructions described in [Postgres version](#postgres-version).
19-
20-
## Use with [com.opentable:otj-pg-embedded](https://github.com/opentable/otj-pg-embedded) project
21-
22-
First, you have to add any of the [available dependencies](https://mvnrepository.com/artifact/io.zonky.test.postgres) to your Maven configuration:
23-
24-
```xml
25-
<dependency>
26-
<groupId>io.zonky.test.postgres</groupId>
27-
<artifactId>embedded-postgres-binaries-linux-amd64</artifactId>
28-
<version>11.11.0</version>
29-
<scope>test</scope>
30-
</dependency>
31-
```
32-
33-
Then you need to implement a custom [PgBinaryResolver](https://github.com/opentable/otj-pg-embedded/blob/master/src/main/java/com/opentable/db/postgres/embedded/PgBinaryResolver.java):
34-
```java
35-
public class CustomPostgresBinaryResolver implements PgBinaryResolver {
36-
public InputStream getPgBinary(String system, String architecture) throws IOException {
37-
ClassPathResource resource = new ClassPathResource(format("postgres-%s-%s.txz", system, architecture));
38-
return resource.getInputStream();
39-
}
40-
}
41-
```
42-
43-
<details>
44-
<summary>Alpine variant</summary>
45-
46-
```java
47-
public class CustomPostgresBinaryResolver implements PgBinaryResolver {
48-
public InputStream getPgBinary(String system, String architecture) throws IOException {
49-
ClassPathResource resource = new ClassPathResource(format("postgres-%s-%s-alpine_linux.txz", system, architecture));
50-
return resource.getInputStream();
51-
}
52-
}
53-
```
54-
55-
</details><br/>
56-
57-
And finally register it to the junit rule.
58-
59-
```java
60-
@Rule
61-
public SingleInstancePostgresRule pg = EmbeddedPostgresRules.singleInstance()
62-
.customize(builder -> builder.setPgBinaryResolver(new CustomPostgresBinaryResolver()));
63-
```
17+
* [zonkyio/embedded-database-spring-test](https://github.com/zonkyio/embedded-database-spring-test) (Java - Spring)
18+
* [zonkyio/embedded-postgres](https://github.com/zonkyio/embedded-postgres) (Java)
19+
* [hgschmie/pg-embedded](https://github.com/hgschmie/pg-embedded) (Java)
20+
* [fergusstrange/embedded-postgres](https://github.com/fergusstrange/embedded-postgres) (Go)
21+
* [faokunega/pg-embed](https://github.com/faokunega/pg-embed) (Rust)
6422

6523
## Postgres version
6624

0 commit comments

Comments
 (0)