-
Notifications
You must be signed in to change notification settings - Fork 624
Add @EnableTestBinder annotation #2947
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright 2015-2023 the original author or authors. | ||
* Copyright 2015-2024 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. | ||
|
@@ -52,7 +52,7 @@ | |
import org.springframework.cloud.stream.binder.DefaultBinderFactory; | ||
import org.springframework.cloud.stream.binder.DefaultBinderTypeRegistry; | ||
import org.springframework.cloud.stream.binder.ProducerProperties; | ||
import org.springframework.cloud.stream.binder.test.TestChannelBinderConfiguration; | ||
import org.springframework.cloud.stream.binder.test.EnableTestBinder; | ||
import org.springframework.cloud.stream.config.BindingProperties; | ||
import org.springframework.cloud.stream.config.BindingServiceConfiguration; | ||
import org.springframework.cloud.stream.config.BindingServiceProperties; | ||
|
@@ -61,7 +61,6 @@ | |
import org.springframework.context.ApplicationContext; | ||
import org.springframework.context.ConfigurableApplicationContext; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Import; | ||
import org.springframework.integration.channel.DirectChannel; | ||
import org.springframework.integration.test.util.TestUtils; | ||
import org.springframework.messaging.Message; | ||
|
@@ -90,6 +89,7 @@ | |
* @author Michael Michailidis | ||
* @author Chris Bono | ||
* @author Artem Bilan | ||
* @author Kotaro Matsumoto | ||
*/ | ||
class BindingServiceTests { | ||
|
||
|
@@ -591,13 +591,13 @@ private BindingServiceProperties createBindingServiceProperties( | |
return bindingServiceProperties; | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need copyright updates, author tag. |
||
@Import(TestChannelBinderConfiguration.class) | ||
@EnableTestBinder | ||
@EnableAutoConfiguration | ||
public static class DefaultConsumerPropertiesTestSink { | ||
|
||
} | ||
|
||
@Import(TestChannelBinderConfiguration.class) | ||
@EnableTestBinder | ||
@EnableAutoConfiguration | ||
public static class FooConfiguration { | ||
|
||
|
@@ -608,7 +608,7 @@ public Consumer<Message<?>> log() { | |
|
||
} | ||
|
||
@Import(TestChannelBinderConfiguration.class) | ||
@EnableTestBinder | ||
@EnableAutoConfiguration | ||
public static class BarConfiguration { | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright 2018-2023 the original author or authors. | ||
* Copyright 2018-2024 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,8 @@ | |
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.boot.context.properties.ConfigurationPropertiesBindException; | ||
import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
import org.springframework.cloud.stream.binder.test.TestChannelBinderConfiguration; | ||
import org.springframework.cloud.stream.binder.test.EnableTestBinder; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Import; | ||
import org.springframework.validation.annotation.Validated; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need copyright updates, author tag. |
||
|
@@ -41,6 +40,7 @@ | |
/** | ||
* @author Oleg Zhurakousky | ||
* @author Soby Chacko | ||
* @author Kotaro Matsumoto | ||
* | ||
*/ | ||
class BindingHandlerAdviseTests { | ||
|
@@ -76,7 +76,7 @@ void validatedConfigProperties() { | |
.run("--spring.jmx.enabled=false")); | ||
} | ||
|
||
@Import(TestChannelBinderConfiguration.class) | ||
@EnableTestBinder | ||
@EnableAutoConfiguration | ||
public static class NonValidatedConfiguration { | ||
|
||
|
@@ -105,7 +105,7 @@ public void setId(String id) { | |
} | ||
} | ||
|
||
@Import(TestChannelBinderConfiguration.class) | ||
@EnableTestBinder | ||
@EnableAutoConfiguration | ||
public static class ValidatedConfiguration { | ||
|
||
|
@@ -136,7 +136,7 @@ public void setId(String id) { | |
} | ||
} | ||
|
||
@Import(TestChannelBinderConfiguration.class) | ||
@EnableTestBinder | ||
@EnableAutoConfiguration | ||
@EnableConfigurationProperties(ValidatedProps.class) | ||
class SampleConfiguration { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright 2018-2023 the original author or authors. | ||
* Copyright 2018-2024 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,17 +29,17 @@ | |
import org.springframework.cloud.stream.annotation.StreamRetryTemplate; | ||
import org.springframework.cloud.stream.binder.AbstractBinder; | ||
import org.springframework.cloud.stream.binder.ConsumerProperties; | ||
import org.springframework.cloud.stream.binder.test.TestChannelBinderConfiguration; | ||
import org.springframework.cloud.stream.binder.test.EnableTestBinder; | ||
import org.springframework.context.ApplicationContext; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Import; | ||
import org.springframework.retry.support.RetryTemplate; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need copyright updates, author tag. |
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
/** | ||
* @author Oleg Zhurakousky | ||
* @author Soby Chacko | ||
* @author Kotaro Matsumoto | ||
*/ | ||
class RetryTemplateTests { | ||
|
||
|
@@ -82,7 +82,7 @@ void specificCustomRetryTemplate() throws Exception { | |
assertThat(retryTemplate).isEqualTo(retryTemplateTwo); | ||
} | ||
|
||
@Import(TestChannelBinderConfiguration.class) | ||
@EnableTestBinder | ||
@EnableAutoConfiguration | ||
public static class SpecificCustomRetryTemplateConfiguration { | ||
|
||
|
@@ -107,7 +107,7 @@ public Function<String, String> processor() { | |
} | ||
} | ||
|
||
@Import(TestChannelBinderConfiguration.class) | ||
@EnableTestBinder | ||
@EnableAutoConfiguration | ||
public static class SingleCustomRetryTemplateConfiguration { | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright 2024-2024 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. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.springframework.cloud.stream.binder.test; | ||
|
||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
import org.springframework.context.annotation.Import; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add some class level javadoc to this? |
||
/** | ||
* This annotation enables the Spring Integration Test Binder when applied to a class. | ||
* | ||
* Please see {@link TestChannelBinderConfiguration} and {@link TestChannelBinder} for more details. | ||
* | ||
* @author Kotaro Matsumoto | ||
* @see TestChannelBinderConfiguration | ||
* @see TestChannelBinder | ||
*/ | ||
@Target(ElementType.TYPE) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Documented | ||
@Import(TestChannelBinderConfiguration.class) | ||
public @interface EnableTestBinder { | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need copyright updates, author tag.