Polish "Add config property for KafkaAdmin modifyTopicConfigs"

See gh-31679
pull/31712/head
Stephane Nicoll 2 years ago
parent 677c05a5b1
commit 4ae4698093

@ -21,12 +21,14 @@ import java.util.Map;
import org.apache.kafka.common.config.SslConfigs; import org.apache.kafka.common.config.SslConfigs;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.boot.autoconfigure.kafka.KafkaProperties.Admin;
import org.springframework.boot.autoconfigure.kafka.KafkaProperties.Cleanup; import org.springframework.boot.autoconfigure.kafka.KafkaProperties.Cleanup;
import org.springframework.boot.autoconfigure.kafka.KafkaProperties.IsolationLevel; import org.springframework.boot.autoconfigure.kafka.KafkaProperties.IsolationLevel;
import org.springframework.boot.autoconfigure.kafka.KafkaProperties.Listener; import org.springframework.boot.autoconfigure.kafka.KafkaProperties.Listener;
import org.springframework.boot.context.properties.source.MutuallyExclusiveConfigurationPropertiesException; import org.springframework.boot.context.properties.source.MutuallyExclusiveConfigurationPropertiesException;
import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.ClassPathResource;
import org.springframework.kafka.core.CleanupConfig; import org.springframework.kafka.core.CleanupConfig;
import org.springframework.kafka.core.KafkaAdmin;
import org.springframework.kafka.listener.ContainerProperties; import org.springframework.kafka.listener.ContainerProperties;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
@ -51,6 +53,14 @@ class KafkaPropertiesTests {
assertThat(original).hasSize(IsolationLevel.values().length); assertThat(original).hasSize(IsolationLevel.values().length);
} }
@Test
void adminDefaultValuesAreConsistent() {
KafkaAdmin admin = new KafkaAdmin(Map.of());
Admin adminProperties = new KafkaProperties().getAdmin();
assertThat(admin).hasFieldOrPropertyWithValue("fatalIfBrokerNotAvailable", adminProperties.isFailFast());
assertThat(admin).hasFieldOrPropertyWithValue("modifyTopicConfigs", adminProperties.isModifyTopicConfigs());
}
@Test @Test
void listenerDefaultValuesAreConsistent() { void listenerDefaultValuesAreConsistent() {
ContainerProperties container = new ContainerProperties("test"); ContainerProperties container = new ContainerProperties("test");

Loading…
Cancel
Save