Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ private void initializeChangelogs(final Set<ChangelogMetadata> newPartitionsToRe
final ChangelogMetadata changelogMetadata = changelogs.get(partition);
final Long endOffset = endOffsets.get(partition);
final Long committedOffset = newPartitionsToFindCommittedOffset.contains(partition) ?
committedOffsets.get(partition) : Long.MAX_VALUE;
committedOffsets.get(partition) : Long.valueOf(Long.MAX_VALUE);

if (endOffset != null && committedOffset != null) {
if (changelogMetadata.restoreEndOffset != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2886,10 +2886,10 @@ public void shouldSupportTriggerMaterializedWithKTableFromKStream() {
builder.stream(input, consumed)
.toTable()
.mapValues(
value -> value.charAt(0) - (int) 'a',
Materialized.<String, Integer, KeyValueStore<Bytes, byte[]>>as(storeName)
value -> String.valueOf(value.charAt(0) - (int) 'a'),
Materialized.<String, String, KeyValueStore<Bytes, byte[]>>as(storeName)
.withKeySerde(Serdes.String())
.withValueSerde(Serdes.Integer()))
.withValueSerde(Serdes.String()))
.toStream()
.to(output);

Expand Down Expand Up @@ -2925,8 +2925,8 @@ public void shouldSupportTriggerMaterializedWithKTableFromKStream() {
Instant.ofEpochMilli(0L))) {
final TestInputTopic<String, String> inputTopic =
driver.createInputTopic(input, new StringSerializer(), new StringSerializer(), Instant.ofEpochMilli(0L), Duration.ZERO);
final TestOutputTopic<String, Integer> outputTopic =
driver.createOutputTopic(output, Serdes.String().deserializer(), Serdes.Integer().deserializer());
final TestOutputTopic<String, String> outputTopic =
driver.createOutputTopic(output, Serdes.String().deserializer(), Serdes.String().deserializer());
final KeyValueStore<String, String> store = driver.getKeyValueStore(storeName);

inputTopic.pipeInput("A", "green", 10L);
Expand All @@ -2935,29 +2935,32 @@ public void shouldSupportTriggerMaterializedWithKTableFromKStream() {
inputTopic.pipeInput("C", "yellow", 15L);
inputTopic.pipeInput("D", "green", 11L);

final Map<String, Integer> expectedStore = new HashMap<>();
expectedStore.putIfAbsent("A", 1);
expectedStore.putIfAbsent("B", 6);
expectedStore.putIfAbsent("C", 24);
expectedStore.putIfAbsent("D", 6);
final Map<String, String> expectedStore = new HashMap<>();
expectedStore.putIfAbsent("A", "1");
expectedStore.putIfAbsent("B", "6");
expectedStore.putIfAbsent("C", "24");
expectedStore.putIfAbsent("D", "6");

assertEquals(expectedStore, asMap(store));

assertEquals(
asList(
new TestRecord<>("A", 6, Instant.ofEpochMilli(10)),
new TestRecord<>("B", 6, Instant.ofEpochMilli(9)),
new TestRecord<>("A", 1, Instant.ofEpochMilli(12)),
new TestRecord<>("C", 24, Instant.ofEpochMilli(15)),
new TestRecord<>("D", 6, Instant.ofEpochMilli(11))),
new TestRecord<>("A", "6", Instant.ofEpochMilli(10)),
new TestRecord<>("B", "6", Instant.ofEpochMilli(9)),
new TestRecord<>("A", "1", Instant.ofEpochMilli(12)),
new TestRecord<>("C", "24", Instant.ofEpochMilli(15)),
new TestRecord<>("D", "6", Instant.ofEpochMilli(11))),
outputTopic.readRecordsToList());

}
}

private static Map<String, String> asMap(final KeyValueStore<String, String> store) {
final HashMap<String, String> result = new HashMap<>();
store.all().forEachRemaining(kv -> result.put(kv.key, kv.value));
store.all().forEachRemaining(kv -> {
System.out.println(kv);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to remove this println?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes! thanks.

result.put(kv.key, kv.value);
});
return result;
}
}