Search in sources :

Example 16 with StateStoreProviderStub

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

the class CompositeReadOnlySessionStoreTest method shouldThrowInvalidStateStoreExceptionOnRebalance.

@Test
public void shouldThrowInvalidStateStoreExceptionOnRebalance() {
    final QueryableStoreType<ReadOnlySessionStore<Object, Object>> queryableStoreType = QueryableStoreTypes.sessionStore();
    final CompositeReadOnlySessionStore<String, String> store = new CompositeReadOnlySessionStore<>(new WrappingStoreProvider(singletonList(new StateStoreProviderStub(true)), StoreQueryParameters.fromNameAndType("whateva", queryableStoreType)), QueryableStoreTypes.sessionStore(), "whateva");
    assertThrows(InvalidStateStoreException.class, () -> store.fetch("a"));
}
Also used : ReadOnlySessionStore(org.apache.kafka.streams.state.ReadOnlySessionStore) StateStoreProviderStub(org.apache.kafka.test.StateStoreProviderStub) Test(org.junit.Test)

Example 17 with StateStoreProviderStub

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

the class QueryableStoreProviderTest method before.

@Before
public void before() {
    final StateStoreProviderStub theStoreProvider = new StateStoreProviderStub(false);
    for (int partition = 0; partition < numStateStorePartitions; partition++) {
        theStoreProvider.addStore(keyValueStore, partition, new NoOpReadOnlyStore<>());
        theStoreProvider.addStore(windowStore, partition, new NoOpWindowStore());
    }
    globalStateStores = new HashMap<>();
    storeProvider = new QueryableStoreProvider(new GlobalStateStoreProvider(globalStateStores));
    storeProvider.addStoreProviderForThread("thread1", theStoreProvider);
}
Also used : NoOpWindowStore(org.apache.kafka.streams.state.NoOpWindowStore) StateStoreProviderStub(org.apache.kafka.test.StateStoreProviderStub) Before(org.junit.Before)

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