use of org.apache.geode.internal.cache.EntryEventImpl.OldValueImporter in project geode by apache.
the class EntryEventImplTest method verifyExportOldValueWithSerializedStoredObjectAndImporterPrefersSerialized.
@Test
public void verifyExportOldValueWithSerializedStoredObjectAndImporterPrefersSerialized() {
LocalRegion region = mock(LocalRegion.class);
when(region.getOffHeap()).thenReturn(true);
StoredObject oldValue = mock(StoredObject.class);
when(oldValue.isSerialized()).thenReturn(true);
byte[] oldValueBytes = new byte[] { 1, 2, 3 };
when(oldValue.getValueAsHeapByteArray()).thenReturn(oldValueBytes);
OldValueImporter ovImporter = mock(OldValueImporter.class);
when(ovImporter.prefersOldSerialized()).thenReturn(true);
EntryEventImpl e = createEntryEvent(region, null);
e.setOldValue(oldValue);
e.exportOldValue(ovImporter);
verify(ovImporter).importOldBytes(oldValueBytes, true);
}
Aggregations