use of org.apache.kafka.test.ReadOnlySessionStoreStub in project kafka by apache.
the class CompositeReadOnlySessionStoreTest method shouldFindValueForKeyWhenMultiStores.
@Test
public void shouldFindValueForKeyWhenMultiStores() throws Exception {
final ReadOnlySessionStoreStub<String, Long> secondUnderlying = new ReadOnlySessionStoreStub<>();
stubProviderTwo.addStore(storeName, secondUnderlying);
final Windowed<String> keyOne = new Windowed<>("key-one", new SessionWindow(0, 0));
final Windowed<String> keyTwo = new Windowed<>("key-two", new SessionWindow(0, 0));
underlyingSessionStore.put(keyOne, 0L);
secondUnderlying.put(keyTwo, 10L);
final List<KeyValue<Windowed<String>, Long>> keyOneResults = toList(sessionStore.fetch("key-one"));
final List<KeyValue<Windowed<String>, Long>> keyTwoResults = toList(sessionStore.fetch("key-two"));
assertEquals(Collections.singletonList(KeyValue.pair(keyOne, 0L)), keyOneResults);
assertEquals(Collections.singletonList(KeyValue.pair(keyTwo, 10L)), keyTwoResults);
}
Aggregations