diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2009-02-08 15:02:03 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2009-02-08 15:02:03 +0000 |
commit | 0e4846e9b7eed9d2acf12a5924105ede04fe839b (patch) | |
tree | 65cbd750bb77a74f9952e08a28dd9f69b1182942 /sandbox/travelsample/chapter-06/payment-bpel-contribution | |
parent | a1475c1fb472b2a953f776a6419b5725311832d7 (diff) |
Sort out payment component using implementation.bpel
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@742117 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r-- | sandbox/travelsample/chapter-06/payment-bpel-contribution/log4j.properties (renamed from sandbox/travelsample/chapter-06/paymentprocess-contribution/log4j.properties) | 0 | ||||
-rw-r--r-- | sandbox/travelsample/chapter-06/payment-bpel-contribution/pom.xml (renamed from sandbox/travelsample/chapter-06/paymentprocess-contribution/pom.xml) | 42 | ||||
-rw-r--r-- | sandbox/travelsample/chapter-06/payment-bpel-contribution/src/CreditCardPayment.wsdl (renamed from sandbox/travelsample/chapter-06/paymentprocess-contribution/resources/CreditCardPayment.wsdl) | 0 | ||||
-rw-r--r-- | sandbox/travelsample/chapter-06/payment-bpel-contribution/src/EmailGateway.wsdl (renamed from sandbox/travelsample/chapter-06/paymentprocess-contribution/resources/EmailGateway.wsdl) | 0 | ||||
-rw-r--r-- | sandbox/travelsample/chapter-06/payment-bpel-contribution/src/META-INF/sca-contribution.xml (renamed from sandbox/travelsample/chapter-06/paymentprocess-contribution/resources/META-INF/sca-contribution.xml) | 4 | ||||
-rw-r--r-- | sandbox/travelsample/chapter-06/payment-bpel-contribution/src/Payment.wsdl (renamed from sandbox/travelsample/chapter-06/paymentprocess-contribution/resources/PaymentProcess.wsdl) | 26 | ||||
-rw-r--r-- | sandbox/travelsample/chapter-06/payment-bpel-contribution/src/payment.bpel (renamed from sandbox/travelsample/chapter-06/paymentprocess-contribution/resources/paymentprocess.bpel) | 24 | ||||
-rw-r--r-- | sandbox/travelsample/chapter-06/payment-bpel-contribution/test/payment.composite (renamed from sandbox/travelsample/chapter-06/paymentprocess-contribution/paymentprocesstest.composite) | 24 | ||||
-rw-r--r-- | sandbox/travelsample/chapter-06/payment-bpel-contribution/test/scatours/payment/PaymentTestCase.java | 67 | ||||
-rw-r--r-- | sandbox/travelsample/chapter-06/payment-bpel-contribution/test/scatours/payment/client/PaymentClientImpl.java (renamed from sandbox/travelsample/chapter-06/paymentprocess-contribution/test/scatours/paymentprocess/PaymentProcessClientImpl.java) | 15 |
10 files changed, 143 insertions, 59 deletions
diff --git a/sandbox/travelsample/chapter-06/paymentprocess-contribution/log4j.properties b/sandbox/travelsample/chapter-06/payment-bpel-contribution/log4j.properties index 7ed0bcaf77..7ed0bcaf77 100644 --- a/sandbox/travelsample/chapter-06/paymentprocess-contribution/log4j.properties +++ b/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 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 @@ <version>1.5-SNAPSHOT</version> <!--relativePath>../../pom.xml</relativePath--> </parent> - <artifactId>scatours-paymentprocess-contribution</artifactId> - <name>Apache Tuscany SCA Tours Payment Process Contribution</name> + <artifactId>scatours-chapter-06-payment-bpel-contribution</artifactId> + <name>Apache Tuscany SCA Tours Chapter 06 Payment BPEL Contribution</name> <dependencies> <dependency> @@ -64,6 +64,20 @@ </dependency> <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours-emailgateway-contribution</artifactId> + <version>1.5-SNAPSHOT</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours-creditcardpayment-contribution</artifactId> + <version>1.5-SNAPSHOT</version> + <scope>test</scope> + </dependency> + + <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.5</version> @@ -77,19 +91,23 @@ <testSourceDirectory>${basedir}/test</testSourceDirectory> <resources> <resource> - <directory>${basedir}/resources</directory> + <directory>${basedir}/src</directory> </resource> </resources> <testResources> <testResource> - <directory>${basedir}/resources</directory> + <directory>${basedir}/src</directory> + <excludes> + <exclude>**/*.java</exclude> + <exclude>**/.*/**</exclude> + </excludes> </testResource> <testResource> - <directory>${basedir}</directory> - <includes> - <include>*.composite</include> - <include>*.properties</include> - </includes> + <directory>${basedir}/test</directory> + <excludes> + <exclude>**/*.java</exclude> + <exclude>**/.*/**</exclude> + </excludes> </testResource> </testResources> <plugins> @@ -124,11 +142,11 @@ <goal>wsimport</goal> </goals> <configuration> - <packageName>scatours.paymentprocess</packageName> - <wsdlDirectory>${basedir}/resources + <packageName>scatours.payment</packageName> + <wsdlDirectory>${basedir}/src </wsdlDirectory> <wsdlFiles> - <wsdlFile>PaymentProcess.wsdl</wsdlFile> + <wsdlFile>Payment.wsdl</wsdlFile> </wsdlFiles> <sourceDestDir>${project.build.directory}/jaxws-source </sourceDestDir> diff --git a/sandbox/travelsample/chapter-06/paymentprocess-contribution/resources/CreditCardPayment.wsdl b/sandbox/travelsample/chapter-06/payment-bpel-contribution/src/CreditCardPayment.wsdl index a90c73cdfb..a90c73cdfb 100644 --- a/sandbox/travelsample/chapter-06/paymentprocess-contribution/resources/CreditCardPayment.wsdl +++ b/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 index d9a5e36bc0..d9a5e36bc0 100644 --- a/sandbox/travelsample/chapter-06/paymentprocess-contribution/resources/EmailGateway.wsdl +++ b/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 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. --> <contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"> - <export.java package="scatours.paymentprocess"/> - <export namespace="http://www.example.org/PaymentProcess/"/> + <export.java package="scatours.payment"/> + <export namespace="http://www.example.org/Payment"/> </contribution>
\ 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 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. --> -<wsdl:definitions name="PaymentProcess" - targetNamespace="http://www.example.org/PaymentProcess/" +<wsdl:definitions name="Payment" + targetNamespace="http://www.example.org/Payment/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" - xmlns:tns="http://www.example.org/PaymentProcess/" + xmlns:tns="http://www.example.org/Payment/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/" xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/"> <wsdl:types> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" - targetNamespace="http://www.example.org/PaymentProcess/" - xmlns:tns="http://www.example.org/PaymentProcess/"> + targetNamespace="http://www.example.org/Payment/" + xmlns:tns="http://www.example.org/Payment/"> <xsd:complexType name="MakePaymentType"> <xsd:sequence> @@ -53,16 +53,16 @@ <wsdl:message name="MakePaymentResponse"> <wsdl:part name="parameters" element="tns:makePaymentResponse"></wsdl:part> </wsdl:message> - <wsdl:portType name="PaymentProcess"> + <wsdl:portType name="Payment"> <wsdl:operation name="makePayment"> <wsdl:input message="tns:MakePaymentRequest"></wsdl:input> <wsdl:output message="tns:MakePaymentResponse"></wsdl:output> </wsdl:operation> </wsdl:portType> - <wsdl:binding name="PaymentProcessBinding" type="tns:PaymentProcess"> + <wsdl:binding name="PaymentBinding" type="tns:Payment"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> <wsdl:operation name="makePayment"> - <soap:operation soapAction="http://www.example.org/PaymentProcess/makePayment" /> + <soap:operation soapAction="http://www.example.org/Payment/makePayment" /> <wsdl:input> <soap:body use="literal" /> </wsdl:input> @@ -71,13 +71,13 @@ </wsdl:output> </wsdl:operation> </wsdl:binding> - <wsdl:service name="PaymentProcessService"> - <wsdl:port name="PaymentProcessPort" binding="tns:PaymentProcessBinding"> - <soap:address location="http://localhost:8083/PaymentProcess" /> + <wsdl:service name="PaymentService"> + <wsdl:port name="PaymentPort" binding="tns:PaymentBinding"> + <soap:address location="http://localhost:8083/Payment" /> </wsdl:port> </wsdl:service> - <plnk:partnerLinkType name="PaymentProcessLinkType"> - <plnk:role name="forward" portType="tns:PaymentProcess"/> + <plnk:partnerLinkType name="PaymentLinkType"> + <plnk:role name="forward" portType="tns:Payment"/> </plnk:partnerLinkType> </wsdl:definitions>
\ 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 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. --> -<process name="PaymentProcess" - targetNamespace="http://www.example.org/PaymentProcess" +<process name="Payment" + targetNamespace="http://www.example.org/Payment" xmlns="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/" - xmlns:tns="http://tuscany.apache.org/PaymentProcess" + xmlns:tns="http://tuscany.apache.org/Payment" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:pp="http://www.example.org/PaymentProcess/" + xmlns:pp="http://www.example.org/Payment/" xmlns:ccp="http://www.example.org/CreditCardPayment/" xmlns:eg="http://www.example.org/EmailGateway/" queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0" expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"> - <import location="PaymentProcess.wsdl" + <import location="Payment.wsdl" importType="http://schemas.xmlsoap.org/wsdl/" - namespace="http://www.example.org/PaymentProcess/"/> + namespace="http://www.example.org/Payment/"/> <import location="CreditCardPayment.wsdl" importType="http://schemas.xmlsoap.org/wsdl/" @@ -42,7 +42,7 @@ namespace="http://www.example.org/EmailGateway/"/> <partnerLinks> - <partnerLink name="paymentProcessPartnerLink" partnerLinkType="pp:PaymentProcessLinkType" myRole="forward" /> + <partnerLink name="paymentPartnerLink" partnerLinkType="pp:PaymentLinkType" myRole="forward" /> <partnerLink name="creditCardPaymentPartnerLink" partnerLinkType="ccp:CreditCardPaymentLinkType" partnerRole="forward" initializePartnerRole="yes" /> <partnerLink name="emailGatewayPartnerLink" partnerLinkType="eg:EmailGatewayLinkType" partnerRole="forward" initializePartnerRole="yes" /> </partnerLinks> @@ -58,8 +58,8 @@ <sequence> <receive name="start" - partnerLink="paymentProcessPartnerLink" - portType="pp:PaymentProcess" + partnerLink="paymentPartnerLink" + portType="pp:Payment" operation="makePayment" variable="makePaymentRequestMessage" createInstance="yes"/> @@ -144,7 +144,7 @@ <copy> <from> <literal> - <makePaymentResponse xmlns="http://www.example.org/PaymentProcess/"> + <makePaymentResponse xmlns="http://www.example.org/Payment"> <Status xmlns="">OK</Status> </makePaymentResponse> </literal> @@ -155,8 +155,8 @@ <reply name="end" - partnerLink="paymentProcessPartnerLink" - portType="pp:PaymentProcess" + partnerLink="paymentPartnerLink" + portType="pp:Payment" operation="makePayment" variable="makePaymentResponseMessage"> </reply> diff --git a/sandbox/travelsample/chapter-06/paymentprocess-contribution/paymentprocesstest.composite b/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 @@ --> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0" - xmlns:pp="http://www.example.org/PaymentProcess" - targetNamespace="http://www.example.org/PaymentProcess" - name="paymentprocess"> + xmlns:pp="http://www.example.org/Payment" + targetNamespace="http://www.example.org/Payment" + name="payment"> - <component name="PaymentProcessClient"> - <implementation.java class="scatours.paymentprocess.PaymentProcessClientImpl" /> - <reference name="paymentProcess"> - <binding.ws uri="http://localhost:8083/PaymentProcess" /> + <component name="PaymentClient"> + <implementation.java class="scatours.payment.client.PaymentClientImpl" /> + <reference name="payment"> + <binding.ws uri="http://localhost:8083/Payment" /> </reference> </component> - <component name="PaymentProcess"> - <implementation.bpel process="pp:PaymentProcess"/> - <service name="paymentProcessPartnerLink"> - <interface.wsdl interface="http://www.example.org/PaymentProcess/#wsdl.interface(PaymentProcess)" /> - <binding.ws uri="http://localhost:8083/PaymentProcess" wsdlElement="http://www.example.org/PaymentProcess/#wsdl.service(PaymentProcessService)"/> + <component name="Payment"> + <implementation.bpel process="pp:Payment"/> + <service name="paymentPartnerLink"> + <interface.wsdl interface="http://www.example.org/Payment/#wsdl.interface(Payment)" /> + <binding.ws uri="http://localhost:8083/Payment" wsdlElement="http://www.example.org/Payment/#wsdl.service(PaymentService)"/> </service> <reference name="creditCardPaymentPartnerLink"> <binding.ws uri="http://localhost:8081/CreditCardPayment"/> 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 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); } } |