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 23B35994C for ; Fri, 23 Sep 2011 21:09:43 +0000 (UTC) Received: (qmail 28816 invoked by uid 500); 23 Sep 2011 21:09:42 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 28779 invoked by uid 500); 23 Sep 2011 21:09:42 -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 28771 invoked by uid 99); 23 Sep 2011 21:09:42 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Sep 2011 21:09:42 +0000 X-ASF-Spam-Status: No, hits=0.7 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [98.129.35.5] (HELO server505.appriver.com) (98.129.35.5) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Sep 2011 21:09:33 +0000 X-Note-AR-ScanTimeLocal: 9/23/2011 4:09:12 PM X-Policy: GLOBAL - axeda.com X-Primary: dford@axeda.com X-Note: This Email was scanned by AppRiver SecureTide X-ALLOW: @axeda.com ALLOWED X-Virus-Scan: V- X-Note: Spam Tests Failed: X-Country-Path: UNITED STATES->UNITED STATES->UNITED STATES X-Note-Sending-IP: 98.129.23.150 X-Note-Reverse-DNS: smtp.exg5.exghost.com X-Note-WHTLIST: dford@axeda.com X-Note: User Rule Hits: X-Note: Global Rule Hits: G211 G212 G213 G214 G218 G219 G230 G320 X-Note: Encrypt Rule Hits: X-Note: Mail Class: ALLOWEDSENDER X-Note: Headers Injected Received: from [98.129.23.150] (HELO smtp.exg5.exghost.com) by server505.appriver.com (CommuniGate Pro SMTP 5.4.1c) with ESMTPS id 199166556 for users@camel.apache.org; Fri, 23 Sep 2011 16:09:12 -0500 Received: from MBX22.exg5.exghost.com ([169.254.1.133]) by HT05.exg5.exghost.com ([10.242.229.85]) with mapi; Fri, 23 Sep 2011 16:09:11 -0500 From: Davis Ford To: "users@camel.apache.org" Date: Fri, 23 Sep 2011 16:08:50 -0500 Subject: RE: testing camel proxy with a mock camel endpoint? Thread-Topic: testing camel proxy with a mock camel endpoint? Thread-Index: Acx6DAVU5Xd4Lzp+SpC6joCckqxPmwAFwKCgAAM+JMAAATlAMA== Message-ID: <17ADFC3640F82D4F9E3A9DEDC9474E9F051CBA66@MBX22.exg5.exghost.com> References: <1316606677978-4826097.post@n5.nabble.com> <17ADFC3640F82D4F9E3A9DEDC9474E9F051CB9F9@MBX22.exg5.exghost.com> <17ADFC3640F82D4F9E3A9DEDC9474E9F051CBA45@MBX22.exg5.exghost.com> In-Reply-To: <17ADFC3640F82D4F9E3A9DEDC9474E9F051CBA45@MBX22.exg5.exghost.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org Removing the subclass for CamelTestSupport and instead doing=20 mockEndpoint =3D camelContext.getEndpoint("mock:queue.incoming"); fixes the issue. -----Original Message----- From: Davis Ford [mailto:dford@axeda.com]=20 Sent: Friday, September 23, 2011 4:39 PM To: users@camel.apache.org Subject: RE: testing camel proxy with a mock camel endpoint? Let me try a different approach to this question. I'm now injecting a mock= :url into the endpoints so this seems like it should work but it doesn't... @ContextConfiguration(locations=3D{"classpath:applicationContext.xml"}) @RunWith(SpringJUnit4ClassRunner.class) public class MyTest extends CamelTestSupport { @Resource(name=3D"myBean") MyBeanInterface bean; MockEndpoint mockEndpoint; @Before public void setUp() throws Exception { super.setUp(); mockEndpoint =3D getMockEndpoint("mock:queue.incoming"); mockEndpoint.expectedMessageCount(1); } @Test public void test() throws Exception { String retval =3D bean.callSomeMethod(); mockEndpoint.assertIsSatisfied(); } } The test fails indicating that 1 message was expected but zero were receive= d. I'm not 100% certain why that is -- perhaps it has to do with the test = subclassing CamelTestSupport but using spring's JUnit 4 test runner, so may= be they are two different camel context's ? i.e. one loaded in spring, and = the other instantiated by CamelTestSupport itself? Any ideas? -----Original Message----- From: Davis Ford [mailto:dford@axeda.com]=20 Sent: Friday, September 23, 2011 3:20 PM To: users@camel.apache.org Subject: testing camel proxy with a mock camel endpoint?