summaryrefslogtreecommitdiff
path: root/cpp/src/tests/interop_runner.cpp
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2007-09-11 11:25:27 +0000
committerGordon Sim <gsim@apache.org>2007-09-11 11:25:27 +0000
commitc922ccae07d060f891848e688f7f1e29dc07c552 (patch)
tree8363c1678c5efc59769c19c58188ccb9466d8aa4 /cpp/src/tests/interop_runner.cpp
parentfbda2ac45519f7108fc48f483d76d1487c2b3544 (diff)
downloadqpid-python-c922ccae07d060f891848e688f7f1e29dc07c552.tar.gz
Moved old ClientChannel class from using basic to using message for publish & consume.
(Get and qos still use the basic class's defintions, that will be changed next) git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@574551 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests/interop_runner.cpp')
-rw-r--r--cpp/src/tests/interop_runner.cpp36
1 files changed, 13 insertions, 23 deletions
diff --git a/cpp/src/tests/interop_runner.cpp b/cpp/src/tests/interop_runner.cpp
index 7c47edafa0..1b87512857 100644
--- a/cpp/src/tests/interop_runner.cpp
+++ b/cpp/src/tests/interop_runner.cpp
@@ -47,6 +47,7 @@ using namespace qpid::sys;
using qpid::TestCase;
using qpid::TestOptions;
using qpid::framing::FieldTable;
+using qpid::framing::ReplyTo;
using namespace std;
class DummyRun : public TestCase
@@ -73,14 +74,14 @@ class Listener : public MessageListener, private Runnable{
const string topic;
TestMap::iterator test;
auto_ptr<Thread> runner;
- string reportTo;
+ ReplyTo reportTo;
string reportCorrelator;
void shutdown();
bool invite(const string& name);
void run();
- void sendResponse(Message& response, string replyTo);
+ void sendResponse(Message& response, ReplyTo replyTo);
void sendResponse(Message& response, Message& request);
void sendSimpleResponse(const string& type, Message& request);
void sendReport();
@@ -146,30 +147,19 @@ void Listener::sendSimpleResponse(const string& type, Message& request)
response.getHeaders().setString("CONTROL_TYPE", type);
response.getHeaders().setString("CLIENT_NAME", name);
response.getHeaders().setString("CLIENT_PRIVATE_CONTROL_KEY", topic);
- response.setCorrelationId(request.getCorrelationId());
+ response.getMessageProperties().setCorrelationId(request.getMessageProperties().getCorrelationId());
sendResponse(response, request);
}
void Listener::sendResponse(Message& response, Message& request)
{
- sendResponse(response, request.getReplyTo());
+ sendResponse(response, request.getMessageProperties().getReplyTo());
}
-void Listener::sendResponse(Message& response, string replyTo)
+void Listener::sendResponse(Message& response, ReplyTo replyTo)
{
- //Exchange and routing key need to be extracted from the reply-to
- //field. Format is assumed to be:
- //
- // <exchange type>://<exchange name>/<routing key>?<options>
- //
- //and all we need is the exchange name and routing key
- //
- if (replyTo.empty()) throw qpid::Exception("Reply address not set!");
- const string delims(":/?=");
-
- string::size_type start = replyTo.find(':');//skip exchange type
- string exchange = parse_next_word(replyTo, delims, start);
- string routingKey = parse_next_word(replyTo, delims, start);
+ string exchange = replyTo.getExchangeName();
+ string routingKey = replyTo.getRoutingKey();
channel.publish(response, exchange, routingKey);
}
@@ -188,12 +178,12 @@ void Listener::received(Message& message)
test->assign(message.getHeaders().getString("ROLE"), message.getHeaders(), options);
sendSimpleResponse("ACCEPT_ROLE", message);
} else if (type == "START") {
- reportTo = message.getReplyTo();
- reportCorrelator = message.getCorrelationId();
+ reportTo = message.getMessageProperties().getReplyTo();
+ reportCorrelator = message.getMessageProperties().getCorrelationId();
runner = auto_ptr<Thread>(new Thread(this));
} else if (type == "STATUS_REQUEST") {
- reportTo = message.getReplyTo();
- reportCorrelator = message.getCorrelationId();
+ reportTo = message.getMessageProperties().getReplyTo();
+ reportCorrelator = message.getMessageProperties().getCorrelationId();
test->stop();
sendReport();
} else if (type == "TERMINATE") {
@@ -229,7 +219,7 @@ void Listener::sendReport()
Message report;
report.getHeaders().setString("CONTROL_TYPE", "REPORT");
test->report(report);
- report.setCorrelationId(reportCorrelator);
+ report.getMessageProperties().setCorrelationId(reportCorrelator);
sendResponse(report, reportTo);
}