summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/components/queue/client-test.cpp
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-02-17 04:14:31 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-02-17 04:14:31 +0000
commit00438314438f3dde00b532ac5d8d28ccc35c7096 (patch)
tree80dbbb010c5125455a164c77670b8694231f123f /sca-cpp/trunk/components/queue/client-test.cpp
parent50063bc212e8e93d014519ef0e4d4cabef0b6be2 (diff)
Working queue and chat components. Added a few useful start/stop scripts. Fixed lifecycle code to call start/stop/restart functions before APR pools are cleaned up in both parent and child processes. Minor build script improvements.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@910819 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--sca-cpp/trunk/components/queue/client-test.cpp60
1 files changed, 44 insertions, 16 deletions
diff --git a/sca-cpp/trunk/components/queue/client-test.cpp b/sca-cpp/trunk/components/queue/client-test.cpp
index 121a739e0d..a448d1fccd 100644
--- a/sca-cpp/trunk/components/queue/client-test.cpp
+++ b/sca-cpp/trunk/components/queue/client-test.cpp
@@ -32,28 +32,54 @@
#include "monad.hpp"
#include "perf.hpp"
#include "../../modules/http/curl.hpp"
+#include "qpid.hpp"
+
+// Ignore conversion issues and redundant declarations in Qpid headers
+#ifdef WANT_MAINTAINER_MODE
+#pragma GCC diagnostic ignored "-Wconversion"
+#pragma GCC diagnostic ignored "-Wredundant-decls"
+#endif
namespace tuscany {
namespace queue {
+const value key(mklist<value>(string("report")));
+const string qname("reportq");
+
+const list<value> item = list<value>()
+ + (list<value>() + "name" + string("Apple"))
+ + (list<value>() + "price" + string("$2.99"));
+const list<value> entry = mklist<value>(string("item"), string("cart-53d67a61-aa5e-4e5e-8401-39edeba8b83b"), item);
+
+bool testDeclareQueue() {
+ QpidConnection qc;
+ QpidSession qs(qc);
+ const failable<bool> r = declareQueue(key, qname, qs);
+ assert(hasContent(r));
+ return true;
+}
+
+const bool listener(const value& k, const value& v) {
+ cerr << "k " << k << " v " << v << endl;
+ assert(k == key);
+ assert(v == entry);
+ return false;
+}
+
+bool testListen() {
+ QpidConnection qc;
+ QpidSession qs(qc);
+ QpidSubscription qsub(qs);
+ const lambda<bool(const value&, const value&)> l(listener);
+ listen(qname, l, qsub);
+ return true;
+}
bool testPost() {
- http::CURLSession cs;
-
- const value func = "http://ws.apache.org/axis2/c/samples/echoString";
- const list<value> arg = mklist<value>(
- list<value>() + "ns1:echoString"
- + (list<value>() + "@xmlns:ns1" + string("http://ws.apache.org/axis2/services/echo"))
- + (list<value>() + "text" + string("Hello World!")));
-
- const failable<value> rval = http::evalExpr(mklist<value>(func, arg), "http://localhost:8090/echo-client", cs);
- assert(hasContent(rval));
-
- const list<value> r = mklist<value>(
- list<value>() + "ns1:echoString"
- + (list<value>() + "@xmlns:ns1" + string("http://ws.apache.org/axis2/c/samples"))
- + (list<value>() + "text" + string("Hello World!")));
- assert(content(rval) == r);
+ gc_scoped_pool pool;
+ http::CURLSession ch;
+ const failable<value> id = http::post(entry, "http://localhost:8090/print-sender", ch);
+ assert(hasContent(id));
return true;
}
@@ -63,7 +89,9 @@ bool testPost() {
int main() {
tuscany::cout << "Testing..." << tuscany::endl;
+ tuscany::queue::testDeclareQueue();
tuscany::queue::testPost();
+ tuscany::queue::testListen();
tuscany::cout << "OK" << tuscany::endl;