Repository: cayenne Updated Branches: refs/heads/master 42eda59bc -> 23eb17ed5
Add new Maven profile postgres-docker * Useful to run integration tests without installed Postgres DB * Activation with `-DcayenneTestConnection=postgres-docker` * Starts Postgres Docker container before integration test and stops if afterwards * Sets JDBC connection properties based on dynamic Docker container port allocation Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/23eb17ed Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/23eb17ed Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/23eb17ed Branch: refs/heads/master Commit: 23eb17ed5448618fd444625551479c25979f5ccc Parents: 42eda59 Author: Stefan Seelmann <m...@stefan-seelmann.de> Authored: Tue Sep 13 06:50:45 2016 +0200 Committer: Savva Kolbachev <s.kolbac...@gmail.com> Committed: Sun Sep 25 23:28:43 2016 +0300 ---------------------------------------------------------------------- cayenne-client/pom.xml | 33 +++++++++++++++++++++++ cayenne-server/pom.xml | 33 +++++++++++++++++++++++ pom.xml | 66 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 132 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cayenne/blob/23eb17ed/cayenne-client/pom.xml ---------------------------------------------------------------------- diff --git a/cayenne-client/pom.xml b/cayenne-client/pom.xml index 5c9affb..4ecc832 100644 --- a/cayenne-client/pom.xml +++ b/cayenne-client/pom.xml @@ -109,6 +109,39 @@ <profiles> <profile> + <id>postgres-docker</id> + <activation> + <property> + <name>cayenneTestConnection</name> + <value>postgres-docker</value> + </property> + </activation> + <build> + <plugins> + <plugin> + <groupId>io.fabric8</groupId> + <artifactId>docker-maven-plugin</artifactId> + <executions> + <execution> + <id>start-postgres</id> + <phase>pre-integration-test</phase> + <goals> + <goal>start</goal> + </goals> + </execution> + <execution> + <id>stop-postgres</id> + <phase>post-integration-test</phase> + <goals> + <goal>stop</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + <profile> <id>code-quality</id> <activation> http://git-wip-us.apache.org/repos/asf/cayenne/blob/23eb17ed/cayenne-server/pom.xml ---------------------------------------------------------------------- diff --git a/cayenne-server/pom.xml b/cayenne-server/pom.xml index bf9c8e7..a1b4691 100644 --- a/cayenne-server/pom.xml +++ b/cayenne-server/pom.xml @@ -259,6 +259,39 @@ <profiles> <profile> + <id>postgres-docker</id> + <activation> + <property> + <name>cayenneTestConnection</name> + <value>postgres-docker</value> + </property> + </activation> + <build> + <plugins> + <plugin> + <groupId>io.fabric8</groupId> + <artifactId>docker-maven-plugin</artifactId> + <executions> + <execution> + <id>start-postgres</id> + <phase>pre-integration-test</phase> + <goals> + <goal>start</goal> + </goals> + </execution> + <execution> + <id>stop-postgres</id> + <phase>post-integration-test</phase> + <goals> + <goal>stop</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + <profile> <id>code-quality</id> <activation> http://git-wip-us.apache.org/repos/asf/cayenne/blob/23eb17ed/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index b38d9e2..7390058 100644 --- a/pom.xml +++ b/pom.xml @@ -841,6 +841,11 @@ <artifactId>maven-jar-plugin</artifactId> <version>2.4</version> </plugin> + <plugin> + <groupId>io.fabric8</groupId> + <artifactId>docker-maven-plugin</artifactId> + <version>0.15.6</version> + </plugin> </plugins> </pluginManagement> @@ -1347,6 +1352,67 @@ </dependencies> </profile> <profile> + <id>postgres-docker</id> + <activation> + <property> + <name>cayenneTestConnection</name> + <value>postgres-docker</value> + </property> + </activation> + <dependencies> + <dependency> + <groupId>org.postgresql</groupId> + <artifactId>postgresql</artifactId> + <version>9.4.1209</version> + <scope>test</scope> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-failsafe-plugin</artifactId> + <configuration> + <systemPropertyVariables> + <!-- Default user, password, and DB name is "postgres", see https://hub.docker.com/_/postgres/ --> + <!-- ${db.host} and ${db.port} are dynamically set by docker-maven-plugin below --> + <cayenneAdapter>org.apache.cayenne.dba.postgres.PostgresAdapter</cayenneAdapter> + <cayenneJdbcUsername>postgres</cayenneJdbcUsername> + <cayenneJdbcPassword>postgres</cayenneJdbcPassword> + <cayenneJdbcUrl>jdbc:postgresql://${db.host}:${db.port}/postgres</cayenneJdbcUrl> + <cayenneJdbcDriver>org.postgresql.Driver</cayenneJdbcDriver> + </systemPropertyVariables> + </configuration> + </plugin> + <plugin> + <groupId>io.fabric8</groupId> + <artifactId>docker-maven-plugin</artifactId> + <configuration> + <images> + <image> + <alias>db</alias> + <name>postgres:9.5</name> + <run> + <ports> + <port>${db.host}:${db.port}:5432</port> + </ports> + <wait> + <tcp> + <ports> + <port>5432</port> + </ports> + </tcp> + <time>30000</time> + </wait> + </run> + </image> + </images> + </configuration> + </plugin> + </plugins> + </build> + </profile> + <profile> <id>derby</id> <activation> <property>