From 54e785c9a15bc1286757c147323b697a6c40a640 Mon Sep 17 00:00:00 2001 From: nash Date: Tue, 20 Apr 2010 22:27:34 +0000 Subject: Copy 1.x travel sample to branches for start of 1.0 travel sample release git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@936092 13f79535-47bb-0310-9956-ffa450edef68 --- .../contributions/payment-groovy/build.xml | 40 +++++ .../contributions/payment-groovy/pom.xml | 162 +++++++++++++++++++++ .../src/main/resources/CreditCardPayment.wsdl | 116 +++++++++++++++ .../src/main/resources/EmailGateway.wsdl | 89 +++++++++++ .../main/resources/META-INF/sca-contribution.xml | 24 +++ .../payment-groovy/src/main/resources/Payment.wsdl | 83 +++++++++++ .../src/main/resources/payment.composite | 38 +++++ .../src/main/resources/payment/PaymentImpl.groovy | 31 ++++ .../java/scatours/payment/PaymentTestCase.java | 86 +++++++++++ .../payment/client/impl/PaymentClientImpl.java | 37 +++++ .../test/resources/META-INF/sca-contribution.xml | 23 +++ .../src/test/resources/payment-client.composite | 32 ++++ 12 files changed, 761 insertions(+) create mode 100644 sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/build.xml create mode 100644 sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/CreditCardPayment.wsdl create mode 100644 sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/EmailGateway.wsdl create mode 100644 sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/META-INF/sca-contribution.xml create mode 100644 sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/Payment.wsdl create mode 100644 sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/payment.composite create mode 100644 sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/payment/PaymentImpl.groovy create mode 100644 sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/test/java/scatours/payment/PaymentTestCase.java create mode 100644 sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java create mode 100644 sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/test/resources/META-INF/sca-contribution.xml create mode 100644 sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/test/resources/payment-client.composite (limited to 'sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy') diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/build.xml new file mode 100644 index 0000000000..3a86952fc1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/build.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/pom.xml new file mode 100644 index 0000000000..523e1a8c24 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/pom.xml @@ -0,0 +1,162 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + scatours + 1.0-SNAPSHOT + ../../pom.xml + + 1.0-SNAPSHOT + scatours-contribution-payment-groovy + Apache Tuscany SCA Tours Payment Groovy Contribution + + + + + org.apache.tuscany.sca + tuscany-implementation-script + ${tuscany.version} + runtime + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + ${tuscany.version} + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + ${tuscany.version} + test + + + + org.apache.tuscany.sca + tuscany-host-jetty + ${tuscany.version} + test + + + + org.apache.tuscany.sca + tuscany-node-impl + ${tuscany.version} + test + + + + junit + junit + 4.5 + test + + + + + ${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 + + + + 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/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/CreditCardPayment.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/CreditCardPayment.wsdl new file mode 100644 index 0000000000..1813c77436 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/CreditCardPayment.wsdl @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/EmailGateway.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/EmailGateway.wsdl new file mode 100644 index 0000000000..a097d9b7e4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/EmailGateway.wsdl @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..36e2990be1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + + diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/Payment.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/Payment.wsdl new file mode 100644 index 0000000000..2519d7642e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/Payment.wsdl @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/payment.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/payment.composite new file mode 100644 index 0000000000..071c6786d1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/payment.composite @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + 0.02 + + diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/payment/PaymentImpl.groovy b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/payment/PaymentImpl.groovy new file mode 100644 index 0000000000..854fbd2f4a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/main/resources/payment/PaymentImpl.groovy @@ -0,0 +1,31 @@ +/* + * 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. + */ + +def makePaymentMember(customerId, amount) { + + def finalAmount = amount + transactionFee; + + com.tuscanyscatours.emailgateway.EmailType email = new com.tuscanyscatours.emailgateway.EmailType(); + email.setTo(customerId); + email.setTitle("Payment " + finalAmount + " Received"); + + emailGateway.sendEmail(email); + + return "Success"; +} \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/test/java/scatours/payment/PaymentTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/test/java/scatours/payment/PaymentTestCase.java new file mode 100644 index 0000000000..1eb611e5b3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/test/java/scatours/payment/PaymentTestCase.java @@ -0,0 +1,86 @@ +/* + * 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; + +import com.tuscanyscatours.payment.Payment; + +/** + * + */ +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", "../creditcard-payment-jaxb/target/classes")); + + creditCardNode.start(); + + emailGatewayNode = + SCANodeFactory.newInstance().createSCANode("emailgateway.composite", + new SCAContribution("emailgateway", + "../emailgateway/target/classes"), + new SCAContribution("emailgateway-test", + "../emailgateway/target/test-classes")); + + emailGatewayNode.start(); + + paymentNode = + SCANodeFactory.newInstance().createSCANode(null, + new SCAContribution("payment-groovy", "./target/classes"), + new SCAContribution("payment-groovy-test", + "./target/test-classes")); + + paymentNode.start(); + } + + @Test + public void testPayment() { + SCAClient client = (SCAClient)paymentNode; + Payment payment = client.getService(Payment.class, "PaymentClient"); + String result = payment.makePaymentMember("Fred", 100.00f); + System.out.println("Result = " + result); + if (!"Success".equals(result)) { + throw new RuntimeException(result); + } + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + paymentNode.stop(); + creditCardNode.stop(); + emailGatewayNode.stop(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java new file mode 100644 index 0000000000..a38ba51ac5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/test/java/scatours/payment/client/impl/PaymentClientImpl.java @@ -0,0 +1,37 @@ +/* + * 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 org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + +import com.tuscanyscatours.payment.Payment; + +@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/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/test/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/test/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..378e09009b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/test/resources/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ + + + + + diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/test/resources/payment-client.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/test/resources/payment-client.composite new file mode 100644 index 0000000000..353c1cea04 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/payment-groovy/src/test/resources/payment-client.composite @@ -0,0 +1,32 @@ + + + + + + + + + + + + + -- cgit v1.2.3