Search in sources :

Example 1 with InMemoryKeyValueService

use of com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService in project atlasdb by palantir.

the class SweepProgressStoreTest method setup.

@Before
public void setup() {
    exec = PTExecutors.newCachedThreadPool();
    KeyValueService kvs = new InMemoryKeyValueService(false, exec);
    txManager = SweepTestUtils.setupTxManager(kvs);
    progressStore = SweepProgressStoreImpl.create(kvs, false);
}
Also used : InMemoryKeyValueService(com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService) KeyValueService(com.palantir.atlasdb.keyvalue.api.KeyValueService) InMemoryKeyValueService(com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService) Before(org.junit.Before)

Example 2 with InMemoryKeyValueService

use of com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService in project atlasdb by palantir.

the class PuncherTest method parameters.

@Parameters
public static Collection<Object[]> parameters() {
    InMemoryKeyValueService kvsPuncherStoreKvs = new InMemoryKeyValueService(false);
    InMemoryKeyValueService cachingKvsPuncherStoreKvs = new InMemoryKeyValueService(false);
    InMemoryPuncherStore inMemoryPuncherStore = InMemoryPuncherStore.create();
    PuncherStore puncherStore = KeyValueServicePuncherStore.create(kvsPuncherStoreKvs);
    CachingPuncherStore cachingInMemoryPuncherStore = CachingPuncherStore.create(InMemoryPuncherStore.create(), GRANULARITY_MILLIS);
    CachingPuncherStore cachingKeyValueServicePuncherStore = CachingPuncherStore.create(KeyValueServicePuncherStore.create(cachingKvsPuncherStoreKvs), GRANULARITY_MILLIS);
    Object[][] parameters = new Object[][] { { inMemoryPuncherStore, null }, { puncherStore, kvsPuncherStoreKvs }, { cachingInMemoryPuncherStore, null }, { cachingKeyValueServicePuncherStore, cachingKvsPuncherStoreKvs } };
    return ImmutableList.copyOf(parameters);
}
Also used : InMemoryKeyValueService(com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService) Parameters(org.junit.runners.Parameterized.Parameters)

Example 3 with InMemoryKeyValueService

use of com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService in project atlasdb by palantir.

the class ScrubberTest method before.

@Before
public void before() {
    kvs = new InMemoryKeyValueService(false, MoreExecutors.newDirectExecutorService());
    kvs.createTable(TransactionConstants.TRANSACTION_TABLE, new byte[] {});
    transactions = new SimpleTransactionService(kvs);
    scrubStore = KeyValueServiceScrubberStore.create(kvs);
    scrubber = getScrubber(kvs, scrubStore, transactions);
}
Also used : InMemoryKeyValueService(com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService) SimpleTransactionService(com.palantir.atlasdb.transaction.service.SimpleTransactionService) Before(org.junit.Before)

Example 4 with InMemoryKeyValueService

use of com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService in project atlasdb by palantir.

the class SchemaMetadataServiceImplTest method canInitializeAsynchronously.

