diff options
Diffstat (limited to 'sca-cpp/trunk/samples/store-gae')
-rw-r--r-- | sca-cpp/trunk/samples/store-gae/htdocs/test/getcatalog-result.txt | 1 | ||||
-rwxr-xr-x | sca-cpp/trunk/samples/store-gae/server-test | 24 |
2 files changed, 22 insertions, 3 deletions
diff --git a/sca-cpp/trunk/samples/store-gae/htdocs/test/getcatalog-result.txt b/sca-cpp/trunk/samples/store-gae/htdocs/test/getcatalog-result.txt new file mode 100644 index 0000000000..6c2d599106 --- /dev/null +++ b/sca-cpp/trunk/samples/store-gae/htdocs/test/getcatalog-result.txt @@ -0,0 +1 @@ +{"id":1,"result":[{"price":2.9900000000000002,"javaClass":"services.Item","currencyCode":"USD","name":"Apple","currencySymbol":"$"},{"price":3.5499999999999998,"javaClass":"services.Item","currencyCode":"USD","name":"Orange","currencySymbol":"$"},{"price":1.55,"javaClass":"services.Item","currencyCode":"USD","name":"Pear","currencySymbol":"$"}]}
\ No newline at end of file diff --git a/sca-cpp/trunk/samples/store-gae/server-test b/sca-cpp/trunk/samples/store-gae/server-test index a36f6a0239..acaf3b2f0d 100755 --- a/sca-cpp/trunk/samples/store-gae/server-test +++ b/sca-cpp/trunk/samples/store-gae/server-test @@ -25,12 +25,30 @@ curl_prefix=`cat $here/../../modules/http/curl.prefix` ./start 2>/dev/null sleep 2 -# Test HTTP GET +# Test HTTP GET (with authentication) mkdir -p tmp -$curl_prefix/bin/curl -L http://localhost:8090/ 2>/dev/null >tmp/login.html -grep "Login" tmp/login.html >/dev/null +$curl_prefix/bin/curl -L -c tmp/cookies.txt -b tmp/cookies.txt "http://localhost:8090/_ah/login?email=test@example.com&action=Login&continue=http://localhost:8090/" 2>/dev/null >tmp/index.html +diff tmp/index.html htdocs/index.html rc=$? +# Test Catalog +if [ "$rc" = "0" ]; then + $curl_prefix/bin/curl -b tmp/cookies.txt 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 htdocs/test/getcatalog-result.txt + rc=$? +fi + +# Test Shopping Cart +if [ "$rc" = "0" ]; then + $curl_prefix/bin/curl -b tmp/cookies.txt http://localhost:8090/references/Store/shoppingCart -X POST -H "Content-type: application/atom+xml" --data @../store-cpp/htdocs/test/shopping-cart-entry.xml 2>/dev/null + rc=$? +fi +if [ "$rc" = "0" ]; then + $curl_prefix/bin/curl -b tmp/cookies.txt http://localhost:8090/references/Store/shoppingCart >tmp/shopping-cart-feed.xml 2>/dev/null + grep "3.55" tmp/shopping-cart-feed.xml >/dev/null + rc=$? +fi + # Cleanup ./stop sleep 2 |