doTest(client, "http://localhost:" + port + "/bar/baz", "/bar", "/bar/baz");
}
protected void doTest(MuleClient client, final String url, final String contextPath, final String requestPath) throws Exception
{
FunctionalTestComponent testComponent = (FunctionalTestComponent) getComponent(contextPath);
assertNotNull(testComponent);
EventCallback callback = new EventCallback()
{
public void eventReceived(final MuleEventContext context, final Object component) throws Exception
{
MuleMessage msg = context.getMessage();
assertEquals(requestPath, msg.getInboundProperty(HttpConnector.HTTP_REQUEST_PROPERTY));
assertEquals(requestPath, msg.getInboundProperty(HttpConnector.HTTP_REQUEST_PATH_PROPERTY));
assertEquals(contextPath, msg.getInboundProperty(HttpConnector.HTTP_CONTEXT_PATH_PROPERTY));
}
};
testComponent.setEventCallback(callback);
MuleMessage result = client.send(url, "Hello World", null);
assertEquals("Hello World Received", result.getPayloadAsString());
final int status = result.getInboundProperty(HttpConnector.HTTP_STATUS_PROPERTY, 0);
assertEquals(200, status);