diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2009-12-26 03:25:34 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2009-12-26 03:25:34 +0000 |
commit | 0999fd565d6d629df87d3db38a84d4701b494b3b (patch) | |
tree | 287bb29d011a1c1616ca434ce6c51ab57b63dda2 /sca-cpp/trunk/modules/scdl | |
parent | bd4c1d47aeaf1d4bca76d5713e705b0869d3f2f7 (diff) |
Simplified server configuration, HTTPD modules now use deployment composite to route service requests, minor fixes to store integration test.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@893939 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/modules/scdl')
-rw-r--r-- | sca-cpp/trunk/modules/scdl/scdl-test.cpp | 8 | ||||
-rw-r--r-- | sca-cpp/trunk/modules/scdl/scdl.hpp | 32 |
2 files changed, 34 insertions, 6 deletions
diff --git a/sca-cpp/trunk/modules/scdl/scdl-test.cpp b/sca-cpp/trunk/modules/scdl/scdl-test.cpp index c3da1013a8..582d1ee073 100644 --- a/sca-cpp/trunk/modules/scdl/scdl-test.cpp +++ b/sca-cpp/trunk/modules/scdl/scdl-test.cpp @@ -28,7 +28,9 @@ #include <sstream> #include <fstream> #include <string> +#include "list.hpp" #include "slist.hpp" +#include "tree.hpp" #include "scdl.hpp" namespace tuscany { @@ -53,6 +55,9 @@ bool testComponents() { const value catalog = named(std::string("Catalog"), c); assert(name(catalog) == std::string("Catalog")); + + const list<value> t = mkbtree(sort(nameToElementAssoc(c))); + assert(assoctree<value>("Catalog", t) == mklist<value>("Catalog" , cadr(c))); return true; } @@ -86,6 +91,9 @@ bool testReferences() { const value binding = car(bindings(catalog)); assert(uri(binding) == value()); assert(bindingType(binding) == "t:binding.jsonrpc"); + + const list<value> t = mkbtree(sort(referenceToTargetAssoc(references(store)))); + assert(assoctree<value>("shoppingCart", t) == mklist<value>(std::string("shoppingCart"), std::string("ShoppingCart/Cart"))); return true; } diff --git a/sca-cpp/trunk/modules/scdl/scdl.hpp b/sca-cpp/trunk/modules/scdl/scdl.hpp index 4d84610fb0..9d4bf38b50 100644 --- a/sca-cpp/trunk/modules/scdl/scdl.hpp +++ b/sca-cpp/trunk/modules/scdl/scdl.hpp @@ -53,6 +53,16 @@ const value name(const value& l) { } /** + * Convert a list of elements to a name -> element assoc list. + */ +const list<value> nameToElementAssoc(const list<value>& l) { + if (isNil(l)) + return l; + const value e(car(l)); + return cons<value>(mklist<value>(name(e), e), nameToElementAssoc(cdr(l))); +} + +/** * Returns the scdl declaration with the given name. */ struct filterName { @@ -107,17 +117,20 @@ const list<value> references(const value& l) { } /** - * Returns a list of properties in a component. + * Returns the target of a reference. */ -const list<value> properties(const value& l) { - return elementChildren("property", l); +const value target(const value& l) { + return attributeValue("target", l); } /** - * Returns the target of a reference. + * Convert a list of references to a reference name -> target assoc list. */ -const value target(const value& l) { - return attributeValue("target", l); +const list<value> referenceToTargetAssoc(const list<value>& r) { + if (isNil(r)) + return r; + const value ref(car(r)); + return cons<value>(mklist<value>(scdl::name(ref), scdl::target(ref)), referenceToTargetAssoc(cdr(r))); } /** @@ -132,6 +145,13 @@ const list<value> bindings(const value& l) { } /** + * Returns a list of properties in a component. + */ +const list<value> properties(const value& l) { + return elementChildren("property", l); +} + +/** * Returns the type of an implementation. */ const value implementationType(const value& l) { |