Search in sources :

Example 1 with StateStoreProviderStub

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

the class CompositeReadOnlyWindowStoreTest method emptyIteratorAlwaysReturnsFalse.

@Test
public void emptyIteratorAlwaysReturnsFalse() throws Exception {
    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 2 with StateStoreProviderStub

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

the class CompositeReadOnlyWindowStoreTest method emptyIteratorPeekNextKeyShouldThrowNoSuchElementException.

@Test
public void emptyIteratorPeekNextKeyShouldThrowNoSuchElementException() 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.peekNextKey();
}
Also used : StateStoreProviderStub(org.apache.kafka.test.StateStoreProviderStub) Test(org.junit.Test)

Example 3 with StateStoreProviderStub

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

the class WrappingStoreProviderTest method before.

@Before
public void before() {
    final StateStoreProviderStub stubProviderOne = new StateStoreProviderStub(false);
    final StateStoreProviderStub stubProviderTwo = new StateStoreProviderStub(false);
    stubProviderOne.addStore("kv", StateStoreTestUtils.newKeyValueStore("kv", "app-id", String.class, String.class));
    stubProviderOne.addStore("window", new NoOpWindowStore());
    stubProviderTwo.addStore("kv", StateStoreTestUtils.newKeyValueStore("kv", "app-id", String.class, String.class));
    stubProviderTwo.addStore("window", new NoOpWindowStore());
    wrappingStoreProvider = new WrappingStoreProvider(Arrays.<StateStoreProvider>asList(stubProviderOne, stubProviderTwo));
}
Also used : NoOpWindowStore(org.apache.kafka.streams.state.NoOpWindowStore) StateStoreProviderStub(org.apache.kafka.test.StateStoreProviderStub) Before(org.junit.Before)

Example 4 with StateStoreProviderStub

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

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(Arrays.<StateStoreProvider>asList(stubProviderOne, stubProviderTwo)), QueryableStoreTypes.<String, String>keyValueStore(), storeName);
}
Also used : StateStoreProviderStub(org.apache.kafka.test.StateStoreProviderStub) Before(org.junit.Before)

Example 5 with StateStoreProviderStub

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

the class CompositeReadOnlySessionStoreTest method shouldThrowInvalidStateStoreExceptionOnRebalance.

@Test(expected = InvalidStateStoreException.class)
public void shouldThrowInvalidStateStoreExceptionOnRebalance() {
    final CompositeReadOnlySessionStore<String, String> store = new CompositeReadOnlySessionStore<>(new StateStoreProviderStub(true), QueryableStoreTypes.<String, String>sessionStore(), "whateva");
    store.fetch("a");
}
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