camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pavan <>
Subject Help on Mock for Async calls
Date Mon, 10 Sep 2012 07:58:41 GMT

I am new to Camel.

I am trying to simulate the endpoint using MockEndPoints. The objective is
the mock the endpoint and verify the headers received.

Following is my code: -

import org.apache.camel.impl.DefaultExchange;
import org.apache.camel.test.CamelTestSupport;

public class TestAsyncCalls extends CamelTestSupport {
    public String isMockEndpoints() {
        return "ahc*";
	public void testmakeAsyncNSApiLoginCall() {
		try {
			DefaultExchange dfex = new DefaultExchange(context);
			dfex.getIn().setHeader("username", "admin");
			dfex.getIn().setHeader("password", "admin");
			template.asyncSend("ahc:<some uri>", dfex);
		} catch (Exception e) {
			Assert.assertTrue("Failed to make async call to nsapi login", false);

I was expecting the "expectedHeaderReceived()" to fail, since the username
set in the exchange differs. But when I run it, it does not fail. What else
need I be doing to get it to work? Please help.

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message