use of org.springframework.cloud.stream.config.BindingProperties in project spring-cloud-stream by spring-cloud.
the class MessageConverterConfigurerTests method testConfigureOutputChannelWithBadContentType.
// @Test
public void testConfigureOutputChannelWithBadContentType() {
BindingServiceProperties props = new BindingServiceProperties();
BindingProperties bindingProps = new BindingProperties();
bindingProps.setContentType("application/json");
props.setBindings(Collections.singletonMap("foo", bindingProps));
CompositeMessageConverterFactory converterFactory = new CompositeMessageConverterFactory(Collections.<MessageConverter>emptyList(), null);
MessageConverterConfigurer configurer = new MessageConverterConfigurer(props, converterFactory);
QueueChannel out = new QueueChannel();
configurer.configureOutputChannel(out, "foo");
out.send(new GenericMessage<Foo>(new Foo(), Collections.<String, Object>singletonMap(MessageHeaders.CONTENT_TYPE, "bad/ct")));
Message<?> received = out.receive(0);
assertThat(received).isNotNull();
assertThat(received.getPayload()).isInstanceOf(Foo.class);
}
use of org.springframework.cloud.stream.config.BindingProperties in project spring-cloud-stream by spring-cloud.
the class SourceBindingWithGlobalPropertiesTest method testGlobalPropertiesSet.
@Test
public void testGlobalPropertiesSet() {
BindingProperties bindingProperties = serviceProperties.getBindingProperties(Source.OUTPUT);
Assertions.assertThat(bindingProperties.getContentType()).isEqualTo("application/json");
Assertions.assertThat(bindingProperties.getDestination()).isEqualTo("ticktock");
Assertions.assertThat(bindingProperties.getProducer().getRequiredGroups()).containsExactly("someGroup");
Assertions.assertThat(bindingProperties.getProducer().getHeaderMode()).isEqualTo(HeaderMode.none);
}
use of org.springframework.cloud.stream.config.BindingProperties in project spring-cloud-stream by spring-cloud.
the class ChannelsEndpoint method channels.
@ReadOperation
public Map<String, Object> channels() {
ChannelsMetaData map = new ChannelsMetaData();
Map<String, BindingProperties> inputs = map.getInputs();
Map<String, BindingProperties> outputs = map.getOutputs();
for (Bindable factory : this.adapters) {
for (String name : factory.getInputs()) {
inputs.put(name, this.properties.getBindingProperties(name));
}
for (String name : factory.getOutputs()) {
outputs.put(name, this.properties.getBindingProperties(name));
}
}
return new ObjectMapper().convertValue(map, new TypeReference<Map<String, Object>>() {
});
}
use of org.springframework.cloud.stream.config.BindingProperties in project spring-cloud-netflix by spring-cloud.
the class HystrixStreamAutoConfiguration method init.
@PostConstruct
public void init() {
BindingProperties outputBinding = this.bindings.getBindings().get(HystrixStreamClient.OUTPUT);
if (outputBinding == null) {
this.bindings.getBindings().put(HystrixStreamClient.OUTPUT, new BindingProperties());
}
BindingProperties output = this.bindings.getBindings().get(HystrixStreamClient.OUTPUT);
if (output.getDestination() == null) {
output.setDestination(this.properties.getDestination());
}
if (output.getContentType() == null) {
output.setContentType(this.properties.getContentType());
}
}
Aggregations