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 59EDE200CC2 for ; Wed, 5 Jul 2017 13:03:02 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 5868E162F34; Wed, 5 Jul 2017 11:03:02 +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 77876162F33 for ; Wed, 5 Jul 2017 13:03:01 +0200 (CEST) Received: (qmail 24123 invoked by uid 500); 5 Jul 2017 11:03:00 -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 24109 invoked by uid 99); 5 Jul 2017 11:03:00 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Jul 2017 11:03:00 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id C64E8C0620 for ; Wed, 5 Jul 2017 11:02:59 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.693 X-Spam-Level: * X-Spam-Status: No, score=1.693 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001, URIBL_BLOCKED=0.001, URI_HEX=1.313] autolearn=disabled Authentication-Results: spamd4-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 (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id lF7B0-0vYxi8 for ; Wed, 5 Jul 2017 11:02:58 +0000 (UTC) Received: from mail-qt0-f175.google.com (mail-qt0-f175.google.com [209.85.216.175]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 55D865FC6C for ; Wed, 5 Jul 2017 11:02:58 +0000 (UTC) Received: by mail-qt0-f175.google.com with SMTP id 32so183007587qtv.1 for ; Wed, 05 Jul 2017 04:02:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=Jg3JvEpkvBAyzT6SIScI4nO63xe3jJk39T9LxGLpSOs=; b=d2z946aVhAv/7PJ7+5B2/gR2LFwBTPVlYtWZgcJWeryExznxAxVbfPHYPDTxBqeJYD aYhhADCuecdKV2HyVWuHEMUGUvbVqDMa/crKrQEEOdQt94l6IEcgf+S84USR+VmG6jeX tN3Xs0uBb9FHNMLC7o3ARli6pk1uxHkiH4pAVar4eBviLcRyYyYkVOIVD5j0wHLfvvDQ uuIDHMZvzSdw9wc0whjfWJVFM8ZhlDB7EQOabrZpyFScoeqrzDyw9dmBxFdm0lz4Z4gi ozC6IXqTfxuFJAQkfDvj7WoKOArkG9BO/JsCFaRtjTIzAa7NQ8n61gN9IiIPgMpV956r 02lA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=Jg3JvEpkvBAyzT6SIScI4nO63xe3jJk39T9LxGLpSOs=; b=BLdkNyPECM2knehtxQ3mb7Ty6mA2kHn6cxjzudqeQ1LQRROd033eHaT8kTVpeUkY6X lALow5lFW9bYno/wt2xUsBJyHueG3bgrGEBoH6t5EK/1NihHF/BF+kyFEdd15kTW+Yu1 wXZ1t/XoNIfUEYyAsAX6pZgHQCS/MXTmAWwWPkW4FTFYb4MiRITphJ+OLaxDtN1jNsTj 9R3CP4g8oQfEkJp9d0Jmf/6ICHPe14l+J2pkPapd61ar3aSOVhxS6BA++qZXHw+HrMhZ Nzx6bE6AR0Bcrzqp9UOe+yHtH5sjCqULtty5MCeRqWZ2X8C9Uei1n5ruRRz5uUTITdYy zz7g== X-Gm-Message-State: AKS2vOwTGwVZp73I1omNsVkVvVRurLxZRQyHIqbsBb8gTuYkSoH3uBSS MPC+KKQJoYT0MD9KjSbssOoGCMzylBnx0jw= X-Received: by 10.237.41.71 with SMTP id s65mr56664118qtd.222.1499252577776; Wed, 05 Jul 2017 04:02:57 -0700 (PDT) MIME-Version: 1.0 Received: by 10.237.63.197 with HTTP; Wed, 5 Jul 2017 04:02:37 -0700 (PDT) In-Reply-To: References: <1499194669644-5805805.post@n5.nabble.com> From: Claus Ibsen Date: Wed, 5 Jul 2017 13:02:37 +0200 Message-ID: Subject: Re: how to use CamelSpringTestSupport To: "users@camel.apache.org" Content-Type: text/plain; charset="UTF-8" archived-at: Wed, 05 Jul 2017 11:03:02 -0000 Hi Yeah it depends a bit how you want to trigger the route, you can write a file to that folder so the file consumer will pickup the file and route it. To test your bean, you can also just do a plain unit test without Camel for that and call the bean from your unit test with various inputs and see what it returns. If you want to use Camel as well and test with the route, then you can use advice-with to insert / change / mock your route, so you can eg add a mock endpoint after the bean, where you can then set exceptions on the mock. See the docs about testing at http://camel.apache.org/testing Where you can find links to advice with etc. Also you can check the source code from camel itself as there is a lot of unit tests with camel and spring you can look at. And if you need more in-depth information about testing then some of the Camel books have that. http://camel.apache.org/books And you may find some 3rd party blogs etc about testing with Camel also http://camel.apache.org/articles On Wed, Jul 5, 2017 at 7:14 AM, Zoran Regvart wrote: > Hi, > checkout the documentation[1] on Spring testing, > > zoran > > [1] https://camel.apache.org/spring-testing.html > > On Tue, Jul 4, 2017 at 8:57 PM, yoav hhh wrote: >> I would like to use CamelSpringTestSupport in order to test my camel route. >> this is my camelContext : >> >> >> > location="classpath:incomingFileHandler.properties" /> >> >> > id="incomingFile"/> >> >> >> >> >> >> >> ${exchangeProperty[incomingFileHandlerError]} != 'null' >> >> >> >> >> >> >> >> >> >> >> >> I want to be able to test (assert tests) the Exchange paremeters values >> after returning from incomingFileHandlerBean. >> >> So I have this Junit skeleton class: >> >> @RunWith(SpringJUnit4ClassRunner.class) >> public class Tests extends CamelSpringTestSupport { >> >> @Test >> public void test() throws InterruptedException { >> ////// ?? >> } >> >> @Override >> protected AbstractApplicationContext createApplicationContext() { >> return new >> ClassPathXmlApplicationContext("file:src/main/resources/META-INF/spring/applicationContext.xml"); >> } >> } >> >> But I'm not sure how to fill the test method. >> I will be happy for any help. >> >> >> >> -- >> View this message in context: http://camel.465427.n5.nabble.com/how-to-use-CamelSpringTestSupport-tp5805805.html >> Sent from the Camel - Users mailing list archive at Nabble.com. > > > > -- > Zoran Regvart -- Claus Ibsen ----------------- http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2