diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2010-10-25 03:18:16 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2010-10-25 03:18:16 +0000 |
commit | a2a2cb76e9582af32b6803be7fa99af074dc04ae (patch) | |
tree | d0ef504321e72fe16afd23f385f20386530f5dfc /sca-cpp/trunk/samples/store-nosql | |
parent | 0dd33c3859618f3a385583d7344230f0e1eb1004 (diff) |
Support python method invocation style on references, ref.func(...) in addition to ref('func', ...). Minor cleanup of the various samples, renamed gettotal to total and getcatalog to items, for consistency with the python sample.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1026939 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/samples/store-nosql')
5 files changed, 12 insertions, 12 deletions
diff --git a/sca-cpp/trunk/samples/store-nosql/fruits-catalog.scm b/sca-cpp/trunk/samples/store-nosql/fruits-catalog.scm index 8368a1f369..d55394b96a 100644 --- a/sca-cpp/trunk/samples/store-nosql/fruits-catalog.scm +++ b/sca-cpp/trunk/samples/store-nosql/fruits-catalog.scm @@ -17,7 +17,7 @@ ; Catalog implementation -(define (getcatalog converter currencyCode) +(define (items converter currencyCode) (define code (currencyCode)) (define (convert price) (converter "convert" "USD" code price)) (define symbol (converter "symbol" code)) diff --git a/sca-cpp/trunk/samples/store-nosql/htdocs/index.html b/sca-cpp/trunk/samples/store-nosql/htdocs/index.html index 15e857895e..7de17d92e3 100644 --- a/sca-cpp/trunk/samples/store-nosql/htdocs/index.html +++ b/sca-cpp/trunk/samples/store-nosql/htdocs/index.html @@ -36,7 +36,7 @@ var shoppingTotal = new tuscany.sca.Reference("shoppingTotal"); var catalogItems;
-function catalog_getcatalogResponse(items, exception) {
+function catalog_itemsResponse(items, exception) {
if (exception){
alert(exception.message);
return;
@@ -64,11 +64,11 @@ function shoppingCart_getResponse(feed) { }
document.getElementById("shoppingCart").innerHTML = list;
- shoppingTotal.apply("gettotal", shoppingTotal_gettotalResponse);
+ shoppingTotal.apply("total", shoppingTotal_totalResponse);
}
}
-function shoppingTotal_gettotalResponse(total, exception) {
+function shoppingTotal_totalResponse(total, exception) {
if (exception) {
alert(exception.message);
return;
@@ -119,7 +119,7 @@ function deleteCart() { function init() {
try {
- catalog.apply("getcatalog", catalog_getcatalogResponse);
+ catalog.apply("items", catalog_itemsResponse);
shoppingCart.get("", shoppingCart_getResponse);
} catch(e){
alert(e);
diff --git a/sca-cpp/trunk/samples/store-nosql/server-test b/sca-cpp/trunk/samples/store-nosql/server-test index dd94ccabde..1612bc59e2 100755 --- a/sca-cpp/trunk/samples/store-nosql/server-test +++ b/sca-cpp/trunk/samples/store-nosql/server-test @@ -32,8 +32,8 @@ rc=$? # Test Catalog if [ "$rc" = "0" ]; then - $curl_prefix/bin/curl http://localhost:8090/references/Store/catalog -X POST -H "Content-type: application/json-rpc" --data @../store-cpp/htdocs/test/getcatalog-request.txt >tmp/getcatalog-result.txt 2>/dev/null - diff tmp/getcatalog-result.txt ../store-cpp/htdocs/test/getcatalog-result.txt + $curl_prefix/bin/curl http://localhost:8090/references/Store/catalog -X POST -H "Content-type: application/json-rpc" --data @../store-cpp/htdocs/test/items-request.txt >tmp/items-result.txt 2>/dev/null + diff tmp/items-result.txt ../store-cpp/htdocs/test/items-result.txt rc=$? fi diff --git a/sca-cpp/trunk/samples/store-nosql/shopping-cart.scm b/sca-cpp/trunk/samples/store-nosql/shopping-cart.scm index ec85d463fc..61b169426f 100644 --- a/sca-cpp/trunk/samples/store-nosql/shopping-cart.scm +++ b/sca-cpp/trunk/samples/store-nosql/shopping-cart.scm @@ -75,7 +75,7 @@ ) ; Return the total price of the items in the cart -(define (gettotal cache) +(define (total cache) (define cart (getcart cartId cache)) (sum cart) ) diff --git a/sca-cpp/trunk/samples/store-nosql/store.scm b/sca-cpp/trunk/samples/store-nosql/store.scm index 8bfbb3d5fd..f54257343e 100644 --- a/sca-cpp/trunk/samples/store-nosql/store.scm +++ b/sca-cpp/trunk/samples/store-nosql/store.scm @@ -29,12 +29,12 @@ (shoppingCart "get" id) ) -(define (getcatalog catalog shoppingCart shoppingTotal) - (catalog "getcatalog") +(define (items catalog shoppingCart shoppingTotal) + (catalog "items") ) -(define (gettotal catalog shoppingCart shoppingTotal) - (shoppingCart "gettotal") +(define (total catalog shoppingCart shoppingTotal) + (shoppingCart "total") ) (define (deleteall catalog shoppingCart shoppingTotal) |