polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paulmer...@apache.org
Subject [5/7] polygene-java git commit: POLYGENE-221 integration test Redis ES using Docker
Date Mon, 09 Jan 2017 17:57:23 GMT
POLYGENE-221 integration test Redis ES using Docker


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

Branch: refs/heads/develop
Commit: d93c59005569d738d3c668733d0734e9e9beb5cf
Parents: 7842245
Author: Paul Merlin <paulmerlin@apache.org>
Authored: Mon Jan 9 18:52:07 2017 +0100
Committer: Paul Merlin <paulmerlin@apache.org>
Committed: Mon Jan 9 18:56:58 2017 +0100

----------------------------------------------------------------------
 extensions/entitystore-redis/build.gradle       |  2 +-
 .../redis/RedisMapEntityStoreTest.java          | 20 +++++++++++---------
 .../redis/RedisMapEntityStoreWithCacheTest.java | 18 +++++++++---------
 internals/docker-redis/build.gradle             | 19 +++++++++++++++++++
 .../docker-redis/src/main/docker/Dockerfile     |  1 +
 internals/testsupport-internal/build.gradle     |  4 ++++
 settings.gradle                                 |  3 ++-
 7 files changed, 47 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/d93c5900/extensions/entitystore-redis/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/entitystore-redis/build.gradle b/extensions/entitystore-redis/build.gradle
