You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2021/06/15 23:38:41 UTC

[GitHub] [kafka] mjsax commented on a change in pull request #10701: KAFKA-10437; Fix omitted TODO of KIP-478

mjsax commented on a change in pull request #10701:
URL: https://github.com/apache/kafka/pull/10701#discussion_r652238393



##########
File path: streams/examples/src/test/java/org/apache/kafka/streams/examples/wordcount/WordCountTransformerTest.java
##########
@@ -45,11 +50,26 @@ public void test() {
                 .withLoggingDisabled() // Changelog is not supported by MockProcessorContext.
                 // Caching is disabled by default, but FYI: caching is also not supported by MockProcessorContext.
                 .build();
-            store.init(context, store);
-            context.register(store, null);
+            store.init(context.getStateStoreContext(), store);
+            context.getStateStoreContext().register(store, null);
         }
         final Transformer<String, String, KeyValue<String, String>> transformer = supplier.get();
-        transformer.init(context);
+        transformer.init(new org.apache.kafka.streams.processor.MockProcessorContext() {
+            @Override
+            public <S extends StateStore> S getStateStore(final String name) {
+                return context.getStateStore(name);
+            }
+
+            @Override
+            public <K, V> void forward(final K key, final V value) {
+                context.forward(new Record<>(key.toString(), value.toString(), 0L));

Review comment:
       Why `toString()` -- should we not assume that both `K` and `V` are of type `String`? I guess we cannot declare the input parameters as `String`, but wondering if we should rather cast here?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org