From b4ef4dbd550d28d6bc29e6ecde60dc7bd85cb736 Mon Sep 17 00:00:00 2001 From: Nikita Date: Thu, 18 Jan 2018 11:03:42 +0300 Subject: [PATCH] Useless RedissonConcurrentMapTest removed --- .../redisson/RedissonConcurrentMapTest.java | 177 ------------------ 1 file changed, 177 deletions(-) delete mode 100644 redisson/src/test/java/org/redisson/RedissonConcurrentMapTest.java diff --git a/redisson/src/test/java/org/redisson/RedissonConcurrentMapTest.java b/redisson/src/test/java/org/redisson/RedissonConcurrentMapTest.java deleted file mode 100644 index a94b51cb6..000000000 --- a/redisson/src/test/java/org/redisson/RedissonConcurrentMapTest.java +++ /dev/null @@ -1,177 +0,0 @@ -package org.redisson; - -import java.security.SecureRandom; -import java.util.Map; -import java.util.concurrent.ConcurrentMap; - -import org.junit.Assert; -import org.junit.Test; - -public class RedissonConcurrentMapTest extends BaseConcurrentTest { - - @Test - public void testSingleReplaceOldValue_SingleInstance() throws InterruptedException { - final String name = "testSingleReplaceOldValue_SingleInstance"; - - ConcurrentMap map = BaseTest.createInstance().getMap(name); - map.put("1", "122"); - - testSingleInstanceConcurrency(100, r -> { - ConcurrentMap map1 = r.getMap(name); - map1.replace("1", "122", "32"); - map1.replace("1", "0", "31"); - }); - - ConcurrentMap testMap = BaseTest.createInstance().getMap(name); - Assert.assertEquals("32", testMap.get("1")); - - assertMapSize(1, name); - } - - @Test - public void testSingleRemoveValue_SingleInstance() throws InterruptedException { - final String name = "testSingleRemoveValue_SingleInstance"; - - ConcurrentMap map = BaseTest.createInstance().getMap(name); - map.putIfAbsent("1", "0"); - testSingleInstanceConcurrency(100, r -> { - ConcurrentMap map1 = r.getMap(name); - map1.remove("1", "0"); - }); - - assertMapSize(0, name); - } - - @Test - public void testSingleReplace_SingleInstance() throws InterruptedException { - final String name = "testSingleReplace_SingleInstance"; - - ConcurrentMap map = BaseTest.createInstance().getMap(name); - map.put("1", "0"); - - testSingleInstanceConcurrency(100, r -> { - ConcurrentMap map1 = r.getMap(name); - map1.replace("1", "3"); - }); - - ConcurrentMap testMap = BaseTest.createInstance().getMap(name); - Assert.assertEquals("3", testMap.get("1")); - - assertMapSize(1, name); - } - - @Test - public void test_Multi_Replace_MultiInstance() throws InterruptedException { - final String name = "test_Multi_Replace_MultiInstance"; - - ConcurrentMap map = BaseTest.createInstance().getMap(name); - for (int i = 0; i < 5; i++) { - map.put(i, 1); - } - - final SecureRandom secureRandom = new SecureRandom(); - testSingleInstanceConcurrency(100, r -> { - ConcurrentMap map1 = r.getMap(name); - Assert.assertNotNull(map1.replace(secureRandom.nextInt(5), 2)); - }); - - ConcurrentMap testMap = BaseTest.createInstance().getMap(name); - for (Integer value : testMap.values()) { - Assert.assertEquals(2, (int)value); - } - assertMapSize(5, name); - - } - - @Test - public void test_Multi_RemoveValue_MultiInstance() throws InterruptedException { - final String name = "test_Multi_RemoveValue_MultiInstance"; - - ConcurrentMap map = BaseTest.createInstance().getMap(name); - for (int i = 0; i < 10; i++) { - map.put(i, 1); - } - - final SecureRandom secureRandom = new SecureRandom(); - testMultiInstanceConcurrency(100, r -> { - ConcurrentMap map1 = r.getMap(name); - map1.remove(secureRandom.nextInt(10), 1); - }); - - assertMapSize(0, name); - } - - @Test - public void testSinglePutIfAbsent_SingleInstance() throws InterruptedException { - final String name = "testSinglePutIfAbsent_SingleInstance"; - - ConcurrentMap map = BaseTest.createInstance().getMap(name); - map.putIfAbsent("1", "0"); - testSingleInstanceConcurrency(100, r -> { - ConcurrentMap map1 = r.getMap(name); - map1.putIfAbsent("1", "1"); - }); - - ConcurrentMap testMap = BaseTest.createInstance().getMap(name); - Assert.assertEquals("0", testMap.get("1")); - - assertMapSize(1, name); - } - - @Test - public void testMultiPutIfAbsent_SingleInstance() throws InterruptedException { - final String name = "testMultiPutIfAbsent_SingleInstance"; - testSingleInstanceConcurrency(100, r -> { - ConcurrentMap map = r.getMap(name); - map.putIfAbsent("" + Math.random(), "1"); - }); - - assertMapSize(100, name); - } - - @Test - public void testMultiPutIfAbsent_MultiInstance() throws InterruptedException { - final String name = "testMultiPutIfAbsent_MultiInstance"; - testMultiInstanceConcurrency(100, r -> { - ConcurrentMap map = r.getMap(name); - map.putIfAbsent("" + Math.random(), "1"); - }); - - assertMapSize(100, name); - } - - private void assertMapSize(int size, String name) { - Map map = BaseTest.createInstance().getMap(name); - Assert.assertEquals(size, map.size()); - clear(map); - } - - @Test - public void testMultiPut_SingleInstance() throws InterruptedException { - final String name = "testMultiPut_SingleInstance"; - testSingleInstanceConcurrency(100, r -> { - Map map = r.getMap(name); - map.put("" + Math.random(), "1"); - }); - - assertMapSize(100, name); - } - - - @Test - public void testMultiPut_MultiInstance() throws InterruptedException { - final String name = "testMultiPut_MultiInstance"; - testMultiInstanceConcurrency(100, r -> { - ConcurrentMap map = r.getMap(name); - map.putIfAbsent("" + Math.random(), "1"); - }); - - assertMapSize(100, name); - } - - private void clear(Map map) { - map.clear(); - Assert.assertEquals(0, map.size()); - } - -}