org.springframework.cloud.stream.binding.BinderAwareChannelResolver Java Examples
The following examples show how to use
org.springframework.cloud.stream.binding.BinderAwareChannelResolver.
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: BinderAwareChannelResolverTests.java From spring-cloud-stream with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") @Before public void setupContext() throws Exception { this.context = new SpringApplicationBuilder( TestChannelBinderConfiguration.getCompleteConfiguration( BinderAwareChannelResolverTests.InterceptorConfiguration.class)) .web(WebApplicationType.NONE).run(); this.resolver = this.context.getBean(BinderAwareChannelResolver.class); this.binder = this.context.getBean(Binder.class); this.bindingServiceProperties = this.context .getBean(BindingServiceProperties.class); this.bindingTargetFactory = this.context .getBean(SubscribableChannelBindingTargetFactory.class); }
Example #2
Source File: BindingServiceConfiguration.java From spring-cloud-stream with Apache License 2.0 | 5 votes |
@SuppressWarnings("rawtypes") @Bean public BinderAwareChannelResolver binderAwareChannelResolver( BindingService bindingService, AbstractBindingTargetFactory<? extends MessageChannel> bindingTargetFactory, DynamicDestinationsBindable dynamicDestinationsBindable, @Nullable BinderAwareChannelResolver.NewDestinationBindingCallback callback) { return new BinderAwareChannelResolver(bindingService, bindingTargetFactory, dynamicDestinationsBindable, callback); }
Example #3
Source File: BinderAwareChannelResolverTests.java From spring-cloud-stream with Apache License 2.0 | 5 votes |
@Test @SuppressWarnings({ "rawtypes", "unchecked" }) public void propertyPassthrough() { Map<String, BindingProperties> bindings = new HashMap<>(); BindingProperties genericProperties = new BindingProperties(); genericProperties.setContentType("text/plain"); bindings.put("foo", genericProperties); this.bindingServiceProperties.setBindings(bindings); Binder binder = mock(Binder.class); Binder binder2 = mock(Binder.class); BinderFactory mockBinderFactory = Mockito.mock(BinderFactory.class); Binding<MessageChannel> fooBinding = Mockito.mock(Binding.class); Binding<MessageChannel> barBinding = Mockito.mock(Binding.class); when(binder.bindProducer(matches("foo"), any(DirectChannel.class), any(ProducerProperties.class))).thenReturn(fooBinding); when(binder2.bindProducer(matches("bar"), any(DirectChannel.class), any(ProducerProperties.class))).thenReturn(barBinding); when(mockBinderFactory.getBinder(null, DirectWithAttributesChannel.class)) .thenReturn(binder); when(mockBinderFactory.getBinder("someTransport", DirectWithAttributesChannel.class)).thenReturn(binder2); BindingService bindingService = new BindingService(this.bindingServiceProperties, mockBinderFactory); BinderAwareChannelResolver resolver = new BinderAwareChannelResolver( bindingService, this.bindingTargetFactory, new DynamicDestinationsBindable()); resolver.setBeanFactory(this.context.getBeanFactory()); SubscribableChannel resolved = (SubscribableChannel) resolver .resolveDestination("foo"); verify(binder).bindProducer(eq("foo"), any(MessageChannel.class), any(ProducerProperties.class)); assertThat(resolved).isSameAs(this.context.getBean("foo")); this.context.close(); }
Example #4
Source File: OutputFactoryServiceImpl.java From Lottor with MIT License | 4 votes |
@Autowired public OutputFactoryServiceImpl(BinderAwareChannelResolver resolver) { this.resolver = resolver; }
Example #5
Source File: StreamStubMessageSender.java From spring-cloud-contract with Apache License 2.0 | 4 votes |
private BinderAwareChannelResolver resolver() { if (this.resolver == null) { this.resolver = context.getBean(BinderAwareChannelResolver.class); } return this.resolver; }