diff --git a/sandbox/travelsample/chapter-06/node/build.xml b/sandbox/travelsample/chapter-06/node/build.xml new file mode 100644 index 0000000000..736729e09a --- /dev/null +++ b/sandbox/travelsample/chapter-06/node/build.xml @@ -0,0 +1,273 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/travelsample/chapter-06/node/pom.xml b/sandbox/travelsample/chapter-06/node/pom.xml new file mode 100644 index 0000000000..f3a4e3c432 --- /dev/null +++ b/sandbox/travelsample/chapter-06/node/pom.xml @@ -0,0 +1,178 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 1.5-SNAPSHOT + + + scatours-chapter-06-node + Apache Tuscany SCA Tours Chapter 06 Node + + + + org.apache.tuscany.sca + tuscany-node-api + 1.5-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-node-launcher + 1.5-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-domain-manager + 1.5-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-node-runtime + 1.5-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 1.5-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-widget-runtime + 1.5-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-resource-runtime + 1.5-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-atom-abdera + 1.5-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jsonrpc-runtime + 1.5-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-http-runtime + 1.5-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 1.5-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-sca-axis2 + 1.5-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-ejb-runtime + 1.5-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-ejb + 1.5-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-bpel-ode + 1.5-SNAPSHOT + runtime + + + + org.apache.derby + derby + 10.3.1.4 + runtime + + + + + + ${artifactId} + ${basedir}/src + + + ${basedir} + + **/*.java + **/.*/** + pom.xml + build.xml + target/** + src/** + + + + + + org.apache.tuscany.sca + tuscany-maven-ant-generator + 1.5-SNAPSHOT + + + + launch.LaunchTutorialAdmin + + + generate + + + + + + + diff --git a/sandbox/travelsample/chapter-06/node/src/scatours/LaunchNode.java b/sandbox/travelsample/chapter-06/node/src/scatours/LaunchNode.java new file mode 100644 index 0000000000..777963c13e --- /dev/null +++ b/sandbox/travelsample/chapter-06/node/src/scatours/LaunchNode.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; +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/paymentprocess-contribution/log4j.properties b/sandbox/travelsample/chapter-06/payment-bpel-contribution/log4j.properties similarity index 100% rename from sandbox/travelsample/chapter-06/paymentprocess-contribution/log4j.properties rename to sandbox/travelsample/chapter-06/payment-bpel-contribution/log4j.properties diff --git a/sandbox/travelsample/chapter-06/paymentprocess-contribution/pom.xml b/sandbox/travelsample/chapter-06/payment-bpel-contribution/pom.xml similarity index 82% rename from sandbox/travelsample/chapter-06/paymentprocess-contribution/pom.xml rename to sandbox/travelsample/chapter-06/payment-bpel-contribution/pom.xml index c1a9712a66..852d1b4ecc 100644 --- a/sandbox/travelsample/chapter-06/paymentprocess-contribution/pom.xml +++ b/sandbox/travelsample/chapter-06/payment-bpel-contribution/pom.xml @@ -25,8 +25,8 @@ 1.5-SNAPSHOT - scatours-paymentprocess-contribution - Apache Tuscany SCA Tours Payment Process Contribution + scatours-chapter-06-payment-bpel-contribution + Apache Tuscany SCA Tours Chapter 06 Payment BPEL Contribution @@ -63,6 +63,20 @@ 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 @@ -77,19 +91,23 @@ ${basedir}/test - ${basedir}/resources + ${basedir}/src - ${basedir}/resources + ${basedir}/src + + **/*.java + **/.*/** + - ${basedir} - - *.composite - *.properties - + ${basedir}/test + + **/*.java + **/.*/** + @@ -124,11 +142,11 @@ wsimport - scatours.paymentprocess - ${basedir}/resources + scatours.payment + ${basedir}/src - PaymentProcess.wsdl + Payment.wsdl ${project.build.directory}/jaxws-source diff --git a/sandbox/travelsample/chapter-06/paymentprocess-contribution/resources/CreditCardPayment.wsdl b/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/CreditCardPayment.wsdl similarity index 100% rename from sandbox/travelsample/chapter-06/paymentprocess-contribution/resources/CreditCardPayment.wsdl rename to sandbox/travelsample/chapter-06/payment-bpel-contribution/src/CreditCardPayment.wsdl diff --git a/sandbox/travelsample/chapter-06/paymentprocess-contribution/resources/EmailGateway.wsdl b/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/EmailGateway.wsdl similarity index 100% rename from sandbox/travelsample/chapter-06/paymentprocess-contribution/resources/EmailGateway.wsdl rename to sandbox/travelsample/chapter-06/payment-bpel-contribution/src/EmailGateway.wsdl diff --git a/sandbox/travelsample/chapter-06/paymentprocess-contribution/resources/META-INF/sca-contribution.xml b/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/META-INF/sca-contribution.xml similarity index 87% rename from sandbox/travelsample/chapter-06/paymentprocess-contribution/resources/META-INF/sca-contribution.xml rename to sandbox/travelsample/chapter-06/payment-bpel-contribution/src/META-INF/sca-contribution.xml index 8146abbceb..6ce6568b62 100644 --- a/sandbox/travelsample/chapter-06/paymentprocess-contribution/resources/META-INF/sca-contribution.xml +++ b/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/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/paymentprocess-contribution/resources/PaymentProcess.wsdl b/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/Payment.wsdl similarity index 83% rename from sandbox/travelsample/chapter-06/paymentprocess-contribution/resources/PaymentProcess.wsdl rename to sandbox/travelsample/chapter-06/payment-bpel-contribution/src/Payment.wsdl index c4157cf475..399b550334 100644 --- a/sandbox/travelsample/chapter-06/paymentprocess-contribution/resources/PaymentProcess.wsdl +++ b/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/Payment.wsdl @@ -17,18 +17,18 @@ * specific language governing permissions and limitations * under the License. --> - + targetNamespace="http://www.example.org/Payment/" + xmlns:tns="http://www.example.org/Payment/"> @@ -53,16 +53,16 @@ - + - + - + @@ -71,13 +71,13 @@ - - - + + + - - + + \ No newline at end of file diff --git a/sandbox/travelsample/chapter-06/paymentprocess-contribution/resources/paymentprocess.bpel b/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/payment.bpel similarity index 90% rename from sandbox/travelsample/chapter-06/paymentprocess-contribution/resources/paymentprocess.bpel rename to sandbox/travelsample/chapter-06/payment-bpel-contribution/src/payment.bpel index 08c6b8f636..25c10d43a7 100644 --- a/sandbox/travelsample/chapter-06/paymentprocess-contribution/resources/paymentprocess.bpel +++ b/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/payment.bpel @@ -16,22 +16,22 @@ ~ specific language governing permissions and limitations ~ under the License. --> - - + namespace="http://www.example.org/Payment/"/> - + @@ -58,8 +58,8 @@ @@ -144,7 +144,7 @@ - + OK @@ -155,8 +155,8 @@ diff --git a/sandbox/travelsample/chapter-06/paymentprocess-contribution/paymentprocesstest.composite b/sandbox/travelsample/chapter-06/payment-bpel-contribution/test/payment.composite similarity index 64% rename from sandbox/travelsample/chapter-06/paymentprocess-contribution/paymentprocesstest.composite rename to sandbox/travelsample/chapter-06/payment-bpel-contribution/test/payment.composite index f45dc01a57..039192527b 100644 --- a/sandbox/travelsample/chapter-06/paymentprocess-contribution/paymentprocesstest.composite +++ b/sandbox/travelsample/chapter-06/payment-bpel-contribution/test/payment.composite @@ -19,22 +19,22 @@ --> + xmlns:pp="http://www.example.org/Payment" + targetNamespace="http://www.example.org/Payment" + name="payment"> - - - - + + + + - - - - - + + + + + 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/paymentprocess-contribution/test/scatours/paymentprocess/PaymentProcessClientImpl.java b/sandbox/travelsample/chapter-06/payment-bpel-contribution/test/scatours/payment/client/PaymentClientImpl.java similarity index 80% rename from sandbox/travelsample/chapter-06/paymentprocess-contribution/test/scatours/paymentprocess/PaymentProcessClientImpl.java rename to sandbox/travelsample/chapter-06/payment-bpel-contribution/test/scatours/payment/client/PaymentClientImpl.java index 8d9c2f918c..06a99e4326 100644 --- a/sandbox/travelsample/chapter-06/paymentprocess-contribution/test/scatours/paymentprocess/PaymentProcessClientImpl.java +++ b/sandbox/travelsample/chapter-06/payment-bpel-contribution/test/scatours/payment/client/PaymentClientImpl.java @@ -17,22 +17,21 @@ * under the License. */ -package scatours.paymentprocess; +package scatours.payment.client; import org.osoa.sca.annotations.Reference; import org.osoa.sca.annotations.Service; -/** - * - */ -@Service(PaymentProcess.class) -public class PaymentProcessClientImpl implements PaymentProcess { +import scatours.payment.Payment; + +@Service(Payment.class) +public class PaymentClientImpl implements Payment { @Reference - protected PaymentProcess paymentProcess; + protected Payment payment; public String makePayment(String customerId, float amount) { // Delegate the external web service - return paymentProcess.makePayment(customerId, amount); + return payment.makePayment(customerId, amount); } } diff --git a/sandbox/travelsample/chapter-06/paymentprocess-contribution/resources/paymentprocess.componentType b/sandbox/travelsample/chapter-06/paymentprocess-contribution/resources/paymentprocess.componentType deleted file mode 100644 index ecc2f55a47..0000000000 --- a/sandbox/travelsample/chapter-06/paymentprocess-contribution/resources/paymentprocess.componentType +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/sandbox/travelsample/chapter-06/paymentprocess-contribution/test/scatours/paymentprocess/PaymentProcessTestCase.java b/sandbox/travelsample/chapter-06/paymentprocess-contribution/test/scatours/paymentprocess/PaymentProcessTestCase.java deleted file mode 100644 index f1b4bc6aba..0000000000 --- a/sandbox/travelsample/chapter-06/paymentprocess-contribution/test/scatours/paymentprocess/PaymentProcessTestCase.java +++ /dev/null @@ -1,76 +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.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.Ignore; -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 - @Ignore - public void testPaymentProcess() { - SCAClient client = (SCAClient) node; - PaymentProcess pp = client.getService(PaymentProcess.class, "PaymentProcessClient"); - System.out.println("Result = " + pp.makePayment("Fred", 100.00f)); - } - - @Test - //@Ignore - public void testWaitForInput() { - System.out.println("Press a key to end"); - try { - System.in.read(); - } catch (Exception ex) { - } - System.out.println("Shutting down"); - } - - /** - * @throws java.lang.Exception - */ - @AfterClass - public static void tearDownAfterClass() throws Exception { - if (node != null) { - node.stop(); - node = null; - } - } - -} diff --git a/sandbox/travelsample/chapter-06/pom.xml b/sandbox/travelsample/chapter-06/pom.xml index 173ca5c81b..10fd2cd4e9 100644 --- a/sandbox/travelsample/chapter-06/pom.xml +++ b/sandbox/travelsample/chapter-06/pom.xml @@ -37,7 +37,7 @@ node - ui-contribution + payment-bpel-contribution diff --git a/sandbox/travelsample/pom.xml b/sandbox/travelsample/pom.xml index bba96a1621..af9fa85ee9 100644 --- a/sandbox/travelsample/pom.xml +++ b/sandbox/travelsample/pom.xml @@ -42,7 +42,7 @@ chapter-05 - + chapter-06 chapter-09 diff --git a/sandbox/travelsample/shared-contributions/emailgateway-contribution/test/emailgatewaytest.composite b/sandbox/travelsample/shared-contributions/emailgateway-contribution/test/emailgateway.composite similarity index 100% rename from sandbox/travelsample/shared-contributions/emailgateway-contribution/test/emailgatewaytest.composite rename to sandbox/travelsample/shared-contributions/emailgateway-contribution/test/emailgateway.composite diff --git a/sandbox/travelsample/shared-contributions/emailgateway-contribution/test/scatours/emailgateway/EmailGatewayTestCase.java b/sandbox/travelsample/shared-contributions/emailgateway-contribution/test/scatours/emailgateway/EmailGatewayTestCase.java index c471e024e3..1e5a511db1 100644 --- a/sandbox/travelsample/shared-contributions/emailgateway-contribution/test/scatours/emailgateway/EmailGatewayTestCase.java +++ b/sandbox/travelsample/shared-contributions/emailgateway-contribution/test/scatours/emailgateway/EmailGatewayTestCase.java @@ -39,7 +39,7 @@ public class EmailGatewayTestCase { @BeforeClass public static void setUpBeforeClass() throws Exception { SCANodeFactory factory = SCANodeFactory.newInstance(); - node = factory.createSCANodeFromClassLoader("emailgatewaytest.composite", EmailGateway.class.getClassLoader()); + node = factory.createSCANodeFromClassLoader("emailgateway.composite", EmailGateway.class.getClassLoader()); node.start(); }