use of org.apache.geode.internal.cache.EntryEventImpl.NewValueImporter in project geode by apache.
the class EntryEventImplTest method verifyExportNewValueWithStringCachedDeserializablePrefersNewValueBytes.
@Test
public void verifyExportNewValueWithStringCachedDeserializablePrefersNewValueBytes() {
LocalRegion region = mock(LocalRegion.class);
CachedDeserializable newValue = mock(CachedDeserializable.class);
Object newValueObj = "newValueObj";
when(newValue.getValue()).thenReturn(newValueObj);
NewValueImporter nvImporter = mock(NewValueImporter.class);
when(nvImporter.prefersNewSerialized()).thenReturn(true);
EntryEventImpl e = createEntryEvent(region, newValue);
byte[] newValueBytes = new byte[] { 1, 2 };
e.newValueBytes = newValueBytes;
e.exportNewValue(nvImporter);
verify(nvImporter).importNewBytes(newValueBytes, true);
}
use of org.apache.geode.internal.cache.EntryEventImpl.NewValueImporter in project geode by apache.
the class EntryEventImplTest method verifyExportNewValueWithStringCachedDeserializable.
@Test
public void verifyExportNewValueWithStringCachedDeserializable() {
LocalRegion region = mock(LocalRegion.class);
CachedDeserializable newValue = mock(CachedDeserializable.class);
Object newValueObj = "newValueObj";
when(newValue.getValue()).thenReturn(newValueObj);
NewValueImporter nvImporter = mock(NewValueImporter.class);
EntryEventImpl e = createEntryEvent(region, newValue);
byte[] newValueBytes = new byte[] { 1, 2 };
e.newValueBytes = newValueBytes;
e.setCachedSerializedNewValue(newValueBytes);
e.exportNewValue(nvImporter);
verify(nvImporter).importNewObject(newValueObj, true);
}
use of org.apache.geode.internal.cache.EntryEventImpl.NewValueImporter in project geode by apache.
the class EntryEventImplTest method verifyExportNewValueWithStringCachedDeserializablePrefersCachedSerializedNewValue.
@Test
public void verifyExportNewValueWithStringCachedDeserializablePrefersCachedSerializedNewValue() {
LocalRegion region = mock(LocalRegion.class);
CachedDeserializable newValue = mock(CachedDeserializable.class);
Object newValueObj = "newValueObj";
when(newValue.getValue()).thenReturn(newValueObj);
NewValueImporter nvImporter = mock(NewValueImporter.class);
when(nvImporter.prefersNewSerialized()).thenReturn(true);
EntryEventImpl e = createEntryEvent(region, newValue);
byte[] newValueBytes = new byte[] { 1, 2 };
e.setCachedSerializedNewValue(newValueBytes);
e.exportNewValue(nvImporter);
verify(nvImporter).importNewBytes(newValueBytes, true);
}
use of org.apache.geode.internal.cache.EntryEventImpl.NewValueImporter in project geode by apache.
the class EntryEventImplTest method verifyExportNewValueWithSerializedStoredObject.
@Test
public void verifyExportNewValueWithSerializedStoredObject() {
LocalRegion region = mock(LocalRegion.class);
when(region.getOffHeap()).thenReturn(true);
StoredObject newValue = mock(StoredObject.class);
when(newValue.isSerialized()).thenReturn(true);
Object newValueDeserialized = "newValueDeserialized";
when(newValue.getValueAsDeserializedHeapObject()).thenReturn(newValueDeserialized);
NewValueImporter nvImporter = mock(NewValueImporter.class);
EntryEventImpl e = createEntryEvent(region, newValue);
e.exportNewValue(nvImporter);
verify(nvImporter).importNewObject(newValueDeserialized, true);
}
use of org.apache.geode.internal.cache.EntryEventImpl.NewValueImporter in project geode by apache.
the class EntryEventImplTest method verifyExportNewValueWithByteArrayCachedDeserializable.
@Test
public void verifyExportNewValueWithByteArrayCachedDeserializable() {
LocalRegion region = mock(LocalRegion.class);
CachedDeserializable newValue = mock(CachedDeserializable.class);
byte[] newValueBytes = new byte[] { 1, 2, 3 };
when(newValue.getValue()).thenReturn(newValueBytes);
NewValueImporter nvImporter = mock(NewValueImporter.class);
EntryEventImpl e = createEntryEvent(region, newValue);
e.exportNewValue(nvImporter);
verify(nvImporter).importNewBytes(newValueBytes, true);
}
Aggregations