-
Notifications
You must be signed in to change notification settings - Fork 616
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
Add @EnableTestBinder annotation #2947
Changes from 2 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 |
---|---|---|
|
@@ -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; | ||
|
@@ -591,13 +590,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 +607,7 @@ public Consumer<Message<?>> log() { | |
|
||
} | ||
|
||
@Import(TestChannelBinderConfiguration.class) | ||
@EnableTestBinder | ||
@EnableAutoConfiguration | ||
public static class BarConfiguration { | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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. |
||
|
@@ -76,7 +75,7 @@ void validatedConfigProperties() { | |
.run("--spring.jmx.enabled=false")); | ||
} | ||
|
||
@Import(TestChannelBinderConfiguration.class) | ||
@EnableTestBinder | ||
@EnableAutoConfiguration | ||
public static class NonValidatedConfiguration { | ||
|
||
|
@@ -105,7 +104,7 @@ public void setId(String id) { | |
} | ||
} | ||
|
||
@Import(TestChannelBinderConfiguration.class) | ||
@EnableTestBinder | ||
@EnableAutoConfiguration | ||
public static class ValidatedConfiguration { | ||
|
||
|
@@ -136,7 +135,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 |
---|---|---|
|
@@ -29,10 +29,9 @@ | |
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; | ||
|
@@ -82,7 +81,7 @@ void specificCustomRetryTemplate() throws Exception { | |
assertThat(retryTemplate).isEqualTo(retryTemplateTwo); | ||
} | ||
|
||
@Import(TestChannelBinderConfiguration.class) | ||
@EnableTestBinder | ||
@EnableAutoConfiguration | ||
public static class SpecificCustomRetryTemplateConfiguration { | ||
|
||
|
@@ -107,7 +106,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,36 @@ | ||
/* | ||
* 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? |
||
/** | ||
* @author Kotaro Matsumoto | ||
*/ | ||
@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.