polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paulmer...@apache.org
Subject [7/7] polygene-java git commit: POLYGENE-221 integration test Memcached Cache using Docker
Date Mon, 09 Jan 2017 17:57:25 GMT
POLYGENE-221 integration test Memcached Cache 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/9ace50e0
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/9ace50e0
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/9ace50e0

Branch: refs/heads/develop
Commit: 9ace50e0111054e7454cfabcaabd87741d9c27db
Parents: d93c590
Author: Paul Merlin <paulmerlin@apache.org>
Authored: Mon Jan 9 18:53:11 2017 +0100
Committer: Paul Merlin <paulmerlin@apache.org>
Committed: Mon Jan 9 18:56:58 2017 +0100

----------------------------------------------------------------------
 extensions/cache-memcache/build.gradle           |  2 +-
 .../cache/memcache/MemcacheCachePoolTest.java    | 17 +++++++----------
 internals/docker-memcached/build.gradle          | 19 +++++++++++++++++++
 .../docker-memcached/src/main/docker/Dockerfile  |  1 +
 internals/testsupport-internal/build.gradle      |  1 +
 settings.gradle                                  |  1 +
 6 files changed, 30 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/9ace50e0/extensions/cache-memcache/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/cache-memcache/build.gradle b/extensions/cache-memcache/build.gradle
index 03cf403..5251c4d 100644
--- a/extensions/cache-memcache/build.gradle
+++ b/extensions/cache-memcache/build.gradle
@@ -30,7 +30,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/9ace50e0/extensions/cache-memcache/src/test/java/org/apache/polygene/cache/memcache/MemcacheCachePoolTest.java
----------------------------------------------------------------------
diff --git a/extensions/cache-memcache/src/test/java/org/apache/polygene/cache/memcache/MemcacheCachePoolTest.java
b/extensions/cache-memcache/src/test/java/org/apache/polygene/cache/memcache/MemcacheCachePoolTest.java
index 1cf17f1..7d5d98b 100644
--- a/extensions/cache-memcache/src/test/java/org/apache/polygene/cache/memcache/MemcacheCachePoolTest.java
+++ b/extensions/cache-memcache/src/test/java/org/apache/polygene/cache/memcache/MemcacheCachePoolTest.java
@@ -19,14 +19,13 @@
  */
 package org.apache.polygene.cache.memcache;
 
-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.test.internal.DockerRule;
 import org.apache.polygene.test.EntityTestAssembler;
 import org.apache.polygene.test.cache.AbstractCachePoolTest;
-
-import static org.apache.polygene.test.util.Assume.assumeConnectivity;
+import org.junit.ClassRule;
 
 /**
  * Memcache CachePool Test.
@@ -34,11 +33,8 @@ import static org.apache.polygene.test.util.Assume.assumeConnectivity;
 public class MemcacheCachePoolTest
     extends AbstractCachePoolTest
 {
-    @BeforeClass
-    public static void beforeMemcacheCacheTests()
-    {
-        assumeConnectivity( "localhost", 11211 );
-    }
+    @ClassRule
+    public static final DockerRule DOCKER = new DockerRule( "memcached", 11211 );
 
     @Override
     // START SNIPPET: assembly
@@ -55,9 +51,10 @@ public class MemcacheCachePoolTest
             assemble( module );
         // END SNIPPET: assembly
         MemcacheConfiguration memcacheConf = confModule.forMixin( MemcacheConfiguration.class
).declareDefaults();
+        String dockerHost = DOCKER.getDockerHost();
+        int dockerPort = DOCKER.getExposedContainerPort( "11211/tcp" );
+        memcacheConf.addresses().set( dockerHost + ':' + dockerPort );
         memcacheConf.protocol().set( "binary" );
-        //memcacheConf.username().set( "foo" );
-        //memcacheConf.password().set( "bar" );
         // START SNIPPET: assembly
     }
     // END SNIPPET: assembly

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/9ace50e0/internals/docker-memcached/build.gradle
----------------------------------------------------------------------
diff --git a/internals/docker-memcached/build.gradle b/internals/docker-memcached/build.gradle
new file mode 100644
index 0000000..d6f59e0
--- /dev/null
+++ b/internals/docker-memcached/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/9ace50e0/internals/docker-memcached/src/main/docker/Dockerfile
----------------------------------------------------------------------
diff --git a/internals/docker-memcached/src/main/docker/Dockerfile b/internals/docker-memcached/src/main/docker/Dockerfile
new file mode 100644
index 0000000..dd2ef40
--- /dev/null
+++ b/internals/docker-memcached/src/main/docker/Dockerfile
@@ -0,0 +1 @@
+FROM memcached:alpine

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/9ace50e0/internals/testsupport-internal/build.gradle
----------------------------------------------------------------------
diff --git a/internals/testsupport-internal/build.gradle b/internals/testsupport-internal/build.gradle
index 38c8c3e..561035a 100644
--- a/internals/testsupport-internal/build.gradle
+++ b/internals/testsupport-internal/build.gradle
@@ -27,4 +27,5 @@ dependencies {
 
 // 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-memcached:docker'
 classes.dependsOn ':internals:docker-redis:docker'

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/9ace50e0/settings.gradle
----------------------------------------------------------------------
diff --git a/settings.gradle b/settings.gradle
index a479d75..dacb684 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -101,6 +101,7 @@ include 'core:api',
         'samples:swing'
 
 include 'internals:testsupport-internal',
+        'internals:docker-memcached',
         'internals:docker-redis'
 
 include 'manual', 'reports', 'distributions', 'release'


Mime
View raw message