HARegionQueue implements RegionQueue { List<EventID> getGIIEvents() { List<EventID> events = new LinkedList<>(); for (long i = positionBeforeGII; i < positionAfterGII + 1; i++) { Map.Entry<?, ?> entry = region.getEntry(i); if (entry != null && entry.getValue() instanceof HAEventWrapper) { HAEventWrapper wrapper = (HAEventWrapper) entry.getValue(); events.add(wrapper.getEventId()); } } return events; } protected  HARegionQueue(String regionName, InternalCache cache, Map haContainer,
      ClientProxyMembershipID clientProxyId, final byte clientConflation, boolean isPrimary,
      StatisticsClock statisticsClock); @VisibleForTesting  HARegionQueue(String regionName, HARegion haRegion, InternalCache cache, Map haContainer,
      ClientProxyMembershipID clientProxyId, final byte clientConflation, boolean isPrimary,
      HARegionQueueStats stats, StoppableReentrantReadWriteLock giiLock,
      StoppableReentrantReadWriteLock rwLock, CancelCriterion cancelCriterion,
      boolean puttingGIIDataInQueue, StatisticsClock statisticsClock); static String createRegionName(String regionName); boolean isQueueInitializedWithWait(long waitTime); @SuppressWarnings("synthetic-access") void recordEventState(InternalDistributedMember sender, Map eventState); @Override boolean put(Object object); void startGiiQueueing(); void endGiiQueueing(); Map getEventMapForGII(); static synchronized void stopHAServices(); static int getMessageSyncInterval(); static void setMessageSyncInterval(int seconds); boolean destroyFromAvailableIDs(Long position); @Override String toString(); @Override HARegion getRegion(); @Override Object take(); @Override List take(int batchSize); @Override void remove(); @Override Object peek(); @Override List peek(int batchSize); @Override List peek(int batchSize, int timeToWait); @Override void addCacheListener(CacheListener listener); @Override void removeCacheListener(); void addDispatchedMessage(ThreadIdentifier tid, long sequenceId); void createAckedEventsMap(); void setAckedEvents(); static Map getDispatchedMessagesMapForTesting(); HARegionQueueStats getStatistics(); @Override int size(); boolean isEmpty(); static HARegionQueue getHARegionQueueInstance(String regionName, InternalCache cache,
      final int haRgnQType, final boolean isDurable, StatisticsClock statisticsClock); static HARegionQueue getHARegionQueueInstance(String regionName, InternalCache cache,
      HARegionQueueAttributes hrqa, final int haRgnQType, final boolean isDurable, Map haContainer,
      ClientProxyMembershipID clientProxyId, final byte clientConflation, boolean isPrimary,
      boolean canHandleDelta, StatisticsClock statisticsClock); static HARegionQueue getHARegionQueueInstance(String regionName, InternalCache cache,
      HARegionQueueAttributes hrqa, final int haRgnQType, final boolean isDurable,
      StatisticsClock statisticsClock); boolean isEmptyAckList(); void closeClientCq(ClientProxyMembershipID clientId, InternalCqQuery cqToClose); Object updateHAEventWrapper(InternalDistributedMember sender,
      CachedDeserializable newValueCd, String regionName); void clearPeekedIDs(); @Override void remove(int top); void destroy(); boolean noPrimaryOrHasRegisteredInterest(); void setHasRegisteredInterest(boolean flag); boolean getHasRegisteredInterest(); Conflatable getAndRemoveFromHAContainer(Conflatable conflatable); void decAndRemoveFromHAContainer(HAEventWrapper wrapper); void decAndRemoveFromHAContainer(HAEventWrapper wrapper, String caller); boolean isPrimary(); boolean isQueueInitialized(); void setPrimary(boolean flag); void setClientConflation(byte value); void initializeTransients(); static boolean isTestMarkerMessageReceived(); static void setUsedByTest(boolean isUsedByTest); boolean isClientSlowReceiver(); @Override void close(); boolean isPeekInitialized(); Queue getGiiQueue(); synchronized void synchronizeQueueWithPrimary(InternalDistributedMember primary,
      InternalCache cache); public HARegionQueueStats stats; static final int BLOCKING_HA_QUEUE; static final int NON_BLOCKING_HA_QUEUE; static final String HA_EVICTION_POLICY_NONE; static final String HA_EVICTION_POLICY_MEMORY; static final String HA_EVICTION_POLICY_ENTRY; static final long INIT_OF_SEQUENCEID; static final int DEFAULT_MESSAGE_SYNC_INTERVAL; public boolean isClientSlowReceiver; }
@Test public void getGIIEventsReturnsCorrectEvents() { HARegionQueue spy = spy(haRegionQueue); List<EventID> giiEvents; spy.positionBeforeGII = 1; spy.positionAfterGII = 4; HAEventWrapper wrapper1 = mock(HAEventWrapper.class); HAEventWrapper wrapper2 = mock(HAEventWrapper.class); when(wrapper1.getEventId()).thenReturn(id1); when(wrapper2.getEventId()).thenReturn(id2); Region.Entry<Object, Object> entry1 = uncheckedCast(mock(Region.Entry.class)); Region.Entry<Object, Object> entry2 = uncheckedCast(mock(Region.Entry.class)); Region.Entry<Object, Object> entry3 = uncheckedCast(mock(Region.Entry.class)); when(entry1.getValue()).thenReturn(wrapper1); when(entry2.getValue()).thenReturn(new Object()); when(entry3.getValue()).thenReturn(wrapper2); when(haRegion.getEntry(1L)).thenReturn(entry1); when(haRegion.getEntry(2L)).thenReturn(entry2); when(haRegion.getEntry(3L)).thenReturn(null); when(haRegion.getEntry(4L)).thenReturn(entry3); giiEvents = spy.getGIIEvents(); assertThat(giiEvents).containsExactlyInAnyOrder(id1, id2); }