Hi again,

this comes from one of my test classes:

  @Test
  public void assortmentTest() throws Exception {

    final String country = getTestProperties().getProperty("country");
final String location = headerLocation(getTestProperties().getProperty("location"));

    CamelTestSupport cts = getCamelTestSupport();

MockEndpoint mock = cts.wireMock("assortmentOut", "activemq:topic:kaufland/store/device/scale/assortment");
    mock.setExpectedMessageCount(1);
    mock.expectedHeaderReceived(HeaderProcessor.PROP_LOCATION, location);
    mock.expectedHeaderReceived(HeaderProcessor.PROP_COUNTRY, country);
mock.expectedHeaderReceived(HeaderProcessor.PROP_QUALIFIED_ID, country + location);

    cts.getContext().start();

    cts.sendTestMessage("/testMessage.xml",
"ResourceType=Msg2TopicScaleAssortment", "activemq:queue:XPDinteg_DeviceClientFromQ");
    mock.assertIsSatisfied(2000l);

String missingHeaderNames = getMissingHeaderNames(mock.getExchanges().get(0), new String[] { "DestinationPath" });

Assert.assertEquals("Message is missing headers [" + missingHeaderNames.toString() + "]", "", missingHeaderNames);

  }

A few things to note:

CamelTestSupport is a helper class I have created for my test suite that simply creates a camel context and injects the required components. I have decided to do it that way as I use quite a number of components for my integration tests and I like it encapsulated.

cts.sendMessage(...) pretty much reads a hermes message definition and creates a camel exchange to be sent. I am using that to test with real business messages and my users use hermes to grab and store those. You can replace that call with a normal producer call to send a
message.

The rest of the code is more or less plain Camel plus a bit of custom chaecking for expected headers.


Hope that helps
Andreas



On 10/11/2013 04:05 PM, gudiseashok wrote:
Hi Muller,

I am afraid, basically the solution you have provided is for "Routing", in
order to do this I have to add when ever I found new server then can call
for routing - Which is basically decisions based.

But my thing is , I need to have a main route which kick-off other "Routes"
(which are meant to start ones and run forever with polling), so when I add
another route like this, I am considering the additional one to be added for
existing routes (which are already running on multicast fashion)

say like
<from "direct:start">
<multicast>
<to direct"a">
<to direct"b">
...
</multicast>
....

so when I add another one I want those to be added to the multicast list,
because I cant affort this to happen sequential manner ... because It doesnt
need to be wait for other routes.

But I remember you also have suggested JMS topic solution to one of the folk
who was having similar issue , while I was searching on this topic. Could
you please provide if you have a JMS topic to - add routeTo existing
TestClass or psuedo code thought also fine.

Thanks for taking time to respond Muller,


Regards
Ashok Gudise



--
View this message in context: 
http://camel.465427.n5.nabble.com/Help-with-Dynamic-route-tp5741336p5741359.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Reply via email to