diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2010-02-22 06:08:34 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2010-02-22 06:08:34 +0000 |
commit | 8c771c8ecd9bdc6b3ef0d5417db9bb9917b65fa9 (patch) | |
tree | a3671bc719d351a822b3728323e6456f163af2c3 /sca-cpp/trunk/test/store-scheme/shopping-cart.scm | |
parent | d11cbfda813c7c6b32c06ddb33242fe3c82514eb (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-scheme/shopping-cart.scm')
-rw-r--r-- | sca-cpp/trunk/test/store-scheme/shopping-cart.scm | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/sca-cpp/trunk/test/store-scheme/shopping-cart.scm b/sca-cpp/trunk/test/store-scheme/shopping-cart.scm index f6a4cd3cfa..484044d420 100644 --- a/sca-cpp/trunk/test/store-scheme/shopping-cart.scm +++ b/sca-cpp/trunk/test/store-scheme/shopping-cart.scm @@ -22,24 +22,19 @@ ; Get the shopping cart from the cache ; Return an empty cart if not found (define (getcart id cache) - (define cart (cache "get" id)) + (define cart (cache "get" (list id))) (if (nul cart) (list) cart) ) ; Post a new item to the cart, create a new cart if necessary -(define (post item cache) +(define (post collection item cache) (define id (uuid)) (define newItem (list (car item) id (caddr item))) (define cart (cons newItem (getcart cartId cache))) - (cache "put" cartId cart) - id -) - -; Return the content of the cart -(define (getall cache) - (cons "Your Cart" (cons cartId (getcart cartId cache))) + (cache "put" (list cartId) cart) + (list id) ) ; Find an item in the cart @@ -51,19 +46,20 @@ (find id (cdr cart)))) ) -; Get an item from the cart +; Get items from the cart (define (get id cache) - (find id (getcart cartId cache)) + (if (nul id) + (cons "Your Cart" (cons cartId (getcart cartId cache))) + (find (car id) (getcart cartId cache)) + ) ) -; Delete the whole cart -(define (deleteall cache) - (cache "delete" cartId) -) - -; Delete an item from the cart +; Delete items from the cart (define (delete id cache) - true + (if (nul id) + (cache "delete" (list cartId)) + true + ) ) ; Return the price of an item @@ -86,4 +82,3 @@ ; TODO remove these JSON-RPC specific functions (define (listMethods cache) (list "Service.gettotal")) - |