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 21E3518B80 for ; Tue, 4 Aug 2015 08:41:29 +0000 (UTC) Received: (qmail 68126 invoked by uid 500); 4 Aug 2015 08:41:28 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 68077 invoked by uid 500); 4 Aug 2015 08:41:28 -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 68065 invoked by uid 99); 4 Aug 2015 08:41:27 -0000 Received: from Unknown (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Aug 2015 08:41:27 +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 6EFECC1385 for ; Tue, 4 Aug 2015 08:41:27 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 4 X-Spam-Level: **** X-Spam-Status: No, score=4 tagged_above=-999 required=6.31 tests=[HTML_MESSAGE=3, KAM_LAZY_DOMAIN_SECURITY=1] autolearn=disabled Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id HY6lfPjr-HHX for ; Tue, 4 Aug 2015 08:41:12 +0000 (UTC) Received: from mail-wi0-f180.google.com (mail-wi0-f180.google.com [209.85.212.180]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTPS id B019724DBC for ; Tue, 4 Aug 2015 08:41:11 +0000 (UTC) Received: by wicmv11 with SMTP id mv11so166208839wic.0 for ; Tue, 04 Aug 2015 01:41:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=COPT2RBsPvk08Jj0F4tC7Tdf/XRi8KoUJ3SSIfTD/QE=; b=Wm9m7zV3faYpf/CEA4L3EKU2IcB1eB4euAOCLc/WA1xfmx8fVkboC20wp89w8AWXP3 piUTBpXzu9KgFEvWuCS+mFwIVbCQ17ME5DNc11I7IJKUKDDjAPFD4BMUQVdMEn8VUvhn EzI9t+ErMfWL4QwHbwXuOU30XCe5cOp0Q9ck68gbg+ZtEYhUsqQ/ZsnNZUpclKPihwLh RmQ0PxIt05gmP7KLQsOTta2fIr+h2QoL7LUxvOg2d4SypRr4FkZw25qj8uyuS55lVlYk veIx7qo8TvNlchpTpx46wfNNDyJfn4+4izZx7tgRqS4OHgfHZzhcc/CQtP9KnjdObo9D P1hQ== X-Gm-Message-State: ALoCoQn8iDDwo2r6cB9dR8Z7P55LEZ7/GgFDXHTnAjAJBYyNhXNhwl6/pbMdWFXpZIzV9BTZITPw MIME-Version: 1.0 X-Received: by 10.194.171.129 with SMTP id au1mr5865476wjc.115.1438677671153; Tue, 04 Aug 2015 01:41:11 -0700 (PDT) Received: by 10.27.2.87 with HTTP; Tue, 4 Aug 2015 01:41:11 -0700 (PDT) X-Originating-IP: [82.135.22.18] In-Reply-To: References: Date: Tue, 4 Aug 2015 10:41:11 +0200 Message-ID: Subject: Re: Routes in unit-testing From: Marc Ende To: users@camel.apache.org Content-Type: multipart/alternative; boundary=089e0122f1a0893653051c783f26 --089e0122f1a0893653051c783f26 Content-Type: text/plain; charset=UTF-8 Hi Claus, thanks for the hint to stub and adviceWith. I'm trying to use stub but I haven't found an example how to use stub. Do I use it in combination with @Produce or is it a completly diffrent approach? Thanks Marc 2015-08-04 9:37 GMT+02:00 Claus Ibsen : > Hi > > Take a look at stub, or advice with and use replace from etc for testing. > > > On Tue, Aug 4, 2015 at 8:48 AM, Marc Ende wrote: > > Hi, > > > > I've got a not very complex route: > > > > > > > from(routes.getActivemqEndpoint()).routeId(Route.PROCESSING_ROUTE.getRouteId()) > > .choice() > > > > > .when(header(Constants.JMS_HEADER_DATA_SOURCE).isEqualTo(Constants.DEFAULT_JMS_HEADER_B)) > > .to(routes.getProcessingEndpoint(Constants.ORIGIN_B)) > > > > > .when(header(Constants.JMS_HEADER_DATA_SOURCE).isEqualTo(Constants.DEFAULT_JMS_HEADER_A)) > > .to(routes.getProcessingEndpoint(Constants.ORIGIN_A)) > > .otherwise() > > .log(LoggingLevel.ERROR,"Message was not identified...") > > .to(routes.getProcessingUnknownEndpoint()); > > > > If I try to unit-test this route using spring. This route is correctly > > build up in camel context and I also can send messages to the endpoints > in > > this route. > > But I would expect that if i send a message to the activemq endpoint it > > should be delivered to one of the other endpoints. But that didn't > happen. > > > > the activemq endpoint is mocked using mock:activemq://queue... If I send > a > > message to mock:activemq://queue... it will only be delivered to this > > endpoint. > > If I send the message to the real endpoint of the route > > (activemq://queue...) it will be delivered to the expected endpoint. But > > then the counter within the MockEndpoint of the endpoint > > isn't incremented and the assertion fails. > > > > Does anyone have an idea? > > > > Marc > > > > -- > Claus Ibsen > ----------------- > http://davsclaus.com @davsclaus > Camel in Action 2nd edition: http://www.manning.com/ibsen2 > --089e0122f1a0893653051c783f26--