Search in sources :

Example 1 with StorageBasedLockProvider

use of net.javacrumbs.shedlock.support.StorageBasedLockProvider in project ShedLock by lukas-krecan.

the class AbstractStorageBasedLockProviderIntegrationTest method lockShouldSurviveCacheClearingInTheMiddle.

@Test
public void lockShouldSurviveCacheClearingInTheMiddle() {
    StorageBasedLockProvider provider = getLockProvider();
    LockConfiguration configuration = lockConfig(LOCK_NAME1);
    Optional<SimpleLock> lock = provider.lock(configuration);
    assertThat(lock).isPresent();
    provider.clearCache();
    // lock is still locked
    assertThat(provider.lock(lockConfig(LOCK_NAME1))).isEmpty();
    lock.get().unlock();
}
Also used : LockConfiguration(net.javacrumbs.shedlock.core.LockConfiguration) SimpleLock(net.javacrumbs.shedlock.core.SimpleLock) StorageBasedLockProvider(net.javacrumbs.shedlock.support.StorageBasedLockProvider) Test(org.junit.jupiter.api.Test)

Aggregations

LockConfiguration (net.javacrumbs.shedlock.core.LockConfiguration)1 SimpleLock (net.javacrumbs.shedlock.core.SimpleLock)1 StorageBasedLockProvider (net.javacrumbs.shedlock.support.StorageBasedLockProvider)1 Test (org.junit.jupiter.api.Test)1