use of org.apache.geode.internal.cache.InternalCacheEvent in project geode by apache.
the class DestroyMessageTest method shouldBeMockable.
@Test
public void shouldBeMockable() throws Exception {
DestroyMessage mockDestroyMessageX = mock(DestroyMessage.class);
InternalCacheEvent mockInternalCacheEvent = mock(InternalCacheEvent.class);
DistributedRegion mockDistributedRegion = mock(DistributedRegion.class);
when(mockDestroyMessageX.createEvent(eq(mockDistributedRegion))).thenReturn(mockInternalCacheEvent);
assertThat(mockDestroyMessageX.createEvent(mockDistributedRegion)).isSameAs(mockInternalCacheEvent);
}
use of org.apache.geode.internal.cache.InternalCacheEvent in project geode by apache.
the class EventIDVerificationInP2PDUnitTest method createServerCache.
public static void createServerCache(Integer type) throws Exception {
new EventIDVerificationInP2PDUnitTest().createCache(new Properties());
AttributesFactory factory = new AttributesFactory();
if (type.intValue() == DISTRIBUTED_ACK)
factory.setScope(Scope.DISTRIBUTED_ACK);
if (type.intValue() == GLOBAL)
factory.setScope(Scope.GLOBAL);
else
factory.setScope(Scope.DISTRIBUTED_NO_ACK);
factory.setDataPolicy(DataPolicy.REPLICATE);
factory.addCacheListener(new CacheListenerAdapter() {
public void afterCreate(EntryEvent event) {
eventId = ((InternalCacheEvent) event).getEventId();
if (receiver) {
synchronized (EventIDVerificationInP2PDUnitTest.class) {
gotCallback = true;
EventIDVerificationInP2PDUnitTest.class.notify();
}
}
}
public void afterUpdate(EntryEvent event) {
eventId = ((InternalCacheEvent) event).getEventId();
if (receiver) {
synchronized (EventIDVerificationInP2PDUnitTest.class) {
gotCallback = true;
EventIDVerificationInP2PDUnitTest.class.notify();
}
}
}
public void afterDestroy(EntryEvent event) {
eventId = ((InternalCacheEvent) event).getEventId();
if (receiver) {
synchronized (EventIDVerificationInP2PDUnitTest.class) {
gotCallback = true;
EventIDVerificationInP2PDUnitTest.class.notify();
}
}
}
public void afterRegionDestroy(RegionEvent event) {
eventId = ((InternalCacheEvent) event).getEventId();
if (receiver) {
synchronized (EventIDVerificationInP2PDUnitTest.class) {
gotCallback = true;
EventIDVerificationInP2PDUnitTest.class.notify();
}
}
}
public void afterRegionInvalidate(RegionEvent event) {
eventId = ((InternalCacheEvent) event).getEventId();
if (receiver) {
synchronized (EventIDVerificationInP2PDUnitTest.class) {
gotCallback = true;
EventIDVerificationInP2PDUnitTest.class.notify();
}
}
}
});
RegionAttributes attrs = factory.create();
cache.createRegion(REGION_NAME, attrs);
}
Aggregations