summaryrefslogtreecommitdiff
path: root/cpp/tests/SimpleTestCaseBase.h
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2007-05-15 07:38:48 +0000
committerGordon Sim <gsim@apache.org>2007-05-15 07:38:48 +0000
commitb20c9a463aa86f91e5c3f5d86c75c988591f8d74 (patch)
tree3bfa8e4badada05d663033c2289ad3df89d0654c /cpp/tests/SimpleTestCaseBase.h
parentad0c6952f75c86ad587602cfb14dab46efedd4f6 (diff)
downloadqpid-python-b20c9a463aa86f91e5c3f5d86c75c988591f8d74.tar.gz
Separated out implementation from interop test headers.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/M2@538079 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/tests/SimpleTestCaseBase.h')
-rw-r--r--cpp/tests/SimpleTestCaseBase.h71
1 files changed, 11 insertions, 60 deletions
diff --git a/cpp/tests/SimpleTestCaseBase.h b/cpp/tests/SimpleTestCaseBase.h
index 7a2421af3b..818ab3b315 100644
--- a/cpp/tests/SimpleTestCaseBase.h
+++ b/cpp/tests/SimpleTestCaseBase.h
@@ -49,26 +49,11 @@ protected:
public:
- Worker(TestOptions& options, const int _messages) :
- connection(options.trace), messages(_messages), count(0)
- {
- connection.open(options.broker, options.port);
- connection.openChannel(&channel);
- }
-
+ Worker(TestOptions& options, const int messages);
virtual ~Worker(){}
- virtual void stop()
- {
- channel.close();
- connection.close();
- }
-
- virtual int getCount()
- {
- return count;
- }
-
+ virtual void stop();
+ virtual int getCount();
virtual void init() = 0;
virtual void start() = 0;
};
@@ -79,24 +64,11 @@ protected:
const std::string key;
public:
Sender(TestOptions& options,
- const Exchange& _exchange,
- const std::string& _key,
- const int _messages)
- : Worker(options, _messages), exchange(_exchange), key(_key) {}
-
- void init()
- {
- channel.start();
- }
-
- void start(){
- Message msg;
- while (count < messages) {
- channel.publish(msg, exchange, key);
- count++;
- }
- stop();
- }
+ const Exchange& exchange,
+ const std::string& key,
+ const int messages);
+ void init();
+ void start();
};
std::auto_ptr<Worker> worker;
@@ -106,30 +78,9 @@ public:
virtual ~SimpleTestCaseBase() {}
- void start()
- {
- if (worker.get()) {
- worker->start();
- }
- }
-
- void stop()
- {
- if (worker.get()) {
- worker->stop();
- }
- }
-
- void report(client::Message& report)
- {
- if (worker.get()) {
- report.getHeaders().setInt("MESSAGE_COUNT", worker->getCount());
- //add number of messages sent or received
- std::stringstream reportstr;
- reportstr << worker->getCount();
- report.setData(reportstr.str());
- }
- }
+ void start();
+ void stop();
+ void report(client::Message& report);
};
}