use of org.apache.geode.internal.cache.EntryEventImpl.NewValueImporter in project geode by apache.
the class EntryEventImplTest method verifyExportNewValueWithByteArray.
@Test
public void verifyExportNewValueWithByteArray() {
LocalRegion region = mock(LocalRegion.class);
byte[] newValue = new byte[] { 1, 2, 3 };
NewValueImporter nvImporter = mock(NewValueImporter.class);
EntryEventImpl e = createEntryEvent(region, newValue);
e.exportNewValue(nvImporter);
verify(nvImporter).importNewBytes(newValue, false);
}
use of org.apache.geode.internal.cache.EntryEventImpl.NewValueImporter in project geode by apache.
the class EntryEventImplTest method verifyExportNewValueWithUnserializedStoredObject.
@Test
public void verifyExportNewValueWithUnserializedStoredObject() {
LocalRegion region = mock(LocalRegion.class);
when(region.getOffHeap()).thenReturn(true);
StoredObject newValue = mock(StoredObject.class);
byte[] newValueBytes = new byte[] { 1, 2, 3 };
when(newValue.getValueAsHeapByteArray()).thenReturn(newValueBytes);
NewValueImporter nvImporter = mock(NewValueImporter.class);
EntryEventImpl e = createEntryEvent(region, newValue);
e.exportNewValue(nvImporter);
verify(nvImporter).importNewBytes(newValueBytes, false);
}
use of org.apache.geode.internal.cache.EntryEventImpl.NewValueImporter in project geode by apache.
the class EntryEventImplTest method verifyExportNewValueWithStringIgnoresNewValueBytes.
@Test
public void verifyExportNewValueWithStringIgnoresNewValueBytes() {
LocalRegion region = mock(LocalRegion.class);
String newValue = "newValue";
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).importNewObject(newValue, true);
}
use of org.apache.geode.internal.cache.EntryEventImpl.NewValueImporter in project geode by apache.
the class EntryEventImplTest method verifyExportNewValueWithSerializedStoredObjectAndImporterPrefersSerialized.
@Test
public void verifyExportNewValueWithSerializedStoredObjectAndImporterPrefersSerialized() {
LocalRegion region = mock(LocalRegion.class);
when(region.getOffHeap()).thenReturn(true);
StoredObject newValue = mock(StoredObject.class);
when(newValue.isSerialized()).thenReturn(true);
byte[] newValueBytes = new byte[] { 1, 2, 3 };
when(newValue.getValueAsHeapByteArray()).thenReturn(newValueBytes);
NewValueImporter nvImporter = mock(NewValueImporter.class);
when(nvImporter.prefersNewSerialized()).thenReturn(true);
EntryEventImpl e = createEntryEvent(region, newValue);
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 verifyExportNewValueWithSerializedStoredObjectAndUnretainedNewReferenceOk.
@Test
public void verifyExportNewValueWithSerializedStoredObjectAndUnretainedNewReferenceOk() {
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);
when(nvImporter.isUnretainedNewReferenceOk()).thenReturn(true);
EntryEventImpl e = createEntryEvent(region, newValue);
e.exportNewValue(nvImporter);
verify(nvImporter).importNewObject(newValue, true);
}
Aggregations