DbLockStore implements LockStore.Mutable { @Timed("lock_store_delete_locks") @Override public void deleteLocks() { mapper.truncate(); } @Inject  DbLockStore(LockMapper mapper, LockKeyMapper lockKeyMapper); @Timed("lock_store_save_lock") @Override void saveLock(ILock lock); @Timed("lock_store_remove_lock") @Override void removeLock(ILockKey lockKey); @Timed("lock_store_delete_locks") @Override void deleteLocks(); @Timed("lock_store_fetch_locks") @Override Set<ILock> fetchLocks(); @Timed("lock_store_fetch_lock") @Override Optional<ILock> fetchLock(ILockKey lockKey);  }
@Test public void testDeleteAllLocks() throws Exception { assertLocks(); String role = "testRole"; String env = "testEnv"; String job1 = "testJob1"; String job2 = "testJob2"; ILock lock1 = makeLock(JobKeys.from(role, env, job1).newBuilder(), "token1"); ILock lock2 = makeLock(JobKeys.from(role, env, job2).newBuilder(), "token2"); saveLocks(lock1, lock2); assertLocks(lock1, lock2); storage.write(storeProvider -> { storeProvider.getLockStore().deleteLocks(); return null; }); assertLocks(); }