Search in sources :

Example 1 with Builder

use of com.palantir.lock.LockRequest.Builder in project atlasdb by palantir.

the class LockRefreshingLockServiceTest method testSimpleRefresh.

@Test
public void testSimpleRefresh() throws InterruptedException {
    Builder builder = LockRequest.builder(ImmutableSortedMap.of(lock1, LockMode.WRITE));
    builder.timeoutAfter(SimpleTimeDuration.of(5, TimeUnit.SECONDS));
    LockResponse lock = server.lockWithFullLockResponse(LockClient.ANONYMOUS, builder.build());
    Thread.sleep(10000);
    Set<HeldLocksToken> refreshTokens = server.refreshTokens(ImmutableList.of(lock.getToken()));
    Assert.assertEquals(1, refreshTokens.size());
}
Also used : LockResponse(com.palantir.lock.LockResponse) HeldLocksToken(com.palantir.lock.HeldLocksToken) Builder(com.palantir.lock.LockRequest.Builder) Test(org.junit.Test)

Aggregations

HeldLocksToken (com.palantir.lock.HeldLocksToken)1 Builder (com.palantir.lock.LockRequest.Builder)1 LockResponse (com.palantir.lock.LockResponse)1 Test (org.junit.Test)1