summaryrefslogtreecommitdiffstats
path: root/cpp/sca/modules/http/httpd-test
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2009-11-01 05:25:14 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2009-11-01 05:25:14 +0000
commit6b94d489977c1cb2eeddded3ee329fe6b9605d5c (patch)
treef51d8b2373102cb6c8ac9fc0e051b6f1227a414c /cpp/sca/modules/http/httpd-test
parent9f187b46ae761e8275362d6c1533e9fe79028c7b (diff)
Minor refactoring of read/write functions and primitive procs. Added functions to help store data in memcached. Fixes to HTTP support and more tests.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@831640 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/sca/modules/http/httpd-test')
-rwxr-xr-xcpp/sca/modules/http/httpd-test57
1 files changed, 48 insertions, 9 deletions
diff --git a/cpp/sca/modules/http/httpd-test b/cpp/sca/modules/http/httpd-test
index 3e4c5f82de..04c584496c 100755
--- a/cpp/sca/modules/http/httpd-test
+++ b/cpp/sca/modules/http/httpd-test
@@ -18,20 +18,59 @@
# under the License.
echo "Testing..."
-mkdir -p tmp
-mkdir -p tmp/conf
-cp test-conf/* tmp/conf
-cat >tmp/conf/httpd.conf <<EOF
-ServerName 127.0.0.1
-Listen 9090
-DocumentRoot `pwd`/test-htdocs
+
+# Setup
+./httpd-conf tmp 8090 htdocs
+cat >>tmp/conf/httpd.conf <<EOF
+<Location /test>
+SetHandler mod_tuscany
+SCAContribution `pwd`/
+SCAComponent httpd-test
+SCAImplementation httpd-test.scm
+</Location>
EOF
-mkdir -p tmp/logs
apachectl -k start -d `pwd`/tmp
sleep 1
-curl http://localhost:9090/index.html 2>&1 | grep "It works" >/dev/null
+
+# Test HTTP GET
+curl http://localhost:8090/index.html 2>/dev/null >tmp/index.html
+diff tmp/index.html htdocs/index.html
rc=$?
+
+# Test ATOMPub
+if [ "$rc" = "0" ]; then
+ curl http://localhost:8090/test/ >tmp/feed.xml 2>/dev/null
+ diff tmp/feed.xml htdocs/feed.xml
+ rc=$?
+fi
+if [ "$rc" = "0" ]; then
+ curl http://localhost:8090/test/111 >tmp/entry.xml 2>/dev/null
+ diff tmp/entry.xml htdocs/entry.xml
+ rc=$?
+fi
+if [ "$rc" = "0" ]; then
+ curl http://localhost:8090/test/ -X POST -H "Content-type: application/atom+xml" --data @htdocs/entry.xml 2>/dev/null
+ rc=$?
+fi
+if [ "$rc" = "0" ]; then
+ curl http://localhost:8090/test/111 -X PUT -H "Content-type: application/atom+xml" --data @htdocs/entry.xml 2>/dev/null
+ rc=$?
+fi
+if [ "$rc" = "0" ]; then
+ curl http://localhost:8090/test/111 -X DELETE 2>/dev/null
+ rc=$?
+fi
+
+# Test JSON-RPC
+if [ "$rc" = "0" ]; then
+ 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
+ rc=$?
+fi
+
+# Cleanup
apachectl -k stop -d `pwd`/tmp
+sleep 1
if [ "$rc" = "0" ]; then
echo "OK"
fi