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 2818A200D39 for ; Sat, 11 Nov 2017 14:05:39 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 269C1160C03; Sat, 11 Nov 2017 13:05:39 +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 6B052160BF1 for ; Sat, 11 Nov 2017 14:05:38 +0100 (CET) Received: (qmail 85507 invoked by uid 500); 11 Nov 2017 13:05:37 -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 85495 invoked by uid 99); 11 Nov 2017 13:05:37 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 11 Nov 2017 13:05:36 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 376C1DA3A8 for ; Sat, 11 Nov 2017 13:05:36 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.72 X-Spam-Level: X-Spam-Status: No, score=-0.72 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=list-zurowski-org.20150623.gappssmtp.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id AKQLHCwnWkUo for ; Sat, 11 Nov 2017 13:05:34 +0000 (UTC) Received: from mail-qt0-f182.google.com (mail-qt0-f182.google.com [209.85.216.182]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 9BD775FB32 for ; Sat, 11 Nov 2017 13:05:34 +0000 (UTC) Received: by mail-qt0-f182.google.com with SMTP id q33so10428686qta.2 for ; Sat, 11 Nov 2017 05:05:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=list-zurowski-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-transfer-encoding; bh=FkHJONBCrzDUEkXpjjGk3EZTnzWHZAtNzrUAMnnifaQ=; b=FX8Cdt3QwPMILDYt/EVEkcZzuJ6w9QublItU+ihZJRjgqmJC6WVx3Oyq8BUNEtX/5g t8azhIH17UrB1NgMbeP8bThLZFZBQ3SMPX8a8UOKRsOACM86L5bmICr6Hf8ALlBZONl6 zt6mUTLsKCRF9UTm1KDHc2lS1cn+g/MMBYOtDhSHa1VIKl0fz+q3iLLkVcUe0i/pZl5h OccmerjE0DLDV1NWwjK/QwWd+byC41Hyug11oNXTnxIygV0MEsjhRtrpuKiyMd/pc0XW /qxbcEfAQSKISrGGQCd8Wh8atuBDLqzBc3VZV+CUW9WeBn008EZXh+4adDelrBiV/+95 Gmvg== 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:content-transfer-encoding; bh=FkHJONBCrzDUEkXpjjGk3EZTnzWHZAtNzrUAMnnifaQ=; b=g+hrgvnHV8ar5vbFX4J7BSRwS1bZ6tSDqfyZD6hPIW2vq9CJMTZd6QuoVX7L3WnNUl 3KmZfaAFSLnIK4quk4AeQPE308rPpOVJDUTq34PhRXKrzKy0yprvCibJbnI2qq0houD5 pqzm4Ry8zJoyQJsSHzXuudzA2X7KsD3q1A08dZslJm7cSiEWc434NrAx+YBNljdKChn7 c3AEe6zVWjwe3gy9gX2CwoUTfqRg8aL/btXtBLtBN5KF4Hz41IBNPS4bo5XYMT58Z3yt GQgQJcw1v9vhfHW4v+hhT6p4EV72nfkjXTHTq79DsNFl6C7Yy2rgJe1bKmdWsqnGWu6B 4IHg== X-Gm-Message-State: AJaThX6YKhymmAEaPmC/Dtdc+4DwUe5x6plb8eSEhkXLFuvn4xXSHQcQ eboFo6uMJ5ZNc8wODpTTliiPwaNIYtzhwBJFlQmNNQ== X-Google-Smtp-Source: AGs4zMaHTPaYclPsNDtC5RC1ql+eeh+1D6mnZcVcC/5RMqwZGUVPPyc2spsNs8XIFdObmUcCXqrQZSUYqnchPr9RgPM= X-Received: by 10.237.58.4 with SMTP id n4mr5569844qte.201.1510405528000; Sat, 11 Nov 2017 05:05:28 -0800 (PST) MIME-Version: 1.0 Received: by 10.140.29.182 with HTTP; Sat, 11 Nov 2017 05:04:47 -0800 (PST) X-Originating-IP: [79.194.121.50] In-Reply-To: References: From: Gregor Zurowski Date: Sat, 11 Nov 2017 14:04:47 +0100 Message-ID: Subject: Re: Setting multiple expectations when streamCaching is on To: users@camel.apache.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable archived-at: Sat, 11 Nov 2017 13:05:39 -0000 Hi, I just ran your code with Camel 2.20.0 and it works without issues, but I can reproduce the problem with earlier releases such as 2.19.x and 2.18.x. Were there any particular changes in Camel 2.20.0 that would make Minhtri's code work? Please note that the test code works in all versions of Camel when stream caching is disabled in the route. Thanks, Gregor On Fri, Nov 10, 2017 at 7:12 PM, Minhtri Tran wrote: > Hello, > > I am currently having an issue with setting up multiple expectations > in a test case when streamCaching is enabled and json marshalling is > used. Every expectation except the first one fails. > > Here=E2=80=99s my test class: > > @RunWith(CamelSpringBootRunner.class) > > @SpringBootTest(classes =3D MyApplication.class) > > public class MyTest extends CamelTestSupport { > > > > @Test > > public void test() throws Exception { > > class Hello { > > Hello(String value) { > > this.value =3D value; > > } > > > > private String value; > > > > public String getValue() { > > return value; > > } > > > > public void setValue(String value) { > > this.value =3D value; > > } > > } > > > > MockEndpoint mock =3D getMockEndpoint("mock:dest"); > > mock.message(0).body().convertToString().contains("hello"); > > mock.message(0).body().convertToString().contains("world"); > > template.sendBody("direct:source", new Hello("hello world")); > > mock.assertIsSatisfied(); } > > > > @Override > > protected RoutesBuilder createRouteBuilder() throws Exception { > > return new RouteBuilder() { > > @Override > > public void configure() throws Exception { > > from("direct:source") > > .streamCaching() > > .marshal().json(JsonLibrary.Jackson) > > .to("mock:dest"); > > } > > }; > > } > > } > > > > This is the assertion error that I=E2=80=99m getting: > > java.lang.AssertionError: Assertion error at index 0 on mock > mock://dest with predicate: Simple: body contains world evaluated as: > contains world on Exchange[ID-A1504214-60132-1508506055845-1-2] > > > > Why is this happening? How can I set multiple expectations on the > same message body in this case? > > > > Thanks, > > Minhtri