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());
}
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()));
}
}
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);
}
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);
}
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();
}
Aggregations