polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paulmer...@apache.org
Subject [45/50] zest-java git commit: ZEST-107 Tests with Cache of EntityStores supporting Cache SPI
Date Tue, 28 Jul 2015 12:55:42 GMT
ZEST-107 Tests with Cache of EntityStores supporting Cache SPI

All but PreferencesES and SQLES.


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

Branch: refs/heads/master
Commit: 7b006504e0ea8e0d274b7c4a1f7f225561d4898f
Parents: 4a1788b
Author: Paul Merlin <paulmerlin@apache.org>
Authored: Mon Jul 27 17:07:06 2015 +0200
Committer: Paul Merlin <paulmerlin@apache.org>
Committed: Mon Jul 27 17:09:02 2015 +0200

----------------------------------------------------------------------
 .../file/FileEntityStoreWithCacheTest.java      | 42 ++++++++++
 .../HazelcastEntityStoreWithCacheTest.java      | 40 ++++++++++
 .../jclouds/JCloudsWithCacheTest.java           | 39 +++++++++
 .../jdbm/JdbmEntityStoreWithCacheTest.java      | 54 +++++++++++++
 .../LevelDBEntityStoreWithCacheTest.java        | 46 +++++++++++
 .../memory/MemoryEntityStoreWithCacheTest.java  | 35 +++++++++
 .../MongoMapEntityStoreWithCacheTest.java       | 83 ++++++++++++++++++++
 .../redis/RedisMapEntityStoreWithCacheTest.java | 78 ++++++++++++++++++
 .../riak/RiakMapEntityStoreWithCacheTest.java   | 76 ++++++++++++++++++
 9 files changed, 493 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-java/blob/7b006504/extensions/entitystore-file/src/test/java/org/qi4j/entitystore/file/FileEntityStoreWithCacheTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-file/src/test/java/org/qi4j/entitystore/file/FileEntityStoreWithCacheTest.java
