polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paulmer...@apache.org
Subject [5/6] polygene-java git commit: :tools:generator Implement MongoDB docker based testing
Date Mon, 05 Jun 2017 12:05:21 GMT
: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 <paulmerlin@apache.org>
Authored: Mon Jun 5 14:02:40 2017 +0200
Committer: Paul Merlin <paulmerlin@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;


Mime
View raw message