summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/test/store-python
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-02-22 06:08:34 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-02-22 06:08:34 +0000
commit8c771c8ecd9bdc6b3ef0d5417db9bb9917b65fa9 (patch)
treea3671bc719d351a822b3728323e6456f163af2c3 /sca-cpp/trunk/test/store-python
parentd11cbfda813c7c6b32c06ddb33242fe3c82514eb (diff)
Moved component start calls from HTTPD postConfig to childInit, to give components an opportunity to start and setup connections and resources in each HTTPD child process. Adjusted utility components and test cases to this change. Minor code cleanup of Java components and integration tests.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@912491 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/test/store-python')
-rw-r--r--sca-cpp/trunk/test/store-python/shopping-cart.py26
1 files changed, 11 insertions, 15 deletions
diff --git a/sca-cpp/trunk/test/store-python/shopping-cart.py b/sca-cpp/trunk/test/store-python/shopping-cart.py
index 083cd94fe0..988fe7bea6 100644
--- a/sca-cpp/trunk/test/store-python/shopping-cart.py
+++ b/sca-cpp/trunk/test/store-python/shopping-cart.py
@@ -24,21 +24,18 @@ 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
# Post a new item to the cart, create a new cart if necessary
-def post(item, cache):
+def post(collection, item, cache):
id = str(uuid.uuid1())
cart = ((item[0], id, item[2]),) + getcart(cartId, cache)
- cache("put", cartId, cart)
- return id
+ cache("put", (cartId,), cart)
+ return (id,)
-# Return the content of the cart
-def getall(cache):
- return ("Your Cart", cartId) + getcart(cartId, cache)
# Find an item in the cart
def find(id, cart):
@@ -49,16 +46,16 @@ def find(id, cart):
else:
return find(id, cart[1:])
-# Get an item from the cart
+# Get items from the cart
def get(id, cache):
- return find(id, getcart(cartId, cache))
+ if id == ():
+ return ("Your Cart", cartId) + getcart(cartId, cache)
+ return find(id[0], getcart(cartId, cache))
-# Delete the whole cart
-def deleteall(cache):
- return cache("delete", cartId)
-
-# Delete an item from the cart
+# Delete items from the cart
def delete(id, cache):
+ if id == ():
+ return cache("delete", (cartId,))
return true
# Return the price of an item
@@ -79,4 +76,3 @@ def gettotal(cache):
# TODO remove these JSON-RPC specific functions
def listMethods(cache):
return ("Service.gettotal",)
-