@Test public void unlockShouldCallRemoteServer_invalidLeases() { setTime(123); LeasedLockToken token = LeasedLockToken.of(LOCK_TOKEN, getLease()); advance(LEASE_DURATION); assertInvalid(token); lockLeaseService.unlock(ImmutableSet.of(token)); verify(timelock).unlock(ConjureUnlockRequest.of(ImmutableSet.of(token.serverToken()))); }
Set<LockToken> unlock(Set<LockToken> tokens) { Set<LeasedLockToken> leasedLockTokens = leasedTokens(tokens); leasedLockTokens.forEach(LeasedLockToken::invalidate); Set<ConjureLockToken> unlocked = delegate.unlock(ConjureUnlockRequest.of(serverTokens(leasedLockTokens))).getTokens(); return leasedLockTokens.stream() .filter(leasedLockToken -> unlocked.contains(leasedLockToken.serverToken())) .collect(Collectors.toSet()); }
LockLeaseService { Set<LockToken> unlock(Set<LockToken> tokens) { Set<LeasedLockToken> leasedLockTokens = leasedTokens(tokens); leasedLockTokens.forEach(LeasedLockToken::invalidate); Set<ConjureLockToken> unlocked = delegate.unlock(ConjureUnlockRequest.of(serverTokens(leasedLockTokens))).getTokens(); return leasedLockTokens.stream() .filter(leasedLockToken -> unlocked.contains(leasedLockToken.serverToken())) .collect(Collectors.toSet()); } }
LockLeaseService { Set<LockToken> unlock(Set<LockToken> tokens) { Set<LeasedLockToken> leasedLockTokens = leasedTokens(tokens); leasedLockTokens.forEach(LeasedLockToken::invalidate); Set<ConjureLockToken> unlocked = delegate.unlock(ConjureUnlockRequest.of(serverTokens(leasedLockTokens))).getTokens(); return leasedLockTokens.stream() .filter(leasedLockToken -> unlocked.contains(leasedLockToken.serverToken())) .collect(Collectors.toSet()); } @VisibleForTesting  LockLeaseService(
            NamespacedConjureTimelockService delegate,
            UUID clientId); }
LockLeaseService { Set<LockToken> unlock(Set<LockToken> tokens) { Set<LeasedLockToken> leasedLockTokens = leasedTokens(tokens); leasedLockTokens.forEach(LeasedLockToken::invalidate); Set<ConjureLockToken> unlocked = delegate.unlock(ConjureUnlockRequest.of(serverTokens(leasedLockTokens))).getTokens(); return leasedLockTokens.stream() .filter(leasedLockToken -> unlocked.contains(leasedLockToken.serverToken())) .collect(Collectors.toSet()); } @VisibleForTesting  LockLeaseService(
            NamespacedConjureTimelockService delegate,
            UUID clientId);  }
LockLeaseService { Set<LockToken> unlock(Set<LockToken> tokens) { Set<LeasedLockToken> leasedLockTokens = leasedTokens(tokens); leasedLockTokens.forEach(LeasedLockToken::invalidate); Set<ConjureLockToken> unlocked = delegate.unlock(ConjureUnlockRequest.of(serverTokens(leasedLockTokens))).getTokens(); return leasedLockTokens.stream() .filter(leasedLockToken -> unlocked.contains(leasedLockToken.serverToken())) .collect(Collectors.toSet()); } @VisibleForTesting  LockLeaseService(
            NamespacedConjureTimelockService delegate,
            UUID clientId);   }