Search in sources :

Example 16 with KeyValueService

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);
}
Also used : KeyValueService(com.palantir.atlasdb.keyvalue.api.KeyValueService) InMemoryKeyValueService(com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService) InMemoryKeyValueService(com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService) Test(org.junit.Test)

Example 17 with KeyValueService

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);
}
Also used : KeyValueService(com.palantir.atlasdb.keyvalue.api.KeyValueService) InMemoryKeyValueService(com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService) InMemoryKeyValueService(com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService) Before(org.junit.Before)

Example 18 with KeyValueService

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);
}
Also used : TableReference(com.palantir.atlasdb.keyvalue.api.TableReference) KeyValueService(com.palantir.atlasdb.keyvalue.api.KeyValueService) Test(org.junit.Test)

Example 19 with KeyValueService

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());
}
Also used : InMemoryKeyValueService(com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService) KeyValueService(com.palantir.atlasdb.keyvalue.api.KeyValueService) Test(org.junit.Test)

Example 20 with KeyValueService

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);
}
Also used : RowResult(com.palantir.atlasdb.keyvalue.api.RowResult) InMemoryKeyValueService(com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService) KeyValueService(com.palantir.atlasdb.keyvalue.api.KeyValueService) InMemoryKeyValueService(com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService) Value(com.palantir.atlasdb.keyvalue.api.Value) Test(org.junit.Test)

Aggregations

KeyValueService (com.palantir.atlasdb.keyvalue.api.KeyValueService)30 Test (org.junit.Test)16 InMemoryKeyValueService (com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService)12 TableReference (com.palantir.atlasdb.keyvalue.api.TableReference)7 SerializableTransactionManager (com.palantir.atlasdb.transaction.impl.SerializableTransactionManager)6 ImmutableMap (com.google.common.collect.ImmutableMap)5 Cell (com.palantir.atlasdb.keyvalue.api.Cell)5 TrackingKeyValueService (com.palantir.atlasdb.keyvalue.impl.TrackingKeyValueService)5 TimestampService (com.palantir.timestamp.TimestampService)5 Map (java.util.Map)5 SingleBackendCliTestRunner (com.palantir.atlasdb.cli.runner.SingleBackendCliTestRunner)4 ForwardingKeyValueService (com.palantir.atlasdb.keyvalue.impl.ForwardingKeyValueService)4 TracingKeyValueService (com.palantir.atlasdb.keyvalue.impl.TracingKeyValueService)4 DaggerTestAtlasDbServices (com.palantir.atlasdb.services.test.DaggerTestAtlasDbServices)4 TestAtlasDbServices (com.palantir.atlasdb.services.test.TestAtlasDbServices)4 Before (org.junit.Before)4 RowResult (com.palantir.atlasdb.keyvalue.api.RowResult)3 LockService (com.palantir.lock.LockService)3 LegacyTimelockService (com.palantir.lock.impl.LegacyTimelockService)3 IdentityHashMap (java.util.IdentityHashMap)3