From 4105b42e3460245f8f7b5178a4829408e2235353 Mon Sep 17 00:00:00 2001 From: slaws Date: Mon, 17 Nov 2008 11:18:46 +0000 Subject: Start adding in a BPEL process for payment processing. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@718221 13f79535-47bb-0310-9956-ffa450edef68 --- .../META-INF/sca-contribution.xml | 22 +++ .../emailgatewaytest.composite | 37 +++++ .../travelsample/emailgateway-contribution/pom.xml | 140 +++++++++++++++++ .../scatours/emailgateway/EmailGatewayImpl.java | 35 +++++ .../emailgateway/EmailGatewayClientImpl.java | 38 +++++ .../emailgateway/EmailGatewayTestCase.java | 65 ++++++++ .../wsdl/EmailGateway.wsdl | 88 +++++++++++ .../wsdl/CreditCardPayment.wsdl | 15 +- .../META-INF/sca-contribution.xml | 22 +++ .../paymentprocesstest.composite | 40 +++++ .../paymentprocess-contribution/pom.xml | 165 +++++++++++++++++++++ .../scatours/paymentprocess/PaymentProcess.wsdl | 82 ++++++++++ .../src/scatours/paymentprocess/deploy.xml | 31 ++++ .../scatours/paymentprocess/paymentprocess.bpel | 87 +++++++++++ .../paymentprocess/paymentprocess.componentType | 38 +++++ .../paymentprocess/PaymentProcessClientImpl.java | 38 +++++ .../paymentprocess/PaymentProcessTestCase.java | 63 ++++++++ sandbox/travelsample/pom.xml | 2 + sandbox/travelsample/travel-scenario.odg | Bin 13971 -> 14441 bytes .../ui-contribution/scatours.composite | 7 + 20 files changed, 1012 insertions(+), 3 deletions(-) create mode 100644 sandbox/travelsample/emailgateway-contribution/META-INF/sca-contribution.xml create mode 100644 sandbox/travelsample/emailgateway-contribution/emailgatewaytest.composite create mode 100644 sandbox/travelsample/emailgateway-contribution/pom.xml create mode 100644 sandbox/travelsample/emailgateway-contribution/src/scatours/emailgateway/EmailGatewayImpl.java create mode 100644 sandbox/travelsample/emailgateway-contribution/test/scatours/emailgateway/EmailGatewayClientImpl.java create mode 100644 sandbox/travelsample/emailgateway-contribution/test/scatours/emailgateway/EmailGatewayTestCase.java create mode 100644 sandbox/travelsample/emailgateway-contribution/wsdl/EmailGateway.wsdl create mode 100644 sandbox/travelsample/paymentprocess-contribution/META-INF/sca-contribution.xml create mode 100644 sandbox/travelsample/paymentprocess-contribution/paymentprocesstest.composite create mode 100644 sandbox/travelsample/paymentprocess-contribution/pom.xml create mode 100644 sandbox/travelsample/paymentprocess-contribution/src/scatours/paymentprocess/PaymentProcess.wsdl create mode 100644 sandbox/travelsample/paymentprocess-contribution/src/scatours/paymentprocess/deploy.xml create mode 100644 sandbox/travelsample/paymentprocess-contribution/src/scatours/paymentprocess/paymentprocess.bpel create mode 100644 sandbox/travelsample/paymentprocess-contribution/src/scatours/paymentprocess/paymentprocess.componentType create mode 100644 sandbox/travelsample/paymentprocess-contribution/test/scatours/paymentprocess/PaymentProcessClientImpl.java create mode 100644 sandbox/travelsample/paymentprocess-contribution/test/scatours/paymentprocess/PaymentProcessTestCase.java (limited to 'sandbox') diff --git a/sandbox/travelsample/emailgateway-contribution/META-INF/sca-contribution.xml b/sandbox/travelsample/emailgateway-contribution/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..d77df2fd7e --- /dev/null +++ b/sandbox/travelsample/emailgateway-contribution/META-INF/sca-contribution.xml @@ -0,0 +1,22 @@ + + + + + \ No newline at end of file diff --git a/sandbox/travelsample/emailgateway-contribution/emailgatewaytest.composite b/sandbox/travelsample/emailgateway-contribution/emailgatewaytest.composite new file mode 100644 index 0000000000..f6e9669dce --- /dev/null +++ b/sandbox/travelsample/emailgateway-contribution/emailgatewaytest.composite @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sandbox/travelsample/emailgateway-contribution/pom.xml b/sandbox/travelsample/emailgateway-contribution/pom.xml new file mode 100644 index 0000000000..8ea2952b69 --- /dev/null +++ b/sandbox/travelsample/emailgateway-contribution/pom.xml @@ -0,0 +1,140 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 1.4-SNAPSHOT + + + scatours-emailgateway-contribution + Apache Tuscany SCA Tours Email Gateway Contribution + + + + org.apache.tuscany.sca + tuscany-host-embedded + 1.4-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 1.4-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jsonrpc-runtime + 1.4-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 1.4-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-host-jetty + 1.4-SNAPSHOT + runtime + + + + junit + junit + 4.5 + test + + + + + ${artifactId} + ${basedir}/src + ${basedir}/test + + + ${basedir} + + **/*.java + **/.*/** + pom.xml + build.xml + target/** + src/** + test/** + + + + + + 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.emailgateway + ${basedir}/wsdl + + + EmailGateway.wsdl + + ${project.build.directory}/jaxws-source + + false + true + + + + + + + diff --git a/sandbox/travelsample/emailgateway-contribution/src/scatours/emailgateway/EmailGatewayImpl.java b/sandbox/travelsample/emailgateway-contribution/src/scatours/emailgateway/EmailGatewayImpl.java new file mode 100644 index 0000000000..5abaecef0d --- /dev/null +++ b/sandbox/travelsample/emailgateway-contribution/src/scatours/emailgateway/EmailGatewayImpl.java @@ -0,0 +1,35 @@ +/* + * 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) { + return "SENT"; + } + +} diff --git a/sandbox/travelsample/emailgateway-contribution/test/scatours/emailgateway/EmailGatewayClientImpl.java b/sandbox/travelsample/emailgateway-contribution/test/scatours/emailgateway/EmailGatewayClientImpl.java new file mode 100644 index 0000000000..a6b76c525f --- /dev/null +++ b/sandbox/travelsample/emailgateway-contribution/test/scatours/emailgateway/EmailGatewayClientImpl.java @@ -0,0 +1,38 @@ +/* + * 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.Reference; +import org.osoa.sca.annotations.Service; + +/** + * + */ +@Service(EmailGateway.class) +public class EmailGatewayClientImpl implements EmailGateway { + @Reference + protected EmailGateway emailGateway; + + public String sendEmail(EmailType email) { + // Delegate the external web service + return emailGateway.sendEmail(email); + } + +} diff --git a/sandbox/travelsample/emailgateway-contribution/test/scatours/emailgateway/EmailGatewayTestCase.java b/sandbox/travelsample/emailgateway-contribution/test/scatours/emailgateway/EmailGatewayTestCase.java new file mode 100644 index 0000000000..a39127653b --- /dev/null +++ b/sandbox/travelsample/emailgateway-contribution/test/scatours/emailgateway/EmailGatewayTestCase.java @@ -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. + */ + +package scatours.emailgateway; + +import org.apache.tuscany.sca.node.SCAClient; +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 EmailGatewayTestCase { + private static SCANode node; + + /** + * @throws java.lang.Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception { + SCANodeFactory factory = SCANodeFactory.newInstance(); + node = factory.createSCANodeFromClassLoader("emailgatewaytest.composite", EmailGateway.class.getClassLoader()); + node.start(); + } + + @Test + public void testEmailGateway() { + SCAClient client = (SCAClient) node; + EmailGateway cc = client.getService(EmailGateway.class, "EmailGatewayClient"); + ObjectFactory objectFactory = new ObjectFactory(); + EmailType email = objectFactory.createEmailType(); + System.out.println(cc.sendEmail(email)); + } + + /** + * @throws java.lang.Exception + */ + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (node != null) { + node.stop(); + node = null; + } + } + +} diff --git a/sandbox/travelsample/emailgateway-contribution/wsdl/EmailGateway.wsdl b/sandbox/travelsample/emailgateway-contribution/wsdl/EmailGateway.wsdl new file mode 100644 index 0000000000..ed5762410d --- /dev/null +++ b/sandbox/travelsample/emailgateway-contribution/wsdl/EmailGateway.wsdl @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sandbox/travelsample/payment-contribution/wsdl/CreditCardPayment.wsdl b/sandbox/travelsample/payment-contribution/wsdl/CreditCardPayment.wsdl index 958d1f3683..c80c37cdf7 100644 --- a/sandbox/travelsample/payment-contribution/wsdl/CreditCardPayment.wsdl +++ b/sandbox/travelsample/payment-contribution/wsdl/CreditCardPayment.wsdl @@ -17,9 +17,14 @@ * specific language governing permissions and limitations * under the License. --> - + @@ -102,4 +107,8 @@ + + + + \ No newline at end of file diff --git a/sandbox/travelsample/paymentprocess-contribution/META-INF/sca-contribution.xml b/sandbox/travelsample/paymentprocess-contribution/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..6b09380868 --- /dev/null +++ b/sandbox/travelsample/paymentprocess-contribution/META-INF/sca-contribution.xml @@ -0,0 +1,22 @@ + + + + + \ No newline at end of file diff --git a/sandbox/travelsample/paymentprocess-contribution/paymentprocesstest.composite b/sandbox/travelsample/paymentprocess-contribution/paymentprocesstest.composite new file mode 100644 index 0000000000..3b11f0a368 --- /dev/null +++ b/sandbox/travelsample/paymentprocess-contribution/paymentprocesstest.composite @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sandbox/travelsample/paymentprocess-contribution/pom.xml b/sandbox/travelsample/paymentprocess-contribution/pom.xml new file mode 100644 index 0000000000..2549201b9c --- /dev/null +++ b/sandbox/travelsample/paymentprocess-contribution/pom.xml @@ -0,0 +1,165 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 1.4-SNAPSHOT + + + scatours-paymentprocess-contribution + Apache Tuscany SCA Tours Payment Process Contribution + + + + org.apache.tuscany.sca + tuscany-host-embedded + 1.4-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 1.4-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-bpel-ode + 1.4-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 1.4-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-host-jetty + 1.4-SNAPSHOT + runtime + + + + junit + junit + 4.5 + test + + + + + ${artifactId} + ${basedir}/src + ${basedir}/test + + + ${basedir} + + **/*.java + **/.*/** + pom.xml + build.xml + target/** + src/** + test/** + + + + + + 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.paymentprocess + ${basedir}/src/scatours/paymentprocess + + + PaymentProcess.wsdl + + ${project.build.directory}/jaxws-source + + 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/paymentprocess-contribution/src/scatours/paymentprocess/PaymentProcess.wsdl b/sandbox/travelsample/paymentprocess-contribution/src/scatours/paymentprocess/PaymentProcess.wsdl new file mode 100644 index 0000000000..5efd6251cd --- /dev/null +++ b/sandbox/travelsample/paymentprocess-contribution/src/scatours/paymentprocess/PaymentProcess.wsdl @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sandbox/travelsample/paymentprocess-contribution/src/scatours/paymentprocess/deploy.xml b/sandbox/travelsample/paymentprocess-contribution/src/scatours/paymentprocess/deploy.xml new file mode 100644 index 0000000000..007fede130 --- /dev/null +++ b/sandbox/travelsample/paymentprocess-contribution/src/scatours/paymentprocess/deploy.xml @@ -0,0 +1,31 @@ + + + + + + true + + + + + diff --git a/sandbox/travelsample/paymentprocess-contribution/src/scatours/paymentprocess/paymentprocess.bpel b/sandbox/travelsample/paymentprocess-contribution/src/scatours/paymentprocess/paymentprocess.bpel new file mode 100644 index 0000000000..43986b1e2d --- /dev/null +++ b/sandbox/travelsample/paymentprocess-contribution/src/scatours/paymentprocess/paymentprocess.bpel @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OK + $paymentProcessResponseMessage.parameters.Status + + + + + + diff --git a/sandbox/travelsample/paymentprocess-contribution/src/scatours/paymentprocess/paymentprocess.componentType b/sandbox/travelsample/paymentprocess-contribution/src/scatours/paymentprocess/paymentprocess.componentType new file mode 100644 index 0000000000..a7f95a012c --- /dev/null +++ b/sandbox/travelsample/paymentprocess-contribution/src/scatours/paymentprocess/paymentprocess.componentType @@ -0,0 +1,38 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/sandbox/travelsample/paymentprocess-contribution/test/scatours/paymentprocess/PaymentProcessClientImpl.java b/sandbox/travelsample/paymentprocess-contribution/test/scatours/paymentprocess/PaymentProcessClientImpl.java new file mode 100644 index 0000000000..8d9c2f918c --- /dev/null +++ b/sandbox/travelsample/paymentprocess-contribution/test/scatours/paymentprocess/PaymentProcessClientImpl.java @@ -0,0 +1,38 @@ +/* + * 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.paymentprocess; + +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +/** + * + */ +@Service(PaymentProcess.class) +public class PaymentProcessClientImpl implements PaymentProcess { + @Reference + protected PaymentProcess paymentProcess; + + public String makePayment(String customerId, float amount) { + // Delegate the external web service + return paymentProcess.makePayment(customerId, amount); + } + +} diff --git a/sandbox/travelsample/paymentprocess-contribution/test/scatours/paymentprocess/PaymentProcessTestCase.java b/sandbox/travelsample/paymentprocess-contribution/test/scatours/paymentprocess/PaymentProcessTestCase.java new file mode 100644 index 0000000000..793e1eb887 --- /dev/null +++ b/sandbox/travelsample/paymentprocess-contribution/test/scatours/paymentprocess/PaymentProcessTestCase.java @@ -0,0 +1,63 @@ +/* + * 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.paymentprocess; + +import org.apache.tuscany.sca.node.SCAClient; +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 PaymentProcessTestCase { + private static SCANode node; + + /** + * @throws java.lang.Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception { + SCANodeFactory factory = SCANodeFactory.newInstance(); + node = factory.createSCANodeFromClassLoader("paymentprocesstest.composite", PaymentProcess.class.getClassLoader()); + node.start(); + } + + @Test + public void testPaymentProcess() { + SCAClient client = (SCAClient) node; + PaymentProcess pp = client.getService(PaymentProcess.class, "PaymentProcessClient"); + System.out.println(pp.makePayment("Fred", 100.00f)); + } + + /** + * @throws java.lang.Exception + */ + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (node != null) { + node.stop(); + node = null; + } + } + +} diff --git a/sandbox/travelsample/pom.xml b/sandbox/travelsample/pom.xml index 4fdbd2f746..6d687c60e4 100644 --- a/sandbox/travelsample/pom.xml +++ b/sandbox/travelsample/pom.xml @@ -43,6 +43,8 @@ flight-contribution car-contribution payment-contribution + paymentprocess-contribution + emailgateway-contribution travelcatalog-contribution tripbooking-contribution shoppingcart-contribution diff --git a/sandbox/travelsample/travel-scenario.odg b/sandbox/travelsample/travel-scenario.odg index 1cf9e801a2..b63b57b021 100644 Binary files a/sandbox/travelsample/travel-scenario.odg and b/sandbox/travelsample/travel-scenario.odg differ diff --git a/sandbox/travelsample/ui-contribution/scatours.composite b/sandbox/travelsample/ui-contribution/scatours.composite index e9193bf0fa..84864d4ba6 100644 --- a/sandbox/travelsample/ui-contribution/scatours.composite +++ b/sandbox/travelsample/ui-contribution/scatours.composite @@ -122,5 +122,12 @@ + + + + + + + -- cgit v1.2.3