You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ds...@apache.org on 2016/09/13 00:28:13 UTC
incubator-geode git commit: fixed EntryEventImplTest
Repository: incubator-geode
Updated Branches:
refs/heads/feature/GEODE-1886 d81ba2eb1 -> d374e25ea
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/d374e25e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/d374e25e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/d374e25e
Branch: refs/heads/feature/GEODE-1886
Commit: d374e25ea6562a017db99baa25332a505d279c33
Parents: d81ba2e
Author: Darrel Schneider <ds...@pivotal.io>
Authored: Mon Sep 12 17:26:46 2016 -0700
Committer: Darrel Schneider <ds...@pivotal.io>
Committed: Mon Sep 12 17:26:46 2016 -0700
----------------------------------------------------------------------
.../internal/cache/EntryEventImplTest.java | 31 ++++++++++++++++++++
1 file changed, 31 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d374e25e/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/EntryEventImplTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/EntryEventImplTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/EntryEventImplTest.java
index bc8a64e..df53f3a 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/EntryEventImplTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/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);