diff options
Diffstat (limited to '')
9 files changed, 44 insertions, 44 deletions
diff --git a/sca-cpp/trunk/samples/store-vhost/domains/jane/fruits-catalog.py b/sca-cpp/trunk/samples/store-vhost/domains/jane/fruits-catalog.py index fb85d12bc7..fb20b4ff27 100644 --- a/sca-cpp/trunk/samples/store-vhost/domains/jane/fruits-catalog.py +++ b/sca-cpp/trunk/samples/store-vhost/domains/jane/fruits-catalog.py @@ -17,11 +17,11 @@ # Catalog implementation -def getcatalog(converter, currencyCode): - code = currencyCode() +def items(converter, currencyCode): + code = currencyCode.eval() def convert(price): - return converter("convert", "USD", code, price) - symbol = converter("symbol", code) + return converter.convert("USD", code, price) + symbol = converter.symbol(code) return ( (("'name", "Passion"), ("'currencyCode", code), ("'currencySymbol", symbol), ("'price", convert(2.99))), (("'name", "Mango"), ("'currencyCode", code), ("'currencySymbol", symbol), ("'price", convert(3.55))), diff --git a/sca-cpp/trunk/samples/store-vhost/domains/jane/shopping-cart.py b/sca-cpp/trunk/samples/store-vhost/domains/jane/shopping-cart.py index 405adb85bf..feb7398ed9 100644 --- a/sca-cpp/trunk/samples/store-vhost/domains/jane/shopping-cart.py +++ b/sca-cpp/trunk/samples/store-vhost/domains/jane/shopping-cart.py @@ -24,7 +24,7 @@ cartId = "1234" # Get the shopping cart from the cache # Return an empty cart if not found def getcart(id, cache): - cart = cache("get", (id,)) + cart = cache.get((id,)) if cart is None: return () return cart @@ -33,7 +33,7 @@ def getcart(id, cache): def post(collection, item, cache): id = str(uuid.uuid1()) cart = ((item[0], id, item[2]),) + getcart(cartId, cache) - cache("put", (cartId,), cart) + cache.put((cartId,), cart) return (id,) @@ -55,7 +55,7 @@ def get(id, cache): # Delete items from the cart def delete(id, cache): if id == (): - return cache("delete", (cartId,)) + return cache.delete((cartId,)) return True # Return the price of an item @@ -69,7 +69,7 @@ def sum(items): return price(items[0]) + sum(items[1:]) # Return the total price of the items in the cart -def gettotal(cache): +def total(cache): cart = getcart(cartId, cache) return sum(cart) diff --git a/sca-cpp/trunk/samples/store-vhost/domains/jane/store.py b/sca-cpp/trunk/samples/store-vhost/domains/jane/store.py index 0b4e0f72fd..ff82f1d327 100644 --- a/sca-cpp/trunk/samples/store-vhost/domains/jane/store.py +++ b/sca-cpp/trunk/samples/store-vhost/domains/jane/store.py @@ -18,23 +18,23 @@ # Store implementation def post(item, catalog, shoppingCart, shoppingTotal): - return shoppingCart("post", item) + return shoppingCart.post(item) def getall(catalog, shoppingCart, shoppingTotal): - return shoppingCart("getall") + return shoppingCart.getall() def get(id, catalog, shoppingCart, shoppingTotal): - return shoppingCart("get", id) + return shoppingCart.get(id) -def getcatalog(catalog, shoppingCart, shoppingTotal): - return catalog("getcatalog") +def items(catalog, shoppingCart, shoppingTotal): + return catalog.items() -def gettotal(catalog, shoppingCart, shoppingTotal): - return shoppingCart("gettotal") +def total(catalog, shoppingCart, shoppingTotal): + return shoppingCart.total() def deleteall(catalog, shoppingCart, shoppingTotal): - return shoppingCart("deleteall") + return shoppingCart.deleteall() def delete(id, catalog, shoppingCart, shoppingTotal): - return shoppingCart("delete", id) + return shoppingCart.delete(id) diff --git a/sca-cpp/trunk/samples/store-vhost/domains/joe/fruits-catalog.py b/sca-cpp/trunk/samples/store-vhost/domains/joe/fruits-catalog.py index b5eb035ae3..6644421683 100644 --- a/sca-cpp/trunk/samples/store-vhost/domains/joe/fruits-catalog.py +++ b/sca-cpp/trunk/samples/store-vhost/domains/joe/fruits-catalog.py @@ -17,11 +17,11 @@ # Catalog implementation -def getcatalog(converter, currencyCode): - code = currencyCode() +def items(converter, currencyCode): + code = currencyCode.eval() def convert(price): - return converter("convert", "USD", code, price) - symbol = converter("symbol", code) + return converter.convert("USD", code, price) + symbol = converter.symbol(code) return ( (("'name", "Apple"), ("'currencyCode", code), ("'currencySymbol", symbol), ("'price", convert(2.99))), (("'name", "Orange"), ("'currencyCode", code), ("'currencySymbol", symbol), ("'price", convert(3.55))), diff --git a/sca-cpp/trunk/samples/store-vhost/domains/joe/shopping-cart.py b/sca-cpp/trunk/samples/store-vhost/domains/joe/shopping-cart.py index 405adb85bf..feb7398ed9 100644 --- a/sca-cpp/trunk/samples/store-vhost/domains/joe/shopping-cart.py +++ b/sca-cpp/trunk/samples/store-vhost/domains/joe/shopping-cart.py @@ -24,7 +24,7 @@ cartId = "1234" # Get the shopping cart from the cache # Return an empty cart if not found def getcart(id, cache): - cart = cache("get", (id,)) + cart = cache.get((id,)) if cart is None: return () return cart @@ -33,7 +33,7 @@ def getcart(id, cache): def post(collection, item, cache): id = str(uuid.uuid1()) cart = ((item[0], id, item[2]),) + getcart(cartId, cache) - cache("put", (cartId,), cart) + cache.put((cartId,), cart) return (id,) @@ -55,7 +55,7 @@ def get(id, cache): # Delete items from the cart def delete(id, cache): if id == (): - return cache("delete", (cartId,)) + return cache.delete((cartId,)) return True # Return the price of an item @@ -69,7 +69,7 @@ def sum(items): return price(items[0]) + sum(items[1:]) # Return the total price of the items in the cart -def gettotal(cache): +def total(cache): cart = getcart(cartId, cache) return sum(cart) diff --git a/sca-cpp/trunk/samples/store-vhost/domains/joe/store.py b/sca-cpp/trunk/samples/store-vhost/domains/joe/store.py index 0b4e0f72fd..ff82f1d327 100644 --- a/sca-cpp/trunk/samples/store-vhost/domains/joe/store.py +++ b/sca-cpp/trunk/samples/store-vhost/domains/joe/store.py @@ -18,23 +18,23 @@ # Store implementation def post(item, catalog, shoppingCart, shoppingTotal): - return shoppingCart("post", item) + return shoppingCart.post(item) def getall(catalog, shoppingCart, shoppingTotal): - return shoppingCart("getall") + return shoppingCart.getall() def get(id, catalog, shoppingCart, shoppingTotal): - return shoppingCart("get", id) + return shoppingCart.get(id) -def getcatalog(catalog, shoppingCart, shoppingTotal): - return catalog("getcatalog") +def items(catalog, shoppingCart, shoppingTotal): + return catalog.items() -def gettotal(catalog, shoppingCart, shoppingTotal): - return shoppingCart("gettotal") +def total(catalog, shoppingCart, shoppingTotal): + return shoppingCart.total() def deleteall(catalog, shoppingCart, shoppingTotal): - return shoppingCart("deleteall") + return shoppingCart.deleteall() def delete(id, catalog, shoppingCart, shoppingTotal): - return shoppingCart("delete", id) + return shoppingCart.delete(id) diff --git a/sca-cpp/trunk/samples/store-vhost/htdocs/domains/jane/index.html b/sca-cpp/trunk/samples/store-vhost/htdocs/domains/jane/index.html index b60e18690a..376b15f6c1 100644 --- a/sca-cpp/trunk/samples/store-vhost/htdocs/domains/jane/index.html +++ b/sca-cpp/trunk/samples/store-vhost/htdocs/domains/jane/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-vhost/htdocs/domains/joe/index.html b/sca-cpp/trunk/samples/store-vhost/htdocs/domains/joe/index.html index 37ed010229..e3675dc2d3 100644 --- a/sca-cpp/trunk/samples/store-vhost/htdocs/domains/joe/index.html +++ b/sca-cpp/trunk/samples/store-vhost/htdocs/domains/joe/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-vhost/server-test b/sca-cpp/trunk/samples/store-vhost/server-test index 5cc160b23f..405da2165d 100755 --- a/sca-cpp/trunk/samples/store-vhost/server-test +++ b/sca-cpp/trunk/samples/store-vhost/server-test @@ -35,8 +35,8 @@ rc=$? # Test Catalog if [ "$rc" = "0" ]; then - $curl_prefix/bin/curl http://joe.sca-store.com: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://joe.sca-store.com: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 |