:tools:generator implement docker based testing for Redis ES

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

Branch: refs/heads/develop
Commit: 3046b57ab58d1acb805500413ca90e70358665b4
Parents: 2310dc0
Author: Paul Merlin <[email protected]>
Authored: Mon Jun 5 14:40:31 2017 +0200
Committer: Paul Merlin <[email protected]>
Committed: Mon Jun 5 14:40:31 2017 +0200

----------------------------------------------------------------------
 .../templates/RestAPIApplication/bootstrap-test.tmpl    | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/3046b57a/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 7114e19..2f5fe49 100644
--- 
a/tools/generator-polygene/app/templates/RestAPIApplication/bootstrap-test.tmpl
+++ 
b/tools/generator-polygene/app/templates/RestAPIApplication/bootstrap-test.tmpl
@@ -256,16 +256,22 @@ if(  polygene.entitystore === 'Preferences' ) {
 <% }
 if(  polygene.entitystore === 'Redis' ) {
 %>
-    private void entityStoreSetup(ApplicationAssembly assembly )
+    private void entityStoreSetup( ApplicationAssembly assembly )
     {
+        ModuleAssembly config = assembly.layer( ConfigurationLayer.NAME 
).module( ConfigModule.NAME );
+
+        RedisEntityStoreConfiguration redisConfig = config.forMixin( 
RedisEntityStoreConfiguration.class )
+                                                          .declareDefaults();
+        redisConfig.host().set( ES_DOCKER.getDockerHost() );
+        redisConfig.port().set( Integer.valueOf( 
ES_DOCKER.getExposedContainerPort( "6379/tcp" ) ) );
     }
 
     @ClassRule
     public static final OptionalDockerRule ES_DOCKER = new OptionalDockerRule( 
DockerRule.builder()
                                                          .imageName( 
"redis:3.2.8-alpine"  )
-                                                         .publishAllPorts( 
true )
+                                                         .expose( "6379" )
                                                          .waitForTimeout( 120 )
-                                                         .waitFor( 
pl.domzal.junit.docker.rule.WaitFor.tcpPort( 6379 ) ) );
+                                                         .waitFor( 
WaitFor.tcpPort( 6379 ) ) );
 <% }
 if(  polygene.entitystore === 'Riak' ) {
 %>

Reply via email to