summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/samples/store-cpp
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-07-06 09:05:57 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-07-06 09:05:57 +0000
commit0389017140b0af23e061fdd66d7467da75f95e83 (patch)
treedc2d6840ee46733632bcc16d1e3fb71bd9d810bf /sca-cpp/trunk/samples/store-cpp
parentf2f3364d648a8bc7edd761677ac937a64c3225ae (diff)
Minor cleanup of config scripts and samples.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@960846 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/samples/store-cpp')
-rw-r--r--sca-cpp/trunk/samples/store-cpp/Makefile.am2
-rw-r--r--sca-cpp/trunk/samples/store-cpp/htdocs/.htaccess19
-rw-r--r--sca-cpp/trunk/samples/store-cpp/htdocs/index.html157
-rw-r--r--sca-cpp/trunk/samples/store-cpp/htdocs/store.html170
-rwxr-xr-xsca-cpp/trunk/samples/store-cpp/server-test4
5 files changed, 160 insertions, 192 deletions
diff --git a/sca-cpp/trunk/samples/store-cpp/Makefile.am b/sca-cpp/trunk/samples/store-cpp/Makefile.am
index 05c8d33808..de4a63553f 100644
--- a/sca-cpp/trunk/samples/store-cpp/Makefile.am
+++ b/sca-cpp/trunk/samples/store-cpp/Makefile.am
@@ -19,7 +19,7 @@
dist_sample_SCRIPTS = start stop ssl-start
sampledir = $(prefix)/samples/store-cpp
-nobase_dist_sample_DATA = currency-converter.cpp fruits-catalog.cpp shopping-cart.cpp store.composite htdocs/.htaccess htdocs/*.html
+nobase_dist_sample_DATA = currency-converter.cpp fruits-catalog.cpp shopping-cart.cpp store.composite htdocs/*.html
sample_LTLIBRARIES = libcurrency-converter.la libfruits-catalog.la libshopping-cart.la
diff --git a/sca-cpp/trunk/samples/store-cpp/htdocs/.htaccess b/sca-cpp/trunk/samples/store-cpp/htdocs/.htaccess
deleted file mode 100644
index e2e343b6b2..0000000000
--- a/sca-cpp/trunk/samples/store-cpp/htdocs/.htaccess
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-DirectoryIndex store.html
diff --git a/sca-cpp/trunk/samples/store-cpp/htdocs/index.html b/sca-cpp/trunk/samples/store-cpp/htdocs/index.html
new file mode 100644
index 0000000000..c27e54f753
--- /dev/null
+++ b/sca-cpp/trunk/samples/store-cpp/htdocs/index.html
@@ -0,0 +1,157 @@
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<html>
+<head>
+<title>Store</title>
+
+<script type="text/javascript" src="/js/tuscany-ref.js"></script>
+
+<script type="text/javascript">
+var component = new tuscany.sca.Component("Store");
+
+//@Reference
+var catalog = new tuscany.sca.Reference("catalog");
+
+//@Reference
+var shoppingCart = new tuscany.sca.Reference("shoppingCart");
+
+//@Reference
+var shoppingTotal = new tuscany.sca.Reference("shoppingTotal");
+
+var catalogItems;
+
+function catalog_getcatalogResponse(items, exception) {
+ if (exception){
+ alert(exception.message);
+ return;
+ }
+ var catalog = "";
+ for (var i=0; i<items.length; i++) {
+ var item = items[i].name + ' - ' + items[i].price;
+ catalog += '<input name="items" type="checkbox" value="' +
+ item + '">' + item + ' <br>';
+ }
+ document.getElementById('catalog').innerHTML=catalog;
+ catalogItems = items;
+
+}
+
+function shoppingCart_getResponse(feed) {
+ if (feed != null) {
+ var entries = feed.getElementsByTagName("entry");
+ var list = "";
+ for (var i=0; i<entries.length; i++) {
+ var content = entries[i].getElementsByTagName("content")[0];
+ var name = content.getElementsByTagName("name")[0].firstChild.nodeValue;
+ var price = content.getElementsByTagName("price")[0].firstChild.nodeValue;
+ list += name + ' - ' + price + ' <br>';
+ }
+ document.getElementById("shoppingCart").innerHTML = list;
+
+ shoppingTotal.apply("gettotal", shoppingTotal_gettotalResponse);
+ }
+}
+
+function shoppingTotal_gettotalResponse(total, exception) {
+ if (exception) {
+ alert(exception.message);
+ return;
+ }
+ document.getElementById('total').innerHTML = total;
+}
+
+function shoppingCart_postResponse(entry) {
+ shoppingCart.get("", shoppingCart_getResponse);
+}
+
+function addToCart() {
+ var items = document.catalogForm.items;
+ var j = 0;
+ for (var i=0; i<items.length; i++)
+ if (items[i].checked) {
+ var entry = '<entry xmlns="http://www.w3.org/2005/Atom"><title type="text">Item</title><content type="application/xml">' +
+ '<item>' +
+ '<javaClass>' + catalogItems[i].javaClass + '</javaClass>' +
+ '<name>' + catalogItems[i].name + '</name>' +
+ '<currencyCode>' + catalogItems[i].currencyCode + '</currencyCode>' +
+ '<currencySymbol>' + catalogItems[i].currencySymbol + '</currencySymbol>' +
+ '<price>' + catalogItems[i].price + '</price>' +
+ '</item>' +
+ '</content></entry>';
+ shoppingCart.post(entry, shoppingCart_postResponse);
+ items[i].checked = false;
+ }
+}
+function checkoutCart() {
+ document.getElementById('store').innerHTML='<h2>' +
+ 'Thanks for Shopping With Us!</h2>'+
+ '<h2>Your Order</h2>'+
+ '<form name="orderForm">'+
+ document.getElementById('shoppingCart').innerHTML+
+ '<br>'+
+ document.getElementById('total').innerHTML+
+ '<br>'+
+ '<br>'+
+ '<input type="submit" value="Continue Shopping">'+
+ '</form>';
+ shoppingCart.del("", null);
+}
+function deleteCart() {
+ shoppingCart.del("", null);
+ document.getElementById('shoppingCart').innerHTML = "";
+ document.getElementById('total').innerHTML = "";
+}
+
+function init() {
+ try {
+ catalog.apply("getcatalog", catalog_getcatalogResponse);
+ shoppingCart.get("", shoppingCart_getResponse);
+ } catch(e){
+ alert(e);
+ }
+}
+</script>
+
+</head>
+
+<body onload="init()">
+<h1>Store</h1>
+<div id="store">
+<h2>Catalog</h2>
+<form name="catalogForm">
+<div id="catalog" ></div>
+<br>
+<input type="button" onClick="addToCart()" value="Add to Cart">
+</form>
+<br>
+
+<h2>Your Shopping Cart</h2>
+<form name="shoppingCartForm">
+<div id="shoppingCart"></div>
+<br>
+<div id="total"></div>
+<br>
+<input type="button" onClick="checkoutCart()" value="Checkout">
+<input type="button" onClick="deleteCart()" value="Empty">
+<a href="shoppingCart/">(feed)</a>
+</form>
+</div>
+
+</body>
+</html>
diff --git a/sca-cpp/trunk/samples/store-cpp/htdocs/store.html b/sca-cpp/trunk/samples/store-cpp/htdocs/store.html
deleted file mode 100644
index 4e2ee6795a..0000000000
--- a/sca-cpp/trunk/samples/store-cpp/htdocs/store.html
+++ /dev/null
@@ -1,170 +0,0 @@
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<html>
-<head>
-<title>Store</title>
-
-<script type="text/javascript" src="/js/tuscany-ref.js"></script>
-
-<script language="JavaScript">
-
- var component = new tuscany.sca.Component("Store");
-
- //@Reference
- var catalog = new tuscany.sca.Reference("catalog");
-
- //@Reference
- var shoppingCart = new tuscany.sca.Reference("shoppingCart");
-
- //@Reference
- var shoppingTotal = new tuscany.sca.Reference("shoppingTotal");
-
- var catalogItems;
-
- function catalog_getcatalogResponse(items,exception) {
- if(exception){
- alert(exception.message);
- return;
- }
- var catalog = "";
-
- for (var i=0; i<items.length; i++) {
- var item = items[i].name + ' - ' + items[i].price;
- catalog += '<input name="items" type="checkbox" value="' +
- item + '">' + item + ' <br>';
- }
- document.getElementById('catalog').innerHTML=catalog;
- catalogItems = items;
-
- shoppingTotal.apply("gettotal", shoppingTotal_gettotalResponse);
- }
-
- function shoppingCart_getResponse(feed) {
- if (feed != null) {
- var entries = feed.getElementsByTagName("entry");
- var list = "";
- for (var i=0; i<entries.length; i++) {
- var content = entries[i].getElementsByTagName("content")[0];
- var name = content.getElementsByTagName("name")[0].firstChild.nodeValue;
- var price = content.getElementsByTagName("price")[0].firstChild.nodeValue;
- list += name + ' - ' + price + ' <br>';
- }
- document.getElementById("shoppingCart").innerHTML = list;
-
- if (entries.length != 0) {
- try {
- shoppingTotal.apply("gettotal", shoppingTotal_gettotalResponse);
- }
- catch(e){
- alert(e);
- }
- }
- }
- }
-
- function shoppingTotal_gettotalResponse(total,exception) {
- if(exception) {
- alert(exception.message);
- return;
- }
- document.getElementById('total').innerHTML = total;
- }
-
- function shoppingCart_postResponse(entry) {
- shoppingCart.get("", shoppingCart_getResponse);
- }
-
- function addToCart() {
- var items = document.catalogForm.items;
- var j = 0;
- for (var i=0; i<items.length; i++)
- if (items[i].checked) {
- var entry = '<entry xmlns="http://www.w3.org/2005/Atom"><title type="text">Item</title><content type="application/xml">' +
- '<item>' +
- '<javaClass>' + catalogItems[i].javaClass + '</javaClass>' +
- '<name>' + catalogItems[i].name + '</name>' +
- '<currencyCode>' + catalogItems[i].currencyCode + '</currencyCode>' +
- '<currencySymbol>' + catalogItems[i].currencySymbol + '</currencySymbol>' +
- '<price>' + catalogItems[i].price + '</price>' +
- '</item>' +
- '</content></entry>';
- shoppingCart.post(entry, shoppingCart_postResponse);
- items[i].checked = false;
- }
- }
- function checkoutCart() {
- document.getElementById('store').innerHTML='<h2>' +
- 'Thanks for Shopping With Us!</h2>'+
- '<h2>Your Order</h2>'+
- '<form name="orderForm">'+
- document.getElementById('shoppingCart').innerHTML+
- '<br>'+
- document.getElementById('total').innerHTML+
- '<br>'+
- '<br>'+
- '<input type="submit" value="Continue Shopping">'+
- '</form>';
- shoppingCart.del("", null);
- }
- function deleteCart() {
- shoppingCart.del("", null);
- document.getElementById('shoppingCart').innerHTML = "";
- document.getElementById('total').innerHTML = "";
- }
-
- function init() {
-
- try {
- catalog.apply("getcatalog", catalog_getcatalogResponse);
- shoppingCart.get("", shoppingCart_getResponse);
- }
- catch(e){
- alert(e);
- }
- }
-
-</script>
-
-</head>
-
-<body onload="init()">
-<h1>Store</h1>
- <div id="store">
- <h2>Catalog</h2>
- <form name="catalogForm">
- <div id="catalog" ></div>
- <br>
- <input type="button" onClick="addToCart()" value="Add to Cart">
- </form>
-
- <br>
-
- <h2>Your Shopping Cart</h2>
- <form name="shoppingCartForm">
- <div id="shoppingCart"></div>
- <br>
- <div id="total"></div>
- <br>
- <input type="button" onClick="checkoutCart()" value="Checkout">
- <input type="button" onClick="deleteCart()" value="Empty">
- <a href="../shoppingCart/">(feed)</a>
- </form>
- </div>
-</body>
-</html>
diff --git a/sca-cpp/trunk/samples/store-cpp/server-test b/sca-cpp/trunk/samples/store-cpp/server-test
index d2013f6892..e50467be98 100755
--- a/sca-cpp/trunk/samples/store-cpp/server-test
+++ b/sca-cpp/trunk/samples/store-cpp/server-test
@@ -26,8 +26,8 @@ curl_prefix=`cat $here/../../modules/http/curl.prefix`
sleep 2
# Test HTTP GET
-$curl_prefix/bin/curl http://localhost:8090/store.html 2>/dev/null >tmp/store.html
-diff tmp/store.html htdocs/store.html
+$curl_prefix/bin/curl http://localhost:8090/ 2>/dev/null >tmp/index.html
+diff tmp/index.html htdocs/index.html
rc=$?
# Cleanup