DistributedEventTracker implements EventTracker { @Override public VersionTag findVersionTagForBulkOp(EventID eventID) { if (eventID == null) { return null; } ThreadIdentifier threadID = createThreadIDFromEvent(eventID); BulkOperationHolder evh = recordedBulkOpVersionTags.get(threadID); if (evh == null) { if (logger.isDebugEnabled()) { logger.debug("search for version tag failed as no events are recorded for {}", threadID.expensiveToString()); } return null; } synchronized (evh) { if (logger.isDebugEnabled()) { logger.debug("search for version tag located event holder for {}: {}", threadID.expensiveToString(), evh); } return evh.getEntryVersionTags().get(eventID); } } DistributedEventTracker(InternalCache cache, CancelCriterion stopper, String regionName); @Override void start(); @Override void stop(); @Override void clear(); @Override Map<ThreadIdentifier, EventSequenceNumberHolder> getState(); @Override void recordState(InternalDistributedMember provider,
      Map<ThreadIdentifier, EventSequenceNumberHolder> state); @Override void setInitialized(); @Override void waitOnInitialization(); @Override void recordEvent(InternalCacheEvent event); @Override boolean hasSeenEvent(InternalCacheEvent event); @Override boolean hasSeenEvent(EventID eventID); @Override boolean hasSeenEvent(EventID eventID, InternalCacheEvent tagHolder); @Override VersionTag findVersionTagForSequence(EventID eventID); @Override VersionTag findVersionTagForBulkOp(EventID eventID); @Override String getName(); @Override void syncBulkOp(Runnable r, EventID eventID, boolean partOfTransaction); @Override void recordBulkOpStart(EventID eventID, ThreadIdentifier tid); @Override boolean isInitialized(); @Override boolean isInitialImageProvider(DistributedMember mbr); @Override ConcurrentMap<ThreadIdentifier, BulkOperationHolder> getRecordedBulkOpVersionTags(); @Override ConcurrentMap<ThreadIdentifier, EventSequenceNumberHolder> getRecordedEvents(); @Override String toString();  }
@Test public void returnsNoTagIfNoBulkOpWhenNoEventGiven() { assertNull(eventTracker.findVersionTagForBulkOp(null)); }
@Test public void returnsNoTagIfNoBulkOpForEventWithSequence() { EventID eventID = new EventID(new byte[0], 0L, 1L); assertNull(eventTracker.findVersionTagForBulkOp(eventID)); }
@Test public void returnsNoTagIfBulkOpsDoNotMatchForEvent() { putEvent("key", "value", new byte[0], 0, false, 0); EventID eventIDWithoutBulkOp = new EventID(new byte[0], 0L, 1); assertNull(eventTracker.findVersionTagForBulkOp(eventIDWithoutBulkOp)); }
@Test public void returnsCorrectTagForEventWithBulkOp() { EventID eventID = new EventID(new byte[0], 0L, 0L); VersionTag tag = mock(VersionTag.class); putEvent("key", "value", new byte[0], 0, false, 0, tag); assertEquals(tag, eventTracker.findVersionTagForBulkOp(eventID)); }