This is an automated email from the git hooks/post-receive script. New commit to branch feature/spgeed in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 24cac1f2654b39bea7c03d0f346d7e2cf6e8ebc6 Author: Killian <killian.herbreteau@epitech.eu> Date: Fri Oct 25 12:03:23 2019 +0200 adding embedded PostgreSQL for Spgeed and Topia --- pollen-services/pom.xml | 10 ++++++ .../test/FakePollenApplicationContext.java | 36 ++++++++++------------ 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/pollen-services/pom.xml b/pollen-services/pom.xml index 77bfad20..99a0d2ec 100644 --- a/pollen-services/pom.xml +++ b/pollen-services/pom.xml @@ -242,6 +242,16 @@ <groupId>org.bouncycastle</groupId> <artifactId>bcpg-jdk15on</artifactId> </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-core</artifactId> + <version>5.3.12.Final</version> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-core</artifactId> + <scope>compile</scope> + </dependency> </dependencies> diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/test/FakePollenApplicationContext.java b/pollen-services/src/main/java/org/chorem/pollen/services/test/FakePollenApplicationContext.java index 28261d1f..f19a93f6 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/test/FakePollenApplicationContext.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/test/FakePollenApplicationContext.java @@ -47,6 +47,7 @@ import org.junit.runner.Description; import org.nuiton.topia.persistence.BeanTopiaConfiguration; import org.nuiton.topia.persistence.TopiaConfiguration; import org.nuiton.topia.persistence.TopiaConfigurationBuilder; +import org.nuiton.topia.persistence.internal.ShortTopiaIdFactory; import org.nuiton.util.DateUtil; import org.nuiton.util.FileUtil; import ru.yandex.qatools.embed.postgresql.EmbeddedPostgres; @@ -93,6 +94,8 @@ public class FakePollenApplicationContext extends TestWatcher implements PollenA protected final String configurationPath; + protected EmbeddedPostgres embeddedPostgres; + protected static final String TIMESTAMP = String.valueOf(System.nanoTime()); public FakePollenApplicationContext(String configurationPath) { @@ -129,24 +132,6 @@ public class FakePollenApplicationContext extends TestWatcher implements PollenA if (log.isDebugEnabled()) { log.debug("testBasedir: " + testBasedir); } - - - EmbeddedPostgres embeddedPostgres = new EmbeddedPostgres(Main.V9_6); - IRuntimeConfig cachedRuntimeConfig = EmbeddedPostgres.cachedRuntimeConfig(testBasedir.toPath()); - - String jdbcConnectionUrl; - try { - jdbcConnectionUrl = embeddedPostgres.start(cachedRuntimeConfig, "127.0.0.1", currentPortNumber, "pollen", "pollen", "pollen", ImmutableList.of("-E", "UTF-8")); - } catch (IOException e) { - throw new UncheckedIOException("ne peut pas démarrer postgresql", e); - } - - TopiaConfiguration topiaConfiguration = new TopiaConfigurationBuilder() - .forPostgresqlDatabase(jdbcConnectionUrl, "pollen", "pollen") - .useFlyway() - .validateSchemaOnStartup() - .useDefaultConnectionPool() - .build(); init(); } @@ -154,7 +139,7 @@ public class FakePollenApplicationContext extends TestWatcher implements PollenA @Override public void finished(Description description) { - close(); + embeddedPostgres.close(); } @Override @@ -162,6 +147,16 @@ public class FakePollenApplicationContext extends TestWatcher implements PollenA // --- create configuration --- // + embeddedPostgres = new EmbeddedPostgres(Main.V10); + IRuntimeConfig cachedRuntimeConfig = EmbeddedPostgres.cachedRuntimeConfig(testBasedir.toPath()); + + String jdbcConnectionUrl; + try { + jdbcConnectionUrl = embeddedPostgres.start(cachedRuntimeConfig, "127.0.0.1", currentPortNumber, "pollenprod", "pollen", "pollen", ImmutableList.of("-E", "UTF-8")); + } catch (IOException e) { + throw new UncheckedIOException("ne peut pas démarrer postgresql", e); + } + Properties defaultvalues = new Properties(); defaultvalues.put(PollenServicesConfigOption.DATA_DIRECTORY.getKey(), testBasedir.getAbsolutePath()); @@ -169,8 +164,11 @@ public class FakePollenApplicationContext extends TestWatcher implements PollenA // --- create topia application context --- // + Map<String, String> topiaProperties = configuration.getTopiaProperties(); BeanTopiaConfiguration topiaConfiguration = new TopiaConfigurationBuilder().readMap(topiaProperties); + topiaConfiguration.setJdbcConnectionUrl(jdbcConnectionUrl); + topiaConfiguration.setTopiaIdFactoryClass(ShortTopiaIdFactory.class); applicationContext = new PollenTopiaApplicationContext(topiaConfiguration); } -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.