use of org.apache.geode.internal.cache.EntryEventImpl.OldValueImporter in project geode by apache.
the class EntryEventImplTest method verifyExportOldValuePrefersOldValueBytes.
@Test
public void verifyExportOldValuePrefersOldValueBytes() {
LocalRegion region = mock(LocalRegion.class);
OldValueImporter ovImporter = mock(OldValueImporter.class);
when(ovImporter.prefersOldSerialized()).thenReturn(true);
EntryEventImpl e = createEntryEvent(region, null);
byte[] oldValueBytes = new byte[] { 1, 2, 3 };
e.setSerializedOldValue(oldValueBytes);
e.exportOldValue(ovImporter);
verify(ovImporter).importOldBytes(oldValueBytes, true);
}
use of org.apache.geode.internal.cache.EntryEventImpl.OldValueImporter in project geode by apache.
the class EntryEventImplTest method verifyExportOldValueWithCacheDeserializableString.
@Test
public void verifyExportOldValueWithCacheDeserializableString() {
LocalRegion region = mock(LocalRegion.class);
CachedDeserializable oldValue = mock(CachedDeserializable.class);
Object oldValueObj = "oldValueObj";
when(oldValue.getValue()).thenReturn(oldValueObj);
OldValueImporter ovImporter = mock(OldValueImporter.class);
EntryEventImpl e = createEntryEvent(region, null);
e.setOldValue(oldValue);
e.exportOldValue(ovImporter);
verify(ovImporter).importOldObject(oldValueObj, true);
}
use of org.apache.geode.internal.cache.EntryEventImpl.OldValueImporter in project geode by apache.
the class EntryEventImplTest method verifyExportOldValueWithByteArray.
@Test
public void verifyExportOldValueWithByteArray() {
LocalRegion region = mock(LocalRegion.class);
byte[] oldValue = new byte[] { 1, 2, 3 };
OldValueImporter ovImporter = mock(OldValueImporter.class);
EntryEventImpl e = createEntryEvent(region, null);
e.setOldValue(oldValue);
e.exportOldValue(ovImporter);
verify(ovImporter).importOldBytes(oldValue, false);
}
use of org.apache.geode.internal.cache.EntryEventImpl.OldValueImporter 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.cache.EntryEventImpl.OldValueImporter 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);
}
Aggregations