summaryrefslogtreecommitdiff
path: root/cpp/test/client
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/test/client')
-rw-r--r--cpp/test/client/client_test.cpp4
-rw-r--r--cpp/test/client/echo_service.cpp4
-rw-r--r--cpp/test/client/topic_listener.cpp13
-rw-r--r--cpp/test/client/topic_publisher.cpp12
4 files changed, 19 insertions, 14 deletions
diff --git a/cpp/test/client/client_test.cpp b/cpp/test/client/client_test.cpp
index 18b162ec8a..0a3c300f4a 100644
--- a/cpp/test/client/client_test.cpp
+++ b/cpp/test/client/client_test.cpp
@@ -90,7 +90,9 @@ int main(int argc, char**)
con.close();
std::cout << "Closed connection." << std::endl;
}catch(qpid::QpidError error){
- std::cout << "Error [" << error.code << "] " << error.msg << " (" << error.file << ":" << error.line << ")" << std::endl;
+ std::cout << "Error [" << error.code << "] " << error.msg << " ("
+ << error.location.file << ":" << error.location.line
+ << ")" << std::endl;
return 1;
}
return 0;
diff --git a/cpp/test/client/echo_service.cpp b/cpp/test/client/echo_service.cpp
index f0aa49fd4b..3df3da0b86 100644
--- a/cpp/test/client/echo_service.cpp
+++ b/cpp/test/client/echo_service.cpp
@@ -107,7 +107,7 @@ int main(int argc, char** argv){
connection.close();
} catch(qpid::QpidError error) {
- std::cout << "Error [" << error.code << "] " << error.msg << " (" << error.file << ":" << error.line << ")" << std::endl;
+ std::cout << error.what() << std::endl;
}
} else {
try {
@@ -133,7 +133,7 @@ int main(int argc, char** argv){
connection.close();
} catch(qpid::QpidError error) {
- std::cout << "Error [" << error.code << "] " << error.msg << " (" << error.file << ":" << error.line << ")" << std::endl;
+ std::cout << error.what() << std::endl;
}
}
}
diff --git a/cpp/test/client/topic_listener.cpp b/cpp/test/client/topic_listener.cpp
index 413d482361..bd7cfdc62c 100644
--- a/cpp/test/client/topic_listener.cpp
+++ b/cpp/test/client/topic_listener.cpp
@@ -38,7 +38,7 @@ class Listener : public MessageListener{
const bool transactional;
bool init;
int count;
- int64_t start;
+ Time start;
void shutdown();
void report();
@@ -96,7 +96,7 @@ int main(int argc, char** argv){
channel.run();
connection.close();
}catch(qpid::QpidError error){
- std::cout << "Error [" << error.code << "] " << error.msg << " (" << error.file << ":" << error.line << ")" << std::endl;
+ std::cout << error.what() << std::endl;
}
}
}
@@ -106,7 +106,7 @@ Listener::Listener(Channel* _channel, const std::string& _responseq, bool tx) :
void Listener::received(Message& message){
if(!init){
- start = Time::now().msecs();
+ start = now();
count = 0;
init = true;
}
@@ -128,10 +128,11 @@ void Listener::shutdown(){
}
void Listener::report(){
- int64_t finish = Time::now().msecs();
- int64_t time = finish - start;
+ Time finish = now();
+ Time time = finish - start;
std::stringstream reportstr;
- reportstr << "Received " << count << " messages in " << time << " ms.";
+ reportstr << "Received " << count << " messages in "
+ << time/TIME_MSEC << " ms.";
Message msg;
msg.setData(reportstr.str());
channel->publish(msg, string(), responseQueue);
diff --git a/cpp/test/client/topic_publisher.cpp b/cpp/test/client/topic_publisher.cpp
index d9f271e2f0..97d589c1d1 100644
--- a/cpp/test/client/topic_publisher.cpp
+++ b/cpp/test/client/topic_publisher.cpp
@@ -114,11 +114,13 @@ int main(int argc, char** argv){
int64_t sum(0);
for(int i = 0; i < batchSize; i++){
if(i > 0 && args.getDelay()) sleep(args.getDelay());
- int64_t time = publisher.publish(args.getMessages(), args.getSubscribers(), args.getSize());
+ Time time = publisher.publish(
+ args.getMessages(), args.getSubscribers(), args.getSize());
if(!max || time > max) max = time;
if(!min || time < min) min = time;
sum += time;
- std::cout << "Completed " << (i+1) << " of " << batchSize << " in " << time << "ms" << std::endl;
+ std::cout << "Completed " << (i+1) << " of " << batchSize
+ << " in " << time/TIME_MSEC << "ms" << std::endl;
}
publisher.terminate();
int64_t avg = sum / batchSize;
@@ -129,7 +131,7 @@ int main(int argc, char** argv){
channel.close();
connection.close();
}catch(qpid::QpidError error){
- std::cout << "Error [" << error.code << "] " << error.msg << " (" << error.file << ":" << error.line << ")" << std::endl;
+ std::cout << error.what() << std::endl;
}
}
}
@@ -153,7 +155,7 @@ void Publisher::waitForCompletion(int msgs){
int64_t Publisher::publish(int msgs, int listeners, int size){
Message msg;
msg.setData(generateData(size));
- int64_t start = Time::now().msecs();
+ Time start = now();
{
Monitor::ScopedLock l(monitor);
for(int i = 0; i < msgs; i++){
@@ -170,7 +172,7 @@ int64_t Publisher::publish(int msgs, int listeners, int size){
waitForCompletion(listeners);
}
- int64_t finish(Time::now().msecs());
+ Time finish = now();
return finish - start;
}