> getTimestampedKeyValueStore
}
/**
- * Get the {@link VersionedKeyValueStore} with the given name.
+ * Get the {@link TimestampedKeyValueStoreWithHeaders} with the given name.
* The store can be a "regular" or global store.
*
* This is often useful in test cases to pre-populate the store before the test case instructs the topology to
* {@link TestInputTopic#pipeInput(TestRecord) process an input message}, and/or to check the store afterward.
*
* @param name the name of the store
- * @return the key value store, or {@code null} if no {@link VersionedKeyValueStore} has been registered with the given name
+ * @return the key value store, or {@code null} if no {@link TimestampedKeyValueStoreWithHeaders} has been registered with the given name
* @see #getAllStateStores()
* @see #getStateStore(String)
* @see #getKeyValueStore(String)
* @see #getTimestampedKeyValueStore(String)
- * @see #getTimestampedKeyValueStoreWithHeaders(String)
+ * @see #getVersionedKeyValueStore(String)
* @see #getWindowStore(String)
* @see #getTimestampedWindowStore(String)
* @see #getTimestampedWindowStoreWithHeaders(String)
* @see #getSessionStore(String)
+ * @see #getSessionStoreWithHeaders(String)
*/
@SuppressWarnings("unchecked")
- public VersionedKeyValueStore getVersionedKeyValueStore(final String name) {
+ public KeyValueStore> getTimestampedKeyValueStoreWithHeaders(final String name) {
final StateStore store = getStateStore(name, false);
- return store instanceof VersionedKeyValueStore ? (VersionedKeyValueStore) store : null;
+ return store instanceof TimestampedKeyValueStoreWithHeaders ? (TimestampedKeyValueStoreWithHeaders) store : null;
}
/**
- * Get the {@link TimestampedKeyValueStoreWithHeaders} with the given name.
+ * Get the {@link VersionedKeyValueStore} with the given name.
* The store can be a "regular" or global store.
*
* This is often useful in test cases to pre-populate the store before the test case instructs the topology to
* {@link TestInputTopic#pipeInput(TestRecord) process an input message}, and/or to check the store afterward.
*
* @param name the name of the store
- * @return the key value store, or {@code null} if no {@link TimestampedKeyValueStoreWithHeaders} has been registered with the given name
+ * @return the key value store, or {@code null} if no {@link VersionedKeyValueStore} has been registered with the given name
* @see #getAllStateStores()
* @see #getStateStore(String)
* @see #getKeyValueStore(String)
* @see #getTimestampedKeyValueStore(String)
- * @see #getVersionedKeyValueStore(String)
+ * @see #getTimestampedKeyValueStoreWithHeaders(String)
* @see #getWindowStore(String)
* @see #getTimestampedWindowStore(String)
* @see #getTimestampedWindowStoreWithHeaders(String)
* @see #getSessionStore(String)
+ * @see #getSessionStoreWithHeaders(String)
*/
@SuppressWarnings("unchecked")
- public KeyValueStore> getTimestampedKeyValueStoreWithHeaders(final String name) {
+ public VersionedKeyValueStore getVersionedKeyValueStore(final String name) {
final StateStore store = getStateStore(name, false);
- return store instanceof TimestampedKeyValueStoreWithHeaders ? (TimestampedKeyValueStoreWithHeaders) store : null;
+ return store instanceof VersionedKeyValueStore ? (VersionedKeyValueStore) store : null;
}
/**
@@ -1123,11 +1126,12 @@ public KeyValueStore> getTimestampedKeyValueS
* @see #getStateStore(String)
* @see #getKeyValueStore(String)
* @see #getTimestampedKeyValueStore(String)
- * @see #getVersionedKeyValueStore(String)
* @see #getTimestampedKeyValueStoreWithHeaders(String)
+ * @see #getVersionedKeyValueStore(String)
* @see #getTimestampedWindowStore(String)
* @see #getTimestampedWindowStoreWithHeaders(String)
* @see #getSessionStore(String)
+ * @see #getSessionStoreWithHeaders(String)
*/
@SuppressWarnings("unchecked")
public WindowStore getWindowStore(final String name) {
@@ -1156,10 +1160,12 @@ public WindowStore getWindowStore(final String name) {
* @see #getStateStore(String)
* @see #getKeyValueStore(String)
* @see #getTimestampedKeyValueStore(String)
- * @see #getVersionedKeyValueStore(String)
* @see #getTimestampedKeyValueStoreWithHeaders(String)
+ * @see #getVersionedKeyValueStore(String)
* @see #getWindowStore(String)
+ * @see #getTimestampedWindowStoreWithHeaders(String)
* @see #getSessionStore(String)
+ * @see #getSessionStoreWithHeaders(String)
*/
@SuppressWarnings("unchecked")
public WindowStore> getTimestampedWindowStore(final String name) {
@@ -1183,11 +1189,12 @@ public WindowStore> getTimestampedWindowStore(fin
* @see #getStateStore(String)
* @see #getKeyValueStore(String)
* @see #getTimestampedKeyValueStore(String)
- * @see #getVersionedKeyValueStore(String)
* @see #getTimestampedKeyValueStoreWithHeaders(String)
+ * @see #getVersionedKeyValueStore(String)
* @see #getWindowStore(String)
* @see #getTimestampedWindowStore(String)
* @see #getSessionStore(String)
+ * @see #getSessionStoreWithHeaders(String)
*/
@SuppressWarnings("unchecked")
public WindowStore> getTimestampedWindowStoreWithHeaders(final String name) {
@@ -1208,11 +1215,12 @@ public WindowStore> getTimestampedWindowStore
* @see #getStateStore(String)
* @see #getKeyValueStore(String)
* @see #getTimestampedKeyValueStore(String)
+ * @see #getTimestampedKeyValueStoreWithHeaders(String)
* @see #getVersionedKeyValueStore(String)
* @see #getWindowStore(String)
* @see #getTimestampedWindowStore(String)
- * @see #getTimestampedKeyValueStoreWithHeaders(String)
* @see #getTimestampedWindowStoreWithHeaders(String)
+ * @see #getSessionStoreWithHeaders(String)
*/
@SuppressWarnings("unchecked")
public SessionStore getSessionStore(final String name) {
@@ -1223,6 +1231,32 @@ public SessionStore getSessionStore(final String name) {
return store instanceof SessionStore ? (SessionStore) store : null;
}
+ /**
+ * Get the {@link SessionStore} with the given name.
+ * The store can be a "regular" or global store.
+ *
+ * This is often useful in test cases to pre-populate the store before the test case instructs the topology to
+ * {@link TestInputTopic#pipeInput(TestRecord) process an input message}, and/or to check the store afterward.
+ *
+ * @param name the name of the store
+ * @return the key value store, or {@code null} if no {@link SessionStore} has been registered with the given name
+ * @see #getAllStateStores()
+ * @see #getStateStore(String)
+ * @see #getKeyValueStore(String)
+ * @see #getTimestampedKeyValueStore(String)
+ * @see #getTimestampedKeyValueStoreWithHeaders(String)
+ * @see #getVersionedKeyValueStore(String)
+ * @see #getWindowStore(String)
+ * @see #getTimestampedWindowStore(String)
+ * @see #getTimestampedWindowStoreWithHeaders(String)
+ * @see #getSessionStore(String)
+ */
+ @SuppressWarnings("unchecked")
+ public SessionStoreWithHeaders getSessionStoreWithHeaders(final String name) {
+ final StateStore store = getStateStore(name, false);
+ return store instanceof SessionStoreWithHeaders ? (SessionStoreWithHeaders) store : null;
+ }
+
/**
* Close the driver, its topology, and all processors.
*/
@@ -1251,21 +1285,6 @@ public void close() {
stateDirectory.clean();
}
- static class MockChangelogRegister implements ChangelogRegister {
- @Override
- public void register(final TopicPartition partition, final ProcessorStateManager stateManager) { }
-
- @Override
- public void register(final Set changelogPartitions, final ProcessorStateManager stateManager) { }
-
- @Override
- public void unregister(final Collection partitions) { }
-
- @Override
- public void unregister(final Collection partitions,
- final SuspendReason reason) { }
- }
-
static class MockTime implements Time {
private final AtomicLong timeMs;
private final AtomicLong highResTimeNs;
diff --git a/streams/test-utils/src/test/java/org/apache/kafka/streams/TopologyTestDriverTest.java b/streams/test-utils/src/test/java/org/apache/kafka/streams/TopologyTestDriverTest.java
index 2dc0089990e69..7555c0783305c 100644
--- a/streams/test-utils/src/test/java/org/apache/kafka/streams/TopologyTestDriverTest.java
+++ b/streams/test-utils/src/test/java/org/apache/kafka/streams/TopologyTestDriverTest.java
@@ -24,6 +24,10 @@
import org.apache.kafka.common.serialization.ByteArrayDeserializer;
import org.apache.kafka.common.serialization.ByteArraySerializer;
import org.apache.kafka.common.serialization.Deserializer;
+import org.apache.kafka.common.serialization.DoubleDeserializer;
+import org.apache.kafka.common.serialization.DoubleSerializer;
+import org.apache.kafka.common.serialization.IntegerDeserializer;
+import org.apache.kafka.common.serialization.IntegerSerializer;
import org.apache.kafka.common.serialization.LongDeserializer;
import org.apache.kafka.common.serialization.LongSerializer;
import org.apache.kafka.common.serialization.Serdes;
@@ -386,7 +390,6 @@ private Topology setupGlobalStoreTopology(final String... sourceTopicNames) {
() -> new Processor