receiveAction.setEndpoint(endpoint);
receiveAction.setValidator(validator);
PayloadTemplateMessageBuilder controlMessageBuilder = new PayloadTemplateMessageBuilder();
XmlMessageValidationContext validationContext = new XmlMessageValidationContext();
validationContext.setMessageBuilder(controlMessageBuilder);
controlMessageBuilder.setPayloadData("<TestRequest xmlns=\"http://citrusframework.org/unittest\">" +
"<Message>Hello World!</Message></TestRequest>");
Map<String, String> extractMessageElements = new HashMap<String, String>();
extractMessageElements.put("/pfx:TestRequest/pfx:Message", "messageVar");
XpathPayloadVariableExtractor variableExtractor = new XpathPayloadVariableExtractor();
variableExtractor.setxPathExpressions(extractMessageElements);
receiveAction.addVariableExtractors(variableExtractor);
Map<String, String> namespaces = new HashMap<String, String>();
namespaces.put("pfx", "http://citrusframework.org/unittest");
variableExtractor.setNamespaces(namespaces);
Message controlMessage = new DefaultMessage("<ns0:TestRequest xmlns:ns0=\"http://citrusframework.org/unittest\">" +
"<ns0:Message>Hello World!</ns0:Message></ns0:TestRequest>");
reset(endpoint, consumer, endpointConfiguration);
expect(endpoint.createConsumer()).andReturn(consumer).anyTimes();
expect(endpoint.getEndpointConfiguration()).andReturn(endpointConfiguration).anyTimes();
expect(endpointConfiguration.getTimeout()).andReturn(5000L).anyTimes();
expect(consumer.receive(anyObject(TestContext.class), anyLong())).andReturn(controlMessage).once();
expect(endpoint.getActor()).andReturn(null).anyTimes();
replay(endpoint, consumer, endpointConfiguration);
validationContext.setSchemaValidation(false);
List<ValidationContext> validationContexts = new ArrayList<ValidationContext>();
validationContexts.add(validationContext);
receiveAction.setValidationContexts(validationContexts);
receiveAction.execute(context);