index f59654f..2bd25af 100644
--- a/extensions/entitystore-redis/build.gradle
+++ b/extensions/entitystore-redis/build.gradle
@@ -31,7 +31,7 @@ dependencies {
 
   runtime polygene.core.runtime
 
-  testCompile polygene.core.testsupport
+  testCompile polygene.internals.testsupport
   testCompile polygene.extension( 'valueserialization-orgjson' )
 
   testRuntime libraries.logback

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/d93c5900/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreTest.java
b/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreTest.java
index f178625..e5ef9f8 100644
--- a/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreTest.java
+++ b/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreTest.java
@@ -19,27 +19,23 @@
  */
 package org.apache.polygene.entitystore.redis;
 
-import org.apache.polygene.entitystore.redis.assembly.RedisEntityStoreAssembler;
-import org.junit.BeforeClass;
 import org.apache.polygene.api.common.Visibility;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.entitystore.redis.assembly.RedisEntityStoreAssembler;
+import org.apache.polygene.test.internal.DockerRule;
 import org.apache.polygene.test.EntityTestAssembler;
 import org.apache.polygene.test.entity.AbstractEntityStoreTest;
 import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
+import org.junit.ClassRule;
 import redis.clients.jedis.Jedis;
 import redis.clients.jedis.JedisPool;
 
-import static org.apache.polygene.test.util.Assume.assumeConnectivity;
-
 public class RedisMapEntityStoreTest
     extends AbstractEntityStoreTest
 {
-    @BeforeClass
-    public static void beforeRedisMapEntityStoreTests()
-    {
-        assumeConnectivity( "localhost", 6379 );
-    }
+    @ClassRule
+    public static final DockerRule DOCKER = new DockerRule( "redis", 6379 );
 
     @Override
     // START SNIPPET: assembly
@@ -53,6 +49,12 @@ public class RedisMapEntityStoreTest
         new OrgJsonValueSerializationAssembler().assemble( module );
         // START SNIPPET: assembly
         new RedisEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble(
module );
+        // END SNIPPET: assembly
+        RedisEntityStoreConfiguration redisConfig = config.forMixin( RedisEntityStoreConfiguration.class
)
+                                                          .declareDefaults();
+        redisConfig.host().set( DOCKER.getDockerHost() );
+        redisConfig.port().set( DOCKER.getExposedContainerPort( "6379/tcp" ) );
+        // START SNIPPET: assembly
     }
     // END SNIPPET: assembly
 

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/d93c5900/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreWithCacheTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreWithCacheTest.java
b/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreWithCacheTest.java
index a4e729a..f4499a1 100644
--- a/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreWithCacheTest.java
+++ b/extensions/entitystore-redis/src/test/java/org/apache/polygene/entitystore/redis/RedisMapEntityStoreWithCacheTest.java
@@ -19,27 +19,23 @@
  */
 package org.apache.polygene.entitystore.redis;
 
-import org.apache.polygene.entitystore.redis.assembly.RedisEntityStoreAssembler;
-import org.junit.BeforeClass;
 import org.apache.polygene.api.common.Visibility;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.entitystore.redis.assembly.RedisEntityStoreAssembler;
+import org.apache.polygene.test.internal.DockerRule;
 import org.apache.polygene.test.EntityTestAssembler;
 import org.apache.polygene.test.cache.AbstractEntityStoreWithCacheTest;
 import org.apache.polygene.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
+import org.junit.ClassRule;
 import redis.clients.jedis.Jedis;
 import redis.clients.jedis.JedisPool;
 
-import static org.apache.polygene.test.util.Assume.assumeConnectivity;
-
 public class RedisMapEntityStoreWithCacheTest
     extends AbstractEntityStoreWithCacheTest
 {
-    @BeforeClass
-    public static void beforeRedisMapEntityStoreTests()
-    {
-        assumeConnectivity( "localhost", 6379 );
-    }
+    @ClassRule
+    public static final DockerRule DOCKER = new DockerRule( "redis", 6379 );
 
     @Override
     public void assemble( ModuleAssembly module )
@@ -50,6 +46,10 @@ public class RedisMapEntityStoreWithCacheTest
         new EntityTestAssembler().assemble( config );
         new OrgJsonValueSerializationAssembler().assemble( module );
         new RedisEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble(
module );
+        RedisEntityStoreConfiguration redisConfig = config.forMixin( RedisEntityStoreConfiguration.class
)
+                                                          .declareDefaults();
+        redisConfig.host().set( DOCKER.getDockerHost() );
+        redisConfig.port().set( DOCKER.getExposedContainerPort( "6379/tcp" ) );
     }
 
     private JedisPool jedisPool;

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/d93c5900/internals/docker-redis/build.gradle
----------------------------------------------------------------------
diff --git a/internals/docker-redis/build.gradle b/internals/docker-redis/build.gradle
new file mode 100644
index 0000000..d6f59e0
--- /dev/null
+++ b/internals/docker-redis/build.gradle
@@ -0,0 +1,19 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+apply plugin: 'polygene-internal-docker'

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/d93c5900/internals/docker-redis/src/main/docker/Dockerfile
----------------------------------------------------------------------
diff --git a/internals/docker-redis/src/main/docker/Dockerfile b/internals/docker-redis/src/main/docker/Dockerfile
new file mode 100644
index 0000000..058f6b2
--- /dev/null
+++ b/internals/docker-redis/src/main/docker/Dockerfile
@@ -0,0 +1 @@
+FROM redis:alpine

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/d93c5900/internals/testsupport-internal/build.gradle
----------------------------------------------------------------------
diff --git a/internals/testsupport-internal/build.gradle b/internals/testsupport-internal/build.gradle
index 6503990..38c8c3e 100644
--- a/internals/testsupport-internal/build.gradle
+++ b/internals/testsupport-internal/build.gradle
@@ -24,3 +24,7 @@ dependencies {
 
   runtime polygene.core.runtime
 }
+
+// Ensure that all Docker images are built alongside this project
+// This is a bit of a stretch but works for now
+classes.dependsOn ':internals:docker-redis:docker'

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/d93c5900/settings.gradle
----------------------------------------------------------------------
diff --git a/settings.gradle b/settings.gradle
index 6858c4c..a479d75 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -100,6 +100,7 @@ include 'core:api',
         'samples:sql-support',
         'samples:swing'
 
-include 'internals:testsupport-internal'
+include 'internals:testsupport-internal',
+        'internals:docker-redis'
 
 include 'manual', 'reports', 'distributions', 'release'


Mime
View raw message