summaryrefslogtreecommitdiff
path: root/qpid/cpp/src/tests/sender.cpp
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2008-11-20 17:24:55 +0000
committerGordon Sim <gsim@apache.org>2008-11-20 17:24:55 +0000
commit682790a3536b8c12dd7d237f7f834c87980b741f (patch)
tree595db62d2ae4c8672067d646545d94e3a20cf2ac /qpid/cpp/src/tests/sender.cpp
parent7ad3988e599da508eb782ca84d97033b33692ac4 (diff)
downloadqpid-python-682790a3536b8c12dd7d237f7f834c87980b741f.tar.gz
Added some extra test options.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@719298 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src/tests/sender.cpp')
-rw-r--r--qpid/cpp/src/tests/sender.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/qpid/cpp/src/tests/sender.cpp b/qpid/cpp/src/tests/sender.cpp
index 2da1990041..a02b713d86 100644
--- a/qpid/cpp/src/tests/sender.cpp
+++ b/qpid/cpp/src/tests/sender.cpp
@@ -39,14 +39,14 @@ struct Args : public qpid::TestOptions
{
string destination;
string key;
- bool sendEos;
+ uint sendEos;
- Args() : key("test-queue"), sendEos(false)
+ Args() : key("test-queue"), sendEos(0)
{
addOptions()
("exchange", qpid::optValue(destination, "EXCHANGE"), "Exchange to send messages to")
("routing-key", qpid::optValue(key, "KEY"), "Routing key to add to messages")
- ("send-eos", qpid::optValue(sendEos), "Send EOS message to mark end of input");
+ ("send-eos", qpid::optValue(sendEos, "N"), "Send N EOS messages to mark end of input");
}
};
@@ -55,16 +55,16 @@ const string EOS("eos");
class Sender : public FailoverManager::Command
{
public:
- Sender(const std::string& destination, const std::string& key, bool sendEos);
+ Sender(const std::string& destination, const std::string& key, uint sendEos);
void execute(AsyncSession& session, bool isRetry);
private:
MessageReplayTracker sender;
Message message;
- const bool sendEos;
+ const uint sendEos;
uint sent;
};
-Sender::Sender(const std::string& destination, const std::string& key, bool eos) :
+Sender::Sender(const std::string& destination, const std::string& key, uint eos) :
sender(10), message(destination, key), sendEos(eos), sent(0) {}
void Sender::execute(AsyncSession& session, bool isRetry)
@@ -77,7 +77,7 @@ void Sender::execute(AsyncSession& session, bool isRetry)
message.getHeaders().setInt("sn", ++sent);
sender.send(message);
}
- if (sendEos) {
+ for (uint i = sendEos; i > 0; --i) {
message.setData(EOS);
sender.send(message);
}