From 4732b74e3a1124644f78cfaead65081a6e142aba Mon Sep 17 00:00:00 2001 From: nash Date: Sun, 13 Sep 2009 16:48:23 +0000 Subject: 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 --- .../contributions/payment-spring/pom.xml | 189 +++++++++++++++++++++ .../emailgateway/impl/EmailGatewayImpl.java | 32 ++++ .../tuscanyscatours/payment/impl/PaymentImpl.java | 73 ++++++++ .../src/main/resources/CreditCardPayment.wsdl | 118 +++++++++++++ .../src/main/resources/EmailGateway.wsdl | 89 ++++++++++ .../main/resources/META-INF/sca-contribution.xml | 24 +++ .../src/main/resources/Payment-context.xml | 35 ++++ .../payment-spring/src/main/resources/Payment.wsdl | 83 +++++++++ .../src/main/resources/payment.composite | 35 ++++ .../java/scatours/payment/PaymentTestCase.java | 65 +++++++ .../payment/client/impl/PaymentClientImpl.java | 36 ++++ .../test/resources/META-INF/sca-contribution.xml | 24 +++ .../src/test/resources/payment-client.composite | 31 ++++ 13 files changed, 834 insertions(+) create mode 100644 sandbox/travelsample/contributions/payment-spring/pom.xml create mode 100644 sandbox/travelsample/contributions/payment-spring/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java create mode 100644 sandbox/travelsample/contributions/payment-spring/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java create mode 100644 sandbox/travelsample/contributions/payment-spring/src/main/resources/CreditCardPayment.wsdl create mode 100644 sandbox/travelsample/contributions/payment-spring/src/main/resources/EmailGateway.wsdl create mode 100644 sandbox/travelsample/contributions/payment-spring/src/main/resources/META-INF/sca-contribution.xml create mode 100644 sandbox/travelsample/contributions/payment-spring/src/main/resources/Payment-context.xml create mode 100644 sandbox/travelsample/contributions/payment-spring/src/main/resources/Payment.wsdl create mode 100644 sandbox/travelsample/contributions/payment-spring/src/main/resources/payment.composite create mode 100644 sandbox/travelsample/contributions/payment-spring/src/test/java/scatours/payment/PaymentTestCase.java create mode 100644 sandbox/travelsample/contributions/payment-spring/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java create mode 100644 sandbox/travelsample/contributions/payment-spring/src/test/resources/META-INF/sca-contribution.xml create mode 100644 sandbox/travelsample/contributions/payment-spring/src/test/resources/payment-client.composite (limited to 'sandbox/travelsample/contributions/payment-spring') diff --git a/sandbox/travelsample/contributions/payment-spring/pom.xml b/sandbox/travelsample/contributions/payment-spring/pom.xml new file mode 100644 index 0000000000..505a54debb --- /dev/null +++ b/sandbox/travelsample/contributions/payment-spring/pom.xml @@ -0,0 +1,189 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 1.6-SNAPSHOT + + + 1.0-SNAPSHOT + scatours-contribution-payment-spring + Apache Tuscany SCA Tours Payment Spring Contribution + + + + org.apache.tuscany.sca + tuscany-host-embedded + 1.6-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 1.6-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-jsonrpc-runtime + 1.6-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + 1.6-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-host-jetty + 1.6-SNAPSHOT + runtime + + + + + org.apache.tuscany.sca + tuscany-implementation-spring + 1.6-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-spring-runtime + 1.6-SNAPSHOT + runtime + + + + junit + junit + 4.5 + test + + + + + + + java.net2 + java.net Maven 2.x Repository + http://download.java.net/maven/2 + + false + + + + + + ${artifactId} + + + 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.12 + + + payment + generate-sources + + wsimport + + + com.tuscanyscatours.payment + ${basedir}/src/main/resources + + Payment.wsdl + + ${project.build.directory}/jaxws-source + ${project.build.directory}/jaxws-source/stale/payment.stale + false + true + + + + payment.creditcard + process-sources + + wsimport + + + com.tuscanyscatours.payment.creditcard + ${basedir}/src/main/resources + + CreditCardPayment.wsdl + + ${project.build.directory}/jaxws-source + ${project.build.directory}/jaxws-source/stale/creditcard.stale + false + true + + + + scatours.emailgateway + process-sources + + wsimport + + + com.tuscanyscatours.emailgateway + ${basedir}/src/main/resources + + EmailGateway.wsdl + + ${project.build.directory}/jaxws-source + ${project.build.directory}/jaxws-source/stale/emailgateway.stale + false + true + + + + + + + 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/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java b/sandbox/travelsample/contributions/payment-spring/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java new file mode 100644 index 0000000000..1e7050edbe --- /dev/null +++ b/sandbox/travelsample/contributions/payment-spring/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java @@ -0,0 +1,73 @@ +/* + * 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.payment.impl; + +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 { + + private CreditCardPayment creditCardPayment; + private EmailGateway emailGateway; + private float transactionFee; + + public void setCreditCardPayment(CreditCardPayment creditCardPayment) { + this.creditCardPayment = creditCardPayment; + } + + public void setEmailGateway(EmailGateway emailGateway) { + this.emailGateway = emailGateway; + } + + public void setTransactionFee(Float transactionFee) { + this.transactionFee = transactionFee; + } + + public String makePaymentMember(String customerId, float amount) { + + ObjectFactory objectFactory = new ObjectFactory(); + CreditCardDetailsType ccDetails = objectFactory.createCreditCardDetailsType(); + ccDetails.setCreditCardType(CreditCardTypeType.fromValue("Visa")); + PayerType ccOwner = objectFactory.createPayerType(); + ccOwner.setName(customerId); + ccDetails.setCardOwner(ccOwner); + + amount += transactionFee; + + String status = creditCardPayment.authorize(ccDetails, amount); + + com.tuscanyscatours.emailgateway.ObjectFactory emailFactory + = new com.tuscanyscatours.emailgateway.ObjectFactory(); + EmailType email = emailFactory.createEmailType(); + email.setTitle("Payment Received"); + email.setTo(customerId); + + emailGateway.sendEmail(email); + + return status; + } + +} diff --git a/sandbox/travelsample/contributions/payment-spring/src/main/resources/CreditCardPayment.wsdl b/sandbox/travelsample/contributions/payment-spring/src/main/resources/CreditCardPayment.wsdl new file mode 100644 index 0000000000..8224cd126f --- /dev/null +++ b/sandbox/travelsample/contributions/payment-spring/src/main/resources/CreditCardPayment.wsdl @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sandbox/travelsample/contributions/payment-spring/src/main/resources/EmailGateway.wsdl b/sandbox/travelsample/contributions/payment-spring/src/main/resources/EmailGateway.wsdl new file mode 100644 index 0000000000..44867f794c --- /dev/null +++ b/sandbox/travelsample/contributions/payment-spring/src/main/resources/EmailGateway.wsdl @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/travelsample/contributions/payment-spring/src/main/resources/META-INF/sca-contribution.xml b/sandbox/travelsample/contributions/payment-spring/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..b480cc4aa1 --- /dev/null +++ b/sandbox/travelsample/contributions/payment-spring/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + + diff --git a/sandbox/travelsample/contributions/payment-spring/src/main/resources/Payment-context.xml b/sandbox/travelsample/contributions/payment-spring/src/main/resources/Payment-context.xml new file mode 100644 index 0000000000..c79abdb6ba --- /dev/null +++ b/sandbox/travelsample/contributions/payment-spring/src/main/resources/Payment-context.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + diff --git a/sandbox/travelsample/contributions/payment-spring/src/main/resources/Payment.wsdl b/sandbox/travelsample/contributions/payment-spring/src/main/resources/Payment.wsdl new file mode 100644 index 0000000000..e2c4062f2e --- /dev/null +++ b/sandbox/travelsample/contributions/payment-spring/src/main/resources/Payment.wsdl @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sandbox/travelsample/contributions/payment-spring/src/main/resources/payment.composite b/sandbox/travelsample/contributions/payment-spring/src/main/resources/payment.composite new file mode 100644 index 0000000000..1e5bae2a2b --- /dev/null +++ b/sandbox/travelsample/contributions/payment-spring/src/main/resources/payment.composite @@ -0,0 +1,35 @@ + + + + + + + + + + + + + 1.23 + + + 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 @@ + + + + + + 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 @@ + + + + + + + + + + + + -- cgit v1.2.3