diff options
| author | Rafael H. Schloming <rhs@apache.org> | 2009-12-26 12:42:57 +0000 |
|---|---|---|
| committer | Rafael H. Schloming <rhs@apache.org> | 2009-12-26 12:42:57 +0000 |
| commit | 248f1fe188fe2307b9dcf2c87a83b653eaa1920c (patch) | |
| tree | d5d0959a70218946ff72e107a6c106e32479a398 /cpp/src/tests/MessageUtils.h | |
| parent | 3c83a0e3ec7cf4dc23e83a340b25f5fc1676f937 (diff) | |
| download | qpid-python-248f1fe188fe2307b9dcf2c87a83b653eaa1920c.tar.gz | |
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
Diffstat (limited to 'cpp/src/tests/MessageUtils.h')
| -rw-r--r-- | cpp/src/tests/MessageUtils.h | 27 |
1 files changed, 17 insertions, 10 deletions
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<Message> createMessage(const string& exchange="", const string& routingKey="", - const Uuid& messageId=Uuid(true), uint64_t contentSize = 0) + static boost::intrusive_ptr<Message> createMessage(const string& exchange="", const string& routingKey="", + const bool durable = false, const Uuid& messageId=Uuid(true), + uint64_t contentSize = 0) { - boost::intrusive_ptr<Message> msg(new Message()); + boost::intrusive_ptr<broker::Message> msg(new broker::Message()); - AMQFrame method(in_place<MessageTransferBody>(ProtocolVersion(), exchange, 0, 0)); - AMQFrame header(in_place<AMQHeaderBody>()); + AMQFrame method(( MessageTransferBody(ProtocolVersion(), exchange, 0, 0))); + AMQFrame header((AMQHeaderBody())); msg->getFrames().append(method); msg->getFrames().append(header); MessageProperties* props = msg->getFrames().getHeaders()->get<MessageProperties>(true); - props->setContentLength(contentSize); + props->setContentLength(contentSize); props->setMessageId(messageId); msg->getFrames().getHeaders()->get<DeliveryProperties>(true)->setRoutingKey(routingKey); + if (durable) + msg->getFrames().getHeaders()->get<DeliveryProperties>(true)->setDeliveryMode(2); return msg; } static void addContent(boost::intrusive_ptr<Message> msg, const string& data) { - AMQFrame content(in_place<AMQContentBody>(data)); + AMQFrame content((AMQContentBody(data))); msg->getFrames().append(content); } }; + +}} // namespace qpid::tests |
