diff options
author | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2009-10-03 21:50:33 +0000 |
---|---|---|
committer | jsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68> | 2009-10-03 21:50:33 +0000 |
commit | b2b06bd2780dc40f666201d095c388313364b37a (patch) | |
tree | 1186e75dd637a02e567f91a1c5d7014a2bca7a95 /cpp/sca/test/store-object | |
parent | 95cb8fb517576b3357ecdf27a30c29b1365c5cf5 (diff) |
Refactored store tests and moved them under test/. Simplified the script evaluation logic a little, added an apply procedure and support for variable lists of args. Added a test case that assembles the store app using a script.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@821425 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/sca/test/store-object')
-rw-r--r-- | cpp/sca/test/store-object/Makefile.am | 28 | ||||
-rw-r--r-- | cpp/sca/test/store-object/cart.hpp | 75 | ||||
-rw-r--r-- | cpp/sca/test/store-object/catalog.hpp | 65 | ||||
-rw-r--r-- | cpp/sca/test/store-object/catalogs.composite | 43 | ||||
-rw-r--r-- | cpp/sca/test/store-object/currency-composite.hpp | 51 | ||||
-rw-r--r-- | cpp/sca/test/store-object/currency.composite | 32 | ||||
-rw-r--r-- | cpp/sca/test/store-object/currency.hpp | 59 | ||||
-rw-r--r-- | cpp/sca/test/store-object/item.hpp | 47 | ||||
-rw-r--r-- | cpp/sca/test/store-object/store-composite.hpp | 68 | ||||
-rw-r--r-- | cpp/sca/test/store-object/store-object-test.cpp | 52 | ||||
-rw-r--r-- | cpp/sca/test/store-object/store-solution.hpp | 62 | ||||
-rw-r--r-- | cpp/sca/test/store-object/store-ui.hpp | 72 | ||||
-rw-r--r-- | cpp/sca/test/store-object/store.composite | 64 |
13 files changed, 718 insertions, 0 deletions
diff --git a/cpp/sca/test/store-object/Makefile.am b/cpp/sca/test/store-object/Makefile.am new file mode 100644 index 0000000000..c79bf6ebde --- /dev/null +++ b/cpp/sca/test/store-object/Makefile.am @@ -0,0 +1,28 @@ +# 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. + +store_object_PROGRAMS = store-object-test +store_objectdir=$(prefix)/test/store-object/deploy + +INCLUDES = -I. -I$(top_builddir)/kernel -I${LIBXML2_INCLUDE} + +store_object_test_SOURCES = store-object-test.cpp +store_object_test_LDADD = -L${LIBXML2_LIB} -lxml2 -lpthread + +EXTRA_DIST = *.composite +store_object_DATA = *.composite + diff --git a/cpp/sca/test/store-object/cart.hpp b/cpp/sca/test/store-object/cart.hpp new file mode 100644 index 0000000000..fc6155aa25 --- /dev/null +++ b/cpp/sca/test/store-object/cart.hpp @@ -0,0 +1,75 @@ +/* + * 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. + */ + +/* $Rev$ $Date$ */ + +#ifndef store_cart_hpp +#define store_cart_hpp + +#include <string> +#include "function.hpp" +#include "list.hpp" +#include "currency.hpp" +#include "item.hpp" +#include "catalog.hpp" + +namespace store +{ + +const double accum(const double total, const Item& item) { + return total + item.price; +} + +class ShoppingCart { +public: + virtual const tuscany::list<Item> getAll() const = 0; + + virtual const bool post(const Item& item) = 0; + + virtual const bool deleteAll() = 0; + + virtual const double getTotal() const = 0; +}; + +class ShoppingCartImpl : public ShoppingCart { +public: + tuscany::list<Item> cart; + + virtual const tuscany::list<Item> getAll() const { + return cart; + } + + virtual const bool post(const Item& item) { + cart = cons(item, cart); + return true; + } + + virtual const bool deleteAll() { + cart = tuscany::list<Item>(); + return true; + } + + virtual const double getTotal() const { + tuscany::lambda<double(double, Item)> a(accum); + return reduce(a, 0.0, cart); + } +}; + +} +#endif /* store_cart_hpp */ diff --git a/cpp/sca/test/store-object/catalog.hpp b/cpp/sca/test/store-object/catalog.hpp new file mode 100644 index 0000000000..6909911c07 --- /dev/null +++ b/cpp/sca/test/store-object/catalog.hpp @@ -0,0 +1,65 @@ +/* + * 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. + */ + +/* $Rev$ $Date$ */ + +#ifndef store_catalog_hpp +#define store_catalog_hpp + +#include <string> +#include "list.hpp" +#include "currency.hpp" +#include "item.hpp" + +namespace store +{ + +class Catalog { +public: + + virtual const double convert(const double price) const = 0; + + virtual const tuscany::list<Item> get() const = 0; +}; + +class CatalogImpl : public Catalog { +public: + + const std::string currencyCode; + const CurrencyConverter& currencyConverter; + + CatalogImpl(const CurrencyConverter& currencyConverter) : + currencyCode("USD"), currencyConverter(currencyConverter) { + } + + virtual const double convert(const double price) const { + return currencyConverter.convert("USD", currencyCode, price); + } + + virtual const tuscany::list<Item> get() const { + const std::string currencySymbol = currencyConverter.getSymbol(currencyCode); + return tuscany::makeList( + Item("Apple", currencyCode, currencySymbol, convert(2.99)), + Item("Orange", currencyCode, currencySymbol, convert(3.55)), + Item("Pear", currencyCode, currencySymbol, convert(1.55))); + } +}; + +} +#endif /* store_catalog_hpp */ diff --git a/cpp/sca/test/store-object/catalogs.composite b/cpp/sca/test/store-object/catalogs.composite new file mode 100644 index 0000000000..1638ed0a05 --- /dev/null +++ b/cpp/sca/test/store-object/catalogs.composite @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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. +--> +<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903" + xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1" + targetNamespace="http://services" + name="catalogs"> + + <component name="FruitsCatalogWebService"> + <implementation.java class="services.FruitsCatalogImpl"/> + <service name="Catalog"> + <binding.ws/> + </service> + <property name="currencyCode">USD</property> + <reference name="currencyConverter" target="CurrencyConverterWebService"> + <binding.ws/> + </reference> + </component> + + <component name="VegetablesCatalogWebService"> + <implementation.java class="services.VegetablesCatalogImpl"/> + <service name="Catalog"> + <binding.ws/> + </service> + </component> + +</composite> diff --git a/cpp/sca/test/store-object/currency-composite.hpp b/cpp/sca/test/store-object/currency-composite.hpp new file mode 100644 index 0000000000..94b52b461e --- /dev/null +++ b/cpp/sca/test/store-object/currency-composite.hpp @@ -0,0 +1,51 @@ +/* + * 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. + */ + +/* $Rev$ $Date$ */ + +#ifndef store_currencycomposite_hpp +#define store_currencycomposite_hpp + +#include <string> +#include "currency.hpp" + +namespace store +{ + +class Currency : public CurrencyConverter { +}; + +class CurrencyImpl : public Currency { +public: + const CurrencyConverterImpl currencyConverter; + + CurrencyImpl() : currencyConverter(CurrencyConverterImpl()) { + } + + virtual const double convert(const std::string& fromCurrencyCode, const std::string& toCurrencyCode, const double amount) const { + return currencyConverter.convert(fromCurrencyCode, toCurrencyCode, amount); + } + + virtual const std::string getSymbol(const std::string& currencyCode) const { + return currencyConverter.getSymbol(currencyCode); + } +}; + +} +#endif /* store_currencycomposite_hpp */ diff --git a/cpp/sca/test/store-object/currency.composite b/cpp/sca/test/store-object/currency.composite new file mode 100644 index 0000000000..aefd474f1f --- /dev/null +++ b/cpp/sca/test/store-object/currency.composite @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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. +--> +<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903" + xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1" + targetNamespace="http://services" + name="currency"> + + <component name="CurrencyConverterWebService"> + <implementation.java class="services.CurrencyConverterImpl"/> + <service name="CurrencyConverter"> + <binding.ws/> + </service> + </component> + +</composite> diff --git a/cpp/sca/test/store-object/currency.hpp b/cpp/sca/test/store-object/currency.hpp new file mode 100644 index 0000000000..a8228ea51c --- /dev/null +++ b/cpp/sca/test/store-object/currency.hpp @@ -0,0 +1,59 @@ +/* + * 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. + */ + +/* $Rev$ $Date$ */ + +#ifndef store_currency_hpp +#define store_currency_hpp + +#include <math.h> +#include <string> + +namespace store +{ + +class CurrencyConverter { +public: + + virtual const double convert(const std::string& fromCurrencyCode, const std::string& toCurrencyCode, const double amount) const = 0; + virtual const std::string getSymbol(const std::string& currencyCode) const = 0; +}; + +class CurrencyConverterImpl : public CurrencyConverter { +public: + + virtual const double convert(const std::string& fromCurrencyCode, const std::string& toCurrencyCode, const double amount) const { + if(toCurrencyCode == "USD") + return amount; + if(toCurrencyCode == "EUR") + return round(amount * 0.7256 * 100) / 100; + return amount; + } + + virtual const std::string getSymbol(const std::string& currencyCode) const { + if(currencyCode == "USD") + return "$"; + if(currencyCode == "EUR") + return "E"; + return "?"; + } +}; + +} +#endif /* store_currency_hpp */ diff --git a/cpp/sca/test/store-object/item.hpp b/cpp/sca/test/store-object/item.hpp new file mode 100644 index 0000000000..ab8e52769b --- /dev/null +++ b/cpp/sca/test/store-object/item.hpp @@ -0,0 +1,47 @@ +/* + * 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. + */ + +/* $Rev$ $Date$ */ + +#ifndef store_item_hpp +#define store_item_hpp + +#include <string> + +namespace store +{ + +class Item { +public: + std::string name; + double price; + std::string currencyCode; + std::string currencySymbol; + + Item() { + } + + Item(const std::string& name, const std::string& currencyCode, const std::string& currencySymbol, const double price) : + name(name), price(price), currencyCode(currencyCode), currencySymbol(currencySymbol) { + } + +}; + +} +#endif /* store_item_hpp */ diff --git a/cpp/sca/test/store-object/store-composite.hpp b/cpp/sca/test/store-object/store-composite.hpp new file mode 100644 index 0000000000..8cee5a943f --- /dev/null +++ b/cpp/sca/test/store-object/store-composite.hpp @@ -0,0 +1,68 @@ +/* + * 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. + */ + +/* $Rev$ $Date$ */ + +#ifndef store_storecomposite_hpp +#define store_storecomposite_hpp + +#include "list.hpp" +#include "currency.hpp" +#include "currency-composite.hpp" +#include "item.hpp" +#include "catalog.hpp" +#include "cart.hpp" +#include "store-ui.hpp" + +namespace store +{ + +class Store : public StoreUI { +}; + +class StoreImpl : public Store { +public: + const CatalogImpl catalog; + ShoppingCartImpl cart; + StoreUIImpl storeUI; + + StoreImpl(const Currency& currency) : + catalog(CatalogImpl(currency)), cart(ShoppingCartImpl()), storeUI(StoreUIImpl(catalog, cart)) { + } + + virtual const tuscany::list<Item> getCatalog() const { + return storeUI.getCatalog(); + } + + virtual const tuscany::list<Item> getCart() const { + return storeUI.getCart(); + } + + virtual const double getTotal() const { + return storeUI.getTotal(); + } + + virtual const bool post(const Item& item) { + return storeUI.post(item); + } + +}; + +} +#endif /* store_storecomposite_hpp */ diff --git a/cpp/sca/test/store-object/store-object-test.cpp b/cpp/sca/test/store-object/store-object-test.cpp new file mode 100644 index 0000000000..bfbf5459ac --- /dev/null +++ b/cpp/sca/test/store-object/store-object-test.cpp @@ -0,0 +1,52 @@ +/* + * 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. + */ + +/* $Rev$ $Date$ */ + +/** + * Store Test case. + */ + +#include <assert.h> +#include <iostream> +#include "store-solution.hpp" + +namespace store +{ + +bool testComponentAssembly() { + StoreSolutionImpl store = StoreSolutionImpl(); + assert(length(store.getCatalog()) == 3); + assert(store.post(car(store.getCatalog())) == true); + assert(store.post(cadr(store.getCatalog())) == true); + assert(length(store.getCart()) == 2); + assert(store.getTotal() == 6.54); + return true; +} + +} + +int main() { + std::cout << "Testing..." << std::endl; + + store::testComponentAssembly(); + std::cout << "OK" << std::endl; + + return 0; +} diff --git a/cpp/sca/test/store-object/store-solution.hpp b/cpp/sca/test/store-object/store-solution.hpp new file mode 100644 index 0000000000..ecabb18f1c --- /dev/null +++ b/cpp/sca/test/store-object/store-solution.hpp @@ -0,0 +1,62 @@ +/* + * 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. + */ + +/* $Rev$ $Date$ */ + +#ifndef store_storesolution_hpp +#define store_storesolution_hpp + +#include "list.hpp" +#include "store-composite.hpp" +#include "currency-composite.hpp" + +namespace store +{ + +class StoreSolution : public Store { +}; + +class StoreSolutionImpl : public StoreSolution { +public: + const CurrencyImpl currency; + StoreImpl store; + + StoreSolutionImpl() : + currency(CurrencyImpl()), store(StoreImpl(currency)) { + } + + virtual const tuscany::list<Item> getCatalog() const { + return store.getCatalog(); + } + + virtual const tuscany::list<Item> getCart() const { + return store.getCart(); + } + + virtual const double getTotal() const { + return store.getTotal(); + } + + virtual const bool post(const Item& item) { + return store.post(item); + } +}; + +} +#endif /* store_storesolution_hpp */ diff --git a/cpp/sca/test/store-object/store-ui.hpp b/cpp/sca/test/store-object/store-ui.hpp new file mode 100644 index 0000000000..c9d0f4330b --- /dev/null +++ b/cpp/sca/test/store-object/store-ui.hpp @@ -0,0 +1,72 @@ +/* + * 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. + */ + +/* $Rev$ $Date$ */ + +#ifndef store_storeui_hpp +#define store_storeui_hpp + +#include "list.hpp" +#include "currency.hpp" +#include "item.hpp" +#include "catalog.hpp" +#include "cart.hpp" + +namespace store +{ + +class StoreUI { +public: + + virtual const tuscany::list<Item> getCatalog() const =0; + + virtual const tuscany::list<Item> getCart() const = 0; + + virtual const double getTotal() const =0; + + virtual const bool post(const Item& item) = 0; +}; + +class StoreUIImpl : public StoreUI { +public: + const Catalog& catalog; + ShoppingCart& cart; + + StoreUIImpl(const Catalog& catalog, ShoppingCart& cart) : catalog(catalog), cart(cart) { + } + + virtual const tuscany::list<Item> getCatalog() const { + return catalog.get(); + } + + virtual const tuscany::list<Item> getCart() const { + return cart.getAll(); + } + + virtual const double getTotal() const { + return cart.getTotal(); + } + + virtual const bool post(const Item& item) { + return cart.post(item); + } +}; + +} +#endif /* store_storeui_hpp */ diff --git a/cpp/sca/test/store-object/store.composite b/cpp/sca/test/store-object/store.composite new file mode 100644 index 0000000000..124adff853 --- /dev/null +++ b/cpp/sca/test/store-object/store.composite @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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. +--> +<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903" + xmlns:t="http://tuscany.apache.org/xmlns/sca/1.1" + targetNamespace="http://store" + name="store"> + + <component name="Store"> + <t:implementation.widget location="uiservices/store.html"/> + <service name="Widget"> + <t:binding.http uri="/ui"/> + </service> + <reference name="catalog" target="StoreCatalog"> + <t:binding.jsonrpc/> + </reference> + <reference name="shoppingCart" target="StoreShoppingCart/Cart"> + <t:binding.atom/> + </reference> + <reference name="shoppingTotal" target="StoreShoppingCart/Total"> + <t:binding.jsonrpc/> + </reference> + </component> + + <component name="StoreCatalog"> + <implementation.java class="services.FruitsCatalogImpl"/> + <property name="currencyCode">USD</property> + <service name="Catalog"> + <t:binding.jsonrpc/> + </service> + <reference name="currencyConverter" target="StoreCurrencyConverter"/> + </component> + + <component name="StoreShoppingCart"> + <implementation.java class="services.ShoppingCartImpl"/> + <service name="Cart"> + <t:binding.atom uri="/ShoppingCart/Cart"/> + </service> + <service name="Total"> + <t:binding.jsonrpc/> + </service> + </component> + + <component name="StoreCurrencyConverter"> + <implementation.java class="services.CurrencyConverterImpl"/> + </component> + +</composite> |