use of com.palantir.atlasdb.keyvalue.api.KeyValueService in project atlasdb by palantir.
the class KvsBackedPersistentLockServiceTest method canCreatePersistentLockService.
@Test
public void canCreatePersistentLockService() {
KeyValueService kvs = new InMemoryKeyValueService(false);
PersistentLockService pls = KvsBackedPersistentLockService.create(kvs);
assertNotNull(pls);
}
use of com.palantir.atlasdb.keyvalue.api.KeyValueService in project atlasdb by palantir.
the class KvsBackedPersistentLockServiceTest method setUp.
@Before
public void setUp() {
KeyValueService kvs = new InMemoryKeyValueService(false);
lockStore = spy(LockStoreImpl.createImplForTest(kvs));
service = new KvsBackedPersistentLockService(lockStore);
}
use of com.palantir.atlasdb.keyvalue.api.KeyValueService in project atlasdb by palantir.
the class KeyValueServiceMigratorsTest method skipsTheOldScrubTable.
@Test
public void skipsTheOldScrubTable() {
TableReference tableToMigrate = TableReference.create(Namespace.DEFAULT_NAMESPACE, "can-be-migrated");
KeyValueService fromKvs = mock(KeyValueService.class);
when(fromKvs.getAllTableNames()).thenReturn(ImmutableSet.of(AtlasDbConstants.OLD_SCRUB_TABLE, tableToMigrate));
Set<TableReference> creatableTableNames = KeyValueServiceMigrators.getMigratableTableNames(fromKvs, ImmutableSet.of());
assertThat(creatableTableNames).containsExactly(tableToMigrate);
}
use of com.palantir.atlasdb.keyvalue.api.KeyValueService in project atlasdb by palantir.
the class ScrubberTest method isNotInitializedWhenScrubberStoreIsNotInitialized.
@Test
public void isNotInitializedWhenScrubberStoreIsNotInitialized() {
KeyValueService mockKvs = mock(KeyValueService.class);
ScrubberStore mockStore = mock(ScrubberStore.class);
when(mockKvs.isInitialized()).thenReturn(true);
when(mockStore.isInitialized()).thenReturn(false);
Scrubber theScrubber = getScrubber(mockKvs, mockStore, transactions);
assertFalse(theScrubber.isInitialized());
}
use of com.palantir.atlasdb.keyvalue.api.KeyValueService in project atlasdb by palantir.
the class LockEntryTest method fromRowResultProducesLockEntry.
@Test
public void fromRowResultProducesLockEntry() {
KeyValueService kvs = new InMemoryKeyValueService(false);
kvs.createTable(TEST_TABLE, AtlasDbConstants.GENERIC_TABLE_METADATA);
kvs.checkAndSet(CheckAndSetRequest.newCell(TEST_TABLE, LOCK_ENTRY.cell(), LOCK_ENTRY.value()));
Iterator<RowResult<Value>> range = kvs.getRange(TEST_TABLE, RangeRequest.all(), AtlasDbConstants.TRANSACTION_TS + 1);
RowResult<Value> onlyEntry = Iterables.getOnlyElement(ImmutableSet.copyOf(range));
LockEntry lockEntry = LockEntry.fromRowResult(onlyEntry);
assertEquals(LOCK_ENTRY, lockEntry);
}
Aggregations