org.springframework.cloud.stream.binder.Spy Java Examples

The following examples show how to use org.springframework.cloud.stream.binder.Spy. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RabbitBinderTests.java    From spring-cloud-stream-binder-rabbit with Apache License 2.0 5 votes vote down vote up
@Override
public Spy spyOn(final String queue) {
	final RabbitTemplate template = new RabbitTemplate(
			this.rabbitAvailableRule.getResource());
	template.setAfterReceivePostProcessors(
			new DelegatingDecompressingPostProcessor());
	return new Spy() {

		@Override
		public Object receive(boolean expectNull) throws Exception {
			if (expectNull) {
				Thread.sleep(50);
				return template.receiveAndConvert(
						new RabbitConsumerProperties().getPrefix() + queue);
			}
			Object bar = null;
			int n = 0;
			while (n++ < 100 && bar == null) {
				bar = template.receiveAndConvert(
						new RabbitConsumerProperties().getPrefix() + queue);
				Thread.sleep(100);
			}
			assertThat(n).isLessThan(100)
					.withFailMessage("Message did not arrive in RabbitMQ");
			return bar;
		}

	};
}
 
Example #2
Source File: KinesisBinderTests.java    From spring-cloud-stream-binder-aws-kinesis with Apache License 2.0 4 votes vote down vote up
@Override
public Spy spyOn(String name) {
	throw new UnsupportedOperationException("'spyOn' is not used by Kinesis tests");
}
 
Example #3
Source File: PubSubMessageChannelBinderEmulatorTests.java    From spring-cloud-gcp with Apache License 2.0 4 votes vote down vote up
@Override
public Spy spyOn(String name) {
	return null;
}
 
Example #4
Source File: KafkaBinderTests.java    From spring-cloud-stream-binder-kafka with Apache License 2.0 4 votes vote down vote up
@Override
public Spy spyOn(final String name) {
	throw new UnsupportedOperationException("'spyOn' is not used by Kafka tests");
}