use of org.apache.kafka.streams.state.TimestampedKeyValueStore in project kafka by apache.
the class TimestampedKeyValueStoreMaterializerTest method shouldCreateBuilderThatBuildsStoreWithCachingAndLoggingDisabled.
@Test
public void shouldCreateBuilderThatBuildsStoreWithCachingAndLoggingDisabled() {
final MaterializedInternal<String, String, KeyValueStore<Bytes, byte[]>> materialized = new MaterializedInternal<>(Materialized.<String, String, KeyValueStore<Bytes, byte[]>>as("store").withCachingDisabled().withLoggingDisabled(), nameProvider, storePrefix);
final TimestampedKeyValueStoreMaterializer<String, String> materializer = new TimestampedKeyValueStoreMaterializer<>(materialized);
final StoreBuilder<TimestampedKeyValueStore<String, String>> builder = materializer.materialize();
final TimestampedKeyValueStore<String, String> store = builder.build();
final StateStore wrapped = ((WrappedStateStore) store).wrapped();
assertThat(wrapped, not(instanceOf(CachingKeyValueStore.class)));
assertThat(wrapped, not(instanceOf(ChangeLoggingKeyValueBytesStore.class)));
}
use of org.apache.kafka.streams.state.TimestampedKeyValueStore in project kafka by apache.
the class TimestampedKeyValueStoreMaterializerTest method shouldCreateBuilderThatBuildsMeteredStoreWithCachingAndLoggingEnabled.
@Test
public void shouldCreateBuilderThatBuildsMeteredStoreWithCachingAndLoggingEnabled() {
final MaterializedInternal<String, String, KeyValueStore<Bytes, byte[]>> materialized = new MaterializedInternal<>(Materialized.as("store"), nameProvider, storePrefix);
final TimestampedKeyValueStoreMaterializer<String, String> materializer = new TimestampedKeyValueStoreMaterializer<>(materialized);
final StoreBuilder<TimestampedKeyValueStore<String, String>> builder = materializer.materialize();
final TimestampedKeyValueStore<String, String> store = builder.build();
final WrappedStateStore caching = (WrappedStateStore) ((WrappedStateStore) store).wrapped();
final StateStore logging = caching.wrapped();
assertThat(store, instanceOf(MeteredTimestampedKeyValueStore.class));
assertThat(caching, instanceOf(CachingKeyValueStore.class));
assertThat(logging, instanceOf(ChangeLoggingTimestampedKeyValueBytesStore.class));
}
use of org.apache.kafka.streams.state.TimestampedKeyValueStore in project kafka by apache.
the class TimestampedKeyValueStoreMaterializerTest method shouldCreateBuilderThatBuildsStoreWithCachingDisabled.
@Test
public void shouldCreateBuilderThatBuildsStoreWithCachingDisabled() {
final MaterializedInternal<String, String, KeyValueStore<Bytes, byte[]>> materialized = new MaterializedInternal<>(Materialized.<String, String, KeyValueStore<Bytes, byte[]>>as("store").withCachingDisabled(), nameProvider, storePrefix);
final TimestampedKeyValueStoreMaterializer<String, String> materializer = new TimestampedKeyValueStoreMaterializer<>(materialized);
final StoreBuilder<TimestampedKeyValueStore<String, String>> builder = materializer.materialize();
final TimestampedKeyValueStore<String, String> store = builder.build();
final WrappedStateStore logging = (WrappedStateStore) ((WrappedStateStore) store).wrapped();
assertThat(logging, instanceOf(ChangeLoggingKeyValueBytesStore.class));
}
use of org.apache.kafka.streams.state.TimestampedKeyValueStore in project kafka by apache.
the class TimestampedKeyValueStoreMaterializerTest method shouldCreateKeyValueStoreWithTheProvidedInnerStore.
@Test
public void shouldCreateKeyValueStoreWithTheProvidedInnerStore() {
final KeyValueBytesStoreSupplier supplier = EasyMock.createNiceMock(KeyValueBytesStoreSupplier.class);
final InMemoryKeyValueStore store = new InMemoryKeyValueStore("name");
EasyMock.expect(supplier.name()).andReturn("name").anyTimes();
EasyMock.expect(supplier.get()).andReturn(store);
EasyMock.expect(supplier.metricsScope()).andReturn("metricScope");
EasyMock.replay(supplier);
final MaterializedInternal<String, Integer, KeyValueStore<Bytes, byte[]>> materialized = new MaterializedInternal<>(Materialized.as(supplier), nameProvider, storePrefix);
final TimestampedKeyValueStoreMaterializer<String, Integer> materializer = new TimestampedKeyValueStoreMaterializer<>(materialized);
final StoreBuilder<TimestampedKeyValueStore<String, Integer>> builder = materializer.materialize();
final TimestampedKeyValueStore<String, Integer> built = builder.build();
assertThat(store.name(), CoreMatchers.equalTo(built.name()));
}
use of org.apache.kafka.streams.state.TimestampedKeyValueStore in project kafka by apache.
the class TimestampedKeyValueStoreMaterializerTest method shouldCreateBuilderThatBuildsStoreWithLoggingDisabled.
@Test
public void shouldCreateBuilderThatBuildsStoreWithLoggingDisabled() {
final MaterializedInternal<String, String, KeyValueStore<Bytes, byte[]>> materialized = new MaterializedInternal<>(Materialized.<String, String, KeyValueStore<Bytes, byte[]>>as("store").withLoggingDisabled(), nameProvider, storePrefix);
final TimestampedKeyValueStoreMaterializer<String, String> materializer = new TimestampedKeyValueStoreMaterializer<>(materialized);
final StoreBuilder<TimestampedKeyValueStore<String, String>> builder = materializer.materialize();
final TimestampedKeyValueStore<String, String> store = builder.build();
final WrappedStateStore caching = (WrappedStateStore) ((WrappedStateStore) store).wrapped();
assertThat(caching, instanceOf(CachingKeyValueStore.class));
assertThat(caching.wrapped(), not(instanceOf(ChangeLoggingKeyValueBytesStore.class)));
}
Aggregations