fixed EntryEventImplTest
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/254bd193 Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/254bd193 Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/254bd193 Branch: refs/heads/feature/GEODE-1886 Commit: 254bd1935afdfa78dbe811ca732ab155fe11fe81 Parents: b8b627c Author: Darrel Schneider <[email protected]> Authored: Mon Sep 12 17:26:46 2016 -0700 Committer: Darrel Schneider <[email protected]> Committed: Thu Sep 15 13:56:45 2016 -0700 ---------------------------------------------------------------------- .../internal/cache/EntryEventImplTest.java | 31 ++++++++++++++++++++ 1 file changed, 31 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/254bd193/geode-core/src/test/java/org/apache/geode/internal/cache/EntryEventImplTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/EntryEventImplTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/EntryEventImplTest.java index 973787c..cde151f 100644 --- a/geode-core/src/test/java/org/apache/geode/internal/cache/EntryEventImplTest.java +++ b/geode-core/src/test/java/org/apache/geode/internal/cache/EntryEventImplTest.java @@ -48,6 +48,7 @@ public class EntryEventImplTest { public void verifyToStringOutputHasRegionName() { // mock a region object LocalRegion region = mock(LocalRegion.class); + when(region.getAttributes()).thenReturn(region); String expectedRegionName = "ExpectedFullRegionPathName"; String value = "value1"; KeyInfo keyInfo = new KeyInfo(key, value, null); @@ -68,6 +69,8 @@ public class EntryEventImplTest { @Test public void verifyExportNewValueWithUnserializedStoredObject() { LocalRegion region = mock(LocalRegion.class); + when(region.getAttributes()).thenReturn(region); + when(region.getOffHeap()).thenReturn(true); StoredObject newValue = mock(StoredObject.class); byte[] newValueBytes = new byte[]{1,2,3}; when(newValue.getValueAsHeapByteArray()).thenReturn(newValueBytes); @@ -82,6 +85,7 @@ public class EntryEventImplTest { @Test public void verifyExportNewValueWithByteArray() { LocalRegion region = mock(LocalRegion.class); + when(region.getAttributes()).thenReturn(region); byte[] newValue = new byte[]{1,2,3}; NewValueImporter nvImporter = mock(NewValueImporter.class); EntryEventImpl e = createEntryEvent(region, newValue); @@ -94,6 +98,7 @@ public class EntryEventImplTest { @Test public void verifyExportNewValueWithStringIgnoresNewValueBytes() { LocalRegion region = mock(LocalRegion.class); + when(region.getAttributes()).thenReturn(region); String newValue = "newValue"; NewValueImporter nvImporter = mock(NewValueImporter.class); when(nvImporter.prefersNewSerialized()).thenReturn(true); @@ -109,6 +114,7 @@ public class EntryEventImplTest { @Test public void verifyExportNewValueWithByteArrayCachedDeserializable() { LocalRegion region = mock(LocalRegion.class); + when(region.getAttributes()).thenReturn(region); CachedDeserializable newValue = mock(CachedDeserializable.class); byte[] newValueBytes = new byte[] {1,2,3}; when(newValue.getValue()).thenReturn(newValueBytes); @@ -123,6 +129,7 @@ public class EntryEventImplTest { @Test public void verifyExportNewValueWithStringCachedDeserializable() { LocalRegion region = mock(LocalRegion.class); + when(region.getAttributes()).thenReturn(region); CachedDeserializable newValue = mock(CachedDeserializable.class); Object newValueObj = "newValueObj"; when(newValue.getValue()).thenReturn(newValueObj); @@ -140,6 +147,7 @@ public class EntryEventImplTest { @Test public void verifyExportNewValueWithStringCachedDeserializablePrefersNewValueBytes() { LocalRegion region = mock(LocalRegion.class); + when(region.getAttributes()).thenReturn(region); CachedDeserializable newValue = mock(CachedDeserializable.class); Object newValueObj = "newValueObj"; when(newValue.getValue()).thenReturn(newValueObj); @@ -157,6 +165,7 @@ public class EntryEventImplTest { @Test public void verifyExportNewValueWithStringCachedDeserializablePrefersCachedSerializedNewValue() { LocalRegion region = mock(LocalRegion.class); + when(region.getAttributes()).thenReturn(region); CachedDeserializable newValue = mock(CachedDeserializable.class); Object newValueObj = "newValueObj"; when(newValue.getValue()).thenReturn(newValueObj); @@ -174,6 +183,8 @@ public class EntryEventImplTest { @Test public void verifyExportNewValueWithSerializedStoredObjectAndImporterPrefersSerialized() { LocalRegion region = mock(LocalRegion.class); + when(region.getAttributes()).thenReturn(region); + when(region.getOffHeap()).thenReturn(true); StoredObject newValue = mock(StoredObject.class); when(newValue.isSerialized()).thenReturn(true); byte[] newValueBytes = new byte[]{1,2,3}; @@ -190,6 +201,8 @@ public class EntryEventImplTest { @Test public void verifyExportNewValueWithSerializedStoredObject() { LocalRegion region = mock(LocalRegion.class); + when(region.getAttributes()).thenReturn(region); + when(region.getOffHeap()).thenReturn(true); StoredObject newValue = mock(StoredObject.class); when(newValue.isSerialized()).thenReturn(true); Object newValueDeserialized = "newValueDeserialized"; @@ -205,6 +218,8 @@ public class EntryEventImplTest { @Test public void verifyExportNewValueWithSerializedStoredObjectAndUnretainedNewReferenceOk() { LocalRegion region = mock(LocalRegion.class); + when(region.getAttributes()).thenReturn(region); + when(region.getOffHeap()).thenReturn(true); StoredObject newValue = mock(StoredObject.class); when(newValue.isSerialized()).thenReturn(true); Object newValueDeserialized = "newValueDeserialized"; @@ -221,6 +236,8 @@ public class EntryEventImplTest { @Test public void verifyExportOldValueWithUnserializedStoredObject() { LocalRegion region = mock(LocalRegion.class); + when(region.getAttributes()).thenReturn(region); + when(region.getOffHeap()).thenReturn(true); StoredObject oldValue = mock(StoredObject.class); byte[] oldValueBytes = new byte[]{1,2,3}; when(oldValue.getValueAsHeapByteArray()).thenReturn(oldValueBytes); @@ -236,6 +253,7 @@ public class EntryEventImplTest { @Test public void verifyExportOldValueWithByteArray() { LocalRegion region = mock(LocalRegion.class); + when(region.getAttributes()).thenReturn(region); byte[] oldValue = new byte[]{1,2,3}; OldValueImporter ovImporter = mock(OldValueImporter.class); EntryEventImpl e = createEntryEvent(region, null); @@ -249,6 +267,7 @@ public class EntryEventImplTest { @Test public void verifyExportOldValueWithStringIgnoresOldValueBytes() { LocalRegion region = mock(LocalRegion.class); + when(region.getAttributes()).thenReturn(region); String oldValue = "oldValue"; OldValueImporter ovImporter = mock(OldValueImporter.class); when(ovImporter.prefersOldSerialized()).thenReturn(true); @@ -265,6 +284,7 @@ public class EntryEventImplTest { @Test public void verifyExportOldValuePrefersOldValueBytes() { LocalRegion region = mock(LocalRegion.class); + when(region.getAttributes()).thenReturn(region); OldValueImporter ovImporter = mock(OldValueImporter.class); when(ovImporter.prefersOldSerialized()).thenReturn(true); EntryEventImpl e = createEntryEvent(region, null); @@ -279,6 +299,7 @@ public class EntryEventImplTest { @Test public void verifyExportOldValueWithCacheDeserializableByteArray() { LocalRegion region = mock(LocalRegion.class); + when(region.getAttributes()).thenReturn(region); CachedDeserializable oldValue = mock(CachedDeserializable.class); byte[] oldValueBytes = new byte[]{1,2,3}; when(oldValue.getValue()).thenReturn(oldValueBytes); @@ -294,6 +315,7 @@ public class EntryEventImplTest { @Test public void verifyExportOldValueWithCacheDeserializableString() { LocalRegion region = mock(LocalRegion.class); + when(region.getAttributes()).thenReturn(region); CachedDeserializable oldValue = mock(CachedDeserializable.class); Object oldValueObj = "oldValueObj"; when(oldValue.getValue()).thenReturn(oldValueObj); @@ -309,6 +331,7 @@ public class EntryEventImplTest { @Test public void verifyExportOldValueWithCacheDeserializableOk() { LocalRegion region = mock(LocalRegion.class); + when(region.getAttributes()).thenReturn(region); CachedDeserializable oldValue = mock(CachedDeserializable.class); Object oldValueObj = "oldValueObj"; when(oldValue.getValue()).thenReturn(oldValueObj); @@ -325,6 +348,8 @@ public class EntryEventImplTest { @Test public void verifyExportOldValueWithSerializedStoredObjectAndImporterPrefersSerialized() { LocalRegion region = mock(LocalRegion.class); + when(region.getAttributes()).thenReturn(region); + when(region.getOffHeap()).thenReturn(true); StoredObject oldValue = mock(StoredObject.class); when(oldValue.isSerialized()).thenReturn(true); byte[] oldValueBytes = new byte[]{1,2,3}; @@ -342,6 +367,8 @@ public class EntryEventImplTest { @Test public void verifyExportOldValueWithSerializedStoredObject() { LocalRegion region = mock(LocalRegion.class); + when(region.getAttributes()).thenReturn(region); + when(region.getOffHeap()).thenReturn(true); StoredObject oldValue = mock(StoredObject.class); when(oldValue.isSerialized()).thenReturn(true); Object oldValueDeserialized = "newValueDeserialized"; @@ -358,6 +385,8 @@ public class EntryEventImplTest { @Test public void verifyExportOldValueWithSerializedStoredObjectAndUnretainedOldReferenceOk() { LocalRegion region = mock(LocalRegion.class); + when(region.getAttributes()).thenReturn(region); + when(region.getOffHeap()).thenReturn(true); StoredObject oldValue = mock(StoredObject.class); when(oldValue.isSerialized()).thenReturn(true); Object oldValueDeserialized = "oldValueDeserialized"; @@ -375,6 +404,8 @@ public class EntryEventImplTest { @Test public void verifyExternalReadMethodsBlockedByRelease() throws InterruptedException { LocalRegion region = mock(LocalRegion.class); + when(region.getAttributes()).thenReturn(region); + when(region.getOffHeap()).thenReturn(true); StoredObject newValue = mock(StoredObject.class); when(newValue.hasRefCount()).thenReturn(true); when(newValue.isSerialized()).thenReturn(true);