b/extensions/entitystore-file/src/test/java/org/qi4j/entitystore/file/FileEntityStoreWithCacheTest.java
new file mode 100644
index 0000000..4fd31a5
--- /dev/null
+++ b/extensions/entitystore-file/src/test/java/org/qi4j/entitystore/file/FileEntityStoreWithCacheTest.java
@@ -0,0 +1,42 @@
+/*
+ *  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.
+ */
+package org.qi4j.entitystore.file;
+
+import org.qi4j.api.common.Visibility;
+import org.qi4j.bootstrap.AssemblyException;
+import org.qi4j.bootstrap.ModuleAssembly;
+import org.qi4j.entitystore.file.assembly.FileEntityStoreAssembler;
+import org.qi4j.library.fileconfig.FileConfigurationService;
+import org.qi4j.test.EntityTestAssembler;
+import org.qi4j.test.cache.AbstractEntityStoreWithCacheTest;
+import org.qi4j.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
+
+public class FileEntityStoreWithCacheTest
+    extends AbstractEntityStoreWithCacheTest
+{
+    @Override
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        super.assemble( module );
+        module.services( FileConfigurationService.class );
+        ModuleAssembly config = module.layer().module( "config" );
+        new EntityTestAssembler().assemble( config );
+        new OrgJsonValueSerializationAssembler().assemble( module );
+        new FileEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module
);
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/7b006504/extensions/entitystore-hazelcast/src/test/java/org/qi4j/entitystore/hazelcast/HazelcastEntityStoreWithCacheTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-hazelcast/src/test/java/org/qi4j/entitystore/hazelcast/HazelcastEntityStoreWithCacheTest.java
b/extensions/entitystore-hazelcast/src/test/java/org/qi4j/entitystore/hazelcast/HazelcastEntityStoreWithCacheTest.java
new file mode 100644
index 0000000..8b8f032
--- /dev/null
+++ b/extensions/entitystore-hazelcast/src/test/java/org/qi4j/entitystore/hazelcast/HazelcastEntityStoreWithCacheTest.java
@@ -0,0 +1,40 @@
+/*
+ *  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.
+ */
+package org.qi4j.entitystore.hazelcast;
+
+import org.qi4j.api.common.Visibility;
+import org.qi4j.bootstrap.AssemblyException;
+import org.qi4j.bootstrap.ModuleAssembly;
+import org.qi4j.entitystore.hazelcast.assembly.HazelcastEntityStoreAssembler;
+import org.qi4j.test.EntityTestAssembler;
+import org.qi4j.test.cache.AbstractEntityStoreWithCacheTest;
+import org.qi4j.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
+
+public class HazelcastEntityStoreWithCacheTest
+    extends AbstractEntityStoreWithCacheTest
+{
+    @Override
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        super.assemble( module );
+        ModuleAssembly config = module.layer().module( "config" );
+        new EntityTestAssembler().assemble( config );
+        new OrgJsonValueSerializationAssembler().assemble( module );
+        new HazelcastEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble(
module );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/7b006504/extensions/entitystore-jclouds/src/test/java/org/qi4j/entitystore/jclouds/JCloudsWithCacheTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-jclouds/src/test/java/org/qi4j/entitystore/jclouds/JCloudsWithCacheTest.java
b/extensions/entitystore-jclouds/src/test/java/org/qi4j/entitystore/jclouds/JCloudsWithCacheTest.java
new file mode 100644
index 0000000..ab473c7
--- /dev/null
+++ b/extensions/entitystore-jclouds/src/test/java/org/qi4j/entitystore/jclouds/JCloudsWithCacheTest.java
@@ -0,0 +1,39 @@
+/*
+ *  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.
+ */
+package org.qi4j.entitystore.jclouds;
+
+import org.qi4j.api.common.Visibility;
+import org.qi4j.bootstrap.AssemblyException;
+import org.qi4j.bootstrap.ModuleAssembly;
+import org.qi4j.test.EntityTestAssembler;
+import org.qi4j.test.cache.AbstractEntityStoreWithCacheTest;
+import org.qi4j.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
+
+public class JCloudsWithCacheTest
+    extends AbstractEntityStoreWithCacheTest
+{
+    @Override
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        super.assemble( module );
+        ModuleAssembly config = module.layer().module( "config" );
+        new EntityTestAssembler().assemble( config );
+        new OrgJsonValueSerializationAssembler().assemble( module );
+        new JCloudsMapEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble(
module );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/7b006504/extensions/entitystore-jdbm/src/test/java/org/qi4j/entitystore/jdbm/JdbmEntityStoreWithCacheTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-jdbm/src/test/java/org/qi4j/entitystore/jdbm/JdbmEntityStoreWithCacheTest.java
b/extensions/entitystore-jdbm/src/test/java/org/qi4j/entitystore/jdbm/JdbmEntityStoreWithCacheTest.java
new file mode 100644
index 0000000..f5ded45
--- /dev/null
+++ b/extensions/entitystore-jdbm/src/test/java/org/qi4j/entitystore/jdbm/JdbmEntityStoreWithCacheTest.java
@@ -0,0 +1,54 @@
+/*
+ *  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.
+ */
+package org.qi4j.entitystore.jdbm;
+
+import org.junit.Before;
+import org.qi4j.api.common.Visibility;
+import org.qi4j.bootstrap.AssemblyException;
+import org.qi4j.bootstrap.ModuleAssembly;
+import org.qi4j.entitystore.jdbm.assembly.JdbmEntityStoreAssembler;
+import org.qi4j.library.fileconfig.FileConfiguration;
+import org.qi4j.library.fileconfig.FileConfigurationDataWiper;
+import org.qi4j.library.fileconfig.FileConfigurationService;
+import org.qi4j.test.EntityTestAssembler;
+import org.qi4j.test.cache.AbstractEntityStoreWithCacheTest;
+import org.qi4j.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
+
+public class JdbmEntityStoreWithCacheTest
+    extends AbstractEntityStoreWithCacheTest
+{
+    @Before
+    public void testDataCleanup()
+    {
+        FileConfiguration fileConfig = module.findService( FileConfiguration.class ).get();
+        FileConfigurationDataWiper.registerApplicationPassivationDataWiper( fileConfig, application
);
+    }
+
+    @Override
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        super.assemble( module );
+
+        ModuleAssembly config = module.layer().module( "config" );
+        config.services( FileConfigurationService.class ).visibleIn( Visibility.layer ).instantiateOnStartup();
+        new EntityTestAssembler().assemble( config );
+
+        new OrgJsonValueSerializationAssembler().assemble( module );
+        new JdbmEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble( module
);
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/7b006504/extensions/entitystore-leveldb/src/test/java/org/qi4j/entitystore/leveldb/LevelDBEntityStoreWithCacheTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-leveldb/src/test/java/org/qi4j/entitystore/leveldb/LevelDBEntityStoreWithCacheTest.java
b/extensions/entitystore-leveldb/src/test/java/org/qi4j/entitystore/leveldb/LevelDBEntityStoreWithCacheTest.java
new file mode 100644
index 0000000..71b7bdf
--- /dev/null
+++ b/extensions/entitystore-leveldb/src/test/java/org/qi4j/entitystore/leveldb/LevelDBEntityStoreWithCacheTest.java
@@ -0,0 +1,46 @@
+/*
+ *  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.
+ */
+package org.qi4j.entitystore.leveldb;
+
+import org.qi4j.api.common.Visibility;
+import org.qi4j.bootstrap.AssemblyException;
+import org.qi4j.bootstrap.ModuleAssembly;
+import org.qi4j.library.fileconfig.FileConfigurationService;
+import org.qi4j.test.EntityTestAssembler;
+import org.qi4j.test.cache.AbstractEntityStoreWithCacheTest;
+import org.qi4j.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
+
+public class LevelDBEntityStoreWithCacheTest
+    extends AbstractEntityStoreWithCacheTest
+{
+    @Override
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        super.assemble( module );
+        ModuleAssembly config = module.layer().module( "config" );
+        new EntityTestAssembler().visibleIn( Visibility.module ).assemble( config );
+        new OrgJsonValueSerializationAssembler().assemble( module );
+
+        module.services( FileConfigurationService.class );
+
+        new LevelDBEntityStoreAssembler().
+            withConfig( config, Visibility.layer ).
+            identifiedBy( "java-leveldb-entitystore" ).
+            assemble( module );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/7b006504/extensions/entitystore-memory/src/test/java/org/qi4j/entitystore/memory/MemoryEntityStoreWithCacheTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-memory/src/test/java/org/qi4j/entitystore/memory/MemoryEntityStoreWithCacheTest.java
b/extensions/entitystore-memory/src/test/java/org/qi4j/entitystore/memory/MemoryEntityStoreWithCacheTest.java
new file mode 100644
index 0000000..3a1c72c
--- /dev/null
+++ b/extensions/entitystore-memory/src/test/java/org/qi4j/entitystore/memory/MemoryEntityStoreWithCacheTest.java
@@ -0,0 +1,35 @@
+/*
+ *  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.
+ */
+package org.qi4j.entitystore.memory;
+
+import org.qi4j.bootstrap.AssemblyException;
+import org.qi4j.bootstrap.ModuleAssembly;
+import org.qi4j.test.cache.AbstractEntityStoreWithCacheTest;
+import org.qi4j.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
+
+public class MemoryEntityStoreWithCacheTest
+    extends AbstractEntityStoreWithCacheTest
+{
+    @Override
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        super.assemble( module );
+        new OrgJsonValueSerializationAssembler().assemble( module );
+        new MemoryEntityStoreAssembler().assemble( module );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/7b006504/extensions/entitystore-mongodb/src/test/java/org/qi4j/entitystore/mongodb/MongoMapEntityStoreWithCacheTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-mongodb/src/test/java/org/qi4j/entitystore/mongodb/MongoMapEntityStoreWithCacheTest.java
b/extensions/entitystore-mongodb/src/test/java/org/qi4j/entitystore/mongodb/MongoMapEntityStoreWithCacheTest.java
new file mode 100644
index 0000000..7daec24
--- /dev/null
+++ b/extensions/entitystore-mongodb/src/test/java/org/qi4j/entitystore/mongodb/MongoMapEntityStoreWithCacheTest.java
@@ -0,0 +1,83 @@
+/*
+ *  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.
+ */
+package org.qi4j.entitystore.mongodb;
+
+import com.mongodb.Mongo;
+import org.junit.BeforeClass;
+import org.qi4j.api.common.Visibility;
+import org.qi4j.bootstrap.AssemblyException;
+import org.qi4j.bootstrap.ModuleAssembly;
+import org.qi4j.test.EntityTestAssembler;
+import org.qi4j.test.cache.AbstractEntityStoreWithCacheTest;
+import org.qi4j.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
+
+import static org.qi4j.test.util.Assume.assumeConnectivity;
+
+/**
+ * Test the MongoMapEntityStoreService usage with a CachePool.
+ * <p>Installing mongodb and starting it should suffice as the test use mongodb defaults:
127.0.0.1:27017</p>
+ */
+public class MongoMapEntityStoreWithCacheTest
+    extends AbstractEntityStoreWithCacheTest
+{
+    @BeforeClass
+    public static void beforeRedisMapEntityStoreTests()
+    {
+        assumeConnectivity( "localhost", 27017 );
+    }
+
+    @Override
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        super.assemble( module );
+
+        ModuleAssembly config = module.layer().module( "config" );
+        new EntityTestAssembler().assemble( config );
+
+        new OrgJsonValueSerializationAssembler().assemble( module );
+
+        new MongoMapEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble(
module );
+
+        MongoEntityStoreConfiguration mongoConfig = config.forMixin( MongoEntityStoreConfiguration.class
).declareDefaults();
+        mongoConfig.writeConcern().set( MongoEntityStoreConfiguration.WriteConcern.FSYNC_SAFE
);
+        mongoConfig.database().set( "qi4j:test" );
+        mongoConfig.collection().set( "qi4j:test:entities" );
+    }
+
+    private Mongo mongo;
+    private String dbName;
+
+    @Override
+    public void setUp()
+        throws Exception
+    {
+        super.setUp();
+        MongoMapEntityStoreService es = module.findService( MongoMapEntityStoreService.class
).get();
+        mongo = es.mongoInstanceUsed();
+        dbName = es.dbInstanceUsed().getName();
+
+    }
+
+    @Override
+    public void tearDown()
+        throws Exception
+    {
+        mongo.dropDatabase( dbName );
+        super.tearDown();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/7b006504/extensions/entitystore-redis/src/test/java/org/qi4j/entitystore/redis/RedisMapEntityStoreWithCacheTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-redis/src/test/java/org/qi4j/entitystore/redis/RedisMapEntityStoreWithCacheTest.java
b/extensions/entitystore-redis/src/test/java/org/qi4j/entitystore/redis/RedisMapEntityStoreWithCacheTest.java
new file mode 100644
index 0000000..ab15743
--- /dev/null
+++ b/extensions/entitystore-redis/src/test/java/org/qi4j/entitystore/redis/RedisMapEntityStoreWithCacheTest.java
@@ -0,0 +1,78 @@
+/*
+ *  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.
+ */
+package org.qi4j.entitystore.redis;
+
+import org.junit.BeforeClass;
+import org.qi4j.api.common.Visibility;
+import org.qi4j.bootstrap.AssemblyException;
+import org.qi4j.bootstrap.ModuleAssembly;
+import org.qi4j.test.EntityTestAssembler;
+import org.qi4j.test.cache.AbstractEntityStoreWithCacheTest;
+import org.qi4j.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
+import redis.clients.jedis.Jedis;
+import redis.clients.jedis.JedisPool;
+
+import static org.qi4j.test.util.Assume.assumeConnectivity;
+
+public class RedisMapEntityStoreWithCacheTest
+    extends AbstractEntityStoreWithCacheTest
+{
+    @BeforeClass
+    public static void beforeRedisMapEntityStoreTests()
+    {
+        assumeConnectivity( "localhost", 6379 );
+    }
+
+    @Override
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        super.assemble( module );
+        ModuleAssembly config = module.layer().module( "config" );
+        new EntityTestAssembler().assemble( config );
+        new OrgJsonValueSerializationAssembler().assemble( module );
+        new RedisMapEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble(
module );
+    }
+
+    private JedisPool jedisPool;
+
+    @Override
+    public void setUp()
+        throws Exception
+    {
+        super.setUp();
+        RedisMapEntityStoreService es = module.findService( RedisMapEntityStoreService.class
).get();
+        jedisPool = es.jedisPool();
+
+    }
+
+    @Override
+    public void tearDown()
+        throws Exception
+    {
+        Jedis jedis = jedisPool.getResource();
+        try
+        {
+            jedis.flushDB();
+        }
+        finally
+        {
+            jedisPool.returnResource( jedis );
+        }
+        super.tearDown();
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-java/blob/7b006504/extensions/entitystore-riak/src/test/java/org/qi4j/entitystore/riak/RiakMapEntityStoreWithCacheTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-riak/src/test/java/org/qi4j/entitystore/riak/RiakMapEntityStoreWithCacheTest.java
b/extensions/entitystore-riak/src/test/java/org/qi4j/entitystore/riak/RiakMapEntityStoreWithCacheTest.java
new file mode 100644
index 0000000..5a0e6b3
--- /dev/null
+++ b/extensions/entitystore-riak/src/test/java/org/qi4j/entitystore/riak/RiakMapEntityStoreWithCacheTest.java
@@ -0,0 +1,76 @@
+/*
+ *  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.
+ */
+package org.qi4j.entitystore.riak;
+
+import com.basho.riak.client.IRiakClient;
+import com.basho.riak.client.bucket.Bucket;
+import org.junit.BeforeClass;
+import org.qi4j.api.common.Visibility;
+import org.qi4j.bootstrap.AssemblyException;
+import org.qi4j.bootstrap.ModuleAssembly;
+import org.qi4j.test.EntityTestAssembler;
+import org.qi4j.test.cache.AbstractEntityStoreWithCacheTest;
+import org.qi4j.valueserialization.orgjson.OrgJsonValueSerializationAssembler;
+
+import static org.qi4j.test.util.Assume.assumeConnectivity;
+
+public class RiakMapEntityStoreWithCacheTest
+    extends AbstractEntityStoreWithCacheTest
+{
+    @BeforeClass
+    public static void beforeRiakProtobufMapEntityStoreTests()
+    {
+        assumeConnectivity( "localhost", 8087 );
+    }
+
+    @Override
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        super.assemble( module );
+        ModuleAssembly config = module.layer().module( "config" );
+        new EntityTestAssembler().assemble( config );
+        new OrgJsonValueSerializationAssembler().assemble( module );
+        new RiakProtobufMapEntityStoreAssembler().withConfig( config, Visibility.layer ).assemble(
module );
+    }
+
+    private IRiakClient riakClient;
+    private String bucketKey;
+
+    @Override
+    public void setUp()
+        throws Exception
+    {
+        super.setUp();
+        RiakMapEntityStoreService es = module.findService( RiakMapEntityStoreService.class
).get();
+        riakClient = es.riakClient();
+        bucketKey = es.bucket();
+    }
+
+    @Override
+    public void tearDown()
+        throws Exception
+    {
+        // Riak don't expose bucket deletion in its API so we empty the Zest Entities bucket.
+        Bucket bucket = riakClient.fetchBucket( bucketKey ).execute();
+        for( String key : bucket.keys() )
+        {
+            bucket.delete( key ).execute();
+        }
+        super.tearDown();
+    }
+}


Mime
View raw message