Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -586,7 +586,7 @@ public static SinkConfig validateUpdate(SinkConfig existingConfig, SinkConfig ne

if (newConfig.getInputs() != null) {
newConfig.getInputs().forEach((topicName -> {
newConfig.getInputSpecs().put(topicName,
newConfig.getInputSpecs().putIfAbsent(topicName,
ConsumerConfig.builder().isRegexPattern(false).build());
}));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import com.google.common.collect.Lists;
import com.google.gson.Gson;
import java.util.ArrayList;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
Expand Down Expand Up @@ -277,6 +278,24 @@ public void testMergeDifferentInputSpec() {
assertEquals(sinkConfig.getInputSpecs().get("test-input").getReceiverQueueSize().intValue(), 1000);
}

@Test
public void testMergeDifferentInputSpecWithInputsSet() {
SinkConfig sinkConfig = createSinkConfig();
sinkConfig.getInputSpecs().put("test-input", ConsumerConfig.builder().isRegexPattern(false).receiverQueueSize(1000).build());

Map<String, ConsumerConfig> inputSpecs = new HashMap<>();
ConsumerConfig newConsumerConfig = ConsumerConfig.builder().isRegexPattern(false).serdeClassName("test-serde").receiverQueueSize(58).build();
inputSpecs.put("test-input", newConsumerConfig);
SinkConfig newSinkConfig = createUpdatedSinkConfig("inputSpecs", inputSpecs);
newSinkConfig.setInputs(new ArrayList<>());
newSinkConfig.getInputs().add("test-input");
SinkConfig mergedConfig = SinkConfigUtils.validateUpdate(sinkConfig, newSinkConfig);
assertEquals(mergedConfig.getInputSpecs().get("test-input"), newConsumerConfig);

// make sure original sinkConfig was not modified
assertEquals(sinkConfig.getInputSpecs().get("test-input").getReceiverQueueSize().intValue(), 1000);
}

@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = "Processing Guarantees cannot be altered")
public void testMergeDifferentProcessingGuarantees() {
SinkConfig sinkConfig = createSinkConfig();
Expand Down