Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D0347657E for ; Mon, 30 May 2011 10:05:14 +0000 (UTC) Received: (qmail 7781 invoked by uid 500); 30 May 2011 10:05:14 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 7746 invoked by uid 500); 30 May 2011 10:05:14 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 7737 invoked by uid 99); 30 May 2011 10:05:14 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 May 2011 10:05:14 +0000 X-ASF-Spam-Status: No, hits=0.6 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of willem.jiang@gmail.com designates 74.125.83.173 as permitted sender) Received: from [74.125.83.173] (HELO mail-pv0-f173.google.com) (74.125.83.173) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 May 2011 10:05:09 +0000 Received: by pvg3 with SMTP id 3so1805803pvg.32 for ; Mon, 30 May 2011 03:04:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=MqYDzYueWInbdyxk8pnkogIjqNo121GUm1cOmm/QPeI=; b=kQrFZPnV7s/H8m3/D9tVIYzE01lKv90Glh0by3z6TXNw6w8mGSQEqTQoL5MTFuYemO +vw1gntpsZxYNz1wRh8iga+Ui48tjZIDJIiIDYrjnSbDAXNE9yLuKR3MLt/7ZxLUd+XR N4TC6jZbZ9MH8J4JKsb0OgTAv5JJbTZpQa6Nw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; b=AHwbex6UqiRKNqkSSRGWeFAjZW72aHahCOC5LZjK1AEwzCskVFOiafFRcjjWvU4ZCW MEGVloLTXAW/umLljtsOtrJrGHNUk/EF6kS2ic6fCKwWA3fDtxfEi1KfRR2ex8qlfFjH nSLWGY8NtA046nvFGA0EFRMKSVzH5fwRjMJuk= Received: by 10.68.69.15 with SMTP id a15mr1922077pbu.411.1306749888897; Mon, 30 May 2011 03:04:48 -0700 (PDT) Received: from [192.168.0.158] ([125.34.10.156]) by mx.google.com with ESMTPS id w2sm2767690pbg.21.2011.05.30.03.04.46 (version=SSLv3 cipher=OTHER); Mon, 30 May 2011 03:04:48 -0700 (PDT) Message-ID: <4DE36BBC.5070001@gmail.com> Date: Mon, 30 May 2011 18:04:44 +0800 From: Willem Jiang User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.17) Gecko/20110414 Lightning/1.0b2 Thunderbird/3.1.10 MIME-Version: 1.0 To: users@camel.apache.org Subject: Re: Unit test camel with activeMQ References: <1306747155409-4438797.post@n5.nabble.com> In-Reply-To: <1306747155409-4438797.post@n5.nabble.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi, It depends on if you want to start the JMS broker. In most case, you don't need to start the JMS broker if you just want to test the route method. So you can replace the activemq to direct or seda endpoint. There are some useful discussion in the Chapter6 of Camel in Action. On 5/30/11 5:19 PM, hbellat wrote: > Hello, > > I used Junit for java program but I need some examples to understand how it > works in camel with activeMQ > > I wrote a simple camel.xml as follow : > > > > > > > > > > and MyBean.java is : > > public class MyBean { > > > public void route(Exchange message){ > > String name = message.getIn().getBody(String.class); > > name="test"; > > message.getOut().setBody(name); > } > } > > In my route I send any string like "my unit Test", this string received by > the bean and affecte "test" in my String and route it to activemq:finish. > > How can I write a unit test for that simple code ? > > In my test I was wondring if my activemq must be started ? > > I will appreciate your help. > > > > > > -- > View this message in context: http://camel.465427.n5.nabble.com/Unit-test-camel-with-activeMQ-tp4438797p4438797.html > Sent from the Camel - Users mailing list archive at Nabble.com. > -- Willem ---------------------------------- FuseSource Web: http://www.fusesource.com Blog: http://willemjiang.blogspot.com (English) http://jnn.javaeye.com (Chinese) Twitter: willemjiang Weibo: willemjiang