From d8735d25aae8c51255459099799d626ca31eeb39 Mon Sep 17 00:00:00 2001 From: Jan Srnicek Date: Wed, 31 Aug 2016 08:36:24 +0200 Subject: HONEYCOMB-144 - Make dump cache manager thread-save Modified to be thread save and generic to be usable in all plugins Change-Id: I26c90e8c8aa13c07fa389d86a9784e92e9532bcd Signed-off-by: Jan Srnicek --- .../translate/v3po/util/cache/DumpCacheManagerTest.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/v3po') diff --git a/vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/v3po/util/cache/DumpCacheManagerTest.java b/vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/v3po/util/cache/DumpCacheManagerTest.java index 21b3646c4..456744f86 100644 --- a/vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/v3po/util/cache/DumpCacheManagerTest.java +++ b/vpp-common/vpp-translate-utils/src/test/java/io/fd/honeycomb/translate/v3po/util/cache/DumpCacheManagerTest.java @@ -20,9 +20,9 @@ import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.when; import com.google.common.base.Optional; +import io.fd.honeycomb.translate.ModificationCache; import io.fd.honeycomb.translate.v3po.util.cache.exceptions.check.i.DumpEmptyException; import io.fd.honeycomb.translate.v3po.util.cache.exceptions.execution.DumpExecutionFailedException; -import io.fd.honeycomb.translate.ModificationCache; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; @@ -73,7 +73,7 @@ public class DumpCacheManagerTest { public void testCaching() throws DumpExecutionFailedException { - Optional stage1Optional = managerNegative.getDump(KEY, cache); + Optional stage1Optional = managerNegative.getDump(KEY, cache, null); //this is first call so instance should be from executor assertEquals(false, stage1Optional.isPresent()); @@ -81,18 +81,18 @@ public class DumpCacheManagerTest { //rebind executor with other data IpDetailsReplyDump stage2LoadedDump = new IpDetailsReplyDump(); - when(executor.executeDump()).thenReturn(stage2LoadedDump); + when(executor.executeDump(null)).thenReturn(stage2LoadedDump); - Optional stage2Optional = managerPositive.getDump(KEY, cache); + Optional stage2Optional = managerPositive.getDump(KEY, cache, null); assertEquals(true, stage2Optional.isPresent()); assertEquals(stage2LoadedDump, stage2Optional.get()); //rebind executor with other data IpDetailsReplyDump stage3LoadedDump = new IpDetailsReplyDump(); - when(executor.executeDump()).thenReturn(stage3LoadedDump); + when(executor.executeDump(null)).thenReturn(stage3LoadedDump); - Optional stage3Optional = managerPositive.getDump(KEY, cache); + Optional stage3Optional = managerPositive.getDump(KEY, cache, null); assertEquals(true, stage3Optional.isPresent()); //check if it returns instance cached from previous stage assertEquals(stage2LoadedDump, stage3Optional.get()); @@ -105,9 +105,9 @@ public class DumpCacheManagerTest { details.swIfIndex = 2; dump.ipDetails.add(details); - when(executor.executeDump()).thenReturn(dump); + when(executor.executeDump(null)).thenReturn(dump); - Optional optionalDump = managerPositiveWithPostProcessing.getDump(KEY, cache); + Optional optionalDump = managerPositiveWithPostProcessing.getDump(KEY, cache, null); assertEquals(true, optionalDump.isPresent()); assertEquals(1, optionalDump.get().ipDetails.size()); -- cgit 1.2.3-korg