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
  • Field Details

    • logger

      protected final org.apache.commons.logging.Log logger
    • testBinder

      protected B extends AbstractTestBinder<? extends org.springframework.cloud.stream.binder.AbstractBinder<org.springframework.messaging.MessageChannel,CP,PP>,CP,PP> testBinder
    • messageConverter

      protected org.springframework.messaging.converter.SmartMessageConverter messageConverter
    • applicationContext

      protected org.springframework.context.support.GenericApplicationContext applicationContext
    • timeoutMultiplier

      protected double timeoutMultiplier
      Subclasses 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 the timeoutMultiplier).
    • 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

      @Test public void testClean(org.junit.jupiter.api.TestInfo testInfo) throws Exception
      Throws:
      Exception
    • testSendAndReceive

      @Test public void testSendAndReceive(org.junit.jupiter.api.TestInfo testInfo) throws Exception
      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

      protected abstract B getBinder() throws Exception
      Throws:
      Exception
    • createConsumerProperties

      protected abstract CP createConsumerProperties()
    • createProducerProperties

      protected abstract PP createProducerProperties(org.junit.jupiter.api.TestInfo testInfo)
    • 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

      protected void binderBindUnbindLatency() throws InterruptedException
      If appropriate, let the binder middleware settle down a bit while binding/unbinding actually happens.
      Throws:
      InterruptedException
    • spyOn

      public abstract Spy spyOn(String name)
      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

      protected String 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.