Add more JSON and ATOMPub test cases.

git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@965342 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
jsdelfino 2010-07-19 02:27:31 +00:00
parent c59c7ef6db
commit a19a7d3f51
24 changed files with 168 additions and 39 deletions

View file

@ -43,20 +43,20 @@ rc=$?
# Test ATOMPub
if [ "$rc" = "0" ]; then
$curl_prefix/bin/curl http://localhost:8090/client/ >tmp/feed.xml 2>/dev/null
diff tmp/feed.xml ../server/htdocs/feed.xml
diff tmp/feed.xml ../server/htdocs/test/feed.xml
rc=$?
fi
if [ "$rc" = "0" ]; then
$curl_prefix/bin/curl http://localhost:8090/client/111 >tmp/entry.xml 2>/dev/null
diff tmp/entry.xml ../server/htdocs/entry.xml
diff tmp/entry.xml ../server/htdocs/test/entry.xml
rc=$?
fi
if [ "$rc" = "0" ]; then
$curl_prefix/bin/curl http://localhost:8090/client/ -X POST -H "Content-type: application/atom+xml" --data @../server/htdocs/entry.xml 2>/dev/null
$curl_prefix/bin/curl http://localhost:8090/client/ -X POST -H "Content-type: application/atom+xml" --data @../server/htdocs/test/entry.xml 2>/dev/null
rc=$?
fi
if [ "$rc" = "0" ]; then
$curl_prefix/bin/curl http://localhost:8090/client/111 -X PUT -H "Content-type: application/atom+xml" --data @../server/htdocs/entry.xml 2>/dev/null
$curl_prefix/bin/curl http://localhost:8090/client/111 -X PUT -H "Content-type: application/atom+xml" --data @../server/htdocs/test/entry.xml 2>/dev/null
rc=$?
fi
if [ "$rc" = "0" ]; then
@ -66,8 +66,8 @@ fi
# Test JSON-RPC
if [ "$rc" = "0" ]; then
$curl_prefix/bin/curl http://localhost:8090/client/ -X POST -H "Content-type: application/json-rpc" --data @../server/htdocs/json-request.txt >tmp/json-result.txt 2>/dev/null
diff tmp/json-result.txt ../server/htdocs/json-result.txt
$curl_prefix/bin/curl http://localhost:8090/client/ -X POST -H "Content-type: application/json-rpc" --data @../server/htdocs/test/json-request.txt >tmp/json-result.txt 2>/dev/null
diff tmp/json-result.txt ../server/htdocs/test/json-result.txt
rc=$?
fi

View file

@ -41,20 +41,20 @@ rc=$?
# Test ATOMPub
if [ "$rc" = "0" ]; then
$curl_prefix/bin/curl http://localhost:8090/client/ >tmp/feed.xml 2>/dev/null
diff tmp/feed.xml ../server/htdocs/feed.xml
diff tmp/feed.xml ../server/htdocs/test/feed.xml
rc=$?
fi
if [ "$rc" = "0" ]; then
$curl_prefix/bin/curl http://localhost:8090/client/111 >tmp/entry.xml 2>/dev/null
diff tmp/entry.xml ../server/htdocs/entry.xml
diff tmp/entry.xml ../server/htdocs/test/entry.xml
rc=$?
fi
if [ "$rc" = "0" ]; then
$curl_prefix/bin/curl http://localhost:8090/client/ -X POST -H "Content-type: application/atom+xml" --data @../server/htdocs/entry.xml 2>/dev/null
$curl_prefix/bin/curl http://localhost:8090/client/ -X POST -H "Content-type: application/atom+xml" --data @../server/htdocs/test/entry.xml 2>/dev/null
rc=$?
fi
if [ "$rc" = "0" ]; then
$curl_prefix/bin/curl http://localhost:8090/client/111 -X PUT -H "Content-type: application/atom+xml" --data @../server/htdocs/entry.xml 2>/dev/null
$curl_prefix/bin/curl http://localhost:8090/client/111 -X PUT -H "Content-type: application/atom+xml" --data @../server/htdocs/test/entry.xml 2>/dev/null
rc=$?
fi
if [ "$rc" = "0" ]; then
@ -64,8 +64,8 @@ fi
# Test JSON-RPC
if [ "$rc" = "0" ]; then
$curl_prefix/bin/curl http://localhost:8090/client/ -X POST -H "Content-type: application/json-rpc" --data @../server/htdocs/json-request.txt >tmp/json-result.txt 2>/dev/null
diff tmp/json-result.txt ../server/htdocs/json-result.txt
$curl_prefix/bin/curl http://localhost:8090/client/ -X POST -H "Content-type: application/json-rpc" --data @../server/htdocs/test/json-request.txt >tmp/json-result.txt 2>/dev/null
diff tmp/json-result.txt ../server/htdocs/test/json-result.txt
rc=$?
fi

