use of org.apache.geode.internal.offheap.StoredObject 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.offheap.StoredObject in project geode by apache.
the class EntryEventImplTest method verifyExportOldValueWithSerializedStoredObject.
@Test
public void verifyExportOldValueWithSerializedStoredObject() {
LocalRegion region = mock(LocalRegion.class);
when(region.getOffHeap()).thenReturn(true);
StoredObject oldValue = mock(StoredObject.class);
when(oldValue.isSerialized()).thenReturn(true);
Object oldValueDeserialized = "newValueDeserialized";
when(oldValue.getValueAsDeserializedHeapObject()).thenReturn(oldValueDeserialized);
OldValueImporter ovImporter = mock(OldValueImporter.class);
EntryEventImpl e = createEntryEvent(region, null);
e.setOldValue(oldValue);
e.exportOldValue(ovImporter);
verify(ovImporter).importOldObject(oldValueDeserialized, true);
}
use of org.apache.geode.internal.offheap.StoredObject in project geode by apache.
the class EntryEventImplTest method verifyExportOldValueWithUnserializedStoredObject.
@Test
public void verifyExportOldValueWithUnserializedStoredObject() {
LocalRegion region = mock(LocalRegion.class);
when(region.getOffHeap()).thenReturn(true);
StoredObject oldValue = mock(StoredObject.class);
byte[] oldValueBytes = new byte[] { 1, 2, 3 };
when(oldValue.getValueAsHeapByteArray()).thenReturn(oldValueBytes);
OldValueImporter ovImporter = mock(OldValueImporter.class);
EntryEventImpl e = createEntryEvent(region, null);
e.setOldValue(oldValue);
e.exportOldValue(ovImporter);
verify(ovImporter).importOldBytes(oldValueBytes, false);
}
use of org.apache.geode.internal.offheap.StoredObject 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