diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2009-02-08 13:55:21 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2009-02-08 13:55:21 +0000 |
commit | 4d8028d9c83f266ad73b4254f16e5a668530bd08 (patch) | |
tree | 11256aafb92d8e5d5c9630dfc52bacd9b881713c /sandbox/travelsample | |
parent | 2a3ab5ac993c6b146e360dbd5c970813f9191a0a (diff) |
set up payment/creditcardpayment combination
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@742093 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sandbox/travelsample')
8 files changed, 158 insertions, 222 deletions
diff --git a/sandbox/travelsample/shared-contributions/payment-contribution/pom.xml b/sandbox/travelsample/shared-contributions/creditcardpayment-contribution/pom.xml index 98a1166a66..46902b1fc9 100644 --- a/sandbox/travelsample/shared-contributions/payment-contribution/pom.xml +++ b/sandbox/travelsample/shared-contributions/creditcardpayment-contribution/pom.xml @@ -25,8 +25,8 @@ <version>1.5-SNAPSHOT</version> <!--relativePath>../../pom.xml</relativePath--> </parent> - <artifactId>scatours-payment-contribution</artifactId> - <name>Apache Tuscany SCA Tours Payment Contribution</name> + <artifactId>scatours-creditcardpayment-contribution</artifactId> + <name>Apache Tuscany SCA Tours Credit Card Payment Contribution</name> <dependencies> <dependency> @@ -77,30 +77,19 @@ <testSourceDirectory>${basedir}/test</testSourceDirectory> <resources> <resource> - <directory>${basedir}</directory> + <directory>${basedir}/src</directory> <excludes> <exclude>**/*.java</exclude> <exclude>**/.*/**</exclude> - <exclude>pom.xml</exclude> - <exclude>build.xml</exclude> - <exclude>target/**</exclude> - <exclude>src/**</exclude> - <exclude>test/**</exclude> - <exclude>*.composite</exclude> </excludes> </resource> </resources> <testResources> <testResource> - <directory>${basedir}</directory> + <directory>${basedir}/test</directory> <excludes> <exclude>**/*.java</exclude> <exclude>**/.*/**</exclude> - <exclude>pom.xml</exclude> - <exclude>build.xml</exclude> - <exclude>target/**</exclude> - <exclude>src/**</exclude> - <exclude>test/**</exclude> </excludes> </testResource> </testResources> @@ -137,7 +126,7 @@ </goals> <configuration> <packageName>payment.creditcard</packageName> - <wsdlDirectory>${basedir}/wsdl + <wsdlDirectory>${basedir}/src/wsdl </wsdlDirectory> <wsdlFiles> <wsdlFile>CreditCardPayment.wsdl</wsdlFile> diff --git a/sandbox/travelsample/shared-contributions/payment-contribution/META-INF/sca-contribution.xml b/sandbox/travelsample/shared-contributions/creditcardpayment-contribution/src/META-INF/sca-contribution.xml index d22f4816ab..d22f4816ab 100644 --- a/sandbox/travelsample/shared-contributions/payment-contribution/META-INF/sca-contribution.xml +++ b/sandbox/travelsample/shared-contributions/creditcardpayment-contribution/src/META-INF/sca-contribution.xml diff --git a/sandbox/travelsample/shared-contributions/payment-contribution/src/payment/creditcard/ws/impl/CreditCardPaymentWSImpl.java b/sandbox/travelsample/shared-contributions/creditcardpayment-contribution/src/payment/creditcard/CreditCardPaymentImpl.java index f0c61cd14d..450485e466 100644 --- a/sandbox/travelsample/shared-contributions/payment-contribution/src/payment/creditcard/ws/impl/CreditCardPaymentWSImpl.java +++ b/sandbox/travelsample/shared-contributions/creditcardpayment-contribution/src/payment/creditcard/CreditCardPaymentImpl.java @@ -17,7 +17,7 @@ * under the License. */ -package payment.creditcard.ws.impl; +package payment.creditcard; import org.osoa.sca.annotations.Service; @@ -28,8 +28,8 @@ import payment.creditcard.CreditCardPayment; * */ @Service(CreditCardPayment.class) -public class CreditCardPaymentWSImpl implements CreditCardPayment { - +public class CreditCardPaymentImpl implements CreditCardPayment { + public String authorize(CreditCardDetailsType creditCard, float amount) { if (creditCard != null){ System.out.println("Checking card: name = " + @@ -44,5 +44,4 @@ public class CreditCardPaymentWSImpl implements CreditCardPayment { return "OK"; } - } diff --git a/sandbox/travelsample/shared-contributions/payment-contribution/wsdl/CreditCardPayment.wsdl b/sandbox/travelsample/shared-contributions/creditcardpayment-contribution/src/wsdl/CreditCardPayment.wsdl index b40c341389..c194d78982 100644 --- a/sandbox/travelsample/shared-contributions/payment-contribution/wsdl/CreditCardPayment.wsdl +++ b/sandbox/travelsample/shared-contributions/creditcardpayment-contribution/src/wsdl/CreditCardPayment.wsdl @@ -1,116 +1,116 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * 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.
--->
-<wsdl:definitions name="CreditCardPayment"
- targetNamespace="http://www.example.org/CreditCardPayment/"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
- xmlns:tns="http://www.example.org/CreditCardPayment/"
- 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/CreditCardPayment/"
- xmlns:tns="http://www.example.org/CreditCardPayment/">
-
- <xsd:element name="authorize" type="tns:AuthorizeType"/>
- <xsd:complexType name="AuthorizeType">
- <xsd:sequence>
- <xsd:element name="CreditCard" type="tns:CreditCardDetailsType"></xsd:element>
- <xsd:element name="Amount" type="xsd:float"></xsd:element>
- </xsd:sequence>
- </xsd:complexType>
-
- <xsd:element name="authorizeResponse" type="tns:AuthorizeResponseType"/>
- <xsd:complexType name="AuthorizeResponseType">
- <xsd:sequence>
- <xsd:element name="Status" type="xsd:string"></xsd:element>
- </xsd:sequence>
- </xsd:complexType>
-
- <xsd:complexType name="CreditCardDetailsType">
- <xsd:sequence>
- <xsd:element name="CreditCardType" type="tns:CreditCardTypeType" minOccurs="0" />
- <xsd:element name="CreditCardNumber" type="xsd:string" minOccurs="0" />
- <xsd:element name="ExpMonth" type="xsd:int" minOccurs="0" />
- <xsd:element name="ExpYear" type="xsd:int" minOccurs="0" />
- <xsd:element name="CardOwner" type="tns:PayerType" minOccurs="0" />
- <xsd:element name="CVV2" type="xsd:string" minOccurs="0" />
- </xsd:sequence>
- </xsd:complexType>
- <xsd:simpleType name="CreditCardTypeType">
- <xsd:restriction base="xsd:token">
- <xsd:enumeration value="Visa" />
- <xsd:enumeration value="MasterCard" />
- <xsd:enumeration value="Discover" />
- <xsd:enumeration value="Amex" />
- </xsd:restriction>
- </xsd:simpleType>
- <xsd:complexType name="PayerType">
- <xsd:sequence>
- <xsd:element name="Name" type="xsd:string" />
- <xsd:element name="Address" type="tns:AddressType" />
- </xsd:sequence>
- </xsd:complexType>
- <xsd:complexType name="AddressType">
- <xsd:sequence>
- <xsd:element name="Street" type="xsd:string" />
- <xsd:element name="City" type="xsd:string" />
- <xsd:element name="State" type="xsd:string" />
- <xsd:element name="ZipCode" type="xsd:string" />
- <xsd:element name="HomePhone" type="xsd:string" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:schema>
+<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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. +--> +<wsdl:definitions name="CreditCardPayment" + targetNamespace="http://www.example.org/CreditCardPayment/" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:tns="http://www.example.org/CreditCardPayment/" + 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/CreditCardPayment/" + xmlns:tns="http://www.example.org/CreditCardPayment/"> + + <xsd:element name="authorize" type="tns:AuthorizeType"/> + <xsd:complexType name="AuthorizeType"> + <xsd:sequence> + <xsd:element name="CreditCard" type="tns:CreditCardDetailsType"></xsd:element> + <xsd:element name="Amount" type="xsd:float"></xsd:element> + </xsd:sequence> + </xsd:complexType> + + <xsd:element name="authorizeResponse" type="tns:AuthorizeResponseType"/> + <xsd:complexType name="AuthorizeResponseType"> + <xsd:sequence> + <xsd:element name="Status" type="xsd:string"></xsd:element> + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="CreditCardDetailsType"> + <xsd:sequence> + <xsd:element name="CreditCardType" type="tns:CreditCardTypeType" minOccurs="0" /> + <xsd:element name="CreditCardNumber" type="xsd:string" minOccurs="0" /> + <xsd:element name="ExpMonth" type="xsd:int" minOccurs="0" /> + <xsd:element name="ExpYear" type="xsd:int" minOccurs="0" /> + <xsd:element name="CardOwner" type="tns:PayerType" minOccurs="0" /> + <xsd:element name="CVV2" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + </xsd:complexType> + <xsd:simpleType name="CreditCardTypeType"> + <xsd:restriction base="xsd:token"> + <xsd:enumeration value="Visa" /> + <xsd:enumeration value="MasterCard" /> + <xsd:enumeration value="Discover" /> + <xsd:enumeration value="Amex" /> + </xsd:restriction> + </xsd:simpleType> + <xsd:complexType name="PayerType"> + <xsd:sequence> + <xsd:element name="Name" type="xsd:string" /> + <xsd:element name="Address" type="tns:AddressType" /> + </xsd:sequence> + </xsd:complexType> + <xsd:complexType name="AddressType"> + <xsd:sequence> + <xsd:element name="Street" type="xsd:string" /> + <xsd:element name="City" type="xsd:string" /> + <xsd:element name="State" type="xsd:string" /> + <xsd:element name="ZipCode" type="xsd:string" /> + <xsd:element name="HomePhone" type="xsd:string" /> + </xsd:sequence> + </xsd:complexType> + </xsd:schema> </wsdl:types> - <wsdl:message name="AuthorizeRequest">
- <wsdl:part name="parameters" element="tns:authorize"></wsdl:part>
- </wsdl:message>
- <wsdl:message name="AuthorizeResponse">
- <wsdl:part name="parameters" element="tns:authorizeResponse"></wsdl:part>
- </wsdl:message>
- <wsdl:portType name="CreditCardPayment">
- <wsdl:operation name="authorize">
- <wsdl:input message="tns:AuthorizeRequest"></wsdl:input>
- <wsdl:output message="tns:AuthorizeResponse"></wsdl:output>
- </wsdl:operation>
- </wsdl:portType>
- <wsdl:binding name="CreditCardPaymentBinding" type="tns:CreditCardPayment">
- <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="authorize">
- <soap:operation soapAction="http://www.example.org/CreditCardPayment/authorize" />
- <wsdl:input>
- <soap:body use="literal" />
- </wsdl:input>
- <wsdl:output>
- <soap:body use="literal" />
- </wsdl:output>
- </wsdl:operation>
- </wsdl:binding>
- <wsdl:service name="CreditCardPaymentService">
- <wsdl:port name="CreditCardPaymentPort" binding="tns:CreditCardPaymentBinding">
- <soap:address location="http://localhost:8080/CreditCardPayment" />
- </wsdl:port>
- </wsdl:service>
-
- <plnk:partnerLinkType name="CreditCardPaymentLinkType">
- <plnk:role name="forward" portType="tns:CreditCardPayment"/>
- </plnk:partnerLinkType>
+ <wsdl:message name="AuthorizeRequest"> + <wsdl:part name="parameters" element="tns:authorize"></wsdl:part> + </wsdl:message> + <wsdl:message name="AuthorizeResponse"> + <wsdl:part name="parameters" element="tns:authorizeResponse"></wsdl:part> + </wsdl:message> + <wsdl:portType name="CreditCardPayment"> + <wsdl:operation name="authorize"> + <wsdl:input message="tns:AuthorizeRequest"></wsdl:input> + <wsdl:output message="tns:AuthorizeResponse"></wsdl:output> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="CreditCardPaymentBinding" type="tns:CreditCardPayment"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> + <wsdl:operation name="authorize"> + <soap:operation soapAction="http://www.example.org/CreditCardPayment/authorize" /> + <wsdl:input> + <soap:body use="literal" /> + </wsdl:input> + <wsdl:output> + <soap:body use="literal" /> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="CreditCardPaymentService"> + <wsdl:port name="CreditCardPaymentPort" binding="tns:CreditCardPaymentBinding"> + <soap:address location="http://localhost:8080/CreditCardPayment" /> + </wsdl:port> + </wsdl:service> + + <plnk:partnerLinkType name="CreditCardPaymentLinkType"> + <plnk:role name="forward" portType="tns:CreditCardPayment"/> + </plnk:partnerLinkType> </wsdl:definitions>
\ No newline at end of file diff --git a/sandbox/travelsample/shared-contributions/payment-contribution/creditcard.composite b/sandbox/travelsample/shared-contributions/creditcardpayment-contribution/test/creditcard.composite index 184304e829..d0721a8bae 100644 --- a/sandbox/travelsample/shared-contributions/payment-contribution/creditcard.composite +++ b/sandbox/travelsample/shared-contributions/creditcardpayment-contribution/test/creditcard.composite @@ -1,38 +1,34 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * 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.
--->
-<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
- xmlns:c="http://creditcard" targetNamespace="http://creditcard" name="creditcard">
- <component name="CreditCardPaymentWSClient">
- <implementation.java class="payment.creditcard.impl.CreditCardPaymentImpl" />
- <reference name="creditCardPayment">
- <binding.ws uri="http://localhost:8081/CreditCardPayment" />
- </reference>
- <service name="CreditCardPayment">
- <!--t:binding.jsonrpc uri="/jsonrpc/CreditCardPayment" /-->
- <binding.sca />
- </service>
- </component>
- <component name="CreditCardPaymentWS">
- <implementation.java class="payment.creditcard.ws.impl.CreditCardPaymentWSImpl" />
- <service name="CreditCardPayment">
- <binding.ws uri="http://localhost:8081/CreditCardPayment" />
- </service>
- </component>
+<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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. +--> +<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" + targetNamespace="http://creditcard" + xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0" + xmlns:c="http://creditcard" + name="creditcard"> + + <component name="CreditCardPaymentComponent"> + <implementation.java class="payment.creditcard.CreditCardPaymentImpl" /> + <service name="CreditCardPayment"> + <binding.ws uri="http://localhost:8081/CreditCardPayment" /> + <binding.sca/> + </service> + </component> + </composite>
\ No newline at end of file diff --git a/sandbox/travelsample/shared-contributions/payment-contribution/test/payment/creditcard/CreditCardPaymentTestCase.java b/sandbox/travelsample/shared-contributions/creditcardpayment-contribution/test/payment/creditcard/CreditCardPaymentTestCase.java index 656197dcb9..0c25509ab3 100644 --- a/sandbox/travelsample/shared-contributions/payment-contribution/test/payment/creditcard/CreditCardPaymentTestCase.java +++ b/sandbox/travelsample/shared-contributions/creditcardpayment-contribution/test/payment/creditcard/CreditCardPaymentTestCase.java @@ -46,7 +46,7 @@ public class CreditCardPaymentTestCase { @Test public void testCreditCardPayment() { SCAClient client = (SCAClient) node; - CreditCardPayment cc = client.getService(CreditCardPayment.class, "CreditCardPaymentWSClient"); + CreditCardPayment cc = client.getService(CreditCardPayment.class, "CreditCardPaymentComponent/CreditCardPayment"); ObjectFactory objectFactory = new ObjectFactory(); CreditCardDetailsType ccDetails = objectFactory.createCreditCardDetailsType(); @@ -59,16 +59,14 @@ public class CreditCardPaymentTestCase { } @Test - //@Ignore + @Ignore public void testWaitForInput() { -/* System.out.println("Press a key to end"); try { System.in.read(); } catch (Exception ex) { } System.out.println("Shutting down"); -*/ } /** diff --git a/sandbox/travelsample/shared-contributions/payment-contribution/src/payment/creditcard/impl/CreditCardPaymentImpl.java b/sandbox/travelsample/shared-contributions/payment-contribution/src/payment/creditcard/impl/CreditCardPaymentImpl.java deleted file mode 100644 index 2a9c537775..0000000000 --- a/sandbox/travelsample/shared-contributions/payment-contribution/src/payment/creditcard/impl/CreditCardPaymentImpl.java +++ /dev/null @@ -1,46 +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 payment.creditcard.impl; - -import org.osoa.sca.annotations.Reference; -import org.osoa.sca.annotations.Service; - -import payment.creditcard.CreditCardDetailsType; -import payment.creditcard.CreditCardPayment; - -/** - * - */ -@Service(CreditCardPayment.class) -public class CreditCardPaymentImpl implements CreditCardPayment { - - @Reference - protected CreditCardPayment creditCardPayment; - - public String authorize(CreditCardDetailsType creditCard, float amount) { - // Validate some of the fields in CreditCardDetailsType - if (creditCard.getCreditCardType() == null) { - return "UnknownCreditCardType"; - } - // Delegate the external web service - return creditCardPayment.authorize(creditCard, amount); - } - -} diff --git a/sandbox/travelsample/shared-contributions/pom.xml b/sandbox/travelsample/shared-contributions/pom.xml index 39dde3875f..583c42a4fc 100644 --- a/sandbox/travelsample/shared-contributions/pom.xml +++ b/sandbox/travelsample/shared-contributions/pom.xml @@ -39,11 +39,11 @@ <module>calendar-contribution</module> <module>car-contribution</module> <module>common-contribution</module> + <module>creditcardpayment-contribution</module> <module>currency-contribution</module> <module>emailgateway-contribution</module> <module>flight-contribution</module> <module>hotel-contribution</module> - <module>payment-contribution</module> <module>shoppingcart-contribution</module> <module>travelcatalog-contribution</module> <module>tripbooking-contribution</module> |