View file

@ -41,20 +41,20 @@ rc=$?
# Test ATOMPub
if [ "$rc" = "0" ]; then
$curl_prefix/bin/curl http://localhost:8090/test/ >tmp/feed.xml 2>/dev/null
diff tmp/feed.xml htdocs/feed.xml
diff tmp/feed.xml htdocs/test/feed.xml
rc=$?
fi
if [ "$rc" = "0" ]; then
$curl_prefix/bin/curl http://localhost:8090/test/111 >tmp/entry.xml 2>/dev/null
diff tmp/entry.xml htdocs/entry.xml
diff tmp/entry.xml htdocs/test/entry.xml
rc=$?
fi
if [ "$rc" = "0" ]; then
$curl_prefix/bin/curl http://localhost:8090/test/ -X POST -H "Content-type: application/atom+xml" --data @htdocs/entry.xml 2>/dev/null
$curl_prefix/bin/curl http://localhost:8090/test/ -X POST -H "Content-type: application/atom+xml" --data @htdocs/test/entry.xml 2>/dev/null
rc=$?
fi
if [ "$rc" = "0" ]; then
$curl_prefix/bin/curl http://localhost:8090/test/111 -X PUT -H "Content-type: application/atom+xml" --data @htdocs/entry.xml 2>/dev/null
$curl_prefix/bin/curl http://localhost:8090/test/111 -X PUT -H "Content-type: application/atom+xml" --data @htdocs/test/entry.xml 2>/dev/null
rc=$?
fi
if [ "$rc" = "0" ]; then
@ -64,8 +64,8 @@ fi
# Test JSON-RPC
if [ "$rc" = "0" ]; then
$curl_prefix/bin/curl http://localhost:8090/test/ -X POST -H "Content-type: application/json-rpc" --data @htdocs/json-request.txt >tmp/json-result.txt 2>/dev/null
diff tmp/json-result.txt htdocs/json-result.txt
$curl_prefix/bin/curl http://localhost:8090/test/ -X POST -H "Content-type: application/json-rpc" --data @htdocs/test/json-request.txt >tmp/json-result.txt 2>/dev/null
diff tmp/json-result.txt htdocs/test/json-result.txt
rc=$?
fi

View file

@ -41,20 +41,20 @@ rc=$?
# Test ATOMPub
if [ "$rc" = "0" ]; then
$curl_prefix/bin/curl http://localhost:8090/client/ >tmp/feed.xml 2>/dev/null
diff tmp/feed.xml htdocs/feed.xml
diff tmp/feed.xml htdocs/test/feed.xml
rc=$?
fi
if [ "$rc" = "0" ]; then
$curl_prefix/bin/curl http://localhost:8090/client/111 >tmp/entry.xml 2>/dev/null
diff tmp/entry.xml htdocs/entry.xml
diff tmp/entry.xml htdocs/test/entry.xml
rc=$?
fi
if [ "$rc" = "0" ]; then
$curl_prefix/bin/curl http://localhost:8090/client/ -X POST -H "Content-type: application/atom+xml" --data @htdocs/entry.xml 2>/dev/null
$curl_prefix/bin/curl http://localhost:8090/client/ -X POST -H "Content-type: application/atom+xml" --data @htdocs/test/entry.xml 2>/dev/null
rc=$?
fi
if [ "$rc" = "0" ]; then
$curl_prefix/bin/curl http://localhost:8090/client/111 -X PUT -H "Content-type: application/atom+xml" --data @htdocs/entry.xml 2>/dev/null
$curl_prefix/bin/curl http://localhost:8090/client/111 -X PUT -H "Content-type: application/atom+xml" --data @htdocs/test/entry.xml 2>/dev/null
rc=$?
fi
if [ "$rc" = "0" ]; then
@ -64,8 +64,8 @@ fi
# Test JSON-RPC
if [ "$rc" = "0" ]; then
$curl_prefix/bin/curl http://localhost:8090/client/ -X POST -H "Content-type: application/json-rpc" --data @htdocs/json-request.txt >tmp/json-result.txt 2>/dev/null
diff tmp/json-result.txt htdocs/json-result.txt
$curl_prefix/bin/curl http://localhost:8090/client/ -X POST -H "Content-type: application/json-rpc" --data @htdocs/test/json-request.txt >tmp/json-result.txt 2>/dev/null
diff tmp/json-result.txt htdocs/test/json-result.txt
rc=$?
fi

