summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/components/cache/client-test.cpp
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2012-01-16 03:49:08 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2012-01-16 03:49:08 +0000
commitd907c6fe647877d70da4d0da60a9d484bb36560f (patch)
tree34431733b7b8247e83ebb41bf6351f14d356bfd1 /sca-cpp/trunk/components/cache/client-test.cpp
parentc3cc3ea6b1ea3472899bd467230fffd82d1889aa (diff)
Add a partitioner component, which combined with a selector component can be used to implement data partitioning, sharding, or data access load balancing for example.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1231822 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--sca-cpp/trunk/components/cache/client-test.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/sca-cpp/trunk/components/cache/client-test.cpp b/sca-cpp/trunk/components/cache/client-test.cpp
index c44060b7a4..b652ad3a88 100644
--- a/sca-cpp/trunk/components/cache/client-test.cpp
+++ b/sca-cpp/trunk/components/cache/client-test.cpp
@@ -39,6 +39,8 @@ namespace cache {
const string memcacheuri("http://localhost:8090/memcache");
const string datacacheuri("http://localhost:8090/datacache");
const string memocacheuri("http://localhost:8090/memocache");
+const string partition1uri("http://localhost:8090/partitioner/a");
+const string partition2uri("http://localhost:8090/partitioner/b");
bool testCache(const string& uri) {
http::CURLSession cs("", "", "", "");
@@ -114,6 +116,20 @@ bool testMemocache() {
return true;
}
+bool testPartitioner() {
+ http::CURLSession cs("", "", "", "");
+
+ const failable<value> res1 = http::get(partition1uri, cs);
+ assert(hasContent(res1));
+ assert(cadr<value>(content(res1)) == string("1"));
+
+ const failable<value> res2 = http::get(partition2uri, cs);
+ assert(hasContent(res2));
+ assert(cadr<value>(content(res2)) == string("2"));
+
+ return true;
+}
+
struct getLoop {
const string path;
const value entry;
@@ -157,6 +173,7 @@ int main() {
tuscany::cache::testMemcache();
tuscany::cache::testDatacache();
tuscany::cache::testMemocache();
+ tuscany::cache::testPartitioner();
tuscany::cache::testGetPerf();
tuscany::cout << "OK" << tuscany::endl;