From 6c3797050830fef73e5a67b17e94e1b01a591318 Mon Sep 17 00:00:00 2001 From: antelder Date: Wed, 4 Feb 2009 10:19:00 +0000 Subject: Move tutorials to contrib git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@740671 13f79535-47bb-0310-9956-ffa450edef68 --- .../cart-amazon/amazon/cart/AmazonCart.java | 44 -- .../cart-amazon/amazon/cart/AmazonCart.wsdl | 451 --------------------- .../cart-amazon/amazon/cart/AmazonCartImpl.java | 120 ------ .../www-services/cart-amazon/amazoncart.composite | 33 -- .../cart-amazon/launch/LaunchAmazonCart.java | 52 --- .../store/www-services/cart-amazon/pom.xml | 215 ---------- .../cart-amazon/test/AmazonCartTestCase.java | 99 ----- 7 files changed, 1014 deletions(-) delete mode 100644 java/sca/tutorials/store/www-services/cart-amazon/amazon/cart/AmazonCart.java delete mode 100644 java/sca/tutorials/store/www-services/cart-amazon/amazon/cart/AmazonCart.wsdl delete mode 100644 java/sca/tutorials/store/www-services/cart-amazon/amazon/cart/AmazonCartImpl.java delete mode 100644 java/sca/tutorials/store/www-services/cart-amazon/amazoncart.composite delete mode 100644 java/sca/tutorials/store/www-services/cart-amazon/launch/LaunchAmazonCart.java delete mode 100644 java/sca/tutorials/store/www-services/cart-amazon/pom.xml delete mode 100644 java/sca/tutorials/store/www-services/cart-amazon/test/AmazonCartTestCase.java (limited to 'java/sca/tutorials/store/www-services/cart-amazon') diff --git a/java/sca/tutorials/store/www-services/cart-amazon/amazon/cart/AmazonCart.java b/java/sca/tutorials/store/www-services/cart-amazon/amazon/cart/AmazonCart.java deleted file mode 100644 index e105fa3e9a..0000000000 --- a/java/sca/tutorials/store/www-services/cart-amazon/amazon/cart/AmazonCart.java +++ /dev/null @@ -1,44 +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. - */ -package amazon.cart; - -import org.apache.tuscany.sca.databinding.annotation.DataBinding; -import org.oasisopen.sca.annotation.Remotable; - -import com.cart.amazon.CartAdd; -import com.cart.amazon.CartAddResponse; -import com.cart.amazon.CartClear; -import com.cart.amazon.CartClearResponse; -import com.cart.amazon.CartCreate; -import com.cart.amazon.CartCreateResponse; -import com.cart.amazon.CartGet; -import com.cart.amazon.CartGetResponse; - -@Remotable -@DataBinding(value="commonj.sdo.DataObject", wrapped=true) -public interface AmazonCart { - - public CartCreateResponse CartCreate(CartCreate cartCreate); - - public CartAddResponse CartAdd(CartAdd cartAdd); - - public CartClearResponse CartClear(CartClear cartClear); - - public CartGetResponse CartGet(CartGet cartGet); -} diff --git a/java/sca/tutorials/store/www-services/cart-amazon/amazon/cart/AmazonCart.wsdl b/java/sca/tutorials/store/www-services/cart-amazon/amazon/cart/AmazonCart.wsdl deleted file mode 100644 index 051c8ad906..0000000000 --- a/java/sca/tutorials/store/www-services/cart-amazon/amazon/cart/AmazonCart.wsdl +++ /dev/null @@ -1,451 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/java/sca/tutorials/store/www-services/cart-amazon/amazon/cart/AmazonCartImpl.java b/java/sca/tutorials/store/www-services/cart-amazon/amazon/cart/AmazonCartImpl.java deleted file mode 100644 index 36c2ff83e4..0000000000 --- a/java/sca/tutorials/store/www-services/cart-amazon/amazon/cart/AmazonCartImpl.java +++ /dev/null @@ -1,120 +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. - */ -package amazon.cart; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.oasisopen.sca.annotation.Service; - -import com.cart.amazon.AmazonFactory; -import com.cart.amazon.Cart; -import com.cart.amazon.CartAdd; -import com.cart.amazon.CartAddRequest; -import com.cart.amazon.CartAddResponse; -import com.cart.amazon.CartClear; -import com.cart.amazon.CartClearResponse; -import com.cart.amazon.CartCreate; -import com.cart.amazon.CartCreateResponse; -import com.cart.amazon.CartGet; -import com.cart.amazon.CartGetResponse; -import com.cart.amazon.CartItem; -import com.cart.amazon.CartItems; -import com.cart.amazon.Item1; -import com.cart.amazon.Items1; - -@Service(AmazonCart.class) -public class AmazonCartImpl { - - protected Map cartsHash = new HashMap(); - - public CartCreateResponse CartCreate(CartCreate cartCreate) { - - System.out.println("CartServiceID: " + this.toString()); - System.out.println("Entering cartCreate..."); - String userId = cartCreate.getAWSAccessKeyId(); - - Cart cart = getCart(userId); - if (cart != null) { - System.out.println("User " + cartCreate.getAWSAccessKeyId() - + " has already created a cart with ID: " - + cart.getCartId()); - return null; - } - cart = new Cart(); - cart.setCartItems(new CartItems()); - addCart(userId, cart); - - CartCreateResponse response = AmazonFactory.INSTANCE.createCartCreateResponse(); - System.out.println("Exiting cartCreate..."); - return response; - - } - - public CartAddResponse CartAdd(CartAdd cartAdd) { - - String userId = cartAdd.getAWSAccessKeyId(); - - Cart cart = getCart(userId); - if (cart == null) { - System.out.println("User has not associated Cart yet..."); - return null; - } - - List cartAddRequestList = cartAdd.getRequest(); - CartAddRequest car = (CartAddRequest)cartAddRequestList.get(0); - Items1 carItems = car.getItems(); - List itemList = carItems.getItem(); - Item1 item = (Item1)itemList.get(0); //Take only the first one, no iteration for now - System.out.println("item.getASIN: " + item.getASIN()); - System.out.println("item.getQuantity(): " + item.getQuantity()); - CartItems cartItems = cart.getCartItems(); - List cartItemList = cartItems.getCartItem(); - cart.setCartItems(cartItems); - return null; - } - - public CartClearResponse CartClear(CartClear cartClear) { - String userId = cartClear.getAWSAccessKeyId(); - - Cart cart = getCart(userId); - if (cart == null) { - System.out.println("User has not associated Cart yet..."); - return null; - } - - cart.setCartItems(new CartItems()); - return null; - } - - public CartGetResponse CartGet(CartGet cartGet) { - return null; - } - - private Cart getCart(String userId) { - Cart cart = null; - cart = this.cartsHash.get(userId); - return cart; - } - - private void addCart(String userId, Cart cart) { - this.cartsHash.put(userId, cart); - } -} diff --git a/java/sca/tutorials/store/www-services/cart-amazon/amazoncart.composite b/java/sca/tutorials/store/www-services/cart-amazon/amazoncart.composite deleted file mode 100644 index 6f8cc7b878..0000000000 --- a/java/sca/tutorials/store/www-services/cart-amazon/amazoncart.composite +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/java/sca/tutorials/store/www-services/cart-amazon/launch/LaunchAmazonCart.java b/java/sca/tutorials/store/www-services/cart-amazon/launch/LaunchAmazonCart.java deleted file mode 100644 index 69dd06c2ef..0000000000 --- a/java/sca/tutorials/store/www-services/cart-amazon/launch/LaunchAmazonCart.java +++ /dev/null @@ -1,52 +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. - */ -package launch; - -import java.net.URL; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.node.SCANode; -import org.apache.tuscany.sca.node.SCANodeFactory; -import org.apache.tuscany.sca.node.util.SCAContributionUtil; - -public class LaunchAmazonCart { - - public static void main(String[] args) throws Exception { - - System.out.println("Starting ..."); - SCANodeFactory nodeFactory = SCANodeFactory.newInstance(); - SCANode node = nodeFactory.createSCANode(null, "http://localhost:9999"); - - URL contribution = SCAContributionUtil.findContributionFromClass(LaunchAmazonCart.class); - node.addContribution("http://amazonCart", contribution); - - node.addToDomainLevelComposite(new QName("http://amazonCart", "amazonCart")); - node.start(); - - System.out.println("amazoncart.composite ready for big business !!!"); - System.in.read(); - - System.out.println("Stopping ..."); - node.stop(); - node.destroy(); - System.out.println(); - } - -} diff --git a/java/sca/tutorials/store/www-services/cart-amazon/pom.xml b/java/sca/tutorials/store/www-services/cart-amazon/pom.xml deleted file mode 100644 index 7ba441c1f3..0000000000 --- a/java/sca/tutorials/store/www-services/cart-amazon/pom.xml +++ /dev/null @@ -1,215 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-tutorial-store - 2.0-SNAPSHOT - ../pom.xml - - tutorial-cart-amazon - Apache Tuscany SCA Store Tutorial Amazon Cart - - - - - org.apache.tuscany.sca - tuscany-host-jetty - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-node-api - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-node-impl - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sca - tuscany-binding-ws-axis2 - 2.0-SNAPSHOT - runtime - - - - org.apache.tuscany.sdo - tuscany-sdo-lib - 1.1-incubating - - - - org.apache.tuscany.sdo - tuscany-sdo-impl - 1.1-incubating - - - - org.apache.tuscany.sca - tuscany-databinding - 2.0-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-databinding-sdo - 2.0-SNAPSHOT - runtime - - - - junit - junit - 4.2 - compile - - - - - - ${artifactId} - ${basedir} - ${basedir}/test - - - ${basedir} - - **/*.java - pom.xml - build.xml - - - - - - org.codehaus.mojo - build-helper-maven-plugin - 1.0 - - - add-test-source - generate-sources - - add-source - - - - target/sdo-source - target/wsdl2java-source - - - - - - - org.apache.tuscany.sdo - tuscany-sdo-plugin - 1.1-incubating - - - - ${basedir}/amazon/cart/AmazonCart.wsdl - true - true - true - true - - - generate - - - - - - - org.apache.tuscany.sca - tuscany-maven-ant-generator - 2.0-SNAPSHOT - - - - generate - - - - - - org.apache.tuscany.sca - tuscany-maven-wsdl2java - 2.0-SNAPSHOT - - - - ${basedir}/amazon/cart/AmazonCart.wsdl - amazon.cart.api - - - generate - - - - - - - org.apache.tuscany.sca - tuscany-maven-ant-generator - 2.0-SNAPSHOT - - - - launch.LaunchAmazonCart - - - generate - - - - - - org.apache.maven.plugins - maven-antrun-plugin - - - ant - ant-trax - 1.6.5 - - - - - - - - diff --git a/java/sca/tutorials/store/www-services/cart-amazon/test/AmazonCartTestCase.java b/java/sca/tutorials/store/www-services/cart-amazon/test/AmazonCartTestCase.java deleted file mode 100644 index ede97f7868..0000000000 --- a/java/sca/tutorials/store/www-services/cart-amazon/test/AmazonCartTestCase.java +++ /dev/null @@ -1,99 +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. - */ -package test; - -import java.net.URL; - -import javax.xml.namespace.QName; - -import launch.LaunchAmazonCart; - -import org.apache.tuscany.sca.node.SCANode; -import org.apache.tuscany.sca.node.SCANodeFactory; -import org.apache.tuscany.sca.node.util.SCAContributionUtil; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import amazon.cart.AmazonCart; - -import com.cart.amazon.AmazonFactory; -import com.cart.amazon.CartCreate; -import commonj.sdo.DataObject; - -/** - * Test case for helloworld web service client - */ -public class AmazonCartTestCase { - - private SCANode node; - private AmazonCart amazonCart; - - @Before - public void startClient() throws Exception { - try { - - System.out.println("Starting ..."); - SCANodeFactory nodeFactory = SCANodeFactory.newInstance(); - node = nodeFactory.createSCANode(null, null); - - URL contribution = SCAContributionUtil.findContributionFromClass(LaunchAmazonCart.class); - node.addContribution("http://amazonCart", contribution); - - node.addToDomainLevelComposite(new QName("http://amazonCart", "amazonCart")); - node.start(); - - System.out.println("amazoncart.composite ready for big business !!!"); - - amazonCart = node.getDomain().getService(AmazonCart.class, "AmazonCartServiceComponent"); - - } catch (Throwable e) { - e.printStackTrace(); - } - } - - @Test - public void testCartCreate() throws Exception { - System.out.println("Entering test..."); - CartCreate create = AmazonFactory.INSTANCE.createCartCreate(); - DataObject root = amazonCart.CartCreate(create); - // Assert.assertEquals("Hello Smith", msg); - System.out.println("Exiting test..."); - } - - /* - * @Test public void testEmbeddedReferenceClient() throws Exception { String - * msg = helloTuscanyService.getGreetings("Tuscany"); - * Assert.assertEquals("Hello Tuscany", msg); } - */ - - @After - public void stopClient() throws Exception { - System.out.println("Stopping ..."); - node.stop(); - node.destroy(); - System.out.println(); - } - - /* - * public void testCartCreate() throws Exception { DataObject root = - * amazonCart.cartCreate(null); //assertNotNull(root); - * //assertEquals("Luciano Resende", root.getString("CUSTOMER[1]/NAME")); } - */ -} -- cgit v1.2.3