Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 37200200B9B for ; Wed, 12 Oct 2016 08:54:34 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 35C1D160AD4; Wed, 12 Oct 2016 06:54:34 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 87636160AD3 for ; Wed, 12 Oct 2016 08:54:33 +0200 (CEST) Received: (qmail 8767 invoked by uid 500); 12 Oct 2016 06:54:27 -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 8755 invoked by uid 99); 12 Oct 2016 06:54:27 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Oct 2016 06:54:27 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id BFA791806F7 for ; Wed, 12 Oct 2016 06:54:26 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.411 X-Spam-Level: ** X-Spam-Status: No, score=2.411 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, KAM_LINEPADDING=1.2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001, URI_HEX=1.313] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id iG069TOJQfbr for ; Wed, 12 Oct 2016 06:54:25 +0000 (UTC) Received: from mail-pf0-f174.google.com (mail-pf0-f174.google.com [209.85.192.174]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 931805F47D for ; Wed, 12 Oct 2016 06:54:24 +0000 (UTC) Received: by mail-pf0-f174.google.com with SMTP id 128so14591744pfz.0 for ; Tue, 11 Oct 2016 23:54:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=g3SMbwxiXNtQGqUP9dwETAQbjNlrSzbGSIOijWx2qoY=; b=misBHp4K0VVJPSkH6xVwr+2j7MEHTfcl5On9iXHyTx+TAyPdsk6R3glftXBosAzwcQ 9uuz39XZeuQMbvWoZwGyHNdGr40pxj9Bgrfx01bayTzqfEM7we+pnnYZuLYJ9Ev+0qsy uDkuOj9HcTs3pSqVWwWBB0KfJb4zm0XfZTciHig/4/gtRbjI6ifJ7gCMvBMqgmskzpst lCailu8HnlKBfWEw921JSUENZCJ29rrNNwTdYJyNq63lBT54cZ2XbuG2JoDwVhNsdld9 fIBmbGH3D+06MXp2xulBeE5iaIH3bA98LPMbAgCow1VYilEgxaHdDfI4Lh1pkfjVwrZf 3awA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=g3SMbwxiXNtQGqUP9dwETAQbjNlrSzbGSIOijWx2qoY=; b=axRBZAr4KsVwmoR24wyLgeT9se+tQ8WiGkG97GviTVNEOOV9/yjJI4dLT6oiTqpJIT tf7v7OTityDkHTwBTeJB56kSGB0+1saEyAymtQx9N5XgNGbyGqi9zJxCVZF5aOp1e4UM j12MLxMf/SBFALCO+iZ55VviTsn2160gu0PrNAJLKmalfJW82cxcZjGEfnnrE8u4XHM0 FzUpYdrF2UCdLJ8gqgeJtWTGv49DCLghKBCH3FzbtXKnlXDwCjeZw5IefC27ARKyTnz1 zgbmxV1ZCTSiWUu08DzEvWVTEBWkM1z18qtPcceNHTav82IzSBPmLKXxkdmv/r3x38zS FUIw== X-Gm-Message-State: AA6/9RmmD9Z59ulSd4CEh1Kn8azdsjZ83DCrvwt2vRIpD9YcUOPidOou5Tf2d1GNDgK9iA== X-Received: by 10.99.104.69 with SMTP id d66mr6711734pgc.26.1476255252281; Tue, 11 Oct 2016 23:54:12 -0700 (PDT) Received: from [192.168.12.56] (p793002-ipngn403funabasi.chiba.ocn.ne.jp. [180.56.113.2]) by smtp.googlemail.com with ESMTPSA id e6sm8936367pfb.57.2016.10.11.23.54.10 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Oct 2016 23:54:11 -0700 (PDT) Subject: Re: Camel Spring Unit Testing with Mocks To: users@camel.apache.org References: <1476219279385-5788635.post@n5.nabble.com> From: Tomohisa Igarashi Message-ID: <1a080907-3f96-8e23-82ed-289534cd8ab4@gmail.com> Date: Wed, 12 Oct 2016 15:54:09 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <1476219279385-5788635.post@n5.nabble.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit archived-at: Wed, 12 Oct 2016 06:54:34 -0000 Hi, Is this what you're looking for as an example? interceptSendToEndpoint()&skipSendToOriginalEndpoint() via AdviceWithRouteBuilder intercepts sending to the actual endpoint defined in spring XML and forwarding it to the mock endpoint for testing purpose. https://github.com/apache/camel/blob/master/components/camel-http/src/test/java/org/apache/camel/component/http/HttpInterceptSendToEndpointTest.java#L35 Thanks, Tomo On 10/12/2016 05:54 AM, catequil wrote: > Background > > I'm a newbie to Apache Camel. (3 months) > I have read the testing section to Camel in Action MEAP version. > I have read http://camel.apache.org/testing.html and > http://camel.apache.org/spring-testing.html > I have searched this forum, google and stackoverflow for answers. > I've tried using the adviceWith, but that is confusing too. > Current versions are Camel 2.16.2 and Spring 4.0.6 and Junit 4.12 > Dependencies loaded: {camel-core, camel-spring, camel-cxf, camel-jackson, > camel-test, camel-test-spring40, camel-kafka, spring-test} > > Criteria > > DRY (No identical code in testing) > Cannot modify production code. > Must use Mocks as integration tests would take too long to run. > Must use CamelSpringTestSupport (The only configuration I can get to work in > my environment that supports spring and camel) > > Question > > The part I am struggling with the most, for a week now, is the Mocks. They > do not make sense to me on how they work in relation to the production > version of the route. > Can some one please help me to create a unit test that works having all this > criteria and help me understand the Mocking for Endpoints? > > > > > > > > -- > View this message in context: http://camel.465427.n5.nabble.com/Camel-Spring-Unit-Testing-with-Mocks-tp5788635.html > Sent from the Camel - Users mailing list archive at Nabble.com. >