This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit c82a9f5eb759a0a4c8d20b198aeaa41892824a72 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Thu Jun 1 15:27:30 2017 +0200 mise en place de flyway pour la migration de base de données + utilisé un autre fichier de properties pour les tests (evite les conflits avec les conf local) --- pollen-persistence/pom.xml | 5 ++++ .../persistence/PollenFlywayServiceImpl.java | 29 ++++++++++++++++++++++ .../db/migration/common/V3_0_0_1__exemple.sql | 2 ++ .../db/migration/h2/V3_0_0_2__exemple.sql | 2 ++ .../db/migration/postgresql/V3_0_0_2__exemple.sql | 3 +++ pollen-persistence/src/main/xmi/pollen.properties | 2 +- .../src/main/resources/pollen-rest-api.properties | 1 + .../pollen/rest/api/AbstractPollenRestApiTest.java | 2 +- pollen-services/pom.xml | 7 +++--- pollen-ui-riot-js/package.json | 2 +- pollen-ui-riot-js/src/main/web/conf.js | 2 +- pom.xml | 6 +++++ 12 files changed, 56 insertions(+), 7 deletions(-) diff --git a/pollen-persistence/pom.xml b/pollen-persistence/pom.xml index 35567db..b6324fb 100644 --- a/pollen-persistence/pom.xml +++ b/pollen-persistence/pom.xml @@ -59,6 +59,11 @@ </dependency> <dependency> + <groupId>org.nuiton.topia</groupId> + <artifactId>topia-service-flyway</artifactId> + </dependency> + + <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> </dependency> diff --git a/pollen-persistence/src/main/java/org/chorem/pollen/persistence/PollenFlywayServiceImpl.java b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/PollenFlywayServiceImpl.java new file mode 100644 index 0000000..42bea66 --- /dev/null +++ b/pollen-persistence/src/main/java/org/chorem/pollen/persistence/PollenFlywayServiceImpl.java @@ -0,0 +1,29 @@ +package org.chorem.pollen.persistence; + +import com.google.common.collect.Lists; +import org.flywaydb.core.Flyway; +import org.nuiton.topia.flyway.TopiaFlywayServiceImpl; +import org.nuiton.topia.persistence.TopiaApplicationContext; + +import java.util.List; + +/** + * @author Sylvain Bavencoff - bavencoff@codelutin.com + */ +public class PollenFlywayServiceImpl extends TopiaFlywayServiceImpl { + + @Override + protected void setLocations(Flyway flyway, TopiaApplicationContext topiaApplicationContext) { + List<String> locations = Lists.newArrayList("db/migration/common"); + String jdbcUrl = topiaApplicationContext.getConfiguration().getJdbcConnectionUrl(); + + if (jdbcUrl.startsWith("jdbc:postgresql")) { + locations.add("db/migration/postgresql"); + } else if (jdbcUrl.startsWith("jdbc:h2")) { + locations.add("db/migration/h2"); + } + + String[] locationsArray = locations.toArray(new String[locations.size()]); + flyway.setLocations(locationsArray); + } +} diff --git a/pollen-persistence/src/main/resources/db/migration/common/V3_0_0_1__exemple.sql b/pollen-persistence/src/main/resources/db/migration/common/V3_0_0_1__exemple.sql new file mode 100644 index 0000000..c649638 --- /dev/null +++ b/pollen-persistence/src/main/resources/db/migration/common/V3_0_0_1__exemple.sql @@ -0,0 +1,2 @@ + +-- Ici un script de migration commun aux bases H2 et PostgreSQL diff --git a/pollen-persistence/src/main/resources/db/migration/h2/V3_0_0_2__exemple.sql b/pollen-persistence/src/main/resources/db/migration/h2/V3_0_0_2__exemple.sql new file mode 100644 index 0000000..766ee6c --- /dev/null +++ b/pollen-persistence/src/main/resources/db/migration/h2/V3_0_0_2__exemple.sql @@ -0,0 +1,2 @@ + +-- Ici un script de migration specifique pour les bases H2 diff --git a/pollen-persistence/src/main/resources/db/migration/postgresql/V3_0_0_2__exemple.sql b/pollen-persistence/src/main/resources/db/migration/postgresql/V3_0_0_2__exemple.sql new file mode 100644 index 0000000..19b1120 --- /dev/null +++ b/pollen-persistence/src/main/resources/db/migration/postgresql/V3_0_0_2__exemple.sql @@ -0,0 +1,3 @@ + + +-- Ici un script de migration specifique pour les bases PostgreSQL diff --git a/pollen-persistence/src/main/xmi/pollen.properties b/pollen-persistence/src/main/xmi/pollen.properties index e074670..dec4909 100644 --- a/pollen-persistence/src/main/xmi/pollen.properties +++ b/pollen-persistence/src/main/xmi/pollen.properties @@ -18,7 +18,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # #L% ###m -model.tagvalue.version=2.0 +model.tagvalue.version=3.0.0.0 #model.tagValue.notGenerateToString=true #model.tagValue.constantPrefix=PROPERTY_ #model.tagValue.useEnumerationName=true diff --git a/pollen-rest-api/src/main/resources/pollen-rest-api.properties b/pollen-rest-api/src/main/resources/pollen-rest-api.properties index 4e3951b..4965f75 100644 --- a/pollen-rest-api/src/main/resources/pollen-rest-api.properties +++ b/pollen-rest-api/src/main/resources/pollen-rest-api.properties @@ -30,3 +30,4 @@ hibernate.hikari.minimumIdle=2 hibernate.hikari.maximumPoolSize=20 hibernate.hikari.autoCommit=false topia.persistence.topiaIdFactoryClassName=org.nuiton.topia.persistence.internal.ShortTopiaIdFactory +topia.service.migration=org.chorem.pollen.persistence.PollenFlywayServiceImpl diff --git a/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/AbstractPollenRestApiTest.java b/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/AbstractPollenRestApiTest.java index baf2364..74037f7 100644 --- a/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/AbstractPollenRestApiTest.java +++ b/pollen-rest-api/src/test/java/org/chorem/pollen/rest/api/AbstractPollenRestApiTest.java @@ -55,7 +55,7 @@ public class AbstractPollenRestApiTest extends WebMotionTest { private static final Log log = LogFactory.getLog(AbstractPollenRestApiTest.class); @Rule - public final FakePollenApplicationContext application = new FakePollenApplicationContext("pollen-rest-api.properties"); + public final FakePollenApplicationContext application = new FakePollenApplicationContext("pollen-rest-api-test.properties"); protected JsonHelper jsonHelper; diff --git a/pollen-services/pom.xml b/pollen-services/pom.xml index 7fa0d31..1df904c 100644 --- a/pollen-services/pom.xml +++ b/pollen-services/pom.xml @@ -60,10 +60,11 @@ <groupId>org.nuiton.topia</groupId> <artifactId>topia-persistence</artifactId> </dependency> - <!--dependency> + + <dependency> <groupId>org.nuiton.topia</groupId> - <artifactId>topia-junit</artifactId> - </dependency--> + <artifactId>topia-service-flyway</artifactId> + </dependency> <dependency> <groupId>org.hibernate</groupId> diff --git a/pollen-ui-riot-js/package.json b/pollen-ui-riot-js/package.json index 8a41cc1..cc3a8c9 100644 --- a/pollen-ui-riot-js/package.json +++ b/pollen-ui-riot-js/package.json @@ -24,7 +24,7 @@ } ], "scripts": { - "start": "./node_modules/.bin/webpack-dev-server --hot --inline --host 0.0.0.0", + "start": "./node_modules/.bin/webpack-dev-server --hot --inline --host 0.0.0.0 --public felteu:8080", "package": "./node_modules/.bin/webpack --bail" }, "devDependencies": { diff --git a/pollen-ui-riot-js/src/main/web/conf.js b/pollen-ui-riot-js/src/main/web/conf.js index 19b836c..6a5f712 100644 --- a/pollen-ui-riot-js/src/main/web/conf.js +++ b/pollen-ui-riot-js/src/main/web/conf.js @@ -1,5 +1,5 @@ window.pollenConf = { - endPoint: "http://localhost:8888/pollen-rest-api", + endPoint: "http://felteu:8888/pollen-rest-api", defaultErrorTimeout: 15, resourceMaxSize: 10000000 // octets => 10 Mo }; diff --git a/pom.xml b/pom.xml index 617c8f8..603652d 100644 --- a/pom.xml +++ b/pom.xml @@ -313,6 +313,12 @@ </dependency> <dependency> + <groupId>org.nuiton.topia</groupId> + <artifactId>topia-service-flyway</artifactId> + <version>${topiaVersion}</version> + </dependency> + + <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>${hibernateVersion}</version> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.