HttpComponent component = new HttpComponent();
component.getConfiguration().setStreamingEnabled(streaming);
container.activateComponent(component, "HttpProviderTest");
// Add a receiver component
Receiver receiver = new ReceiverComponent();
ActivationSpec asReceiver = new ActivationSpec("receiver", receiver);
asReceiver.setService(new QName("test", "receiver"));
container.activateComponent(asReceiver);
// Add the http receiver
HttpConnector connector = new HttpConnector("localhost", 9192);
connector.setDefaultInOut(false);
ActivationSpec asConnector = new ActivationSpec("connector", connector);
asConnector.setDestinationService(new QName("test", "receiver"));
container.activateComponent(asConnector);
// Start container
container.start();
// Deploy SU
URL url = getClass().getClassLoader().getResource("provider/http.wsdl");
File path = new File(new URI(url.toString()));
path = path.getParentFile();
component.getServiceUnitManager().deploy("provider", path.getAbsolutePath());
component.getServiceUnitManager().start("provider");
// Call it
DefaultServiceMixClient client = new DefaultServiceMixClient(container);
RobustInOnly in = client.createRobustInOnlyExchange();
in.setInterfaceName(new QName("http://http.servicemix.org/Test", "ProviderInterface"));
in.getInMessage().setContent(new StreamSource(new ByteArrayInputStream(msg.getBytes())));
in.getInMessage().setProperty(JbiConstants.HTTP_DESTINATION_URI, "http://localhost:9192/CheckAvailability");
long t0 = System.currentTimeMillis();
client.sendSync(in);
long t1 = System.currentTimeMillis();
assertTrue(in.getStatus() == ExchangeStatus.DONE);
// Check we received the message
receiver.getMessageList().assertMessagesReceived(1);
component.getServiceUnitManager().stop("provider");
component.getServiceUnitManager().shutDown("provider");
component.getServiceUnitManager().undeploy("provider", path.getAbsolutePath());