summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/modules/atom/atom-test.cpp
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2011-03-08 08:18:07 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2011-03-08 08:18:07 +0000
commit49b878b1b0f2e52bbd5282c22ac32a68e1e8736c (patch)
tree1eb26926f9d703c61b329a0f07178090b57cd55d /sca-cpp/trunk/modules/atom/atom-test.cpp
parent5b33dc5c5a87fff146951ca0543bf558454c331d (diff)
Change ATOM and RSS feed representations to use name value pairs instead of just strings, to allow support for all ATOM and RSS attributes and avoid confusion with non-feed string results.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1079292 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/modules/atom/atom-test.cpp')
-rw-r--r--sca-cpp/trunk/modules/atom/atom-test.cpp63
1 files changed, 39 insertions, 24 deletions
diff --git a/sca-cpp/trunk/modules/atom/atom-test.cpp b/sca-cpp/trunk/modules/atom/atom-test.cpp
index 5503c0f9b4..3030777b87 100644
--- a/sca-cpp/trunk/modules/atom/atom-test.cpp
+++ b/sca-cpp/trunk/modules/atom/atom-test.cpp
@@ -93,19 +93,27 @@ bool testEntry() {
const list<value> i = list<value>() + element + value("item")
+ value(list<value>() + element + value("name") + value(string("Apple")))
+ value(list<value>() + element + value("price") + value(string("$2.99")));
- const list<value> a = mklist<value>(string("item"), string("cart-53d67a61-aa5e-4e5e-8401-39edeba8b83b"), i);
+ const list<value> a = list<value>() + (list<value>() + element + value("entry")
+ + value(list<value>() + element + value("title") + value(string("item")))
+ + value(list<value>() + element + value("id") + value(string("cart-53d67a61-aa5e-4e5e-8401-39edeba8b83b")))
+ + value(list<value>() + element + value("content") + value(i)));
ostringstream os;
writeATOMEntry<ostream*>(writer, &os, a);
assert(str(os) == itemEntry);
}
{
- const list<value> a = mklist<value>(string("item"), string("cart-53d67a61-aa5e-4e5e-8401-39edeba8b83b"), string("Apple"));
+ const list<value> a = list<value>() + (list<value>() + element + value("entry")
+ + value(list<value>() + element + value("title") + value(string("item")))
+ + value(list<value>() + element + value("id") + value(string("cart-53d67a61-aa5e-4e5e-8401-39edeba8b83b")))
+ + value(list<value>() + element + value("content") + value(string("Apple"))));
ostringstream os;
writeATOMEntry<ostream*>(writer, &os, a);
assert(str(os) == itemTextEntry);
}
{
- const list<value> a = mklist<value>(string("item"), string("cart-53d67a61-aa5e-4e5e-8401-39edeba8b83b"), list<value>());
+ const list<value> a = list<value>() + (list<value>() + element + value("entry")
+ + value(list<value>() + element + value("title") + value(string("item")))
+ + value(list<value>() + element + value("id") + value(string("cart-53d67a61-aa5e-4e5e-8401-39edeba8b83b"))));
ostringstream os;
writeATOMEntry<ostream*>(writer, &os, a);
assert(str(os) == itemNoContentEntry);
@@ -173,8 +181,11 @@ const string itemFeed("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
bool testFeed() {
{
+ const list<value> a = list<value>() + (list<value>() + element + value("feed")
+ + value(list<value>() + element + value("title") + value(string("Feed")))
+ + value(list<value>() + element + value("id") + value(string("1234"))));
ostringstream os;
- writeATOMFeed<ostream*>(writer, &os, mklist<value>("Feed", "1234"));
+ writeATOMFeed<ostream*>(writer, &os, a);
assert(str(os) == emptyFeed);
}
{
@@ -184,39 +195,43 @@ bool testFeed() {
assert(str(os) == emptyFeed);
}
{
- const list<value> i = list<value>()
- + (list<value>() + "item" + "cart-53d67a61-aa5e-4e5e-8401-39edeba8b83b"
- + (list<value>() + element + "item"
+ const list<value> i1 = list<value>() + element + "item"
+ (list<value>() + element + "name" + "Apple")
- + (list<value>() + element + "price" + "$2.99")))
- + (list<value>() + "item" + "cart-53d67a61-aa5e-4e5e-8401-39edeba8b83c"
- + (list<value>() + element + "item"
+ + (list<value>() + element + "price" + "$2.99");
+
+ const list<value> i2 = list<value>() + element + "item"
+ (list<value>() + element + "name" + "Orange")
- + (list<value>() + element + "price" + "$3.55")));
- const list<value> a = cons<value>("Feed", cons<value>("1234", i));
+ + (list<value>() + element + "price" + "$3.55");
+
+ const list<value> i = list<value>()
+ + value(list<value>() + element + value("entry")
+ + value(list<value>() + element + value("title") + value(string("item")))
+ + value(list<value>() + element + value("id") + value(string("cart-53d67a61-aa5e-4e5e-8401-39edeba8b83b")))
+ + value(list<value>() + element + value("content") + value(i1)))
+ + value(list<value>() + element + value("entry")
+ + value(list<value>() + element + value("title") + value(string("item")))
+ + value(list<value>() + element + value("id") + value(string("cart-53d67a61-aa5e-4e5e-8401-39edeba8b83c")))
+ + value(list<value>() + element + value("content") + value(i2)));
+
+ const list<value> a = list<value>() + (append<value>(list<value>() + element + value("feed")
+ + value(list<value>() + element + value("title") + value(string("Feed")))
+ + value(list<value>() + element + value("id") + value("1234")),
+ i));
+
ostringstream os;
writeATOMFeed<ostream*>(writer, &os, a);
assert(str(os) == itemFeed);
}
{
- const list<value> i = list<value>()
- + (list<value>() + "item" + "cart-53d67a61-aa5e-4e5e-8401-39edeba8b83b"
- + valueToElement(list<value>() + "item"
- + (list<value>() + "name" + "Apple")
- + (list<value>() + "price" + "$2.99")))
- + (list<value>() + "item" + "cart-53d67a61-aa5e-4e5e-8401-39edeba8b83c"
- + valueToElement(list<value>() + "item"
- + (list<value>() + "name" + "Orange")
- + (list<value>() + "price" + "$3.55")));
- const list<value> a = cons<value>("Feed", cons<value>("1234", i));
+ const list<value> a = content(readATOMFeed(mklist(itemFeed)));
ostringstream os;
writeATOMFeed<ostream*>(writer, &os, a);
assert(str(os) == itemFeed);
}
{
- const list<value> a = content(readATOMFeed(mklist(itemFeed)));
+ const list<value> a = elementsToValues(content(readATOMFeed(mklist(itemFeed))));
ostringstream os;
- writeATOMFeed<ostream*>(writer, &os, a);
+ writeATOMFeed<ostream*>(writer, &os, valuesToElements(a));
assert(str(os) == itemFeed);
}
return true;