Test cleanup in Kafka binder modules

Part of fixing https://github.com/spring-cloud/spring-cloud-stream/issues/2371.
This commit is contained in:
Soby Chacko
2023-11-08 19:34:42 -05:00
parent 71e095343c
commit d130b46110
22 changed files with 109 additions and 109 deletions

View File

@@ -36,7 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat;
class KafkaBinderConfigurationPropertiesTest {
@Test
public void mergedConsumerConfigurationFiltersGroupIdFromKafkaProperties() {
void mergedConsumerConfigurationFiltersGroupIdFromKafkaProperties() {
KafkaProperties kafkaProperties = new KafkaProperties();
kafkaProperties.getConsumer().setGroupId("group1");
KafkaBinderConfigurationProperties kafkaBinderConfigurationProperties =
@@ -49,7 +49,7 @@ class KafkaBinderConfigurationPropertiesTest {
}
@Test
public void mergedConsumerConfigurationFiltersEnableAutoCommitFromKafkaProperties() {
void mergedConsumerConfigurationFiltersEnableAutoCommitFromKafkaProperties() {
KafkaProperties kafkaProperties = new KafkaProperties();
kafkaProperties.getConsumer().setEnableAutoCommit(true);
KafkaBinderConfigurationProperties kafkaBinderConfigurationProperties =
@@ -62,7 +62,7 @@ class KafkaBinderConfigurationPropertiesTest {
}
@Test
public void mergedConsumerConfigurationFiltersGroupIdFromKafkaBinderConfigurationPropertiesConfiguration() {
void mergedConsumerConfigurationFiltersGroupIdFromKafkaBinderConfigurationPropertiesConfiguration() {
KafkaProperties kafkaProperties = new KafkaProperties();
KafkaBinderConfigurationProperties kafkaBinderConfigurationProperties =
new KafkaBinderConfigurationProperties(kafkaProperties);
@@ -75,7 +75,7 @@ class KafkaBinderConfigurationPropertiesTest {
}
@Test
public void mergedConsumerConfigurationFiltersEnableAutoCommitFromKafkaBinderConfigurationPropertiesConfiguration() {
void mergedConsumerConfigurationFiltersEnableAutoCommitFromKafkaBinderConfigurationPropertiesConfiguration() {
KafkaProperties kafkaProperties = new KafkaProperties();
KafkaBinderConfigurationProperties kafkaBinderConfigurationProperties =
new KafkaBinderConfigurationProperties(kafkaProperties);
@@ -88,7 +88,7 @@ class KafkaBinderConfigurationPropertiesTest {
}
@Test
public void mergedConsumerConfigurationFiltersGroupIdFromKafkaBinderConfigurationPropertiesConsumerProperties() {
void mergedConsumerConfigurationFiltersGroupIdFromKafkaBinderConfigurationPropertiesConsumerProperties() {
KafkaProperties kafkaProperties = new KafkaProperties();
KafkaBinderConfigurationProperties kafkaBinderConfigurationProperties =
new KafkaBinderConfigurationProperties(kafkaProperties);
@@ -101,7 +101,7 @@ class KafkaBinderConfigurationPropertiesTest {
}
@Test
public void mergedConsumerConfigurationFiltersEnableAutoCommitFromKafkaBinderConfigurationPropertiesConsumerProps() {
void mergedConsumerConfigurationFiltersEnableAutoCommitFromKafkaBinderConfigurationPropertiesConsumerProps() {
KafkaProperties kafkaProperties = new KafkaProperties();
KafkaBinderConfigurationProperties kafkaBinderConfigurationProperties =
new KafkaBinderConfigurationProperties(kafkaProperties);
@@ -114,7 +114,7 @@ class KafkaBinderConfigurationPropertiesTest {
}
@Test
public void testCertificateFilesAreConvertedToAbsolutePathsFromClassPathResources() {
void certificateFilesAreConvertedToAbsolutePathsFromClassPathResources() {
KafkaProperties kafkaProperties = new KafkaProperties();
KafkaBinderConfigurationProperties kafkaBinderConfigurationProperties =
new KafkaBinderConfigurationProperties(kafkaProperties);
@@ -132,7 +132,7 @@ class KafkaBinderConfigurationPropertiesTest {
}
@Test
public void testCertificateFilesAreConvertedToAbsolutePathsFromHttpResources() throws IOException {
void certificateFilesAreConvertedToAbsolutePathsFromHttpResources() throws IOException {
HttpServer server = HttpServer.create(new InetSocketAddress("localhost", 5869), 0);
createContextWithCertFileHandler(server, "testclient.truststore");
createContextWithCertFileHandler(server, "testclient.keystore");
@@ -164,7 +164,7 @@ class KafkaBinderConfigurationPropertiesTest {
}
@Test
public void testCertificateFilesAreConvertedToGivenAbsolutePathsFromClassPathResources() {
void certificateFilesAreConvertedToGivenAbsolutePathsFromClassPathResources() {
KafkaProperties kafkaProperties = new KafkaProperties();
KafkaBinderConfigurationProperties kafkaBinderConfigurationProperties =
new KafkaBinderConfigurationProperties(kafkaProperties);
@@ -182,7 +182,7 @@ class KafkaBinderConfigurationPropertiesTest {
}
@Test
public void testCertificateFilesAreMovedForSchemaRegistryConfiguration() {
void certificateFilesAreMovedForSchemaRegistryConfiguration() {
KafkaProperties kafkaProperties = new KafkaProperties();
KafkaBinderConfigurationProperties kafkaBinderConfigurationProperties =
new KafkaBinderConfigurationProperties(kafkaProperties);

View File

@@ -46,7 +46,7 @@ class KafkaTopicProvisionerTests {
@SuppressWarnings("rawtypes")
@Test
public void bootPropertiesOverriddenExceptServers() throws Exception {
void bootPropertiesOverriddenExceptServers() throws Exception {
KafkaProperties bootConfig = new KafkaProperties();
bootConfig.getProperties().put(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG,
"PLAINTEXT");
@@ -75,7 +75,7 @@ class KafkaTopicProvisionerTests {
@SuppressWarnings("rawtypes")
@Test
public void bootPropertiesOverriddenIncludingServers() throws Exception {
void bootPropertiesOverriddenIncludingServers() throws Exception {
KafkaProperties bootConfig = new KafkaProperties();
bootConfig.getProperties().put(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG,
"PLAINTEXT");
@@ -102,7 +102,7 @@ class KafkaTopicProvisionerTests {
}
@Test
public void brokersInvalid() throws Exception {
void brokersInvalid() throws Exception {
KafkaProperties bootConfig = new KafkaProperties();
KafkaBinderConfigurationProperties binderConfig = new KafkaBinderConfigurationProperties(
bootConfig);

View File

@@ -59,7 +59,7 @@ class AdminConfigTests {
private KafkaMessageChannelBinder binder;
@Test
void testConsumerTopicProperties() {
void consumerTopicProperties() {
final KafkaConsumerProperties consumerProperties = this.binder
.getExtendedConsumerProperties("secondInput");
final KafkaTopicProperties kafkaTopicProperties = consumerProperties.getTopic();
@@ -72,7 +72,7 @@ class AdminConfigTests {
}
@Test
void testProducerTopicProperties() {
void producerTopicProperties() {
final KafkaProducerProperties producerProperties = this.binder
.getExtendedProducerProperties("output");
final KafkaTopicProperties kafkaTopicProperties = producerProperties.getTopic();

View File

@@ -47,7 +47,7 @@ class AutoCreateTopicDisabledTests {
private static final EmbeddedKafkaBroker embeddedKafka = EmbeddedKafkaCondition.getBroker();
@Test
void testAutoCreateTopicDisabledFailsOnConsumerIfTopicNonExistentOnBroker() {
void autoCreateTopicDisabledFailsOnConsumerIfTopicNonExistentOnBroker() {
KafkaProperties kafkaProperties = new TestKafkaProperties();
kafkaProperties.setBootstrapServers(Collections
@@ -76,7 +76,7 @@ class AutoCreateTopicDisabledTests {
}
@Test
void testAutoCreateTopicDisabledFailsOnProducerIfTopicNonExistentOnBroker() {
void autoCreateTopicDisabledFailsOnProducerIfTopicNonExistentOnBroker() {
KafkaProperties kafkaProperties = new TestKafkaProperties();
kafkaProperties.setBootstrapServers(Collections

View File

@@ -57,7 +57,7 @@ class KafkaBinderAutoConfigurationPropertiesTest {
@Test
@SuppressWarnings("unchecked")
void testKafkaBinderConfigurationWithKafkaProperties() throws Exception {
void kafkaBinderConfigurationWithKafkaProperties() throws Exception {
assertThat(this.kafkaMessageChannelBinder).isNotNull();
ExtendedProducerProperties<KafkaProducerProperties> producerProperties = new ExtendedProducerProperties<>(
new KafkaProducerProperties());
@@ -111,7 +111,7 @@ class KafkaBinderAutoConfigurationPropertiesTest {
@Test
@SuppressWarnings("unchecked")
void testKafkaHealthIndicatorProperties() {
void kafkaHealthIndicatorProperties() {
assertThat(this.kafkaBinderHealthIndicator).isNotNull();
Field consumerFactoryField = ReflectionUtils.findField(
KafkaBinderHealthIndicator.class, "consumerFactory",

View File

@@ -56,7 +56,7 @@ class KafkaBinderConfigurationPropertiesTest {
@Test
@SuppressWarnings("unchecked")
void testKafkaBinderConfigurationProperties() throws Exception {
void kafkaBinderConfigurationProperties() throws Exception {
assertThat(this.kafkaMessageChannelBinder).isNotNull();
KafkaProducerProperties kafkaProducerProperties = new KafkaProducerProperties();
kafkaProducerProperties.setBufferSize(12345);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016-2022 the original author or authors.
* Copyright 2016-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -57,7 +57,7 @@ class KafkaBinderConfigurationTest {
}
@Test
public void testMultipleClientFactoryCustomizers() {
public void multipleClientFactoryCustomizers() {
contextRunner.withUserConfiguration(ClientFactoryCustomizerConfigs.class)
.run(context -> {
assertThat(context).hasSingleBean(KafkaMessageChannelBinder.class);
@@ -77,7 +77,7 @@ class KafkaBinderConfigurationTest {
}
@Test
public void testMultipleAdminClientConfigCustomizers() {
public void multipleAdminClientConfigCustomizers() {
contextRunner.withUserConfiguration(AdminClientConfigCustomizerConfigs.class)
.run(context -> {
assertThat(context).hasSingleBean(KafkaTopicProvisioner.class);

View File

@@ -78,7 +78,7 @@ class KafkaBinderJaasInitializerListenerTest {
}
@Test
void testConfigurationParsedCorrectlyWithKafkaClientAndDefaultControlFlag()
void configurationParsedCorrectlyWithKafkaClientAndDefaultControlFlag()
throws Exception {
ConfigFile configFile = new ConfigFile(
new ClassPathResource("jaas-sample-kafka-only.conf").getURI());
@@ -107,7 +107,7 @@ class KafkaBinderJaasInitializerListenerTest {
}
@Test
void testConfigurationParsedCorrectlyWithKafkaClientAndNonDefaultControlFlag()
void configurationParsedCorrectlyWithKafkaClientAndNonDefaultControlFlag()
throws Exception {
ConfigFile configFile = new ConfigFile(
new ClassPathResource("jaas-sample-kafka-only.conf").getURI());

View File

@@ -379,7 +379,7 @@ class KafkaBinderTests extends
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
void testDefaultHeaderMapper() throws Exception {
void defaultHeaderMapper() throws Exception {
Binder binder = getBinder();
BindingProperties producerBindingProperties = createProducerBindingProperties(
@@ -438,7 +438,7 @@ class KafkaBinderTests extends
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
void testCustomHeaderMapper() throws Exception {
void customHeaderMapper() throws Exception {
KafkaBinderConfigurationProperties binderConfiguration = createConfigurationProperties();
binderConfiguration.setHeaderMapperBeanName("headerMapper");
@@ -517,7 +517,7 @@ class KafkaBinderTests extends
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
void testWellKnownHeaderMapperWithBeanNameKafkaHeaderMapper() throws Exception {
void wellKnownHeaderMapperWithBeanNameKafkaHeaderMapper() throws Exception {
KafkaBinderConfigurationProperties binderConfiguration = createConfigurationProperties();
@@ -1050,37 +1050,37 @@ class KafkaBinderTests extends
}
@Test
void testDlqAndRetry() throws Exception {
void dlqAndRetry() throws Exception {
testDlqGuts(true, null, null, false, false);
}
@Test
void testDlqAndRetryTransactional() throws Exception {
void dlqAndRetryTransactional() throws Exception {
testDlqGuts(true, null, null, true, false);
}
@Test
void testDlq() throws Exception {
void dlq() throws Exception {
testDlqGuts(false, null, 3, false, false);
}
@Test
void testDlqWithDlqDestinationResolver() throws Exception {
void dlqWithDlqDestinationResolver() throws Exception {
testDlqGuts(false, null, 3, false, true);
}
@Test
void testDlqTransactional() throws Exception {
void dlqTransactional() throws Exception {
testDlqGuts(false, null, 3, true, false);
}
@Test
void testDlqNone() throws Exception {
void dlqNone() throws Exception {
testDlqGuts(false, HeaderMode.none, 1, false, false);
}
@Test
void testDlqEmbedded() throws Exception {
void dlqEmbedded() throws Exception {
testDlqGuts(false, HeaderMode.embeddedHeaders, 3, false, false);
}
@@ -1317,7 +1317,7 @@ class KafkaBinderTests extends
@Test
@SuppressWarnings("unchecked")
void testDefaultAutoCommitOnErrorWithDlq() throws Exception {
void defaultAutoCommitOnErrorWithDlq() throws Exception {
Binder binder = getBinder();
ExtendedProducerProperties<KafkaProducerProperties> producerProperties = createProducerProperties();
BindingProperties producerBindingProperties = createProducerBindingProperties(
@@ -1394,7 +1394,7 @@ class KafkaBinderTests extends
@Test
@SuppressWarnings("unchecked")
void testRetriesWithoutDlq() throws Exception {
void retriesWithoutDlq() throws Exception {
Binder binder = getBinder();
ExtendedProducerProperties<KafkaProducerProperties> producerProperties = createProducerProperties();
BindingProperties producerBindingProperties = createProducerBindingProperties(
@@ -1439,7 +1439,7 @@ class KafkaBinderTests extends
@Test
@SuppressWarnings("unchecked")
void testCommonErrorHandlerBeanNameOnConsumerBinding() throws Exception {
void commonErrorHandlerBeanNameOnConsumerBinding() throws Exception {
Binder binder = getBinder();
ExtendedProducerProperties<KafkaProducerProperties> producerProperties = createProducerProperties();
BindingProperties producerBindingProperties = createProducerBindingProperties(
@@ -1502,7 +1502,7 @@ class KafkaBinderTests extends
//See https://github.com/spring-cloud/spring-cloud-stream-binder-kafka/issues/870 for motivation for this test.
@Test
@SuppressWarnings("unchecked")
void testAutoCommitOnErrorWhenManualAcknowledgement() throws Exception {
void autoCommitOnErrorWhenManualAcknowledgement() throws Exception {
Binder binder = getBinder();
ExtendedProducerProperties<KafkaProducerProperties> producerProperties = createProducerProperties();
BindingProperties producerBindingProperties = createProducerBindingProperties(
@@ -1582,7 +1582,7 @@ class KafkaBinderTests extends
@Test
@SuppressWarnings("unchecked")
void testConfigurableDlqName() throws Exception {
void configurableDlqName() throws Exception {
Binder binder = getBinder();
ExtendedProducerProperties<KafkaProducerProperties> producerProperties = createProducerProperties();
@@ -1661,7 +1661,7 @@ class KafkaBinderTests extends
}
@Test
public void testValidateKafkaTopicName() {
public void validateKafkaTopicName() {
try {
KafkaTopicUtils.validateTopicName("foo:bar");
fail("Expecting IllegalArgumentException");
@@ -1676,7 +1676,7 @@ class KafkaBinderTests extends
// TODO: This test needs to be rethought - sending byte[] without explicit content
// type
// - yet being converted by the json converter
void testCompression() throws Exception {
void compression() throws Exception {
final KafkaProducerProperties.CompressionType[] codecs = new KafkaProducerProperties.CompressionType[] {
KafkaProducerProperties.CompressionType.none,
KafkaProducerProperties.CompressionType.gzip,
@@ -1729,7 +1729,7 @@ class KafkaBinderTests extends
@Test
@SuppressWarnings("unchecked")
void testEarliest() throws Exception {
void earliest() throws Exception {
Binding<MessageChannel> producerBinding = null;
Binding<MessageChannel> consumerBinding = null;
@@ -1877,7 +1877,7 @@ class KafkaBinderTests extends
@Test
@SuppressWarnings("unchecked")
void testManualAckSucceedsWhenAutoCommitOffsetIsTurnedOff() throws Exception {
void manualAckSucceedsWhenAutoCommitOffsetIsTurnedOff() throws Exception {
Binder binder = getBinder();
DirectChannel moduleOutputChannel = createBindableChannel("output",
@@ -1923,7 +1923,7 @@ class KafkaBinderTests extends
@Test
@SuppressWarnings("unchecked")
void testManualAckIsNotPossibleWhenAutoCommitOffsetIsEnabledOnTheBinder()
void manualAckIsNotPossibleWhenAutoCommitOffsetIsEnabledOnTheBinder()
throws Exception {
Binder binder = getBinder();
@@ -2142,7 +2142,7 @@ class KafkaBinderTests extends
@Test
// @Override
@SuppressWarnings({ "unchecked", "rawtypes" })
void testPartitionedModuleJava() throws Exception {
void partitionedModuleJava() throws Exception {
Binder binder = getBinder();
KafkaBinderConfigurationProperties configurationProperties = createConfigurationProperties();
@@ -2299,7 +2299,7 @@ class KafkaBinderTests extends
@Test
@SuppressWarnings("unchecked")
void testPartitionedModuleJavaWithRawMode() throws Exception {
void partitionedModuleJavaWithRawMode() throws Exception {
Binder binder = getBinder();
ExtendedProducerProperties<KafkaProducerProperties> properties = createProducerProperties();
properties.setHeaderMode(HeaderMode.none);
@@ -2362,7 +2362,7 @@ class KafkaBinderTests extends
@Test
@SuppressWarnings("unchecked")
void testPartitionedModuleSpELWithRawMode() throws Exception {
void partitionedModuleSpELWithRawMode() throws Exception {
Binder binder = getBinder();
ExtendedProducerProperties<KafkaProducerProperties> properties = createProducerProperties();
properties.setPartitionKeyExpression(
@@ -2434,7 +2434,7 @@ class KafkaBinderTests extends
@Test
@SuppressWarnings({ "unchecked", "rawtypes" })
void testPartitionedNative() throws Exception {
void partitionedNative() throws Exception {
Binder binder = getBinder();
ExtendedProducerProperties<KafkaProducerProperties> properties = createProducerProperties();
properties.setPartitionCount(6);
@@ -2512,7 +2512,7 @@ class KafkaBinderTests extends
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
void testAllowNonTransactionalProducerSetting() throws Exception {
void allowNonTransactionalProducerSetting() throws Exception {
AbstractKafkaTestBinder binder = getBinder();
DirectChannel moduleOutputChannel = createBindableChannel("output",
new BindingProperties());
@@ -2534,7 +2534,7 @@ class KafkaBinderTests extends
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
void testProducerErrorChannel() throws Exception {
void producerErrorChannel() throws Exception {
AbstractKafkaTestBinder binder = getBinder();
DirectChannel moduleOutputChannel = createBindableChannel("output",
new BindingProperties());
@@ -2599,7 +2599,7 @@ class KafkaBinderTests extends
@Test
@SuppressWarnings("unchecked")
void testAutoCreateTopicsEnabledSucceeds() throws Exception {
void autoCreateTopicsEnabledSucceeds() throws Exception {
KafkaBinderConfigurationProperties configurationProperties = createConfigurationProperties();
configurationProperties.setAutoCreateTopics(true);
Binder binder = getBinder(configurationProperties);
@@ -2615,7 +2615,7 @@ class KafkaBinderTests extends
@Test
@SuppressWarnings("unchecked")
void testCustomPartitionCountOverridesDefaultIfLarger() throws Exception {
void customPartitionCountOverridesDefaultIfLarger() throws Exception {
var testPayload = new byte[2048];
Arrays.fill(testPayload, (byte) 65);
KafkaBinderConfigurationProperties binderConfiguration = createConfigurationProperties();
@@ -2652,7 +2652,7 @@ class KafkaBinderTests extends
@Test
@SuppressWarnings("unchecked")
void testCustomPartitionCountDoesNotOverridePartitioningIfSmaller()
void customPartitionCountDoesNotOverridePartitioningIfSmaller()
throws Exception {
var testPayload = new byte[2048];
Arrays.fill(testPayload, (byte) 65);
@@ -2690,7 +2690,7 @@ class KafkaBinderTests extends
@Test
@SuppressWarnings("unchecked")
void testDynamicKeyExpression() throws Exception {
void dynamicKeyExpression() throws Exception {
Binder binder = getBinder(createConfigurationProperties());
var moduleInputChannel = new QueueChannel();
ExtendedProducerProperties<KafkaProducerProperties> producerProperties = createProducerProperties();
@@ -2724,7 +2724,7 @@ class KafkaBinderTests extends
@Test
@SuppressWarnings("unchecked")
void testCustomPartitionCountOverridesPartitioningIfLarger() throws Exception {
void customPartitionCountOverridesPartitioningIfLarger() throws Exception {
var testPayload = new byte[2048];
Arrays.fill(testPayload, (byte) 65);
KafkaBinderConfigurationProperties binderConfiguration = createConfigurationProperties();
@@ -2760,7 +2760,7 @@ class KafkaBinderTests extends
@Test
@SuppressWarnings("unchecked")
void testDefaultConsumerStartsAtEarliest() throws Exception {
void defaultConsumerStartsAtEarliest() throws Exception {
Binder binder = getBinder(createConfigurationProperties());
BindingProperties producerBindingProperties = createProducerBindingProperties(
@@ -2826,7 +2826,7 @@ class KafkaBinderTests extends
@Test
@SuppressWarnings("unchecked")
void testResume() throws Exception {
void resume() throws Exception {
Binding<MessageChannel> producerBinding = null;
Binding<MessageChannel> consumerBinding = null;
@@ -2921,7 +2921,7 @@ class KafkaBinderTests extends
@Test
@SuppressWarnings("unchecked")
void testSyncProducerMetadata() throws Exception {
void syncProducerMetadata() throws Exception {
Binder binder = getBinder(createConfigurationProperties());
var output = new DirectChannel();
String testTopicName = UUID.randomUUID().toString();
@@ -2941,7 +2941,7 @@ class KafkaBinderTests extends
@Test
@SuppressWarnings("unchecked")
void testSendTimeoutExpressionProducerMetadata() throws Exception {
void sendTimeoutExpressionProducerMetadata() throws Exception {
Binder binder = getBinder(createConfigurationProperties());
var output = new DirectChannel();
String testTopicName = UUID.randomUUID().toString();
@@ -2963,7 +2963,7 @@ class KafkaBinderTests extends
@Test
@SuppressWarnings("unchecked")
void testAutoCreateTopicsDisabledOnBinderStillWorksAsLongAsBrokerCreatesTopic()
void autoCreateTopicsDisabledOnBinderStillWorksAsLongAsBrokerCreatesTopic()
throws Exception {
KafkaBinderConfigurationProperties configurationProperties = createConfigurationProperties();
configurationProperties.setAutoCreateTopics(false);
@@ -3010,7 +3010,7 @@ class KafkaBinderTests extends
@Test
@SuppressWarnings("unchecked")
void testAutoConfigureTopicsDisabledSucceedsIfTopicExisting()
void autoConfigureTopicsDisabledSucceedsIfTopicExisting()
throws Throwable {
KafkaBinderConfigurationProperties configurationProperties = createConfigurationProperties();
@@ -3030,7 +3030,7 @@ class KafkaBinderTests extends
@Test
@SuppressWarnings("unchecked")
void testPartitionCountIncreasedIfAutoAddPartitionsSet() throws Throwable {
void partitionCountIncreasedIfAutoAddPartitionsSet() throws Throwable {
KafkaBinderConfigurationProperties configurationProperties = createConfigurationProperties();
String testTopicName = "existing" + System.currentTimeMillis();
@@ -3049,7 +3049,7 @@ class KafkaBinderTests extends
@Test
@SuppressWarnings("unchecked")
void testAutoAddPartitionsDisabledSucceedsIfTopicUnderPartitionedAndAutoRebalanceEnabled()
void autoAddPartitionsDisabledSucceedsIfTopicUnderPartitionedAndAutoRebalanceEnabled()
throws Throwable {
KafkaBinderConfigurationProperties configurationProperties = createConfigurationProperties();
@@ -3076,7 +3076,7 @@ class KafkaBinderTests extends
@Test
@SuppressWarnings("unchecked")
void testAutoAddPartitionsDisabledFailsIfTopicUnderPartitionedAndAutoRebalanceDisabled()
void autoAddPartitionsDisabledFailsIfTopicUnderPartitionedAndAutoRebalanceDisabled()
throws Throwable {
KafkaBinderConfigurationProperties configurationProperties = createConfigurationProperties();
@@ -3105,7 +3105,7 @@ class KafkaBinderTests extends
@Test
@SuppressWarnings("unchecked")
void testAutoAddPartitionsDisabledSucceedsIfTopicPartitionedCorrectly()
void autoAddPartitionsDisabledSucceedsIfTopicPartitionedCorrectly()
throws Throwable {
Binding<?> binding = null;
try {
@@ -3149,7 +3149,7 @@ class KafkaBinderTests extends
@Test
@SuppressWarnings("unchecked")
void testPartitionCountNotReduced() throws Throwable {
void partitionCountNotReduced() throws Throwable {
String testTopicName = "existing" + System.currentTimeMillis();
KafkaBinderConfigurationProperties configurationProperties = createConfigurationProperties();
@@ -3173,7 +3173,7 @@ class KafkaBinderTests extends
@Test
@SuppressWarnings("unchecked")
void testConsumerDefaultDeserializer() throws Throwable {
void consumerDefaultDeserializer() throws Throwable {
Binding<?> binding = null;
try {
KafkaBinderConfigurationProperties configurationProperties = createConfigurationProperties();
@@ -3205,7 +3205,7 @@ class KafkaBinderTests extends
@Test
@SuppressWarnings("unchecked")
void testConsumerCustomDeserializer() throws Exception {
void consumerCustomDeserializer() throws Exception {
Binding<?> binding = null;
try {
KafkaBinderConfigurationProperties configurationProperties = createConfigurationProperties();
@@ -3244,7 +3244,7 @@ class KafkaBinderTests extends
@Test
@SuppressWarnings({ "unchecked", "rawtypes" })
void testNativeSerializationWithCustomSerializerDeserializer()
void nativeSerializationWithCustomSerializerDeserializer()
throws Exception {
Binding<?> producerBinding = null;
Binding<?> consumerBinding = null;
@@ -3307,7 +3307,7 @@ class KafkaBinderTests extends
@Test
@SuppressWarnings({ "unchecked", "rawtypes" })
void testNativeSerializationWithCustomSerializerDeserializerBytesPayload()
void nativeSerializationWithCustomSerializerDeserializerBytesPayload()
throws Exception {
Binding<?> producerBinding = null;
Binding<?> consumerBinding = null;
@@ -3366,7 +3366,7 @@ class KafkaBinderTests extends
@Test
@SuppressWarnings("unchecked")
void testBuiltinSerialization() throws Exception {
void builtinSerialization() throws Exception {
Binding<?> producerBinding = null;
Binding<?> consumerBinding = null;
try {
@@ -3529,7 +3529,7 @@ class KafkaBinderTests extends
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
void testPolledConsumer() throws Exception {
void polledConsumer() throws Exception {
KafkaTestBinder binder = getBinder();
PollableSource<MessageHandler> inboundBindTarget = new DefaultPollableMessageSource(
this.messageConverter);
@@ -3583,7 +3583,7 @@ class KafkaBinderTests extends
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
void testPolledConsumerRequeue() throws Exception {
void polledConsumerRequeue() throws Exception {
KafkaTestBinder binder = getBinder();
PollableSource<MessageHandler> inboundBindTarget = new DefaultPollableMessageSource(
this.messageConverter);
@@ -3617,7 +3617,7 @@ class KafkaBinderTests extends
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
void testPolledConsumerWithDlq() throws Exception {
void polledConsumerWithDlq() throws Exception {
KafkaTestBinder binder = getBinder();
PollableSource<MessageHandler> inboundBindTarget = new DefaultPollableMessageSource(
this.messageConverter);
@@ -3662,7 +3662,7 @@ class KafkaBinderTests extends
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
void testTopicPatterns() throws Exception {
void topicPatterns() throws Exception {
try (AdminClient admin = AdminClient.create(
Collections.singletonMap(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG,
embeddedKafka.getBrokersAsString()))) {
@@ -3695,7 +3695,7 @@ class KafkaBinderTests extends
}
@Test
void testSameTopicCannotBeProvisionedAgain() throws Throwable {
void sameTopicCannotBeProvisionedAgain() throws Throwable {
var latch = new CountDownLatch(1);
try (AdminClient admin = AdminClient.create(
Collections.singletonMap(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG,
@@ -3719,7 +3719,7 @@ class KafkaBinderTests extends
@Test
@SuppressWarnings("unchecked")
void testResetOffsets() throws Exception {
void resetOffsets() throws Exception {
Binding<?> producerBinding = null;
Binding<?> consumerBinding = null;
try {
@@ -3793,7 +3793,7 @@ class KafkaBinderTests extends
@Test
@SuppressWarnings("unchecked")
void testRecordMetadata() throws Exception {
void recordMetadata() throws Exception {
Binding<?> producerBinding = null;
try {
String testPayload = "test";
@@ -3830,7 +3830,7 @@ class KafkaBinderTests extends
@Test
@SuppressWarnings("unchecked")
void testMessageKeyInPayload() throws Exception {
void messageKeyInPayload() throws Exception {
Binding<?> producerBinding = null;
try {
String testPayload = "test";
@@ -3867,17 +3867,17 @@ class KafkaBinderTests extends
}
@Test
void testInternalHeadersNotPropagated() throws Exception {
void internalHeadersNotPropagated() throws Exception {
testInternalHeadersNotPropagatedGuts("propagate.1", null, null);
}
@Test
void testInternalHeadersNotPropagatedCustomHeader() throws Exception {
void internalHeadersNotPropagatedCustomHeader() throws Exception {
testInternalHeadersNotPropagatedGuts("propagate.2", new String[] { "foo", "*" }, null);
}
@Test
void testInternalHeadersNotPropagatedCustomMapper() throws Exception {
void internalHeadersNotPropagatedCustomMapper() throws Exception {
testInternalHeadersNotPropagatedGuts("propagate.3", null, new BinderHeaderMapper("*"));
}
@@ -3960,7 +3960,7 @@ class KafkaBinderTests extends
}
@Test
void testNoBrokerOverride() throws Exception {
void noBrokerOverride() throws Exception {
Binder binder = getBinder();
ExtendedProducerProperties<KafkaProducerProperties> producerProperties = createProducerProperties();
producerProperties.getExtension().getConfiguration().put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, "foo");
@@ -3980,7 +3980,7 @@ class KafkaBinderTests extends
}
@Test
void testObservationEnabledOnTheBinder() throws Exception {
void observationEnabledOnTheBinder() throws Exception {
KafkaBinderConfigurationProperties kafkaBinderConfigurationProperties = createConfigurationProperties();
kafkaBinderConfigurationProperties.setEnableObservation(true);
AbstractKafkaTestBinder binder = getBinder(kafkaBinderConfigurationProperties);
@@ -3990,7 +3990,7 @@ class KafkaBinderTests extends
@SuppressWarnings("rawtypes")
@Test
void testObservationEnabledThroughProducerMessageHandlerCustomizer() throws Exception {
void observationEnabledThroughProducerMessageHandlerCustomizer() throws Exception {
AbstractKafkaTestBinder binder = getBinder();
KafkaMessageChannelBinder kafkaMessageChannelBinder = binder.getCoreBinder();
kafkaMessageChannelBinder.setProducerMessageHandlerCustomizer(
@@ -4001,7 +4001,7 @@ class KafkaBinderTests extends
}
@Test
void testDynamicPartitionUpdates() throws Exception {
void dynamicPartitionUpdates() throws Exception {
Binder binder = getBinder();
ExtendedProducerProperties<KafkaProducerProperties> properties = createProducerProperties();
properties.setPartitionKeyExpression(

View File

@@ -73,7 +73,7 @@ import static org.mockito.Mockito.verify;
class KafkaBinderUnitTests {
@Test
void testPropertyOverrides() throws Exception {
void propertyOverrides() throws Exception {
KafkaProperties kafkaProperties = new TestKafkaProperties();
KafkaBinderConfigurationProperties binderConfigurationProperties = new KafkaBinderConfigurationProperties(
kafkaProperties);
@@ -120,7 +120,7 @@ class KafkaBinderUnitTests {
}
@Test
void testMergedConsumerProperties() {
void mergedConsumerProperties() {
KafkaProperties bootProps = new TestKafkaProperties();
bootProps.getConsumer().getProperties()
.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "bar");
@@ -137,7 +137,7 @@ class KafkaBinderUnitTests {
}
@Test
void testMergedProducerProperties() {
void mergedProducerProperties() {
KafkaProperties bootProps = new TestKafkaProperties();
bootProps.getProducer().getProperties().put(ProducerConfig.RETRIES_CONFIG, "bar");
KafkaBinderConfigurationProperties props = new KafkaBinderConfigurationProperties(
@@ -153,25 +153,25 @@ class KafkaBinderUnitTests {
}
@Test
void testOffsetResetWithGroupManagementEarliest() throws Exception {
void offsetResetWithGroupManagementEarliest() throws Exception {
testOffsetResetWithGroupManagement(true, true, "foo-100",
"testOffsetResetWithGroupManagementEarliest");
}
@Test
void testOffsetResetWithGroupManagementLatest() throws Throwable {
void offsetResetWithGroupManagementLatest() throws Throwable {
testOffsetResetWithGroupManagement(false, true, "foo-101",
"testOffsetResetWithGroupManagementLatest");
}
@Test
void testOffsetResetWithManualAssignmentEarliest() throws Exception {
void offsetResetWithManualAssignmentEarliest() throws Exception {
testOffsetResetWithGroupManagement(true, false, "foo-102",
"testOffsetResetWithManualAssignmentEarliest");
}
@Test
void testOffsetResetWithGroupManualAssignmentLatest() throws Throwable {
void offsetResetWithGroupManualAssignmentLatest() throws Throwable {
testOffsetResetWithGroupManagement(false, false, "foo-103",
"testOffsetResetWithGroupManualAssignmentLatest");
}

View File

@@ -70,7 +70,7 @@ class KafkaTransactionTests {
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
void testProducerRunsInTx() {
void producerRunsInTx() {
KafkaProperties kafkaProperties = new TestKafkaProperties();
kafkaProperties.setBootstrapServers(Collections
.singletonList(embeddedKafka.getBrokersAsString()));

View File

@@ -49,7 +49,7 @@ class KafkaBinderCustomHealthCheckTests {
}
@Test
void testCustomHealthIndicatorIsActivated() {
void customHealthIndicatorIsActivated() {
ConfigurableApplicationContext applicationContext = new SpringApplicationBuilder(
CustomHealthCheckApplication.class).web(WebApplicationType.NONE).run(
"--spring.cloud.stream.kafka.binder.brokers="

View File

@@ -71,7 +71,7 @@ class KafkaBinderMeterRegistryTest {
}
@Test
void testMetricsWithSingleBinder() throws Exception {
void metricsWithSingleBinder() throws Exception {
ConfigurableApplicationContext applicationContext = new SpringApplicationBuilder(SimpleApplication.class)
.web(WebApplicationType.NONE)
.run("--spring.cloud.stream.bindings.uppercase-in-0.destination=inputTopic",
@@ -99,7 +99,7 @@ class KafkaBinderMeterRegistryTest {
}
@Test
void testMetricsWithMultiBinders() {
void metricsWithMultiBinders() {
ConfigurableApplicationContext applicationContext = new SpringApplicationBuilder(SimpleApplication.class)
.web(WebApplicationType.NONE)
.run("--spring.cloud.stream.bindings.uppercase-in-0.destination=inputTopic",

View File

@@ -78,7 +78,7 @@ class KafkaBinderActuatorTests {
private KafkaTemplate<?, byte[]> kafkaTemplate;
@Test
void testKafkaBinderMetricsExposed() {
void kafkaBinderMetricsExposed() {
this.kafkaTemplate.send("input", null, "foo".getBytes());
this.kafkaTemplate.flush();
@@ -89,7 +89,7 @@ class KafkaBinderActuatorTests {
@Test
@Disabled
void testKafkaBinderMetricsWhenNoMicrometer() {
void kafkaBinderMetricsWhenNoMicrometer() {
new ApplicationContextRunner().withUserConfiguration(KafkaMetricsTestConfig.class)
.withPropertyValues(
"spring.cloud.stream.bindings.input.group", KafkaBinderActuatorTests.TEST_CONSUMER_GROUP,

View File

@@ -76,7 +76,7 @@ class KafkaBinderExtendedPropertiesTest {
private ConfigurableApplicationContext context;
@Test
void testKafkaBinderExtendedProperties() throws Exception {
void kafkaBinderExtendedProperties() throws Exception {
BinderFactory binderFactory = context.getBeanFactory()
.getBean(BinderFactory.class);

View File

@@ -50,7 +50,7 @@ class KafkaBindingServiceTests {
private ApplicationContext context;
@Test
void testKafkaBinderOverridesBindingPartitionCountToTopicPartitionsIfHigher() {
void kafkaBinderOverridesBindingPartitionCountToTopicPartitionsIfHigher() {
final StreamBridge streamBridge = this.context.getBean(StreamBridge.class);
GenericMessage<String> message = new GenericMessage<>("foo", Map.of("partitionKey", "key1"));
streamBridge.send("kafka-binding-service-test", message);

View File

@@ -66,7 +66,7 @@ class KafkaConfigCustomizationTests {
EmbeddedKafkaBroker embeddedKafkaBroker;
@Test
void testBothConsumerAndProducerConfigsCanBeCustomized() throws InterruptedException {
void bothConsumerAndProducerConfigsCanBeCustomized() throws InterruptedException {
Map<String, Object> producerProps = KafkaTestUtils
.producerProps(embeddedKafkaBroker);
KafkaTemplate<Integer, String> template = new KafkaTemplate<>(

View File

@@ -59,7 +59,7 @@ class KafkaNullConverterTest {
private KafkaNullConverterTestConfig config;
@Test
void testKafkaNullConverterOutput() throws InterruptedException {
void kafkaNullConverterOutput() throws InterruptedException {
final StreamBridge streamBridge = context.getBean(StreamBridge.class);
streamBridge.send("kafkaNullOutput", new GenericMessage<>(KafkaNull.INSTANCE));
@@ -69,7 +69,7 @@ class KafkaNullConverterTest {
}
@Test
void testKafkaNullConverterInput() throws InterruptedException {
void kafkaNullConverterInput() throws InterruptedException {
final MessageChannel kafkaNullInput = context.getBean("kafkaNullInput", MessageChannel.class);

View File

@@ -77,7 +77,7 @@ class ProducerOnlyTransactionTests {
EmbeddedKafkaBroker embeddedKafkaBrokera;
@Test
void testProducerTx() {
void producerTx() {
final StreamBridge streamBridge = context.getBean(StreamBridge.class);
this.sender.DoInTransaction(streamBridge);
assertThat(this.sender.isInTx()).isTrue();

View File

@@ -37,7 +37,7 @@ import static org.assertj.core.api.Assertions.assertThat;
class DisabledKafkaBinderTopicPropertiesUpdateTest extends BaseKafkaBinderTopicPropertiesUpdateTest {
@Test
void testKafkaBinderShouldNotUpdateTopicConfigurationOnDisabledFeature() throws Exception {
void kafkaBinderShouldNotUpdateTopicConfigurationOnDisabledFeature() throws Exception {
Map<String, Object> adminClientConfig = new HashMap<>();
adminClientConfig.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, embeddedKafka.getBrokersAsString());
AdminClient adminClient = AdminClient.create(adminClientConfig);

View File

@@ -40,7 +40,7 @@ import static org.assertj.core.api.Assertions.assertThat;
class KafkaBinderTopicPropertiesUpdateTest extends BaseKafkaBinderTopicPropertiesUpdateTest {
@Test
void testKafkaBinderUpdateTopicConfiguration() throws Exception {
void kafkaBinderUpdateTopicConfiguration() throws Exception {
Map<String, Object> adminClientConfig = new HashMap<>();
adminClientConfig.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, embeddedKafka.getBrokersAsString());
AdminClient adminClient = AdminClient.create(adminClientConfig);

View File

@@ -84,7 +84,7 @@ class ConsumerProducerTransactionTests {
private ApplicationContext context;
@Test
public void testProducerRunsInConsumerTransaction() throws InterruptedException {
public void producerRunsInConsumerTransaction() throws InterruptedException {
assertThat(this.config.latch.await(10, TimeUnit.SECONDS)).isTrue();
assertThat(this.config.outs).containsExactlyInAnyOrder("ONE", "THREE");
}