use of org.springframework.amqp.support.converter.Jackson2JsonMessageConverter in project spring-integration by spring-projects.
the class DefaultAmqpHeaderMapperTests method jsonTypeIdNotOverwritten.
// INT-2090
@Test
public void jsonTypeIdNotOverwritten() {
DefaultAmqpHeaderMapper headerMapper = DefaultAmqpHeaderMapper.inboundMapper();
MessageConverter converter = new Jackson2JsonMessageConverter();
MessageProperties amqpProperties = new MessageProperties();
converter.toMessage("123", amqpProperties);
Map<String, Object> headerMap = new HashMap<String, Object>();
headerMap.put("__TypeId__", "java.lang.Integer");
MessageHeaders integrationHeaders = new MessageHeaders(headerMap);
headerMapper.fromHeadersToRequest(integrationHeaders, amqpProperties);
assertEquals("java.lang.String", amqpProperties.getHeaders().get("__TypeId__"));
Object result = converter.fromMessage(new Message("123".getBytes(), amqpProperties));
assertEquals(String.class, result.getClass());
}
Aggregations