View file

@ -38,20 +38,20 @@ rc=$?
# Test ATOMPub
if [ "$rc" = "0" ]; then
$curl_prefix/bin/curl $uri/client/ >tmp/feed.xml 2>/dev/null
diff tmp/feed.xml htdocs/feed.xml
diff tmp/feed.xml htdocs/test/feed.xml
rc=$?
fi
if [ "$rc" = "0" ]; then
$curl_prefix/bin/curl $uri/client/111 >tmp/entry.xml 2>/dev/null
diff tmp/entry.xml htdocs/entry.xml
diff tmp/entry.xml htdocs/test/entry.xml
rc=$?
fi
if [ "$rc" = "0" ]; then
$curl_prefix/bin/curl $uri/client/ -X POST -H "Content-type: application/atom+xml" --data @htdocs/entry.xml 2>/dev/null
$curl_prefix/bin/curl $uri/client/ -X POST -H "Content-type: application/atom+xml" --data @htdocs/test/entry.xml 2>/dev/null
rc=$?
fi
if [ "$rc" = "0" ]; then
$curl_prefix/bin/curl $uri/client/111 -X PUT -H "Content-type: application/atom+xml" --data @htdocs/entry.xml 2>/dev/null
$curl_prefix/bin/curl $uri/client/111 -X PUT -H "Content-type: application/atom+xml" --data @htdocs/test/entry.xml 2>/dev/null
rc=$?
fi
if [ "$rc" = "0" ]; then
@ -61,8 +61,8 @@ fi
# Test JSON-RPC
if [ "$rc" = "0" ]; then
$curl_prefix/bin/curl $uri/client/ -X POST -H "Content-type: application/json-rpc" --data @htdocs/json-request.txt >tmp/json-result.txt 2>/dev/null
diff tmp/json-result.txt htdocs/json-result.txt
$curl_prefix/bin/curl $uri/client/ -X POST -H "Content-type: application/json-rpc" --data @htdocs/test/json-request.txt >tmp/json-result.txt 2>/dev/null
diff tmp/json-result.txt htdocs/test/json-result.txt
rc=$?
fi

View file

@ -34,20 +34,20 @@ rc=$?
# Test ATOMPub
if [ "$rc" = "0" ]; then
$curl_prefix/bin/curl http://localhost:8090/wsgi/ >tmp/feed.xml 2>/dev/null
diff tmp/feed.xml htdocs/feed.xml
diff tmp/feed.xml htdocs/test/feed.xml
rc=$?
fi
if [ "$rc" = "0" ]; then
$curl_prefix/bin/curl http://localhost:8090/wsgi/111 >tmp/entry.xml 2>/dev/null
diff tmp/entry.xml htdocs/entry.xml
diff tmp/entry.xml htdocs/test/entry.xml
rc=$?
fi
if [ "$rc" = "0" ]; then
$curl_prefix/bin/curl http://localhost:8090/wsgi/ -X POST -H "Content-type: application/atom+xml" --data @htdocs/entry.xml 2>/dev/null
$curl_prefix/bin/curl http://localhost:8090/wsgi/ -X POST -H "Content-type: application/atom+xml" --data @htdocs/test/entry.xml 2>/dev/null
rc=$?
fi
if [ "$rc" = "0" ]; then
$curl_prefix/bin/curl http://localhost:8090/wsgi/111 -X PUT -H "Content-type: application/atom+xml" --data @htdocs/entry.xml 2>/dev/null
$curl_prefix/bin/curl http://localhost:8090/wsgi/111 -X PUT -H "Content-type: application/atom+xml" --data @htdocs/test/entry.xml 2>/dev/null
rc=$?
fi
if [ "$rc" = "0" ]; then
@ -57,8 +57,8 @@ fi
# Test JSON-RPC
if [ "$rc" = "0" ]; then
$curl_prefix/bin/curl http://localhost:8090/wsgi/ -X POST -H "Content-type: application/json-rpc" --data @htdocs/json-request.txt >tmp/json-result.txt 2>/dev/null
diff tmp/json-result.txt htdocs/json-result.txt
$curl_prefix/bin/curl http://localhost:8090/wsgi/ -X POST -H "Content-type: application/json-rpc" --data @htdocs/test/json-request.txt >tmp/json-result.txt 2>/dev/null
diff tmp/json-result.txt htdocs/test/json-result.txt
rc=$?
fi

