You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by pa...@apache.org on 2017/06/05 12:05:21 UTC

[5/6] polygene-java git commit: :tools:generator Implement MongoDB docker based testing

:tools:generator Implement MongoDB docker based testing


Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/a8851732
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/a8851732
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/a8851732

Branch: refs/heads/develop
Commit: a8851732af57a1d873ae224fc4b1d378cc19ec4b
Parents: 182434b
Author: Paul Merlin <pa...@apache.org>
Authored: Mon Jun 5 14:02:40 2017 +0200
Committer: Paul Merlin <pa...@apache.org>
Committed: Mon Jun 5 14:02:40 2017 +0200

----------------------------------------------------------------------
 .../templates/RestAPIApplication/bootstrap-test.tmpl   | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/a8851732/tools/generator-polygene/app/templates/RestAPIApplication/bootstrap-test.tmpl
----------------------------------------------------------------------
diff --git a/tools/generator-polygene/app/templates/RestAPIApplication/bootstrap-test.tmpl b/tools/generator-polygene/app/templates/RestAPIApplication/bootstrap-test.tmpl
index 14f93e5..80303c1 100644
--- a/tools/generator-polygene/app/templates/RestAPIApplication/bootstrap-test.tmpl
+++ b/tools/generator-polygene/app/templates/RestAPIApplication/bootstrap-test.tmpl
@@ -205,9 +205,20 @@ if(  polygene.entitystore === 'Memory' ) {
 <% }
 if(  polygene.entitystore === 'MongoDB' ) {
 %>
-    private void entityStoreSetup(ApplicationAssembly assembly )
+    private void entityStoreSetup( ApplicationAssembly assembly )
     {
+        ModuleAssembly config = assembly.layer( ConfigurationLayer.NAME ).module( ConfigModule.NAME );
+        MongoDBEntityStoreConfiguration mongoConfig = config.forMixin( MongoDBEntityStoreConfiguration.class ).declareDefaults();
+        mongoConfig.hostname().set( ES_DOCKER.getDockerHost() );
+        mongoConfig.port().set( Integer.valueOf( ES_DOCKER.getExposedContainerPort( "27017/tcp" ) ) );
     }
+
+    @ClassRule
+    public static final OptionalDockerRule ES_DOCKER = new OptionalDockerRule( DockerRule.builder()
+                                                            .imageName( "mongo:3.5.8" )
+                                                            .expose( "27017" )
+                                                            .waitForTimeout( 120 )
+                                                            .waitFor( WaitFor.tcpPort(27017) ) );
 <% }
 if(  polygene.entitystore === 'MySQL' ) {
     polygene.needsDelayChecker = true;