Search in sources :

Example 6 with StateStoreProviderStub

use of org.apache.kafka.test.StateStoreProviderStub in project apache-kafka-on-k8s by banzaicloud.

the class CompositeReadOnlyWindowStoreTest method emptyIteratorAlwaysReturnsFalse.

@Test
public void emptyIteratorAlwaysReturnsFalse() {
    final CompositeReadOnlyWindowStore<Object, Object> store = new CompositeReadOnlyWindowStore<>(new StateStoreProviderStub(false), QueryableStoreTypes.windowStore(), "foo");
    final WindowStoreIterator<Object> windowStoreIterator = store.fetch("key", 1, 10);
    Assert.assertFalse(windowStoreIterator.hasNext());
}
Also used : StateStoreProviderStub(org.apache.kafka.test.StateStoreProviderStub) Test(org.junit.Test)

Example 7 with StateStoreProviderStub

use of org.apache.kafka.test.StateStoreProviderStub in project kafka by apache.

the class WrappingStoreProviderTest method before.

@Before
public void before() {
    final StateStoreProviderStub stubProviderOne = new StateStoreProviderStub(false);
    final StateStoreProviderStub stubProviderTwo = new StateStoreProviderStub(false);
    for (int partition = 0; partition < numStateStorePartitions; partition++) {
        stubProviderOne.addStore("kv", partition, Stores.keyValueStoreBuilder(Stores.inMemoryKeyValueStore("kv"), Serdes.serdeFrom(String.class), Serdes.serdeFrom(String.class)).build());
        stubProviderOne.addStore("window", partition, new NoOpWindowStore());
        wrappingStoreProvider = new WrappingStoreProvider(Arrays.asList(stubProviderOne, stubProviderTwo), StoreQueryParameters.fromNameAndType("kv", QueryableStoreTypes.keyValueStore()));
    }
}
Also used : NoOpWindowStore(org.apache.kafka.streams.state.NoOpWindowStore) StateStoreProviderStub(org.apache.kafka.test.StateStoreProviderStub) Before(org.junit.Before)

Example 8 with StateStoreProviderStub

use of org.apache.kafka.test.StateStoreProviderStub in project kafka by apache.

the class CompositeReadOnlyKeyValueStoreTest method before.

@Before
public void before() {
    final StateStoreProviderStub stubProviderOne = new StateStoreProviderStub(false);
    stubProviderTwo = new StateStoreProviderStub(false);
    stubOneUnderlying = newStoreInstance();
    stubProviderOne.addStore(storeName, stubOneUnderlying);
    otherUnderlyingStore = newStoreInstance();
    stubProviderOne.addStore("other-store", otherUnderlyingStore);
    theStore = new CompositeReadOnlyKeyValueStore<>(new WrappingStoreProvider(asList(stubProviderOne, stubProviderTwo), StoreQueryParameters.fromNameAndType(storeName, QueryableStoreTypes.keyValueStore())), QueryableStoreTypes.keyValueStore(), storeName);
}
Also used : StateStoreProviderStub(org.apache.kafka.test.StateStoreProviderStub) Before(org.junit.Before)

Example 9 with StateStoreProviderStub

use of org.apache.kafka.test.StateStoreProviderStub in project kafka by apache.

the class CompositeReadOnlyWindowStoreTest method before.

@Before
public void before() {
    stubProviderOne = new StateStoreProviderStub(false);
    stubProviderTwo = new StateStoreProviderStub(false);
    underlyingWindowStore = new ReadOnlyWindowStoreStub<>(WINDOW_SIZE);
    stubProviderOne.addStore(storeName, underlyingWindowStore);
    otherUnderlyingStore = new ReadOnlyWindowStoreStub<>(WINDOW_SIZE);
    stubProviderOne.addStore("other-window-store", otherUnderlyingStore);
    windowStore = new CompositeReadOnlyWindowStore<>(new WrappingStoreProvider(asList(stubProviderOne, stubProviderTwo), StoreQueryParameters.fromNameAndType(storeName, QueryableStoreTypes.windowStore())), QueryableStoreTypes.windowStore(), storeName);
}
Also used : StateStoreProviderStub(org.apache.kafka.test.StateStoreProviderStub) Before(org.junit.Before)

Example 10 with StateStoreProviderStub

use of org.apache.kafka.test.StateStoreProviderStub in project kafka by apache.

the class CompositeReadOnlyWindowStoreTest method emptyIteratorNextShouldThrowNoSuchElementException.

@Test
public void emptyIteratorNextShouldThrowNoSuchElementException() throws Exception {
    final CompositeReadOnlyWindowStore<Object, Object> store = new CompositeReadOnlyWindowStore<>(new StateStoreProviderStub(false), QueryableStoreTypes.windowStore(), "foo");
    final WindowStoreIterator<Object> windowStoreIterator = store.fetch("key", 1, 10);
    windowStoreIteratorException.expect(NoSuchElementException.class);
    windowStoreIterator.next();
}
Also used : StateStoreProviderStub(org.apache.kafka.test.StateStoreProviderStub) Test(org.junit.Test)

Aggregations

StateStoreProviderStub (org.apache.kafka.test.StateStoreProviderStub)17 Test (org.junit.Test)9 Before (org.junit.Before)8 NoOpWindowStore (org.apache.kafka.streams.state.NoOpWindowStore)4 ReadOnlySessionStore (org.apache.kafka.streams.state.ReadOnlySessionStore)1