@Test
public void canInitializeAsynchronously() {
    ForwardingKeyValueService forwardingKeyValueService = new ForwardingKeyValueService() {

        private KeyValueService realKeyValueService = new InMemoryKeyValueService(true);

        private boolean fail = true;

        @Override
        protected KeyValueService delegate() {
            if (fail) {
                fail = false;
                return mock(KeyValueService.class, (Answer) invocation -> {
                    throw new RuntimeException("I am unhappy");
                });
            }
            return realKeyValueService;
        }
    };
    SchemaMetadataService metadataService = SchemaMetadataServiceImpl.create(forwardingKeyValueService, true);
    assertThatThrownBy(() -> metadataService.putSchemaMetadata(SCHEMA_NAME_ONE, SCHEMA_METADATA_ONE)).isInstanceOf(NotInitializedException.class);
    Awaitility.await().atMost(30, TimeUnit.SECONDS).pollInterval(1, TimeUnit.SECONDS).until(metadataService::isInitialized);
    metadataService.putSchemaMetadata(SCHEMA_NAME_ONE, SCHEMA_METADATA_ONE);
    assertThat(metadataService.loadSchemaMetadata(SCHEMA_NAME_ONE)).contains(SCHEMA_METADATA_ONE);
}
Also used : IntStream(java.util.stream.IntStream) NotInitializedException(com.palantir.exception.NotInitializedException) Namespace(com.palantir.atlasdb.keyvalue.api.Namespace) ImmutableMap(com.google.common.collect.ImmutableMap) SchemaMetadataService(com.palantir.atlasdb.schema.metadata.SchemaMetadataService) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) Test(org.junit.Test) InMemoryKeyValueService(com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService) TimeUnit(java.util.concurrent.TimeUnit) Answer(org.mockito.stubbing.Answer) ImmutableSchemaDependentTableMetadata(com.palantir.atlasdb.schema.ImmutableSchemaDependentTableMetadata) ImmutableStreamStoreCleanupMetadata(com.palantir.atlasdb.schema.cleanup.ImmutableStreamStoreCleanupMetadata) Assertions.assertThatThrownBy(org.assertj.core.api.Assertions.assertThatThrownBy) ValueType(com.palantir.atlasdb.table.description.ValueType) KeyValueService(com.palantir.atlasdb.keyvalue.api.KeyValueService) ImmutableSchemaMetadata(com.palantir.atlasdb.schema.ImmutableSchemaMetadata) Map(java.util.Map) TableReference(com.palantir.atlasdb.keyvalue.api.TableReference) ForwardingKeyValueService(com.palantir.atlasdb.keyvalue.impl.ForwardingKeyValueService) SchemaMetadataServiceImpl(com.palantir.atlasdb.schema.metadata.SchemaMetadataServiceImpl) Awaitility(org.awaitility.Awaitility) Mockito.mock(org.mockito.Mockito.mock) SchemaMetadata(com.palantir.atlasdb.schema.SchemaMetadata) NullCleanupMetadata(com.palantir.atlasdb.schema.cleanup.NullCleanupMetadata) SchemaMetadataService(com.palantir.atlasdb.schema.metadata.SchemaMetadataService) InMemoryKeyValueService(com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService) KeyValueService(com.palantir.atlasdb.keyvalue.api.KeyValueService) ForwardingKeyValueService(com.palantir.atlasdb.keyvalue.impl.ForwardingKeyValueService) InMemoryKeyValueService(com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService) ForwardingKeyValueService(com.palantir.atlasdb.keyvalue.impl.ForwardingKeyValueService) Test(org.junit.Test)

Example 5 with InMemoryKeyValueService

use of com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService in project atlasdb by palantir.

the class KeyValueServicePuncherStoreTest method initializePuncherStore.

private static PuncherStore initializePuncherStore(Map<Long, Long> timestampMap) {
    PuncherStore puncherStore = KeyValueServicePuncherStore.create(new InMemoryKeyValueService(false));
    timestampMap.forEach((key, value) -> puncherStore.put(key, value));
    return puncherStore;
}
Also used : InMemoryKeyValueService(com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService)

Aggregations

InMemoryKeyValueService (com.palantir.atlasdb.keyvalue.impl.InMemoryKeyValueService)14 KeyValueService (com.palantir.atlasdb.keyvalue.api.KeyValueService)8 Before (org.junit.Before)6 Test (org.junit.Test)4 ImmutableMap (com.google.common.collect.ImmutableMap)2 Namespace (com.palantir.atlasdb.keyvalue.api.Namespace)2 RowResult (com.palantir.atlasdb.keyvalue.api.RowResult)2 TableReference (com.palantir.atlasdb.keyvalue.api.TableReference)2 ValueType (com.palantir.atlasdb.table.description.ValueType)2 ConflictDetectionManager (com.palantir.atlasdb.transaction.impl.ConflictDetectionManager)2 SweepStrategyManager (com.palantir.atlasdb.transaction.impl.SweepStrategyManager)2 Iterables (com.google.common.collect.Iterables)1 Lists (com.google.common.collect.Lists)1 AtlasDbTestCase (com.palantir.atlasdb.AtlasDbTestCase)1 Cleaner (com.palantir.atlasdb.cleaner.Cleaner)1 CleanupFollower (com.palantir.atlasdb.cleaner.CleanupFollower)1 DefaultCleanerBuilder (com.palantir.atlasdb.cleaner.DefaultCleanerBuilder)1 PtBytes (com.palantir.atlasdb.encoding.PtBytes)1 Cell (com.palantir.atlasdb.keyvalue.api.Cell)1 RangeRequest (com.palantir.atlasdb.keyvalue.api.RangeRequest)1