};
_domain.getValidatorRegistry().addValidator(helloValidate);
try {
// Provide the service
MockHandler provider = new MockHandler();
ServiceReference service = _domain.createInOnlyService(serviceName, provider);
// Create the exchange and invoke the service
Exchange exchange = service.createExchange();
// Set the message name. NOTE: setting to the to message
// name will not be necessary once the service definition is available
// at runtime
Message msg = exchange.createMessage().setContent(input);
msg.getContext().setProperty(Exchange.CONTENT_TYPE, typeName);
msg.setContent(input);
exchange.send(msg);
// wait for message and verify validation
provider.waitForOKMessage();
Assert.assertEquals(provider.getMessages().poll().getMessage().getContent(), input);
} finally {
// Must remove this validator, otherwise it's there for the following test... will be
// fixed once we get rid of the static service domain.
_domain.getValidatorRegistry().removeValidator(helloValidate);
}