EntryEventImpl implements InternalEntryEvent, InternalCacheEvent,
    DataSerializableFixedID, EntryOperation, Releasable { public long getEventTime(long suggestedTime) { long result = suggestedTime; if (this.versionTag != null && getRegion().getConcurrencyChecksEnabled()) { if (suggestedTime != 0) { this.versionTag.setVersionTimeStamp(suggestedTime); } else { result = this.versionTag.getVersionTimeStamp(); } } if (result <= 0) { InternalRegion region = this.getRegion(); if (region != null) { result = region.cacheTimeMillis(); } else { result = System.currentTimeMillis(); } } return result; } EntryEventImpl(); @Retained protected  EntryEventImpl(InternalRegion region, Operation op, Object key, boolean originRemote,
      DistributedMember distributedMember, boolean generateCallbacks, boolean fromRILocalDestroy); @Retained protected  EntryEventImpl(final InternalRegion region, Operation op, Object key,
      @Retained(ENTRY_EVENT_NEW_VALUE) Object newVal, Object callbackArgument, boolean originRemote,
      DistributedMember distributedMember, boolean generateCallbacks, boolean initializeId); @Retained protected  EntryEventImpl(InternalRegion region, Operation op, Object key,
      @Retained(ENTRY_EVENT_NEW_VALUE) Object newValue, Object callbackArgument,
      boolean originRemote, DistributedMember distributedMember, boolean generateCallbacks,
      EventID eventID); @Retained  EntryEventImpl(
      @Retained({ENTRY_EVENT_NEW_VALUE, ENTRY_EVENT_OLD_VALUE}) EntryEventImpl other); @Retained  EntryEventImpl(
      @Retained({ENTRY_EVENT_NEW_VALUE, ENTRY_EVENT_OLD_VALUE}) EntryEventImpl other,
      boolean setOldValue); @Retained  EntryEventImpl(Object key2, boolean isOffHeap); @Override void fromData(DataInput in,
      DeserializationContext context); @Retained static EntryEventImpl create(InternalRegion region, Operation op, Object key,
      @Retained(ENTRY_EVENT_NEW_VALUE) Object newValue, Object callbackArgument,
      boolean originRemote, DistributedMember distributedMember); @Retained static EntryEventImpl create(InternalRegion region, Operation op, Object key,
      @Retained(ENTRY_EVENT_NEW_VALUE) Object newValue, Object callbackArgument,
      boolean originRemote, DistributedMember distributedMember, boolean generateCallbacks); @Retained static EntryEventImpl create(InternalRegion region, Operation op, Object key,
      @Retained(ENTRY_EVENT_NEW_VALUE) Object newValue, Object callbackArgument,
      boolean originRemote, DistributedMember distributedMember, boolean generateCallbacks,
      EventID eventID); @Retained static EntryEventImpl create(InternalRegion region, Operation op, Object key,
      boolean originRemote, DistributedMember distributedMember, boolean generateCallbacks,
      boolean fromRILocalDestroy); @Retained static EntryEventImpl create(final InternalRegion region, Operation op, Object key,
      @Retained(ENTRY_EVENT_NEW_VALUE) Object newVal, Object callbackArgument, boolean originRemote,
      DistributedMember distributedMember, boolean generateCallbacks, boolean initializeId); boolean isBulkOpInProgress(); DistributedPutAllOperation getPutAllOperation(); DistributedPutAllOperation setPutAllOperation(DistributedPutAllOperation nv); DistributedRemoveAllOperation getRemoveAllOperation(); DistributedRemoveAllOperation setRemoveAllOperation(DistributedRemoveAllOperation nv); @Override DistributedMember getDistributedMember(); void setOriginRemote(boolean b); void setLocalInvalid(boolean b); void setGenerateCallbacks(boolean b); void setInvokePRCallbacks(boolean b); boolean getInvokePRCallbacks(); boolean getInhibitDistribution(); void setInhibitDistribution(boolean b); boolean getIsRedestroyedEntry(); void setIsRedestroyedEntry(boolean b); void isConcurrencyConflict(boolean b); boolean isConcurrencyConflict(); void setCausedByMessage(DistributionMessage msg); PartitionMessage getPartitionMessage(); RemoteOperationMessage getRemoteOperationMessage(); boolean isLocalLoad(); boolean isNetSearch(); boolean isNetLoad(); boolean isDistributed(); boolean isExpiration(); boolean isEviction(); void setEvicted(); boolean isEvicted(); boolean hasRetried(); void setRetried(boolean retried); boolean isPendingSecondaryExpireDestroy(); void setPendingSecondaryExpireDestroy(boolean value); @Override boolean isOriginRemote(); boolean isFromWANAndVersioned(); boolean isFromBridgeAndVersioned(); @Override boolean isGenerateCallbacks(); void setNewEventId(DistributedSystem sys); void reserveNewEventId(DistributedSystem sys, int count); void setEventId(EventID id); @Override EventID getEventId(); @Override boolean isBridgeEvent(); @Override boolean hasClientOrigin(); void setContext(ClientProxyMembershipID contx); @Override ClientProxyMembershipID getContext(); boolean isLocalInvalid(); @Override Object getKey(); @Override Object getOldValue(); boolean getReadOldValueFromDisk(); void setReadOldValueFromDisk(boolean v); Object getRawNewValueAsHeapObject(); @Unretained(ENTRY_EVENT_NEW_VALUE) Object getRawNewValue(); @Unretained(ENTRY_EVENT_NEW_VALUE) Object getValue(); @Override @Unretained Object basicGetNewValue(); Object getRawOldValueAsHeapObject(); @Unretained Object getRawOldValue(); @Unretained(ENTRY_EVENT_OLD_VALUE) Object getOldValueAsOffHeapDeserializedOrRaw(); @Override Object getNewValue(); String getNewValueStringForm(); String getOldValueStringForm(); void setNewValue(@Retained(ENTRY_EVENT_NEW_VALUE) Object obj); @Override TransactionId getTransactionId(); void setTransactionId(TransactionId txId); boolean isLoad(); void setRegion(InternalRegion r); @Override InternalRegion getRegion(); @Override Operation getOperation(); void setOperation(Operation op); @Override Object getCallbackArgument(); @Override boolean isCallbackArgumentAvailable(); Object getRawCallbackArgument(); void setRawCallbackArgument(Object newCallbackArgument); void setCallbackArgument(Object newCallbackArgument); @Override SerializedCacheValue<?> getSerializedNewValue(); void exportNewValue(NewValueImporter importer); void exportOldValue(OldValueImporter importer); @Unretained(ENTRY_EVENT_NEW_VALUE) Object getNewValueAsOffHeapDeserializedOrRaw(); @Retained(ENTRY_EVENT_NEW_VALUE) StoredObject getOffHeapNewValue(); @Retained(ENTRY_EVENT_OLD_VALUE) StoredObject getOffHeapOldValue(); Object getDeserializedValue(); byte[] getSerializedValue(); void makeSerializedNewValue(); static Object getCachedDeserializable(Object obj, EntryEventImpl ev); @Override void setCachedSerializedNewValue(byte[] v); @Override byte[] getCachedSerializedNewValue(); void setSerializedNewValue(byte[] serializedValue); void setSerializedOldValue(byte[] serializedOldValue); void putExistingEntry(final InternalRegion owner, final RegionEntry reentry,
      boolean requireOldValue, Object oldValueForDelta); void makeUpdate(); void makeCreate(); void putNewEntry(final InternalRegion owner, final RegionEntry reentry); @Override void setRegionEntry(RegionEntry re); RegionEntry getRegionEntry(); int getNewValueBucketSize(); void setOldValueFromRegion(); void setOldValueDestroyedToken(); void setOldValue(Object v); void setOldValue(Object v, boolean force); void setConcurrentMapOldValue(Object v); boolean hasNewValue(); boolean hasOldValue(); boolean isOldValueAToken(); @Override boolean isOldValueAvailable(); void oldValueNotAvailable(); static Object deserialize(byte[] bytes); static Object deserialize(byte[] bytes, KnownVersion version, ByteArrayDataInput in); static @Unretained Object deserializeOffHeap(StoredObject bytes); static byte[] serialize(Object obj); static byte[] serialize(Object obj, KnownVersion version); static void fillSerializedValue(BytesAndBitsForCompactor wrapper, Object obj,
      byte userBits); @Override String toString(); @Override int getDSFID(); @Override void toData(DataOutput out,
      SerializationContext context); @Override SerializedCacheValue<?> getSerializedOldValue(); int getNewValSizeForPR(); int getOldValSize(); @Override EnumListenerEvent getEventType(); @Override void setEventType(EnumListenerEvent eventType); void callbacksInvoked(boolean dispatched); boolean callbacksInvoked(); void inhibitCacheListenerNotification(boolean inhibit); boolean inhibitCacheListenerNotification(); void invokeCallbacks(InternalRegion rgn, boolean skipListeners, boolean notifyGateways); boolean isFromRILocalDestroy(); void setNextRegionVersion(long regionVersion); long getNextRegionVersion(); boolean isFromServer(); void setFromServer(boolean v); boolean isPossibleDuplicate(); void setPossibleDuplicate(boolean possibleDuplicate); boolean inhibitAllNotifications(); void setInhibitAllNotifications(boolean inhibit); @Override void setLocalFilterInfo(FilterInfo info); @Override FilterInfo getLocalFilterInfo(); byte[] getDeltaBytes(); void setDeltaBytes(byte[] deltaBytes); boolean isCreate(); EntryEventImpl setCreate(boolean isCreate); KeyInfo getKeyInfo(); void setKeyInfo(KeyInfo keyInfo); void setOldValueForQueryProcessing(); @Override KnownVersion[] getSerializationVersions(); void setVersionTag(VersionTag versionTag); @Override VersionTag getVersionTag(); boolean hasValidVersionTag(); long getEventTime(long suggestedTime); void setTailKey(Long tailKey); Long getTailKey(); void setCallbacksInvokedByCurrentThread(); boolean getCallbacksInvokedByCurrentThread(); boolean isOnPdxTypeRegion(); boolean noVersionReceivedFromServer(); @Retained TimestampedEntryEvent getTimestampedEvent(final int newDSID, final int oldDSID,
      final long newTimestamp, final long oldTimestamp); boolean isSingleHop(); boolean isSingleHopPutOp(); @Override @Released({ENTRY_EVENT_NEW_VALUE, ENTRY_EVENT_OLD_VALUE}) void release(); @Override void disallowOffHeapValues(); @Released({ENTRY_EVENT_NEW_VALUE, ENTRY_EVENT_OLD_VALUE}) void copyOffHeapToHeap(); boolean isOldValueOffHeap(); void changeRegionToBucketsOwner(); static final Object SUSPECT_TOKEN; }
@Test public void testGetEventTimeWithNullVersionTag() { long timestamp = System.currentTimeMillis(); LocalRegion region = mock(LocalRegion.class); when(region.cacheTimeMillis()).thenReturn(timestamp); InternalCache cache = mock(InternalCache.class); InternalDistributedSystem ids = mock(InternalDistributedSystem.class); when(region.getCache()).thenReturn(cache); when(cache.getDistributedSystem()).thenReturn(ids); when(ids.getOffHeapStore()).thenReturn(null); EntryEventImpl e = createEntryEvent(region, null); assertThat(e.getEventTime(0l)).isEqualTo(timestamp); }