Class AbstractBinderTests<B extends AbstractTestBinder<? extends org.springframework.cloud.stream.binder.AbstractBinder<org.springframework.messaging.MessageChannel,CP,PP>,CP,PP>,CP extends org.springframework.cloud.stream.binder.ConsumerProperties,PP extends org.springframework.cloud.stream.binder.ProducerProperties>
java.lang.Object
org.springframework.cloud.stream.binder.AbstractBinderTests<B,CP,PP>
- Direct Known Subclasses:
PartitionCapableBinderTests
public abstract class AbstractBinderTests<B extends AbstractTestBinder<? extends org.springframework.cloud.stream.binder.AbstractBinder<org.springframework.messaging.MessageChannel,CP,PP>,CP,PP>,CP extends org.springframework.cloud.stream.binder.ConsumerProperties,PP extends org.springframework.cloud.stream.binder.ProducerProperties>
extends Object
- Author:
- Gary Russell, Ilayaperumal Gopinathan, David Turanski, Mark Fisher, Marius Bogoevici, Oleg Zhurakousky, Jacob Severson, Artem Bilan, Soby Chacko
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.springframework.context.support.GenericApplicationContextprotected final org.apache.commons.logging.Logprotected org.springframework.messaging.converter.SmartMessageConverterprotected Bprotected doubleSubclasses may override this default value to have tests wait longer for a message receive, for example if running in an environment that is known to be slow (e.g. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbefore()protected voidIf appropriate, let the binder middleware settle down a bit while binding/unbinding actually happens.voidcleanup()protected org.springframework.integration.channel.DirectChannelcreateBindableChannel(String channelName, org.springframework.cloud.stream.config.BindingProperties bindingProperties) protected org.springframework.integration.channel.DirectChannelcreateBindableChannel(String channelName, org.springframework.cloud.stream.config.BindingProperties bindingProperties, boolean inputChannel) protected org.springframework.cloud.stream.binder.DefaultPollableMessageSourcecreateBindableMessageSource(String bindingName, org.springframework.cloud.stream.config.BindingProperties bindingProperties) protected final org.springframework.cloud.stream.config.BindingPropertiescreateConsumerBindingProperties(CP consumerProperties) protected abstract CPprotected org.springframework.cloud.stream.config.BindingPropertiescreateProducerBindingProperties(PP producerProperties) protected abstract PPcreateProducerProperties(org.junit.jupiter.api.TestInfo testInfo) protected abstract Bprotected StringSet the delimiter that will be used in the message source/target name.protected org.springframework.messaging.Message<?>receive(org.springframework.messaging.PollableChannel channel) Attempt to receive a message on the given channel, waiting up to 1s (times thetimeoutMultiplier).protected org.springframework.messaging.Message<?>receive(org.springframework.messaging.PollableChannel channel, int additionalMultiplier) Attempt to receive a message on the given channel, waiting up to 1s * additionalMultiplier *timeoutMultiplier).abstract SpyCreate a new spy on the given 'queue'.voidtestClean(org.junit.jupiter.api.TestInfo testInfo) voidtestSendAndReceive(org.junit.jupiter.api.TestInfo testInfo) voidtestSendAndReceiveMultipleTopics(org.junit.jupiter.api.TestInfo testInfo) voidtestSendAndReceiveNoOriginalContentType(org.junit.jupiter.api.TestInfo testInfo)
-
Field Details
-
logger
protected final org.apache.commons.logging.Log logger -
testBinder
-
messageConverter
protected org.springframework.messaging.converter.SmartMessageConverter messageConverter -
applicationContext
protected org.springframework.context.support.GenericApplicationContext applicationContext -
timeoutMultiplier
protected double timeoutMultiplierSubclasses may override this default value to have tests wait longer for a message receive, for example if running in an environment that is known to be slow (e.g. travis).
-
-
Constructor Details
-
AbstractBinderTests
public AbstractBinderTests()
-
-
Method Details
-
before
@BeforeEach public void before() -
receive
protected org.springframework.messaging.Message<?> receive(org.springframework.messaging.PollableChannel channel) Attempt to receive a message on the given channel, waiting up to 1s (times thetimeoutMultiplier). -
receive
protected org.springframework.messaging.Message<?> receive(org.springframework.messaging.PollableChannel channel, int additionalMultiplier) Attempt to receive a message on the given channel, waiting up to 1s * additionalMultiplier *timeoutMultiplier). Allows accomodating tests which are slower than normal (e.g. retry). -
testClean
- Throws:
Exception
-
testSendAndReceive
- Throws:
Exception
-
testSendAndReceiveMultipleTopics
@Test public void testSendAndReceiveMultipleTopics(org.junit.jupiter.api.TestInfo testInfo) throws Exception - Throws:
Exception
-
testSendAndReceiveNoOriginalContentType
@Test public void testSendAndReceiveNoOriginalContentType(org.junit.jupiter.api.TestInfo testInfo) throws Exception - Throws:
Exception
-
getBinder
- Throws:
Exception
-
createConsumerProperties
-
createProducerProperties
-
createConsumerBindingProperties
protected final org.springframework.cloud.stream.config.BindingProperties createConsumerBindingProperties(CP consumerProperties) -
createProducerBindingProperties
protected org.springframework.cloud.stream.config.BindingProperties createProducerBindingProperties(PP producerProperties) -
createBindableChannel
protected org.springframework.integration.channel.DirectChannel createBindableChannel(String channelName, org.springframework.cloud.stream.config.BindingProperties bindingProperties) throws Exception - Throws:
Exception
-
createBindableChannel
protected org.springframework.integration.channel.DirectChannel createBindableChannel(String channelName, org.springframework.cloud.stream.config.BindingProperties bindingProperties, boolean inputChannel) throws Exception - Throws:
Exception
-
createBindableMessageSource
protected org.springframework.cloud.stream.binder.DefaultPollableMessageSource createBindableMessageSource(String bindingName, org.springframework.cloud.stream.config.BindingProperties bindingProperties) throws Exception - Throws:
Exception
-
cleanup
@AfterEach public void cleanup() -
binderBindUnbindLatency
If appropriate, let the binder middleware settle down a bit while binding/unbinding actually happens.- Throws:
InterruptedException
-
spyOn
Create a new spy on the given 'queue'. This allows de-correlating the creation of the 'connection' from its actual usage, which may be needed by some implementations to see messages sent after connection creation. -
getDestinationNameDelimiter
Set the delimiter that will be used in the message source/target name. Some brokers may have naming constraints (such as SQS), so this provides a way to override the character being used as a delimiter. The default is a period.
-