diff options
author | nash <nash@13f79535-47bb-0310-9956-ffa450edef68> | 2009-09-13 16:48:23 +0000 |
---|---|---|
committer | nash <nash@13f79535-47bb-0310-9956-ffa450edef68> | 2009-09-13 16:48:23 +0000 |
commit | 4732b74e3a1124644f78cfaead65081a6e142aba (patch) | |
tree | 8766494f477c2b1f4778b55c6ad683421e91737b /sandbox/travelsample/contributions/payment-spring | |
parent | ae27417c3e0192eb1920bbbf61b300380d03810c (diff) |
Apply new naming convention to contributions/payment-spring
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@814341 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
13 files changed, 231 insertions, 44 deletions
diff --git a/sandbox/travelsample/contributions/payment-spring-contribution/pom.xml b/sandbox/travelsample/contributions/payment-spring/pom.xml index b517da76c7..505a54debb 100644 --- a/sandbox/travelsample/contributions/payment-spring-contribution/pom.xml +++ b/sandbox/travelsample/contributions/payment-spring/pom.xml @@ -26,7 +26,7 @@ <!--relativePath>../../pom.xml</relativePath--> </parent> <version>1.0-SNAPSHOT</version> - <artifactId>scatours-payment-spring-contribution</artifactId> + <artifactId>scatours-contribution-payment-spring</artifactId> <name>Apache Tuscany SCA Tours Payment Spring Contribution</name> <dependencies> @@ -135,7 +135,7 @@ <goal>wsimport</goal> </goals> <configuration> - <packageName>payment</packageName> + <packageName>com.tuscanyscatours.payment</packageName> <wsdlDirectory>${basedir}/src/main/resources</wsdlDirectory> <wsdlFiles> <wsdlFile>Payment.wsdl</wsdlFile> @@ -153,7 +153,7 @@ <goal>wsimport</goal> </goals> <configuration> - <packageName>payment.creditcard</packageName> + <packageName>com.tuscanyscatours.payment.creditcard</packageName> <wsdlDirectory>${basedir}/src/main/resources</wsdlDirectory> <wsdlFiles> <wsdlFile>CreditCardPayment.wsdl</wsdlFile> @@ -171,7 +171,7 @@ <goal>wsimport</goal> </goals> <configuration> - <packageName>scatours.emailgateway</packageName> + <packageName>com.tuscanyscatours.emailgateway</packageName> <wsdlDirectory>${basedir}/src/main/resources</wsdlDirectory> <wsdlFiles> <wsdlFile>EmailGateway.wsdl</wsdlFile> diff --git a/sandbox/travelsample/contributions/payment-spring/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java b/sandbox/travelsample/contributions/payment-spring/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java new file mode 100644 index 0000000000..5eb825cb85 --- /dev/null +++ b/sandbox/travelsample/contributions/payment-spring/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java @@ -0,0 +1,32 @@ +/* + * 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 com.tuscanyscatours.emailgateway.impl; + +import com.tuscanyscatours.emailgateway.EmailGateway; +import com.tuscanyscatours.emailgateway.EmailType; + +public class EmailGatewayImpl implements EmailGateway { + + public String sendEmail(EmailType email) { + System.out.println("Sending mail to " + email.getTo()); + return "SENT"; + } + +} diff --git a/sandbox/travelsample/contributions/payment-spring-contribution/src/main/java/payment/PaymentImpl.java b/sandbox/travelsample/contributions/payment-spring/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java index d3bcb94053..1e7050edbe 100644 --- a/sandbox/travelsample/contributions/payment-spring-contribution/src/main/java/payment/PaymentImpl.java +++ b/sandbox/travelsample/contributions/payment-spring/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java @@ -17,15 +17,16 @@ * under the License. */ -package payment; +package com.tuscanyscatours.payment.impl; -import payment.creditcard.CreditCardDetailsType; -import payment.creditcard.CreditCardPayment; -import payment.creditcard.CreditCardTypeType; -import payment.creditcard.ObjectFactory; -import payment.creditcard.PayerType; -import scatours.emailgateway.EmailGateway; -import scatours.emailgateway.EmailType; +import com.tuscanyscatours.emailgateway.EmailGateway; +import com.tuscanyscatours.emailgateway.EmailType; +import com.tuscanyscatours.payment.Payment; +import com.tuscanyscatours.payment.creditcard.CreditCardDetailsType; +import com.tuscanyscatours.payment.creditcard.CreditCardPayment; +import com.tuscanyscatours.payment.creditcard.CreditCardTypeType; +import com.tuscanyscatours.payment.creditcard.ObjectFactory; +import com.tuscanyscatours.payment.creditcard.PayerType; public class PaymentImpl implements Payment { @@ -58,7 +59,8 @@ public class PaymentImpl implements Payment { String status = creditCardPayment.authorize(ccDetails, amount); - scatours.emailgateway.ObjectFactory emailFactory = new scatours.emailgateway.ObjectFactory(); + com.tuscanyscatours.emailgateway.ObjectFactory emailFactory + = new com.tuscanyscatours.emailgateway.ObjectFactory(); EmailType email = emailFactory.createEmailType(); email.setTitle("Payment Received"); email.setTo(customerId); diff --git a/sandbox/travelsample/contributions/payment-spring-contribution/src/main/resources/CreditCardPayment.wsdl b/sandbox/travelsample/contributions/payment-spring/src/main/resources/CreditCardPayment.wsdl index 8224cd126f..8224cd126f 100644 --- a/sandbox/travelsample/contributions/payment-spring-contribution/src/main/resources/CreditCardPayment.wsdl +++ b/sandbox/travelsample/contributions/payment-spring/src/main/resources/CreditCardPayment.wsdl diff --git a/sandbox/travelsample/contributions/payment-spring-contribution/src/main/resources/EmailGateway.wsdl b/sandbox/travelsample/contributions/payment-spring/src/main/resources/EmailGateway.wsdl index 44867f794c..44867f794c 100644 --- a/sandbox/travelsample/contributions/payment-spring-contribution/src/main/resources/EmailGateway.wsdl +++ b/sandbox/travelsample/contributions/payment-spring/src/main/resources/EmailGateway.wsdl diff --git a/sandbox/travelsample/contributions/payment-spring-contribution/src/main/resources/META-INF/sca-contribution.xml b/sandbox/travelsample/contributions/payment-spring/src/main/resources/META-INF/sca-contribution.xml index 3f466760b0..b480cc4aa1 100644 --- a/sandbox/travelsample/contributions/payment-spring-contribution/src/main/resources/META-INF/sca-contribution.xml +++ b/sandbox/travelsample/contributions/payment-spring/src/main/resources/META-INF/sca-contribution.xml @@ -1,25 +1,24 @@ -<?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. ---> -<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" - xmlns:scatours="http://scatours"> - <export.java package="payment"/> - <export namespace="http://www.tuscanyscatours.com/Payment/"/> - <deployable composite="scatours:payment" /> -</contribution>
\ No newline at end of file +<?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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:scatours="http://tuscanyscatours.com/">
+ <export.java package="com.tuscanyscatours.payment"/>
+ <deployable composite="scatours:payment" />
+</contribution>
diff --git a/sandbox/travelsample/contributions/payment-spring-contribution/src/main/resources/Payment-context.xml b/sandbox/travelsample/contributions/payment-spring/src/main/resources/Payment-context.xml index 976a24ce3a..c79abdb6ba 100644 --- a/sandbox/travelsample/contributions/payment-spring-contribution/src/main/resources/Payment-context.xml +++ b/sandbox/travelsample/contributions/payment-spring/src/main/resources/Payment-context.xml @@ -23,13 +23,13 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> - <bean id="Payment" class="payment.PaymentImpl"> + <bean id="Payment" class="com.tuscanyscatours.payment.impl.PaymentImpl"> <property name="creditCardPayment" ref="creditCardPaymentReference"/> <property name="emailGateway" ref="EmailGateway"/> <property name="transactionFee" value="0.5f"/> </bean> - <bean id="EmailGateway" class="scatours.emailgateway.EmailGatewayImpl"> + <bean id="EmailGateway" class="com.tuscanyscatours.emailgateway.impl.EmailGatewayImpl"> </bean> </beans> diff --git a/sandbox/travelsample/contributions/payment-spring-contribution/src/main/resources/Payment.wsdl b/sandbox/travelsample/contributions/payment-spring/src/main/resources/Payment.wsdl index e2c4062f2e..e2c4062f2e 100644 --- a/sandbox/travelsample/contributions/payment-spring-contribution/src/main/resources/Payment.wsdl +++ b/sandbox/travelsample/contributions/payment-spring/src/main/resources/Payment.wsdl diff --git a/sandbox/travelsample/contributions/payment-spring-contribution/src/main/resources/payment.composite b/sandbox/travelsample/contributions/payment-spring/src/main/resources/payment.composite index f192bf9659..1e5bae2a2b 100644 --- a/sandbox/travelsample/contributions/payment-spring-contribution/src/main/resources/payment.composite +++ b/sandbox/travelsample/contributions/payment-spring/src/main/resources/payment.composite @@ -18,12 +18,10 @@ * under the License. --> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" - targetNamespace="http://scatours" - xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0" - xmlns:c="http://scatours" + targetNamespace="http://tuscanyscatours.com/" name="payment"> - <component name="PaymentComponent"> + <component name="Payment"> <implementation.spring location="Payment-context.xml"/> <service name="Payment"> <binding.ws uri="http://localhost:8081/Payment"/> diff --git a/sandbox/travelsample/contributions/payment-spring/src/test/java/scatours/payment/PaymentTestCase.java b/sandbox/travelsample/contributions/payment-spring/src/test/java/scatours/payment/PaymentTestCase.java new file mode 100644 index 0000000000..41a5d05294 --- /dev/null +++ b/sandbox/travelsample/contributions/payment-spring/src/test/java/scatours/payment/PaymentTestCase.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.payment; + +import com.tuscanyscatours.payment.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; + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + creditCardNode = SCANodeFactory.newInstance().createSCANode("creditcard.composite", + new SCAContribution("creditcard", "../creditcard-payment-jaxb/target/classes")); + + creditCardNode.start(); + + paymentNode = SCANodeFactory.newInstance().createSCANode(null, + new SCAContribution("payment-spring", "./target/classes"), + new SCAContribution("payment-spring-test", "./target/test-classes")); + + paymentNode.start(); + } + + @Test + public void testPayment() { + SCAClient client = (SCAClient) paymentNode; + Payment payment = client.getService(Payment.class, "PaymentClient"); + System.out.println("Result = " + payment.makePaymentMember("Fred", 100.00f)); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + paymentNode.stop(); + creditCardNode.stop(); + } + +} diff --git a/sandbox/travelsample/contributions/payment-spring/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java b/sandbox/travelsample/contributions/payment-spring/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java new file mode 100644 index 0000000000..d602f57dfc --- /dev/null +++ b/sandbox/travelsample/contributions/payment-spring/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java @@ -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. + */ + +package scatours.payment.client.impl; + +import com.tuscanyscatours.payment.Payment; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +@Service(Payment.class) +public class PaymentClientImpl implements Payment { + @Reference + protected Payment payment; + + public String makePaymentMember(String customerId, float amount) { + // Delegate the external web service + return payment.makePaymentMember(customerId, amount); + } + +} diff --git a/sandbox/travelsample/contributions/payment-spring/src/test/resources/META-INF/sca-contribution.xml b/sandbox/travelsample/contributions/payment-spring/src/test/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..b5639eb1f9 --- /dev/null +++ b/sandbox/travelsample/contributions/payment-spring/src/test/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ +<?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.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:scatours="http://tuscanyscatours.com/">
+ <import.java package="com.tuscanyscatours.payment"/>
+ <deployable composite="scatours:paymentClient" />
+</contribution>
diff --git a/sandbox/travelsample/contributions/payment-spring/src/test/resources/payment-client.composite b/sandbox/travelsample/contributions/payment-spring/src/test/resources/payment-client.composite new file mode 100644 index 0000000000..642cebfd1c --- /dev/null +++ b/sandbox/travelsample/contributions/payment-spring/src/test/resources/payment-client.composite @@ -0,0 +1,31 @@ +<?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://tuscanyscatours.com/" + name="paymentClient"> + + <component name="PaymentClient"> + <implementation.java class="scatours.payment.client.impl.PaymentClientImpl" /> + <reference name="payment"> + <binding.ws uri="http://localhost:8081/Payment" /> + </reference> + </component> + +</composite> |