From cc0fa31feb304e7f412e06502ce829760c76dbd8 Mon Sep 17 00:00:00 2001 From: Huqing Yan Date: Mon, 9 Jan 2023 14:07:52 +0800 Subject: [PATCH] Delete DefaultLayedCachePoolTest.java --- .../dble/cache/DefaultLayedCachePoolTest.java | 63 ------------------- 1 file changed, 63 deletions(-) delete mode 100644 src/test/java/com/actiontech/dble/cache/DefaultLayedCachePoolTest.java diff --git a/src/test/java/com/actiontech/dble/cache/DefaultLayedCachePoolTest.java b/src/test/java/com/actiontech/dble/cache/DefaultLayedCachePoolTest.java deleted file mode 100644 index 7d26c400e..000000000 --- a/src/test/java/com/actiontech/dble/cache/DefaultLayedCachePoolTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* -* Copyright (C) 2016-2022 ActionTech. -* based on code by MyCATCopyrightHolder Copyright (c) 2013, OpenCloudDB/MyCAT. -* License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher. -*/ -package com.actiontech.dble.cache; - -import com.actiontech.dble.cache.impl.EnchachePoolFactory; -import org.junit.Assert; -import org.junit.Test; - -public class DefaultLayedCachePoolTest { - - private static DefaultLayedCachePool layedCachePool; - - static { - - layedCachePool = new DefaultLayedCachePool("defaultLayedPool", new EnchachePoolFactory(), 1000, 1); - - } - - @Test - public void testBasic() { - layedCachePool.putIfAbsent("2", "dn2"); - layedCachePool.putIfAbsent("1", "dn1"); - - layedCachePool.putIfAbsent("company", 1, "dn1"); - layedCachePool.putIfAbsent("company", 2, "dn2"); - - layedCachePool.putIfAbsent("goods", "1", "dn1"); - layedCachePool.putIfAbsent("goods", "2", "dn2"); - - Assert.assertEquals("dn2", layedCachePool.get("2")); - Assert.assertEquals("dn1", layedCachePool.get("1")); - Assert.assertEquals(null, layedCachePool.get("3")); - - Assert.assertEquals("dn1", layedCachePool.get("company", 1)); - Assert.assertEquals("dn2", layedCachePool.get("company", 2)); - Assert.assertEquals(null, layedCachePool.get("company", 3)); - - Assert.assertEquals("dn1", layedCachePool.get("goods", "1")); - Assert.assertEquals("dn2", layedCachePool.get("goods", "2")); - Assert.assertEquals(null, layedCachePool.get("goods", 3)); - CacheStatic statics = layedCachePool.getCacheStatic(); - Assert.assertEquals(statics.getItemSize(), 6); - Assert.assertEquals(statics.getPutTimes(), 6); - Assert.assertEquals(statics.getAccessTimes(), 9); - Assert.assertEquals(statics.getHitTimes(), 6); - Assert.assertTrue(statics.getLastAccessTime() > 0); - Assert.assertTrue(statics.getLastPutTime() > 0); - Assert.assertTrue(statics.getLastAccessTime() > 0); - // wait expire - try { - Thread.sleep(2000); - } catch (InterruptedException e) { - } - Assert.assertEquals(null, layedCachePool.get("2")); - Assert.assertEquals(null, layedCachePool.get("1")); - Assert.assertEquals(null, layedCachePool.get("goods", "2")); - Assert.assertEquals(null, layedCachePool.get("company", 2)); - } - -} \ No newline at end of file