use of org.apache.camel.impl.DefaultMessage in project camel by apache.
the class BeanInfoAMoreComplexOverloadedTest method testRequestA.
public void testRequestA() throws Exception {
BeanInfo beanInfo = new BeanInfo(context, Bean.class);
Message message = new DefaultMessage();
message.setBody(new RequestA());
Exchange exchange = new DefaultExchange(context);
exchange.setIn(message);
MethodInvocation methodInvocation = beanInfo.createInvocation(new Bean(), exchange);
Method method = methodInvocation.getMethod();
assertEquals("doSomething", method.getName());
assertEquals(RequestA.class, method.getGenericParameterTypes()[0]);
}
use of org.apache.camel.impl.DefaultMessage in project camel by apache.
the class BeanInfoOverloadedTest method testBeanInfoOverloaded.
public void testBeanInfoOverloaded() throws Exception {
BeanInfo beanInfo = new BeanInfo(context, Bean.class);
Message message = new DefaultMessage();
message.setBody(new RequestB());
Exchange exchange = new DefaultExchange(context);
exchange.setIn(message);
MethodInvocation methodInvocation = beanInfo.createInvocation(new Bean(), exchange);
Method method = methodInvocation.getMethod();
assertEquals("doSomething", method.getName());
assertEquals(RequestB.class, method.getGenericParameterTypes()[0]);
}
use of org.apache.camel.impl.DefaultMessage in project camel by apache.
the class DockerConfigurationTest method testPropertyfromEndpointProperties.
@Test
public void testPropertyfromEndpointProperties() {
String host = "camelhost";
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put(DockerHelper.transformFromHeaderName(DockerConstants.DOCKER_HOST), host);
configuration.setParameters(parameters);
Message message = new DefaultMessage();
String configurationProp = DockerHelper.getProperty(DockerConstants.DOCKER_HOST, configuration, message, String.class);
assertEquals(host, configurationProp);
}
use of org.apache.camel.impl.DefaultMessage in project camel by apache.
the class SplitAttachmentsExpression method extractAttachment.
private Message extractAttachment(Message inMessage, String attachmentName) throws Exception {
final Message outMessage = new DefaultMessage();
outMessage.setHeader(HEADER_NAME, attachmentName);
Object attachment = inMessage.getAttachment(attachmentName).getContent();
if (attachment instanceof InputStream) {
outMessage.setBody(readMimePart((InputStream) attachment));
return outMessage;
} else if (attachment instanceof String || attachment instanceof byte[]) {
outMessage.setBody(attachment);
return outMessage;
} else {
return null;
}
}
use of org.apache.camel.impl.DefaultMessage in project webcert by sklintyg.
the class RouteTest method testWiretappingOfSignedMessages.
@Test
public void testWiretappingOfSignedMessages() throws ModuleException, InterruptedException, IOException {
notificationAggregator.whenAnyExchangeReceived(exchange -> {
Message msg = new DefaultMessage();
exchange.setOut(msg);
});
// Given
when(moduleApi.getIntygFromUtlatande(any())).thenReturn(NotificationTestHelper.createIntyg("luae_fs"));
notificationWSClient.expectedMessageCount(0);
notificationWSClientV3.expectedMessageCount(0);
notificationAggregator.expectedMessageCount(0);
permanentErrorHandlerEndpoint.expectedMessageCount(0);
temporaryErrorHandlerEndpoint.expectedMessageCount(0);
signatWireTap.expectedMessageCount(1);
// When
Map<String, Object> headers = new HashMap<>();
headers.put(NotificationRouteHeaders.INTYGS_TYP, "luae_fs");
headers.put(NotificationRouteHeaders.HANDELSE, HandelsekodEnum.SIGNAT.value());
producerTemplate.sendBodyAndHeaders(createNotificationMessage(SchemaVersion.VERSION_3, "luae_fs"), headers);
// Then
assertIsSatisfied(notificationWSClient);
assertIsSatisfied(notificationWSClientV3);
assertIsSatisfied(notificationAggregator);
assertIsSatisfied(permanentErrorHandlerEndpoint);
assertIsSatisfied(temporaryErrorHandlerEndpoint);
assertIsSatisfied(signatWireTap);
}
Aggregations