View file

@ -0,0 +1 @@
{"id": 1, "method": "getcatalog", "params": []}

View file

@ -0,0 +1 @@
{"id":1,"result":[{"javaClass":"services.Item","name":"Apple","currencyCode":"USD","currencySymbol":"$","price":2.99},{"javaClass":"services.Item","name":"Orange","currencyCode":"USD","currencySymbol":"$","price":3.55},{"javaClass":"services.Item","name":"Pear","currencyCode":"USD","currencySymbol":"$","price":1.55}]}

View file

@ -0,0 +1 @@
<entry xmlns="http://www.w3.org/2005/Atom"><title type="text">Item</title><content type="application/xml"><item><javaClass>services.Item</javaClass><name>Orange</name><currencyCode>USD</currencyCode><currencySymbol>$</currencySymbol><price>3.55</price></item></content></entry>

View file

@ -30,6 +30,24 @@ $curl_prefix/bin/curl 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 http://localhost:8090/references/Store/catalog -X POST -H "Content-type: application/json-rpc" --data @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 http://localhost:8090/references/Store/shoppingCart -X POST -H "Content-type: application/atom+xml" --data @htdocs/test/shopping-cart-entry.xml 2>/dev/null
rc=$?
fi
if [ "$rc" = "0" ]; then
$curl_prefix/bin/curl 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

View file

@ -30,6 +30,24 @@ $curl_prefix/bin/curl 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 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
rc=$?
fi
# Test Shopping Cart
if [ "$rc" = "0" ]; then
$curl_prefix/bin/curl 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 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

View file

@ -30,6 +30,24 @@ $curl_prefix/bin/curl 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 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
rc=$?
fi
# Test Shopping Cart
if [ "$rc" = "0" ]; then
$curl_prefix/bin/curl 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 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

View file

@ -30,6 +30,24 @@ $curl_prefix/bin/curl 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 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
rc=$?
fi
# Test Shopping Cart
if [ "$rc" = "0" ]; then
$curl_prefix/bin/curl 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 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

View file

@ -30,6 +30,24 @@ $curl_prefix/bin/curl 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 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
rc=$?
fi
# Test Shopping Cart
if [ "$rc" = "0" ]; then
$curl_prefix/bin/curl 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 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

View file

@ -30,6 +30,24 @@ $curl_prefix/bin/curl 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 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
rc=$?
fi
# Test Shopping Cart
if [ "$rc" = "0" ]; then
$curl_prefix/bin/curl 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 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

View file

@ -26,13 +26,31 @@ curl_prefix=`cat $here/../../modules/http/curl.prefix`
sleep 2
# For this test to work, add the test domain to your etc/hosts as follows:
# 127.0.0.1 sca-store.com jane.sca-store.com joe.sca-store.com
# 127.0.0.1 sca-store.com joe.sca-store.com joe.sca-store.com
# Test HTTP GET
$curl_prefix/bin/curl http://jane.sca-store.com:8090/ 2>/dev/null >tmp/jane.html
diff tmp/jane.html htdocs/domains/jane/index.html
$curl_prefix/bin/curl http://joe.sca-store.com:8090/ 2>/dev/null >tmp/index.html
diff tmp/index.html htdocs/domains/joe/index.html
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
rc=$?
fi
# Test Shopping Cart
if [ "$rc" = "0" ]; then
$curl_prefix/bin/curl http://joe.sca-store.com: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 http://joe.sca-store.com: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