:tools:generator implement docker based testing for Riak 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/0467eaba Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/0467eaba Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/0467eaba Branch: refs/heads/develop Commit: 0467eaba2aa1a0c71c40751666ac118c1925948e Parents: 3046b57 Author: Paul Merlin <[email protected]> Authored: Mon Jun 5 14:42:27 2017 +0200 Committer: Paul Merlin <[email protected]> Committed: Mon Jun 5 14:42:27 2017 +0200 ---------------------------------------------------------------------- .../templates/RestAPIApplication/bootstrap-test.tmpl | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0467eaba/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 2f5fe49..26e71ae 100644 --- a/tools/generator-polygene/app/templates/RestAPIApplication/bootstrap-test.tmpl +++ b/tools/generator-polygene/app/templates/RestAPIApplication/bootstrap-test.tmpl @@ -274,17 +274,25 @@ if( polygene.entitystore === 'Redis' ) { .waitFor( WaitFor.tcpPort( 6379 ) ) ); <% } if( polygene.entitystore === 'Riak' ) { + polygene.needsDelayChecker = true; %> - private void entityStoreSetup(ApplicationAssembly assembly ) + private void entityStoreSetup( ApplicationAssembly assembly ) { + ModuleAssembly config = assembly.layer( ConfigurationLayer.NAME ).module( ConfigModule.NAME ); + + RiakEntityStoreConfiguration riakConfig = config.forMixin( RiakEntityStoreConfiguration.class ).declareDefaults(); + String host = ES_DOCKER.getDockerHost(); + String port = ES_DOCKER.getExposedContainerPort( "8087/tcp" ); + riakConfig.hosts().set( java.util.Collections.singletonList( host + ':' + port ) ); } @ClassRule public static final OptionalDockerRule ES_DOCKER = new OptionalDockerRule( DockerRule.builder() .imageName( "basho/riak-kv:ubuntu-2.2.3" ) - .publishAllPorts( true ) + .expose( "8087" ) .waitForTimeout( 120 ) - .waitFor( WaitFor.logMessageSequence( "riak_auth_mods started on node" ) ) ); + .waitFor( WaitFor.logMessageSequence( "riak_auth_mods started on node" ) ) + .waitFor( new DelayChecker( 3000L ) ) ); <% } if( polygene.entitystore === 'SQLite' ) { %>
