diff options
Diffstat (limited to 'sca-cpp/trunk/samples/store-scheme')
7 files changed, 25 insertions, 25 deletions
diff --git a/sca-cpp/trunk/samples/store-scheme/fruits-catalog.scm b/sca-cpp/trunk/samples/store-scheme/fruits-catalog.scm index 8368a1f369..d55394b96a 100644 --- a/sca-cpp/trunk/samples/store-scheme/fruits-catalog.scm +++ b/sca-cpp/trunk/samples/store-scheme/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-scheme/htdocs/index.html b/sca-cpp/trunk/samples/store-scheme/htdocs/index.html index 15e857895e..7de17d92e3 100644 --- a/sca-cpp/trunk/samples/store-scheme/htdocs/index.html +++ b/sca-cpp/trunk/samples/store-scheme/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-scheme/script-test.cpp b/sca-cpp/trunk/samples/store-scheme/script-test.cpp index c05c287a20..0d5a9ccf9d 100644 --- a/sca-cpp/trunk/samples/store-scheme/script-test.cpp +++ b/sca-cpp/trunk/samples/store-scheme/script-test.cpp @@ -56,7 +56,7 @@ bool testEval() { ostringstream os; scheme::setupDisplay(os); scheme::Env globalEnv = scheme::setupEnvironment(); - const value exp(mklist<value>("storeui_service", string("getcatalog"))); + const value exp(mklist<value>("storeui_service", string("items"))); const value val = scheme::evalScript(exp, is, globalEnv); ostringstream vs; @@ -71,7 +71,7 @@ bool testEval() { scheme::setupDisplay(os); scheme::Env globalEnv = scheme::setupEnvironment(); - const value exp(mklist<value>("storeui_service", string("gettotal"))); + const value exp(mklist<value>("storeui_service", string("total"))); const value res = scheme::evalScript(exp, is, globalEnv); ostringstream rs; diff --git a/sca-cpp/trunk/samples/store-scheme/script-test.scm b/sca-cpp/trunk/samples/store-scheme/script-test.scm index 2120949701..50b587b8f1 100644 --- a/sca-cpp/trunk/samples/store-scheme/script-test.scm +++ b/sca-cpp/trunk/samples/store-scheme/script-test.scm @@ -53,7 +53,7 @@ (define (catalog_impl converter op args) (cond - ((equal? op "getcatalog") (apply catalog_get (cons converter args))) + ((equal? op "items") (apply catalog_get (cons converter args))) ) ) @@ -76,7 +76,7 @@ (cons "Item" (list id entry)) ) -(define (cart_gettotal) +(define (cart_total) 10.0 ) @@ -85,7 +85,7 @@ ((equal? op "post") (apply cart_post args)) ((equal? op "getall") (apply cart_getall args)) ((equal? op "getentry") (apply cart_getentry args)) - ((equal? op "gettotal") (apply cart_gettotal args)) + ((equal? op "total") (apply cart_total args)) ) ) @@ -103,12 +103,12 @@ (cart "getentry" id) ) -(define (storeui_getcatalog catalog) - (catalog "getcatalog") +(define (storeui_items catalog) + (catalog "items") ) -(define (storeui_gettotal cart) - (cart "gettotal") +(define (storeui_total cart) + (cart "total") ) (define (storeui_impl cart catalog op args) @@ -116,8 +116,8 @@ ((equal? op "post") (apply storeui_post (cons cart args))) ((equal? op "getall") (apply storeui_getcart (cons cart args))) ((equal? op "getentry") (apply storeui_getentry (cons cart args))) - ((equal? op "getcatalog") (apply storeui_getcatalog (cons catalog args))) - ((equal? op "gettotal") (apply storeui_gettotal (cons cart args))) + ((equal? op "items") (apply storeui_items (cons catalog args))) + ((equal? op "total") (apply storeui_total (cons cart args))) ) ) @@ -129,12 +129,12 @@ ; Store UI test case -(define catalog (storeui_service "getcatalog")) +(define catalog (storeui_service "items")) (define empty (list)) (define apple (car catalog)) (define orange (car (cdr catalog))) (define added1 (storeui_service "post" empty apple)) (define added2 (storeui_service "post" added1 orange)) (display (storeui_service "getall" added2)) -(display (storeui_service "gettotal")) +(display (storeui_service "total")) diff --git a/sca-cpp/trunk/samples/store-scheme/server-test b/sca-cpp/trunk/samples/store-scheme/server-test index dd94ccabde..1612bc59e2 100755 --- a/sca-cpp/trunk/samples/store-scheme/server-test +++ b/sca-cpp/trunk/samples/store-scheme/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-scheme/shopping-cart.scm b/sca-cpp/trunk/samples/store-scheme/shopping-cart.scm index ec85d463fc..61b169426f 100644 --- a/sca-cpp/trunk/samples/store-scheme/shopping-cart.scm +++ b/sca-cpp/trunk/samples/store-scheme/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-scheme/store.scm b/sca-cpp/trunk/samples/store-scheme/store.scm index 8bfbb3d5fd..f54257343e 100644 --- a/sca-cpp/trunk/samples/store-scheme/store.scm +++ b/sca-cpp/trunk/samples/store-scheme/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) |