From 248f1fe188fe2307b9dcf2c87a83b653eaa1920c Mon Sep 17 00:00:00 2001 From: "Rafael H. Schloming" Date: Sat, 26 Dec 2009 12:42:57 +0000 Subject: synchronized with trunk except for ruby dir git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/qpid.rnr@893970 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/tests/MessageUtils.h | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'cpp/src/tests/MessageUtils.h') diff --git a/cpp/src/tests/MessageUtils.h b/cpp/src/tests/MessageUtils.h index 21ee834ba7..a1b140d484 100644 --- a/cpp/src/tests/MessageUtils.h +++ b/cpp/src/tests/MessageUtils.h @@ -7,9 +7,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -20,7 +20,6 @@ */ #include "qpid/broker/Message.h" -#include "qpid/broker/MessageDelivery.h" #include "qpid/framing/AMQFrame.h" #include "qpid/framing/MessageTransferBody.h" #include "qpid/framing/Uuid.h" @@ -29,28 +28,36 @@ using namespace qpid; using namespace broker; using namespace framing; +namespace qpid { +namespace tests { + struct MessageUtils { - static boost::intrusive_ptr createMessage(const string& exchange="", const string& routingKey="", - const Uuid& messageId=Uuid(true), uint64_t contentSize = 0) + static boost::intrusive_ptr createMessage(const string& exchange="", const string& routingKey="", + const bool durable = false, const Uuid& messageId=Uuid(true), + uint64_t contentSize = 0) { - boost::intrusive_ptr msg(new Message()); + boost::intrusive_ptr msg(new broker::Message()); - AMQFrame method(in_place(ProtocolVersion(), exchange, 0, 0)); - AMQFrame header(in_place()); + AMQFrame method(( MessageTransferBody(ProtocolVersion(), exchange, 0, 0))); + AMQFrame header((AMQHeaderBody())); msg->getFrames().append(method); msg->getFrames().append(header); MessageProperties* props = msg->getFrames().getHeaders()->get(true); - props->setContentLength(contentSize); + props->setContentLength(contentSize); props->setMessageId(messageId); msg->getFrames().getHeaders()->get(true)->setRoutingKey(routingKey); + if (durable) + msg->getFrames().getHeaders()->get(true)->setDeliveryMode(2); return msg; } static void addContent(boost::intrusive_ptr msg, const string& data) { - AMQFrame content(in_place(data)); + AMQFrame content((AMQContentBody(data))); msg->getFrames().append(content); } }; + +}} // namespace qpid::tests -- cgit v1.2.1