From 7d9e691b83c7669f559337a5a2768b13ce176bd3 Mon Sep 17 00:00:00 2001 From: slaws Date: Sat, 21 Feb 2009 13:31:55 +0000 Subject: Fix up the BPEL payment component to run in the wider application and take advantage of the BPEL resolved fix in 1.x git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@746503 13f79535-47bb-0310-9956-ffa450edef68 --- .../main/resources/META-INF/sca-contribution.xml | 3 +- .../src/main/resources/scatours.composite | 41 ++-- .../src/main/resources/scatours.html | 3 +- sandbox/travelsample/chapter-06/node/build.xml | 225 ++++++++------------- sandbox/travelsample/chapter-06/node/pom.xml | 82 +++++--- .../main/java/scatours/LaunchBPELExampleNode.java | 66 ++++++ .../node/src/main/java/scatours/LaunchNode.java | 66 ------ .../java/scatours/LaunchSpringExampleNode.java | 66 ++++++ .../chapter-06/payment-bpel-contribution/pom.xml | 20 +- .../src/main/resources/CreditCardPayment.wsdl | 10 +- .../src/main/resources/EmailGateway.wsdl | 10 +- .../main/resources/META-INF/sca-contribution.xml | 4 +- .../src/main/resources/Payment.wsdl | 36 ++-- .../src/main/resources/payment.bpel | 42 ++-- .../java/scatours/payment/PaymentTestCase.java | 29 +-- .../scatours/payment/client/PaymentClientImpl.java | 4 +- .../test/resources/META-INF/sca-contribution.xml | 23 +++ .../src/test/resources/payment.composite | 8 +- .../src/main/resources/CreditCardPayment.wsdl | 10 +- .../main/resources/META-INF/sca-contribution.xml | 3 - .../test/resources/META-INF/sca-contribution.xml | 22 ++ .../src/main/resources/EmailGateway.wsdl | 10 +- .../src/test/resources/EmailGatewayImpl.java | 36 ++++ .../test/resources/META-INF/sca-contribution.xml | 22 ++ .../src/main/java/scatours/SCAToursImpl.java | 77 +------ .../scatours/shoppingcart/ShoppingCartImpl.java | 20 +- .../src/main/resources/Payment.wsdl | 83 ++++++++ 27 files changed, 588 insertions(+), 433 deletions(-) create mode 100644 sandbox/travelsample/chapter-06/node/src/main/java/scatours/LaunchBPELExampleNode.java delete mode 100644 sandbox/travelsample/chapter-06/node/src/main/java/scatours/LaunchNode.java create mode 100644 sandbox/travelsample/chapter-06/node/src/main/java/scatours/LaunchSpringExampleNode.java create mode 100644 sandbox/travelsample/chapter-06/payment-bpel-contribution/src/test/resources/META-INF/sca-contribution.xml create mode 100644 sandbox/travelsample/shared-contributions/creditcard-payment-jaxb-contribution/src/test/resources/META-INF/sca-contribution.xml create mode 100644 sandbox/travelsample/shared-contributions/emailgateway-contribution/src/test/resources/EmailGatewayImpl.java create mode 100644 sandbox/travelsample/shared-contributions/emailgateway-contribution/src/test/resources/META-INF/sca-contribution.xml create mode 100644 sandbox/travelsample/shared-contributions/shoppingcart-contribution/src/main/resources/Payment.wsdl (limited to 'sandbox') diff --git a/sandbox/travelsample/chapter-05/ui-contribution/src/main/resources/META-INF/sca-contribution.xml b/sandbox/travelsample/chapter-05/ui-contribution/src/main/resources/META-INF/sca-contribution.xml index 764030c28e..4064565d41 100644 --- a/sandbox/travelsample/chapter-05/ui-contribution/src/main/resources/META-INF/sca-contribution.xml +++ b/sandbox/travelsample/chapter-05/ui-contribution/src/main/resources/META-INF/sca-contribution.xml @@ -28,7 +28,8 @@ - + + diff --git a/sandbox/travelsample/chapter-05/ui-contribution/src/main/resources/scatours.composite b/sandbox/travelsample/chapter-05/ui-contribution/src/main/resources/scatours.composite index 53fac26d3e..ae8d4b7ff6 100644 --- a/sandbox/travelsample/chapter-05/ui-contribution/src/main/resources/scatours.composite +++ b/sandbox/travelsample/chapter-05/ui-contribution/src/main/resources/scatours.composite @@ -142,37 +142,26 @@ - + + + - + diff --git a/sandbox/travelsample/chapter-05/ui-contribution/src/main/resources/scatours.html b/sandbox/travelsample/chapter-05/ui-contribution/src/main/resources/scatours.html index f4206548c0..b8e27e87fc 100644 --- a/sandbox/travelsample/chapter-05/ui-contribution/src/main/resources/scatours.html +++ b/sandbox/travelsample/chapter-05/ui-contribution/src/main/resources/scatours.html @@ -322,7 +322,8 @@ function checkout() { scaToursCart.checkout(cartId); - document.getElementById('searchResponse').innerHTML = ""; + document.getElementById('packagedTripItems').innerHTML = ""; + document.getElementById('bespokeTripItems').innerHTML = ""; document.getElementById('cartItems').innerHTML = "Thank you for shopping with SCA Tours"; document.getElementById('cartPrice').innerHTML = ""; searchResponseItems = null; diff --git a/sandbox/travelsample/chapter-06/node/build.xml b/sandbox/travelsample/chapter-06/node/build.xml index 05d7479267..0ccfcedee1 100644 --- a/sandbox/travelsample/chapter-06/node/build.xml +++ b/sandbox/travelsample/chapter-06/node/build.xml @@ -22,14 +22,15 @@ - + - + + @@ -57,83 +58,78 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -146,13 +142,12 @@ - + - @@ -161,59 +156,26 @@ - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -221,54 +183,29 @@ - + - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - diff --git a/sandbox/travelsample/chapter-06/node/pom.xml b/sandbox/travelsample/chapter-06/node/pom.xml index 61c8b43b94..5319b87630 100644 --- a/sandbox/travelsample/chapter-06/node/pom.xml +++ b/sandbox/travelsample/chapter-06/node/pom.xml @@ -22,7 +22,7 @@ org.apache.tuscany.sca tuscany-sca - 1.4 + 1.5-SNAPSHOT scatours-chapter-06-node @@ -32,103 +32,89 @@ org.apache.tuscany.sca tuscany-node-api - 1.4 + 1.5-SNAPSHOT org.apache.tuscany.sca tuscany-node-launcher - 1.4 + 1.5-SNAPSHOT org.apache.tuscany.sca tuscany-domain-manager - 1.4 + 1.5-SNAPSHOT runtime org.apache.tuscany.sca tuscany-implementation-node-runtime - 1.4 + 1.5-SNAPSHOT runtime org.apache.tuscany.sca tuscany-implementation-java-runtime - 1.4 + 1.5-SNAPSHOT runtime org.apache.tuscany.sca tuscany-implementation-widget-runtime - 1.4 + 1.5-SNAPSHOT runtime org.apache.tuscany.sca tuscany-implementation-resource-runtime - 1.4 + 1.5-SNAPSHOT runtime org.apache.tuscany.sca tuscany-binding-atom-abdera - 1.4 + 1.5-SNAPSHOT runtime org.apache.tuscany.sca tuscany-binding-jsonrpc-runtime - 1.4 + 1.5-SNAPSHOT runtime org.apache.tuscany.sca tuscany-binding-http-runtime - 1.4 + 1.5-SNAPSHOT runtime org.apache.tuscany.sca tuscany-binding-ws-axis2 - 1.4 + 1.5-SNAPSHOT runtime org.apache.tuscany.sca tuscany-binding-sca-axis2 - 1.4 - runtime - - - - org.apache.tuscany.sca - tuscany-binding-ejb-runtime - 1.4 - runtime - - - - org.apache.tuscany.sca - tuscany-implementation-ejb - 1.4 + 1.5-SNAPSHOT runtime org.apache.tuscany.sca - tuscany-implementation-bpel-ode - 1.4 + tuscany-implementation-spring + 1.5-SNAPSHOT runtime @@ -147,7 +133,7 @@ org.apache.tuscany.sca tuscany-maven-ant-generator - 1.4 + 1.5-SNAPSHOT @@ -159,6 +145,42 @@ + + org.apache.maven.plugins + maven-surefire-plugin + + 2.3.1 + + false + false + true + + + + org.apache.maven.plugins + maven-dependency-plugin + + + unpack + test-compile + + unpack + + + + + org.apache.ode + ode-dao-jpa-ojpa-derby + 1.1 + zip + true + ${project.build.directory}/test-classes/ + + + + + + diff --git a/sandbox/travelsample/chapter-06/node/src/main/java/scatours/LaunchBPELExampleNode.java b/sandbox/travelsample/chapter-06/node/src/main/java/scatours/LaunchBPELExampleNode.java new file mode 100644 index 0000000000..e87b0ca44e --- /dev/null +++ b/sandbox/travelsample/chapter-06/node/src/main/java/scatours/LaunchBPELExampleNode.java @@ -0,0 +1,66 @@ +/* + * 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 scatours; + +import java.io.IOException; + +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; + +public class LaunchBPELExampleNode { + public static void main(String[] args) throws Exception { + LaunchBPELExampleNode.launchFromFileSystemDir(); + } + + // OK for development but you must launch the node from this module + public static void launchFromFileSystemDir(){ + SCANode node = null; + + try { + node = SCANodeFactory.newInstance().createSCANode("scatours.composite", + new SCAContribution("common", "../../shared-contributions/common-contribution/target/classes"), + new SCAContribution("currency", "../../shared-contributions/currency-contribution/target/classes"), + new SCAContribution("hotel", "../../shared-contributions/hotel-contribution/target/classes"), + new SCAContribution("flight", "../../shared-contributions/flight-contribution/target/classes"), + new SCAContribution("car", "../../shared-contributions/car-contribution/target/classes"), + new SCAContribution("trip", "../../shared-contributions/trip-contribution/target/classes"), + new SCAContribution("tripbooking", "../../shared-contributions/tripbooking-contribution/target/classes"), + new SCAContribution("travelcatalog", "../../shared-contributions/travelcatalog-contribution/target/classes"), + new SCAContribution("creditcardpayment", "../../shared-contributions/creditcard-payment-jaxb-contribution/target/classes"), + new SCAContribution("emailgateway", "../../shared-contributions/emailgateway-contribution/target/classes"), + new SCAContribution("shoppingcart", "../../shared-contributions/shoppingcart-contribution/target/classes"), + new SCAContribution("scatours", "../../shared-contributions/scatours-contribution/target/classes"), + new SCAContribution("payment", "../payment-bpel-contribution/target/classes"), + new SCAContribution("ui", "../ui-bpel-contribution/target/classes")); + node.start(); + + System.out.println("Node started - Press enter to shutdown."); + try { + System.in.read(); + } catch (IOException e) {} + + node.stop(); + + } catch (Exception ex) { + System.out.println(ex.toString()); + } + } +} diff --git a/sandbox/travelsample/chapter-06/node/src/main/java/scatours/LaunchNode.java b/sandbox/travelsample/chapter-06/node/src/main/java/scatours/LaunchNode.java deleted file mode 100644 index 777963c13e..0000000000 --- a/sandbox/travelsample/chapter-06/node/src/main/java/scatours/LaunchNode.java +++ /dev/null @@ -1,66 +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 scatours; - -import java.io.IOException; - -import org.apache.tuscany.sca.node.SCAContribution; -import org.apache.tuscany.sca.node.SCANode; -import org.apache.tuscany.sca.node.SCANodeFactory; -import org.apache.tuscany.sca.node.launcher.NodeLauncher; - -public class LaunchNode { - public static void main(String[] args) throws Exception { - LaunchNode.launchFromFileSystemDir(); - } - - // OK for development but you must launch the node from this module - public static void launchFromFileSystemDir(){ - SCANode node = null; - - try { - node = SCANodeFactory.newInstance().createSCANode("scatours.composite", - new SCAContribution("common", "../../shared-contributions/common-contribution/target/classes"), - new SCAContribution("currency", "../../shared-contributions/currency-contribution/target/classes"), - new SCAContribution("hotel", "../../shared-contributions/hotel-contribution/target/classes"), - new SCAContribution("flight", "../../shared-contributions/flight-contribution/target/classes"), - new SCAContribution("car", "../../shared-contributions/car-contribution/target/classes"), - new SCAContribution("trip", "../../shared-contributions/trip-contribution/target/classes"), - new SCAContribution("tripbooking", "../../shared-contributions/tripbooking-contribution/target/classes"), - new SCAContribution("travelcatalog", "../../shared-contributions/travelcatalog-contribution/target/classes"), - new SCAContribution("payment", "../../shared-contributions/payment-contribution/target/classes"), - new SCAContribution("emailgateway", "../../shared-contributions/emailgateway-contribution/target/classes"), - new SCAContribution("shoppingcart", "../../shared-contributions/shoppingcart-contribution/target/classes"), - new SCAContribution("scatours", "../../shared-contributions/scatours-contribution/target/classes"), - new SCAContribution("ui", "../ui-contribution/target/classes")); - node.start(); - - System.out.println("Node started - Press enter to shutdown."); - try { - System.in.read(); - } catch (IOException e) {} - - node.stop(); - - } catch (Exception ex) { - System.out.println(ex.toString()); - } - } -} diff --git a/sandbox/travelsample/chapter-06/node/src/main/java/scatours/LaunchSpringExampleNode.java b/sandbox/travelsample/chapter-06/node/src/main/java/scatours/LaunchSpringExampleNode.java new file mode 100644 index 0000000000..45c9be4bce --- /dev/null +++ b/sandbox/travelsample/chapter-06/node/src/main/java/scatours/LaunchSpringExampleNode.java @@ -0,0 +1,66 @@ +/* + * 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 scatours; + +import java.io.IOException; + +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; + +public class LaunchSpringExampleNode { + public static void main(String[] args) throws Exception { + LaunchSpringExampleNode.launchFromFileSystemDir(); + } + + // OK for development but you must launch the node from this module + public static void launchFromFileSystemDir(){ + SCANode node = null; + + try { + node = SCANodeFactory.newInstance().createSCANode("scatours.composite", + new SCAContribution("common", "../../shared-contributions/common-contribution/target/classes"), + new SCAContribution("currency", "../../shared-contributions/currency-contribution/target/classes"), + new SCAContribution("hotel", "../../shared-contributions/hotel-contribution/target/classes"), + new SCAContribution("flight", "../../shared-contributions/flight-contribution/target/classes"), + new SCAContribution("car", "../../shared-contributions/car-contribution/target/classes"), + new SCAContribution("trip", "../../shared-contributions/trip-contribution/target/classes"), + new SCAContribution("tripbooking", "../../shared-contributions/tripbooking-contribution/target/classes"), + new SCAContribution("travelcatalog", "../../shared-contributions/travelcatalog-contribution/target/classes"), + new SCAContribution("creditcardpayment", "../../shared-contributions/creditcard-payment-jaxb-contribution/target/classes"), + new SCAContribution("emailgateway", "../../shared-contributions/emailgateway-contribution/target/classes"), + new SCAContribution("shoppingcart", "../../shared-contributions/shoppingcart-contribution/target/classes"), + new SCAContribution("scatours", "../../shared-contributions/scatours-contribution/target/classes"), + new SCAContribution("payment", "../payment-spring-annotation-contribution/target/classes"), + new SCAContribution("ui", "../ui-spring-contribution/target/classes")); + node.start(); + + System.out.println("Node started - Press enter to shutdown."); + try { + System.in.read(); + } catch (IOException e) {} + + node.stop(); + + } catch (Exception ex) { + System.out.println(ex.toString()); + } + } +} diff --git a/sandbox/travelsample/chapter-06/payment-bpel-contribution/pom.xml b/sandbox/travelsample/chapter-06/payment-bpel-contribution/pom.xml index db486b6727..e30d8b7ff2 100644 --- a/sandbox/travelsample/chapter-06/payment-bpel-contribution/pom.xml +++ b/sandbox/travelsample/chapter-06/payment-bpel-contribution/pom.xml @@ -22,7 +22,7 @@ org.apache.tuscany.sca tuscany-sca - 1.4 + 1.5-SNAPSHOT scatours-chapter-06-payment-bpel-contribution @@ -32,55 +32,55 @@ org.apache.tuscany.sca tuscany-node-api - 1.4 + 1.5-SNAPSHOT org.apache.tuscany.sca tuscany-node-impl - 1.4 + 1.5-SNAPSHOT runtime org.apache.tuscany.sca tuscany-implementation-java-runtime - 1.4 + 1.5-SNAPSHOT runtime org.apache.tuscany.sca tuscany-implementation-bpel-ode - 1.4 + 1.5-SNAPSHOT runtime org.apache.tuscany.sca tuscany-binding-ws-axis2 - 1.4 + 1.5-SNAPSHOT runtime org.apache.tuscany.sca tuscany-host-jetty - 1.4 + 1.5-SNAPSHOT runtime org.apache.tuscany.sca scatours-emailgateway-contribution - 1.4 + 1.5-SNAPSHOT test org.apache.tuscany.sca scatours-creditcard-payment-jaxb-contribution - 1.4 + 1.5-SNAPSHOT test @@ -169,7 +169,7 @@ 1.1 zip true - ${project.build.directory}/test-classes/ + ${project.build.directory}/classes/ diff --git a/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/main/resources/CreditCardPayment.wsdl b/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/main/resources/CreditCardPayment.wsdl index a90c73cdfb..22ef6de317 100644 --- a/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/main/resources/CreditCardPayment.wsdl +++ b/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/main/resources/CreditCardPayment.wsdl @@ -18,17 +18,17 @@ * under the License. --> @@ -96,7 +96,7 @@ - + diff --git a/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/main/resources/EmailGateway.wsdl b/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/main/resources/EmailGateway.wsdl index d9a5e36bc0..a097d9b7e4 100644 --- a/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/main/resources/EmailGateway.wsdl +++ b/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/main/resources/EmailGateway.wsdl @@ -18,17 +18,17 @@ * under the License. --> + targetNamespace="http://www.tuscanyscatours.com/EmailGateway/" + xmlns:tns="http://www.tuscanyscatours.com/EmailGateway/"> @@ -68,7 +68,7 @@ - + diff --git a/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/main/resources/META-INF/sca-contribution.xml b/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/main/resources/META-INF/sca-contribution.xml index 6ce6568b62..725c95a2bd 100644 --- a/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/main/resources/META-INF/sca-contribution.xml +++ b/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/main/resources/META-INF/sca-contribution.xml @@ -18,6 +18,6 @@ * under the License. --> - - + + \ No newline at end of file diff --git a/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/main/resources/Payment.wsdl b/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/main/resources/Payment.wsdl index 399b550334..e2c4062f2e 100644 --- a/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/main/resources/Payment.wsdl +++ b/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/main/resources/Payment.wsdl @@ -18,51 +18,51 @@ * under the License. --> + targetNamespace="http://www.tuscanyscatours.com/Payment/" + xmlns:tns="http://www.tuscanyscatours.com/Payment/"> - + - + - + - + - - + + - - + + - - - + + + - - + + @@ -73,7 +73,7 @@ - + diff --git a/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/main/resources/payment.bpel b/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/main/resources/payment.bpel index 25c10d43a7..8f11d76888 100644 --- a/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/main/resources/payment.bpel +++ b/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/main/resources/payment.bpel @@ -17,29 +17,29 @@ ~ under the License. --> + namespace="http://www.tuscanyscatours.com/Payment/"/> + namespace="http://www.tuscanyscatours.com/CreditCardPayment/"/> + namespace="http://www.tuscanyscatours.com/EmailGateway/"/> @@ -48,8 +48,8 @@ - - + + @@ -60,8 +60,8 @@ @@ -69,7 +69,7 @@ - + Visa 12345678 @@ -93,11 +93,11 @@ $authorizeRequestMessage.parameters - $makePaymentRequestMessage.parameters/CustomerId/text() + $makePaymentMemberRequestMessage.parameters/CustomerId/text() $authorizeRequestMessage.parameters/CreditCard/CardOwner/Name - $makePaymentRequestMessage.parameters/Amount/text() + $makePaymentMemberRequestMessage.parameters/Amount/text() $authorizeRequestMessage.parameters/Amount @@ -114,7 +114,7 @@ - + Default Payment Confirmation @@ -126,7 +126,7 @@ $sendEmailRequestMessage.parameters - $makePaymentRequestMessage.parameters/CustomerId/text() + $makePaymentMemberRequestMessage.parameters/CustomerId/text() $sendEmailRequestMessage.parameters/Email/To @@ -144,12 +144,12 @@ - + OK - + - $makePaymentResponseMessage.parameters + $makePaymentMemberResponseMessage.parameters @@ -157,8 +157,8 @@ + operation="makePaymentMember" + variable="makePaymentMemberResponseMessage"> diff --git a/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/test/java/scatours/payment/PaymentTestCase.java b/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/test/java/scatours/payment/PaymentTestCase.java index 395bc0d3d4..a69c16a726 100644 --- a/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/test/java/scatours/payment/PaymentTestCase.java +++ b/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/test/java/scatours/payment/PaymentTestCase.java @@ -37,25 +37,28 @@ public class PaymentTestCase { @BeforeClass public static void setUpBeforeClass() throws Exception { - - creditCardNode = SCANodeFactory.newInstance().createSCANode("creditcard.composite", - new SCAContribution("creditcard", "../../shared-contributions/creditcardpayment-contribution/target/test-classes")); - emailGatewayNode = SCANodeFactory.newInstance().createSCANode("emailgateway.composite", - new SCAContribution("creditcard", "../../shared-contributions/emailgateway-contribution/target/test-classes")); - paymentNode = SCANodeFactory.newInstance().createSCANode("payment.composite", - new SCAContribution("payment", "./target/test-classes")); - - creditCardNode.start(); - emailGatewayNode.start(); - paymentNode.start(); + try { + creditCardNode = SCANodeFactory.newInstance().createSCANode("creditcard.composite", + new SCAContribution("creditcard", "../../shared-contributions/creditcard-payment-jaxb-contribution/target/test-classes")); + emailGatewayNode = SCANodeFactory.newInstance().createSCANode("emailgateway.composite", + new SCAContribution("creditcard", "../../shared-contributions/emailgateway-contribution/target/test-classes")); + paymentNode = SCANodeFactory.newInstance().createSCANode("payment.composite", + new SCAContribution("payment-bpel", "./target/classes"), + new SCAContribution("payment-bpel-test", "./target/test-classes")); + + creditCardNode.start(); + emailGatewayNode.start(); + paymentNode.start(); + } catch (Exception ex) { + ex.printStackTrace(); + } } @Test public void testPayment() { SCAClient client = (SCAClient) paymentNode; Payment payment = client.getService(Payment.class, "PaymentClient"); - //[nash] Following line is disabled because of NPE problem - //System.out.println("Result = " + payment.makePayment("Fred", 100.00f)); + System.out.println("Result = " + payment.makePaymentMember("Fred", 100.00f)); } @AfterClass diff --git a/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/test/java/scatours/payment/client/PaymentClientImpl.java b/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/test/java/scatours/payment/client/PaymentClientImpl.java index 06a99e4326..eaa7498e84 100644 --- a/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/test/java/scatours/payment/client/PaymentClientImpl.java +++ b/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/test/java/scatours/payment/client/PaymentClientImpl.java @@ -29,9 +29,9 @@ public class PaymentClientImpl implements Payment { @Reference protected Payment payment; - public String makePayment(String customerId, float amount) { + public String makePaymentMember(String customerId, float amount) { // Delegate the external web service - return payment.makePayment(customerId, amount); + return payment.makePaymentMember(customerId, amount); } } diff --git a/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/test/resources/META-INF/sca-contribution.xml b/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/test/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..4984ef0252 --- /dev/null +++ b/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/test/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + + \ No newline at end of file diff --git a/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/test/resources/payment.composite b/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/test/resources/payment.composite index 039192527b..b747b0382a 100644 --- a/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/test/resources/payment.composite +++ b/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/test/resources/payment.composite @@ -19,8 +19,8 @@ --> @@ -33,8 +33,8 @@ - - + + diff --git a/sandbox/travelsample/shared-contributions/creditcard-payment-jaxb-contribution/src/main/resources/CreditCardPayment.wsdl b/sandbox/travelsample/shared-contributions/creditcard-payment-jaxb-contribution/src/main/resources/CreditCardPayment.wsdl index c194d78982..1813c77436 100644 --- a/sandbox/travelsample/shared-contributions/creditcard-payment-jaxb-contribution/src/main/resources/CreditCardPayment.wsdl +++ b/sandbox/travelsample/shared-contributions/creditcard-payment-jaxb-contribution/src/main/resources/CreditCardPayment.wsdl @@ -18,17 +18,17 @@ * under the License. --> + targetNamespace="http://www.tuscanyscatours.com/CreditCardPayment/" + xmlns:tns="http://www.tuscanyscatours.com/CreditCardPayment/"> @@ -95,7 +95,7 @@ - + diff --git a/sandbox/travelsample/shared-contributions/creditcard-payment-jaxb-contribution/src/main/resources/META-INF/sca-contribution.xml b/sandbox/travelsample/shared-contributions/creditcard-payment-jaxb-contribution/src/main/resources/META-INF/sca-contribution.xml index d22f4816ab..8faf8db4ee 100644 --- a/sandbox/travelsample/shared-contributions/creditcard-payment-jaxb-contribution/src/main/resources/META-INF/sca-contribution.xml +++ b/sandbox/travelsample/shared-contributions/creditcard-payment-jaxb-contribution/src/main/resources/META-INF/sca-contribution.xml @@ -19,7 +19,4 @@ --> - - - \ No newline at end of file diff --git a/sandbox/travelsample/shared-contributions/creditcard-payment-jaxb-contribution/src/test/resources/META-INF/sca-contribution.xml b/sandbox/travelsample/shared-contributions/creditcard-payment-jaxb-contribution/src/test/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..666c488b6d --- /dev/null +++ b/sandbox/travelsample/shared-contributions/creditcard-payment-jaxb-contribution/src/test/resources/META-INF/sca-contribution.xml @@ -0,0 +1,22 @@ + + + + + \ No newline at end of file diff --git a/sandbox/travelsample/shared-contributions/emailgateway-contribution/src/main/resources/EmailGateway.wsdl b/sandbox/travelsample/shared-contributions/emailgateway-contribution/src/main/resources/EmailGateway.wsdl index c103ad947d..7c5c190e1e 100644 --- a/sandbox/travelsample/shared-contributions/emailgateway-contribution/src/main/resources/EmailGateway.wsdl +++ b/sandbox/travelsample/shared-contributions/emailgateway-contribution/src/main/resources/EmailGateway.wsdl @@ -18,17 +18,17 @@ * under the License. --> + targetNamespace="http://www.tuscanyscatours.com/EmailGateway/" + xmlns:tns="http://www.tuscanyscatours.com/EmailGateway/"> @@ -68,7 +68,7 @@ - + diff --git a/sandbox/travelsample/shared-contributions/emailgateway-contribution/src/test/resources/EmailGatewayImpl.java b/sandbox/travelsample/shared-contributions/emailgateway-contribution/src/test/resources/EmailGatewayImpl.java new file mode 100644 index 0000000000..6e971c3267 --- /dev/null +++ b/sandbox/travelsample/shared-contributions/emailgateway-contribution/src/test/resources/EmailGatewayImpl.java @@ -0,0 +1,36 @@ +/* + * 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 scatours.emailgateway; + +import org.osoa.sca.annotations.Service; + + +/** + * + */ +@Service(EmailGateway.class) +public class EmailGatewayImpl implements EmailGateway { + + public String sendEmail(EmailType email) { + System.out.println("Sending mail to " + email.getTo()); + return "SENT"; + } + +} diff --git a/sandbox/travelsample/shared-contributions/emailgateway-contribution/src/test/resources/META-INF/sca-contribution.xml b/sandbox/travelsample/shared-contributions/emailgateway-contribution/src/test/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..cd9f3c864c --- /dev/null +++ b/sandbox/travelsample/shared-contributions/emailgateway-contribution/src/test/resources/META-INF/sca-contribution.xml @@ -0,0 +1,22 @@ + + + + + \ No newline at end of file diff --git a/sandbox/travelsample/shared-contributions/scatours-contribution/src/main/java/scatours/SCAToursImpl.java b/sandbox/travelsample/shared-contributions/scatours-contribution/src/main/java/scatours/SCAToursImpl.java index bfbf05ce02..a2a299d9ed 100644 --- a/sandbox/travelsample/shared-contributions/scatours-contribution/src/main/java/scatours/SCAToursImpl.java +++ b/sandbox/travelsample/shared-contributions/scatours-contribution/src/main/java/scatours/SCAToursImpl.java @@ -40,7 +40,10 @@ import scatours.travelcatalog.TravelCatalogSearch; import scatours.tripbooking.TripBooking; /** - * An implementation of the Trip service + * An implementation of the SCA tours component. This component currently provides + * a front end to the components that the UI communicated with. It allows a conversation + * to be held with the shopping cart as javascript doesn't support conversations. + * Other than that it's just a pass through so we could look to remove it. */ @Scope("COMPOSITE") @Service(interfaces={SCAToursSearch.class, SCAToursBooking.class, SCAToursCart.class}) @@ -60,18 +63,13 @@ public class SCAToursImpl implements SCAToursSearch, SCAToursBooking, SCAToursCa private Map carts = new HashMap(); private Map trips = new HashMap(); - //private Map searchItemsCache = new HashMap(); // SCAToursSearch methods public TripItem[] search(TripLeg tripLeg) { - TripItem[] searchItems = travelCatalogSearch.search(tripLeg); - - //for (int i =0; i< searchItems.length; i++){ - // searchItemsCache.put(searchItems[i].getId(), searchItems[i]); - //} - return searchItems; + return travelCatalogSearch.search(tripLeg); + } // SCAToursBooking methods @@ -99,64 +97,7 @@ public class SCAToursImpl implements SCAToursSearch, SCAToursBooking, SCAToursCa } public void checkout(String cartId){ - shoppingCart.checkout("Fred"); - } - -/* - public String addTrip(String cartId){ - String tripId = UUID.randomUUID().toString(); - ServiceReference tripReference = componentContext.getServiceReference(TripBooking.class, - "tripBooking"); - tripReference.setConversationID(tripId); - trips.put(tripId, tripReference.getService()); - - carts.get(cartId).addItem(tripId); - return tripId; - } - - public void removeTrip(String cartId, String tripId) { - carts.get(cartId).removeItem(tripId); - } - - public void addTripItem(String cartId, String tripId, String tripItemId){ - TripItem item = searchItemsCache.get(tripItemId); - TripItem itemCopy = new TripItem(item); - itemCopy.setTripId(tripId); - trips.get(tripId).addTripItem(itemCopy); - } - - public void removeTripItem(String cartId, String tripId, String tripItemId){ - trips.get(tripId).removeTripItem(tripItemId); - } - - public TripItem[] getTripItems(String cartId) { - List returnTripItems = new ArrayList(); - - for( String tripId : carts.get(cartId).getItems()){ - returnTripItems.addAll(Arrays.asList(trips.get(tripId).getTripItems())); - } - - return returnTripItems.toArray(new TripItem[returnTripItems.size()]); - } - - public double getTotalPrice(String cartId){ - double total = 0.0; - - for( String tripId : carts.get(cartId).getItems()){ - total += trips.get(tripId).getTripPrice(); - } - - return total; - } - - public void checkout(String cartId){ - // get users credentials. Hard coded for now but should - // come from the security context - String customerId = "Fred Bloggs"; - float amount = (float)getTotalPrice(cartId); - - paymentProcess.makePayment(customerId, amount); - } - -*/ + // need to get the user id from the context here + carts.get(cartId).checkout("Fred"); + } } diff --git a/sandbox/travelsample/shared-contributions/shoppingcart-contribution/src/main/java/scatours/shoppingcart/ShoppingCartImpl.java b/sandbox/travelsample/shared-contributions/shoppingcart-contribution/src/main/java/scatours/shoppingcart/ShoppingCartImpl.java index 31b273bf47..feb26f4c27 100644 --- a/sandbox/travelsample/shared-contributions/shoppingcart-contribution/src/main/java/scatours/shoppingcart/ShoppingCartImpl.java +++ b/sandbox/travelsample/shared-contributions/shoppingcart-contribution/src/main/java/scatours/shoppingcart/ShoppingCartImpl.java @@ -32,9 +32,10 @@ import org.osoa.sca.annotations.Reference; import org.osoa.sca.annotations.Scope; import org.osoa.sca.annotations.Service; +import payment.Payment; + import scatours.common.TripItem; -//import scatours.paymentprocess.PaymentProcess; /** * An implementation of the Trip service @@ -43,8 +44,8 @@ import scatours.common.TripItem; @Service(interfaces={ShoppingCart.class}) public class ShoppingCartImpl implements ShoppingCart{ - // @Reference - // protected PaymentProcess paymentProcess; + @Reference + protected Payment payment; @ConversationID protected String cartId; @@ -83,7 +84,18 @@ public class ShoppingCartImpl implements ShoppingCart{ // get the total for all the trips float amount = (float)0.0; - //paymentProcess.makePayment(customerId, amount); + for (TripItem trip : trips){ + if (trip.getType().equals(TripItem.TRIP)){ + amount += trip.getPrice(); + } else { + for (TripItem tripItem : trip.getTripItems()){ + amount += tripItem.getPrice(); + } + } + } + + // Take the payment from the customer + payment.makePaymentMember(customerId, amount); } } diff --git a/sandbox/travelsample/shared-contributions/shoppingcart-contribution/src/main/resources/Payment.wsdl b/sandbox/travelsample/shared-contributions/shoppingcart-contribution/src/main/resources/Payment.wsdl new file mode 100644 index 0000000000..2519d7642e --- /dev/null +++ b/sandbox/travelsample/shared-contributions/shoppingcart-contribution/src/main/resources/Payment.wsdl @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3