[Test Cleanup] Kafka binder tests package private

This commit is contained in:
Soby Chacko
2023-11-01 15:31:03 -04:00
parent 903534085c
commit 60dfce7adc
27 changed files with 45 additions and 46 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2018 the original author or authors.
* Copyright 2014-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.
@@ -27,7 +27,7 @@ import org.springframework.context.ApplicationContext;
* @author Soby Chacko
* @author Gary Russell
*/
public abstract class AbstractKafkaTestBinder extends
abstract class AbstractKafkaTestBinder extends
// @checkstyle:off
AbstractPollableConsumerTestBinder<KafkaMessageChannelBinder, ExtendedConsumerProperties<KafkaConsumerProperties>, ExtendedProducerProperties<KafkaProducerProperties>> {

View File

@@ -53,7 +53,7 @@ import static org.assertj.core.api.Assertions.assertThat;
"spring.cloud.stream.kafka.bindings.output.producer.topic.properties.message.format.version=0.9.0.0",
"spring.main.allow-bean-definition-overriding=true" })
@EnableIntegration
public class AdminConfigTests {
class AdminConfigTests {
@Autowired
private KafkaMessageChannelBinder binder;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018-2022 the original author or authors.
* Copyright 2018-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.
@@ -42,7 +42,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
* @author Soby Chacko
*/
@EmbeddedKafka(brokerProperties = {"auto.create.topics.enable=false"})
public class AutoCreateTopicDisabledTests {
class AutoCreateTopicDisabledTests {
private static final EmbeddedKafkaBroker embeddedKafka = EmbeddedKafkaCondition.getBroker();

View File

@@ -47,7 +47,7 @@ import static org.assertj.core.api.Assertions.assertThat;
*/
@SpringBootTest(classes = { KafkaBinderConfiguration.class })
@TestPropertySource(locations = "classpath:binder-config-autoconfig.properties")
public class KafkaBinderAutoConfigurationPropertiesTest {
class KafkaBinderAutoConfigurationPropertiesTest {
@Autowired
private KafkaMessageChannelBinder kafkaMessageChannelBinder;

View File

@@ -49,7 +49,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@SpringBootTest(classes = { KafkaBinderConfiguration.class, KafkaAutoConfiguration.class,
KafkaBinderConfigurationPropertiesTest.class })
@TestPropertySource(locations = "classpath:binder-config.properties")
public class KafkaBinderConfigurationPropertiesTest {
class KafkaBinderConfigurationPropertiesTest {
@Autowired
private KafkaMessageChannelBinder kafkaMessageChannelBinder;

View File

@@ -55,7 +55,7 @@ import static org.mockito.ArgumentMatchers.any;
* @author Taras Danylchuk
*/
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class KafkaBinderHealthIndicatorTest {
class KafkaBinderHealthIndicatorTest {
private static final String TEST_TOPIC = "test";

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.
@@ -41,7 +41,7 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Soby Chacko
*/
@EmbeddedKafka
public class KafkaBinderJaasInitializerListenerTest {
class KafkaBinderJaasInitializerListenerTest {
private static final String KAFKA_BROKERS_PROPERTY = "spring.cloud.stream.kafka.binder.brokers";

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 @@ import static org.mockito.Mockito.mock;
* @author Tomek Szmytka
* @author Nico Heller
*/
public class KafkaBinderMetricsTest {
class KafkaBinderMetricsTest {
private static final String TEST_TOPIC = "test";

View File

@@ -179,7 +179,7 @@ import static org.mockito.Mockito.verify;
*/
@EmbeddedKafka(count = 1, controlledShutdown = true, topics = "error.pollableDlq.group-pcWithDlq", brokerProperties = {"transaction.state.log.replication.factor=1",
"transaction.state.log.min.isr=1"})
public class KafkaBinderTests extends
class KafkaBinderTests extends
PartitionCapableBinderTests<AbstractKafkaTestBinder, ExtendedConsumerProperties<KafkaConsumerProperties>, ExtendedProducerProperties<KafkaProducerProperties>> {
@@ -4132,15 +4132,15 @@ public class KafkaBinderTests extends
}
public static class Pojo {
static class Pojo {
private String field;
public Pojo() {
Pojo() {
super();
}
public Pojo(String field) {
Pojo(String field) {
this.field = field;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2017-2022 the original author or authors.
* Copyright 2017-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.
@@ -70,7 +70,7 @@ import static org.mockito.Mockito.verify;
* @since 1.2.2
*
*/
public class KafkaBinderUnitTests {
class KafkaBinderUnitTests {
@Test
void testPropertyOverrides() throws Exception {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2018 the original author or authors.
* Copyright 2015-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.
@@ -38,7 +38,7 @@ import org.springframework.kafka.support.ProducerListener;
* @author Gary Russell
* @author Soby Chacko
*/
public class KafkaTestBinder extends AbstractKafkaTestBinder {
class KafkaTestBinder extends AbstractKafkaTestBinder {
KafkaTestBinder(KafkaBinderConfigurationProperties binderConfiguration,
KafkaTopicProvisioner kafkaTopicProvisioner) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018-2022 the original author or authors.
* Copyright 2018-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.
@@ -59,7 +59,7 @@ import static org.mockito.Mockito.spy;
*/
@EmbeddedKafka(count = 1, controlledShutdown = true, brokerProperties = {"transaction.state.log.replication.factor=1",
"transaction.state.log.min.isr=1"})
public class KafkaTransactionTests {
class KafkaTransactionTests {
private static EmbeddedKafkaBroker embeddedKafka;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2019 the original author or authors.
* Copyright 2014-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.
@@ -23,7 +23,7 @@ import org.springframework.messaging.Message;
/**
* @author Marius Bogoevici
*/
public class RawKafkaPartitionTestSupport
class RawKafkaPartitionTestSupport
implements PartitionKeyExtractorStrategy, PartitionSelectorStrategy {
@Override

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018-2019 the original author or authors.
* Copyright 2018-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.
@@ -29,9 +29,9 @@ import org.springframework.boot.autoconfigure.kafka.KafkaProperties;
* @since 2.1
*
*/
public class TestKafkaProperties extends KafkaProperties {
class TestKafkaProperties extends KafkaProperties {
public TestKafkaProperties() {
TestKafkaProperties() {
getConsumer().setKeyDeserializer(ByteArrayDeserializer.class);
getConsumer().setValueDeserializer(ByteArrayDeserializer.class);
getProducer().setKeySerializer(ByteArraySerializer.class);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2022-2022 the original author or authors.
* Copyright 2022-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.
@@ -39,7 +39,7 @@ import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy;
* @author Soby Chacko
*/
@EmbeddedKafka(count = 1, controlledShutdown = true)
public class KafkaBinderCustomHealthCheckTests {
class KafkaBinderCustomHealthCheckTests {
private static EmbeddedKafkaBroker embeddedKafka;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2019-2022 the original author or authors.
* Copyright 2019-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.
@@ -46,7 +46,7 @@ import static org.assertj.core.api.Assertions.assertThatCode;
* @author Soby Chacko
*/
@EmbeddedKafka(count = 1, controlledShutdown = true, partitions = 10, topics = "outputTopic")
public class KafkaBinderMeterRegistryTest {
class KafkaBinderMeterRegistryTest {
private static EmbeddedKafkaBroker embeddedKafka;

View File

@@ -67,7 +67,7 @@ import static org.assertj.core.api.Assertions.assertThat;
)
@DirtiesContext
@EmbeddedKafka(bootstrapServersProperty = "spring.kafka.bootstrap-servers")
public class KafkaBinderActuatorTests {
class KafkaBinderActuatorTests {
static final String TEST_CONSUMER_GROUP = "testGroup-actuatorTests";

View File

@@ -70,7 +70,7 @@ import static org.assertj.core.api.Assertions.assertThat;
"spring.cloud.stream.kafka.bindings.custom-in.consumer.ackEachRecord=false" })
@DirtiesContext
@EmbeddedKafka(bootstrapServersProperty = "spring.kafka.bootstrap-servers")
public class KafkaBinderExtendedPropertiesTest {
class KafkaBinderExtendedPropertiesTest {
@Autowired
private ConfigurableApplicationContext context;

View File

@@ -44,7 +44,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@EmbeddedKafka(topics = "kafka-binding-service-test", controlledShutdown = true, partitions = 4,
bootstrapServersProperty = "spring.kafka.bootstrap-servers")
public class KafkaBindingServiceTests {
class KafkaBindingServiceTests {
@Autowired
private ApplicationContext context;

View File

@@ -56,7 +56,7 @@ import static org.assertj.core.api.Assertions.assertThat;
"spring.cloud.stream.bindings.process-in-0.group=KafkaConfigCustomizationTests.group"})
@DirtiesContext
@EmbeddedKafka(bootstrapServersProperty = "spring.kafka.bootstrap-servers")
public class KafkaConfigCustomizationTests {
class KafkaConfigCustomizationTests {
private static final String KAFKA_BROKERS_PROPERTY = "spring.cloud.stream.kafka.binder.brokers";

View File

@@ -50,7 +50,7 @@ import static org.assertj.core.api.Assertions.assertThat;
"spring.cloud.stream.function.bindings.inputListen-in-0=kafkaNullInput"})
@DirtiesContext
@EmbeddedKafka(bootstrapServersProperty = "spring.kafka.bootstrap-servers")
public class KafkaNullConverterTest {
class KafkaNullConverterTest {
@Autowired
private ApplicationContext context;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2021-2022 the original author or authors.
* Copyright 2021-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.
@@ -61,7 +61,7 @@ import static org.mockito.Mockito.mock;
"spring.cloud.stream.kafka.bindings.retryInContainer-in-0.consumer.enable-dlq=true"})
@EmbeddedKafka(bootstrapServersProperty = "spring.kafka.bootstrap-servers")
@DirtiesContext
public class KafkaRetryDlqBinderOrContainerTests {
class KafkaRetryDlqBinderOrContainerTests {
private static final CountDownLatch latch = new CountDownLatch(2);

View File

@@ -65,7 +65,7 @@ import static org.assertj.core.api.Assertions.assertThat;
@DirtiesContext
@EmbeddedKafka(topics = "output", controlledShutdown = true, brokerProperties = {"transaction.state.log.replication.factor=1",
"transaction.state.log.min.isr=1"}, bootstrapServersProperty = "spring.kafka.bootstrap-servers")
public class ProducerOnlyTransactionTests {
class ProducerOnlyTransactionTests {
@Autowired
private Sender sender;

View File

@@ -42,7 +42,7 @@ import org.springframework.test.annotation.DirtiesContext;
})
@DirtiesContext
@EmbeddedKafka(bootstrapServersProperty = "spring.kafka.bootstrap-servers")
public abstract class BaseKafkaBinderTopicPropertiesUpdateTest {
abstract class BaseKafkaBinderTopicPropertiesUpdateTest {
@Autowired
protected EmbeddedKafkaBroker embeddedKafka;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018-2022 the original author or authors.
* Copyright 2018-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.
@@ -34,7 +34,7 @@ import static org.assertj.core.api.Assertions.assertThat;
/**
* @author Taras Danylchuk
*/
public class DisabledKafkaBinderTopicPropertiesUpdateTest extends BaseKafkaBinderTopicPropertiesUpdateTest {
class DisabledKafkaBinderTopicPropertiesUpdateTest extends BaseKafkaBinderTopicPropertiesUpdateTest {
@Test
void testKafkaBinderShouldNotUpdateTopicConfigurationOnDisabledFeature() throws Exception {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018-2022 the original author or authors.
* Copyright 2018-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.
@@ -37,7 +37,7 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Heiko Does
*/
@TestPropertySource(properties = "spring.cloud.stream.kafka.binder.autoAlterTopics=true")
public class KafkaBinderTopicPropertiesUpdateTest extends BaseKafkaBinderTopicPropertiesUpdateTest {
class KafkaBinderTopicPropertiesUpdateTest extends BaseKafkaBinderTopicPropertiesUpdateTest {
@Test
void testKafkaBinderUpdateTopicConfiguration() throws Exception {

View File

@@ -51,7 +51,6 @@ import static org.mockito.Mockito.mock;
/**
* @author Gary Russell
* @author Soby Chacko
* @since 3.0
*
*/
@@ -76,7 +75,7 @@ import static org.mockito.Mockito.mock;
@DirtiesContext
@EmbeddedKafka(topics = "consumer.producer.txOut", controlledShutdown = true, brokerProperties = {"transaction.state.log.replication.factor=1",
"transaction.state.log.min.isr=1"}, bootstrapServersProperty = "spring.kafka.bootstrap-servers")
public class ConsumerProducerTransactionTests {
class ConsumerProducerTransactionTests {
@Autowired
private Config config;