From 0e4846e9b7eed9d2acf12a5924105ede04fe839b Mon Sep 17 00:00:00 2001 From: slaws Date: Sun, 8 Feb 2009 15:02:03 +0000 Subject: Sort out payment component using implementation.bpel git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@742117 13f79535-47bb-0310-9956-ffa450edef68 --- .../payment-bpel-contribution/log4j.properties | 36 ++++ .../chapter-06/payment-bpel-contribution/pom.xml | 197 +++++++++++++++++++++ .../src/CreditCardPayment.wsdl | 117 ++++++++++++ .../src/EmailGateway.wsdl | 89 ++++++++++ .../src/META-INF/sca-contribution.xml | 23 +++ .../payment-bpel-contribution/src/Payment.wsdl | 83 +++++++++ .../payment-bpel-contribution/src/payment.bpel | 164 +++++++++++++++++ .../test/payment.composite | 47 +++++ .../test/scatours/payment/PaymentTestCase.java | 67 +++++++ .../scatours/payment/client/PaymentClientImpl.java | 37 ++++ 10 files changed, 860 insertions(+) create mode 100644 sandbox/travelsample/chapter-06/payment-bpel-contribution/log4j.properties create mode 100644 sandbox/travelsample/chapter-06/payment-bpel-contribution/pom.xml create mode 100644 sandbox/travelsample/chapter-06/payment-bpel-contribution/src/CreditCardPayment.wsdl create mode 100644 sandbox/travelsample/chapter-06/payment-bpel-contribution/src/EmailGateway.wsdl create mode 100644 sandbox/travelsample/chapter-06/payment-bpel-contribution/src/META-INF/sca-contribution.xml create mode 100644 sandbox/travelsample/chapter-06/payment-bpel-contribution/src/Payment.wsdl create mode 100644 sandbox/travelsample/chapter-06/payment-bpel-contribution/src/payment.bpel create mode 100644 sandbox/travelsample/chapter-06/payment-bpel-contribution/test/payment.composite create mode 100644 sandbox/travelsample/chapter-06/payment-bpel-contribution/test/scatours/payment/PaymentTestCase.java create mode 100644 sandbox/travelsample/chapter-06/payment-bpel-contribution/test/scatours/payment/client/PaymentClientImpl.java (limited to 'sandbox/travelsample/chapter-06/payment-bpel-contribution') diff --git a/sandbox/travelsample/chapter-06/payment-bpel-contribution/log4j.properties b/sandbox/travelsample/chapter-06/payment-bpel-contribution/log4j.properties new file mode 100644 index 0000000000..7ed0bcaf77 --- /dev/null +++ b/sandbox/travelsample/chapter-06/payment-bpel-contribution/log4j.properties @@ -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. +# + +# Set root logger level to WARN and its only appender to CONSOLE +log4j.rootLogger=OFF, CONSOLE + +# log4j properties to work with commandline tools. +log4j.category.org.mortbay=OFF +log4j.category.org.hibernate.type=OFF +log4j.category.org.objectweb=OFF +log4j.category.org.apache.ode.axis2=OFF +log4j.category.org.apache.ode.bpel.engine=DEBUG +log4j.category.org.apache.ode.daohib.bpel.CorrelatorDaoImpl=OFF +log4j.category.org.apache.ode.bpel.epr=OFF +log4j.category.org.apache.tuscany.sca.implementation.bpel=DEBUG +log4j.category.org.apache.tuscany.sca.implementation.bpel.ode=DEBUG +log4j.category.org.apache.tuscany.sca.implementation.bpel.provider=DEBUG + +# Console appender +log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender +log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout +log4j.appender.CONSOLE.layout.ConversionPattern=[%p] - %C{1}.%M(%L) | %m%n diff --git a/sandbox/travelsample/chapter-06/payment-bpel-contribution/pom.xml b/sandbox/travelsample/chapter-06/payment-bpel-contribution/pom.xml new file mode 100644 index 0000000000..852d1b4ecc --- /dev/null +++ b/sandbox/travelsample/chapter-06/payment-bpel-contribution/pom.xml @@ -0,0 +1,197 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 1.5-SNAPSHOT + + + scatours-chapter-06-payment-bpel-contribution + Apache Tuscany SCA Tours Chapter 06 Payment BPEL Contribution + + + + org.apache.tuscany.sca + tuscany-host-embedded + 1.5-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 1.5-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-bpel-ode + 1.5-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 1.5-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-host-jetty + 1.5-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + scatours-emailgateway-contribution + 1.5-SNAPSHOT + test + + + + org.apache.tuscany.sca + scatours-creditcardpayment-contribution + 1.5-SNAPSHOT + test + + + + junit + junit + 4.5 + test + + + + + ${artifactId} + ${basedir}/src + ${basedir}/test + + + ${basedir}/src + + + + + ${basedir}/src + + **/*.java + **/.*/** + + + + ${basedir}/test + + **/*.java + **/.*/** + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.0 + + + add-source + generate-sources + + add-source + + + + target/jaxws-source + + + + + + + org.codehaus.mojo + jaxws-maven-plugin + 1.9 + + + wsimport + generate-sources + + wsimport + + + scatours.payment + ${basedir}/src + + + Payment.wsdl + + ${project.build.directory}/jaxws-source + + false + true + + + + + + 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/payment-bpel-contribution/src/CreditCardPayment.wsdl b/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/CreditCardPayment.wsdl new file mode 100644 index 0000000000..a90c73cdfb --- /dev/null +++ b/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/CreditCardPayment.wsdl @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/EmailGateway.wsdl b/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/EmailGateway.wsdl new file mode 100644 index 0000000000..d9a5e36bc0 --- /dev/null +++ b/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/EmailGateway.wsdl @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/META-INF/sca-contribution.xml b/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..6ce6568b62 --- /dev/null +++ b/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/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/Payment.wsdl b/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/Payment.wsdl new file mode 100644 index 0000000000..399b550334 --- /dev/null +++ b/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/Payment.wsdl @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/payment.bpel b/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/payment.bpel new file mode 100644 index 0000000000..25c10d43a7 --- /dev/null +++ b/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/payment.bpel @@ -0,0 +1,164 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Visa + 12345678 + 2 + 2010 + + Empty +
+ 1 The Road + Winchester + Hampshire + AB1 2CD + 12345678 +
+
+
+ 0.0 +
+
+
+ $authorizeRequestMessage.parameters +
+ + $makePaymentRequestMessage.parameters/CustomerId/text() + $authorizeRequestMessage.parameters/CreditCard/CardOwner/Name + + + $makePaymentRequestMessage.parameters/Amount/text() + $authorizeRequestMessage.parameters/Amount + +
+ + + + + + + + + + + Default + Payment Confirmation + Your payment has been confirmed + + + + + $sendEmailRequestMessage.parameters + + + $makePaymentRequestMessage.parameters/CustomerId/text() + $sendEmailRequestMessage.parameters/Email/To + + + + + + + + + + + + + OK + + + + $makePaymentResponseMessage.parameters + + + + + + +
+
diff --git a/sandbox/travelsample/chapter-06/payment-bpel-contribution/test/payment.composite b/sandbox/travelsample/chapter-06/payment-bpel-contribution/test/payment.composite new file mode 100644 index 0000000000..039192527b --- /dev/null +++ b/sandbox/travelsample/chapter-06/payment-bpel-contribution/test/payment.composite @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sandbox/travelsample/chapter-06/payment-bpel-contribution/test/scatours/payment/PaymentTestCase.java b/sandbox/travelsample/chapter-06/payment-bpel-contribution/test/scatours/payment/PaymentTestCase.java new file mode 100644 index 0000000000..e5cf0e43eb --- /dev/null +++ b/sandbox/travelsample/chapter-06/payment-bpel-contribution/test/scatours/payment/PaymentTestCase.java @@ -0,0 +1,67 @@ +/* + * 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.payment; + +import org.apache.tuscany.sca.node.SCAClient; +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode; +import org.apache.tuscany.sca.node.SCANodeFactory; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +/** + * + */ +public class PaymentTestCase { + private static SCANode paymentNode; + private static SCANode creditCardNode; + private static SCANode emailGatewayNode; + + @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(); + } + + @Test + public void testPayment() { + SCAClient client = (SCAClient) paymentNode; + Payment payment = client.getService(Payment.class, "PaymentClient"); + System.out.println("Result = " + payment.makePayment("Fred", 100.00f)); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + paymentNode.stop(); + creditCardNode.stop(); + emailGatewayNode.stop(); + } + +} diff --git a/sandbox/travelsample/chapter-06/payment-bpel-contribution/test/scatours/payment/client/PaymentClientImpl.java b/sandbox/travelsample/chapter-06/payment-bpel-contribution/test/scatours/payment/client/PaymentClientImpl.java new file mode 100644 index 0000000000..06a99e4326 --- /dev/null +++ b/sandbox/travelsample/chapter-06/payment-bpel-contribution/test/scatours/payment/client/PaymentClientImpl.java @@ -0,0 +1,37 @@ +/* + * 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.payment.client; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +import scatours.payment.Payment; + +@Service(Payment.class) +public class PaymentClientImpl implements Payment { + @Reference + protected Payment payment; + + public String makePayment(String customerId, float amount) { + // Delegate the external web service + return payment.makePayment(customerId, amount); + } + +} -- cgit v1.2.3