use of org.springframework.xml.transform.StringSource in project spring-integration by spring-projects.
the class UnmarshallingTransformerTests method testMessageReturnValue.
@Test
public void testMessageReturnValue() {
Unmarshaller unmarshaller = new TestUnmarshaller(true);
UnmarshallingTransformer transformer = new UnmarshallingTransformer(unmarshaller);
Object transformed = transformer.transformPayload(new StringSource("foo"));
assertEquals(GenericMessage.class, transformed.getClass());
assertEquals("message: foo", ((Message<?>) transformed).getPayload());
}
use of org.springframework.xml.transform.StringSource in project citrus-samples by christophd.
the class FieldForceJmsConsumer method onMessage.
@Override
public void onMessage(Message message) {
try {
if (message instanceof TextMessage) {
OrderNotification notification = (OrderNotification) unmarshaller.unmarshal(new StringSource(((TextMessage) message).getText()));
fieldForceService.process(notification);
}
} catch (JMSException e) {
throw new ServiceException("Failed to convert field force notification message", e);
} catch (IOException e) {
throw new ServiceException("Failed to read field force notification message", e);
}
}
Aggregations