@Test void testRegularTokenIsProvidedWhenResetBeyondCurrentPosition() { TrackingToken token1 = new GlobalSequenceTrackingToken(1); TrackingToken token2 = new GlobalSequenceTrackingToken(2); TrackingToken actual = ReplayToken.createReplayToken(token1, token2); assertSame(token2, actual); }
public static TrackingToken createReplayToken(TrackingToken tokenAtReset, TrackingToken startPosition) { if (tokenAtReset == null) { return null; } if (tokenAtReset instanceof ReplayToken) { return createReplayToken(((ReplayToken) tokenAtReset).tokenAtReset, startPosition); } if (startPosition != null && startPosition.covers(WrappedToken.unwrapLowerBound(tokenAtReset))) { return startPosition; } return new ReplayToken(tokenAtReset, startPosition); }
ReplayToken implements TrackingToken, WrappedToken, Serializable { public static TrackingToken createReplayToken(TrackingToken tokenAtReset, TrackingToken startPosition) { if (tokenAtReset == null) { return null; } if (tokenAtReset instanceof ReplayToken) { return createReplayToken(((ReplayToken) tokenAtReset).tokenAtReset, startPosition); } if (startPosition != null && startPosition.covers(WrappedToken.unwrapLowerBound(tokenAtReset))) { return startPosition; } return new ReplayToken(tokenAtReset, startPosition); } }
ReplayToken implements TrackingToken, WrappedToken, Serializable { public static TrackingToken createReplayToken(TrackingToken tokenAtReset, TrackingToken startPosition) { if (tokenAtReset == null) { return null; } if (tokenAtReset instanceof ReplayToken) { return createReplayToken(((ReplayToken) tokenAtReset).tokenAtReset, startPosition); } if (startPosition != null && startPosition.covers(WrappedToken.unwrapLowerBound(tokenAtReset))) { return startPosition; } return new ReplayToken(tokenAtReset, startPosition); } ReplayToken(TrackingToken tokenAtReset); @JsonCreator @ConstructorProperties({"tokenAtReset", "currentToken"})  ReplayToken(@JsonProperty("tokenAtReset") TrackingToken tokenAtReset,
                       @JsonProperty("currentToken") TrackingToken newRedeliveryToken); private  ReplayToken(TrackingToken tokenAtReset,
                       TrackingToken newRedeliveryToken,
                       boolean lastMessageWasReplay); }
ReplayToken implements TrackingToken, WrappedToken, Serializable { public static TrackingToken createReplayToken(TrackingToken tokenAtReset, TrackingToken startPosition) { if (tokenAtReset == null) { return null; } if (tokenAtReset instanceof ReplayToken) { return createReplayToken(((ReplayToken) tokenAtReset).tokenAtReset, startPosition); } if (startPosition != null && startPosition.covers(WrappedToken.unwrapLowerBound(tokenAtReset))) { return startPosition; } return new ReplayToken(tokenAtReset, startPosition); } ReplayToken(TrackingToken tokenAtReset); @JsonCreator @ConstructorProperties({"tokenAtReset", "currentToken"})  ReplayToken(@JsonProperty("tokenAtReset") TrackingToken tokenAtReset,
                       @JsonProperty("currentToken") TrackingToken newRedeliveryToken); private  ReplayToken(TrackingToken tokenAtReset,
                       TrackingToken newRedeliveryToken,
                       boolean lastMessageWasReplay); static TrackingToken createReplayToken(TrackingToken tokenAtReset, TrackingToken startPosition); static TrackingToken createReplayToken(TrackingToken tokenAtReset); static boolean isReplay(Message<?> message); static boolean isReplay(TrackingToken trackingToken); static OptionalLong getTokenAtReset(TrackingToken trackingToken); TrackingToken getTokenAtReset(); TrackingToken getCurrentToken(); @Override TrackingToken advancedTo(TrackingToken newToken); @Override TrackingToken lowerBound(TrackingToken other); @Override TrackingToken upperBound(TrackingToken other); @Override boolean covers(TrackingToken other); @Override TrackingToken lowerBound(); @Override TrackingToken upperBound(); @Override Optional<R> unwrap(Class<R> tokenType); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); @Override OptionalLong position(); }
ReplayToken implements TrackingToken, WrappedToken, Serializable { public static TrackingToken createReplayToken(TrackingToken tokenAtReset, TrackingToken startPosition) { if (tokenAtReset == null) { return null; } if (tokenAtReset instanceof ReplayToken) { return createReplayToken(((ReplayToken) tokenAtReset).tokenAtReset, startPosition); } if (startPosition != null && startPosition.covers(WrappedToken.unwrapLowerBound(tokenAtReset))) { return startPosition; } return new ReplayToken(tokenAtReset, startPosition); } ReplayToken(TrackingToken tokenAtReset); @JsonCreator @ConstructorProperties({"tokenAtReset", "currentToken"})  ReplayToken(@JsonProperty("tokenAtReset") TrackingToken tokenAtReset,
                       @JsonProperty("currentToken") TrackingToken newRedeliveryToken); private  ReplayToken(TrackingToken tokenAtReset,
                       TrackingToken newRedeliveryToken,
                       boolean lastMessageWasReplay); static TrackingToken createReplayToken(TrackingToken tokenAtReset, TrackingToken startPosition); static TrackingToken createReplayToken(TrackingToken tokenAtReset); static boolean isReplay(Message<?> message); static boolean isReplay(TrackingToken trackingToken); static OptionalLong getTokenAtReset(TrackingToken trackingToken); TrackingToken getTokenAtReset(); TrackingToken getCurrentToken(); @Override TrackingToken advancedTo(TrackingToken newToken); @Override TrackingToken lowerBound(TrackingToken other); @Override TrackingToken upperBound(TrackingToken other); @Override boolean covers(TrackingToken other); @Override TrackingToken lowerBound(); @Override TrackingToken upperBound(); @Override Optional<R> unwrap(Class<R> tokenType); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); @Override OptionalLong position();  }