From 00438314438f3dde00b532ac5d8d28ccc35c7096 Mon Sep 17 00:00:00 2001 From: jsdelfino Date: Wed, 17 Feb 2010 04:14:31 +0000 Subject: 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 --- sca-cpp/trunk/components/cache/client-test.cpp | 27 ++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'sca-cpp/trunk/components/cache/client-test.cpp') diff --git a/sca-cpp/trunk/components/cache/client-test.cpp b/sca-cpp/trunk/components/cache/client-test.cpp index c8b23b391e..ddf093a6dc 100644 --- a/sca-cpp/trunk/components/cache/client-test.cpp +++ b/sca-cpp/trunk/components/cache/client-test.cpp @@ -36,7 +36,7 @@ namespace tuscany { namespace cache { -const string url("http://localhost:8090/mcache"); +const string uri("http://localhost:8090/mcache"); bool testCache() { http::CURLSession cs; @@ -46,10 +46,12 @@ bool testCache() { + (list() + "price" + string("$2.99")); const list a = mklist(string("item"), string("cart-53d67a61-aa5e-4e5e-8401-39edeba8b83b"), i); - const failable id = http::post(a, url, cs); + const failable id = http::post(a, uri, cs); assert(hasContent(id)); + + const string p = path(content(id)); { - const failable val = http::get(url + "/" + content(id), cs); + const failable val = http::get(uri + p, cs); assert(hasContent(val)); assert(content(val) == a); } @@ -60,22 +62,22 @@ bool testCache() { const list b = mklist(string("item"), string("cart-53d67a61-aa5e-4e5e-8401-39edeba8b83b"), j); { - const failable r = http::put(b, url + "/" + content(id), cs); + const failable r = http::put(b, uri + p, cs); assert(hasContent(r)); assert(content(r) == value(true)); } { - const failable val = http::get(url + "/" + content(id), cs); + const failable val = http::get(uri + p, cs); assert(hasContent(val)); assert(content(val) == b); } { - const failable r = http::del(url + "/" + content(id), cs); + const failable r = http::del(uri + p, cs); assert(hasContent(r)); assert(content(r) == value(true)); } { - const failable val = http::get(url + "/" + content(id), cs); + const failable val = http::get(uri + p, cs); assert(!hasContent(val)); } @@ -83,13 +85,13 @@ bool testCache() { } struct getLoop { - const value id; + const string path; const value entry; http::CURLSession cs; - getLoop(const value& id, const value& entry, http::CURLSession cs) : id(id), entry(entry), cs(cs) { + getLoop(const string& path, const value& entry, http::CURLSession cs) : path(path), entry(entry), cs(cs) { } const bool operator()() const { - const failable val = http::get(url + "/" + id, cs); + const failable val = http::get(uri + path, cs); assert(hasContent(val)); assert(content(val) == entry); return true; @@ -103,10 +105,11 @@ bool testGetPerf() { const value a = mklist(string("item"), string("cart-53d67a61-aa5e-4e5e-8401-39edeba8b83b"), i); http::CURLSession cs; - const failable id = http::post(a, url, cs); + const failable id = http::post(a, uri, cs); assert(hasContent(id)); + const string p = path(content(id)); - const lambda gl = getLoop(content(id), a, cs); + const lambda gl = getLoop(p, a, cs); cout << "Cache get test " << time(gl, 5, 200) << " ms" << endl; return true; -- cgit v1.2.3