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 --- .../creditcard-payment-jaxb-policy/build.xml | 30 +++++ .../maven-eclipse.xml | 8 ++ .../creditcard-payment-jaxb-policy/pom.xml | 150 +++++++++++++++++++++ .../creditcard/impl/CreditCardPaymentImpl.java | 46 +++++++ .../src/main/resources/CreditCardPayment.wsdl | 134 ++++++++++++++++++ .../main/resources/META-INF/sca-contribution.xml | 24 ++++ .../src/main/resources/creditcard.composite | 33 +++++ .../src/main/resources/definitions.xml | 36 +++++ .../creditcard/CreditCardPaymentTestCase.java | 100 ++++++++++++++ 9 files changed, 561 insertions(+) create mode 100644 sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/build.xml create mode 100644 sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/maven-eclipse.xml create mode 100644 sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/pom.xml create mode 100644 sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/src/main/java/com/tuscanyscatours/payment/creditcard/impl/CreditCardPaymentImpl.java create mode 100644 sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/src/main/resources/CreditCardPayment.wsdl create mode 100644 sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/src/main/resources/META-INF/sca-contribution.xml create mode 100644 sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/src/main/resources/creditcard.composite create mode 100644 sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/src/main/resources/definitions.xml create mode 100644 sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/src/test/java/scatours/payment/creditcard/CreditCardPaymentTestCase.java (limited to 'sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy') diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/build.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/build.xml new file mode 100644 index 0000000000..93d1c4ad47 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/build.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/maven-eclipse.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/maven-eclipse.xml new file mode 100644 index 0000000000..4ceebd71f7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/maven-eclipse.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/pom.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/pom.xml new file mode 100644 index 0000000000..ea0923d8c9 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/pom.xml @@ -0,0 +1,150 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + scatours + 1.0-SNAPSHOT + ../../pom.xml + + 1.0-SNAPSHOT + scatours-contribution-creditcard-payment-jaxb-policy + Apache Tuscany SCA Tours Credit Card Payment Contribution JAXB Policy + + + + org.apache.tuscany.sca + tuscany-sca-api + ${tuscany.version} + + + + org.apache.tuscany.sca + tuscany-interface-java-jaxws + ${tuscany.version} + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + ${tuscany.version} + runtime + + + + org.apache.tuscany.sca + tuscany-binding-ws-axis2 + ${tuscany.version} + runtime + + + + org.apache.tuscany.sca + tuscany-node-api + ${tuscany.version} + test + + + + org.apache.tuscany.sca + tuscany-node-impl + ${tuscany.version} + test + + + + org.apache.tuscany.sca + tuscany-host-jetty + ${tuscany.version} + test + + + + 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 + + + wsimport + generate-sources + + wsimport + + + com.tuscanyscatours.payment.creditcard + ${basedir}/src/main/resources + + + CreditCardPayment.wsdl + + ${project.build.directory}/jaxws-source + + false + true + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/src/main/java/com/tuscanyscatours/payment/creditcard/impl/CreditCardPaymentImpl.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/src/main/java/com/tuscanyscatours/payment/creditcard/impl/CreditCardPaymentImpl.java new file mode 100644 index 0000000000..293f08453f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/src/main/java/com/tuscanyscatours/payment/creditcard/impl/CreditCardPaymentImpl.java @@ -0,0 +1,46 @@ +/* + * 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.creditcard.impl; + +import org.osoa.sca.annotations.Service; + +import com.tuscanyscatours.payment.creditcard.CreditCardDetailsType; +import com.tuscanyscatours.payment.creditcard.CreditCardPayment; + +/** + * + */ +@Service(CreditCardPayment.class) +public class CreditCardPaymentImpl implements CreditCardPayment { + + public String authorize(CreditCardDetailsType creditCard, float amount) { + if (creditCard != null) { + System.out.println("Checking card: name = " + creditCard.getCardOwner().getName() + + " number = " + + creditCard.getCreditCardNumber() + + " for amount " + + amount); + } else { + System.out.println("Checking card is null"); + } + + return "OK"; + } +} diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/src/main/resources/CreditCardPayment.wsdl b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/src/main/resources/CreditCardPayment.wsdl new file mode 100644 index 0000000000..f313043bf8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/src/main/resources/CreditCardPayment.wsdl @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..3b889caefd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/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/creditcard-payment-jaxb-policy/src/main/resources/creditcard.composite b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/src/main/resources/creditcard.composite new file mode 100644 index 0000000000..4a91a96255 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/src/main/resources/creditcard.composite @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/src/main/resources/definitions.xml b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/src/main/resources/definitions.xml new file mode 100644 index 0000000000..5a2c58eaed --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/src/main/resources/definitions.xml @@ -0,0 +1,36 @@ + + + + + + + + myname + mypassword + + + + \ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/src/test/java/scatours/payment/creditcard/CreditCardPaymentTestCase.java b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/src/test/java/scatours/payment/creditcard/CreditCardPaymentTestCase.java new file mode 100644 index 0000000000..a33b2b3046 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-travelsample-1.0/contributions/creditcard-payment-jaxb-policy/src/test/java/scatours/payment/creditcard/CreditCardPaymentTestCase.java @@ -0,0 +1,100 @@ +/* + * 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.creditcard; + +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.Ignore; +import org.junit.Test; + +import com.tuscanyscatours.payment.creditcard.AuthorizeFault_Exception; +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 CreditCardPaymentTestCase { + private static SCANode node; + + /** + * @throws java.lang.Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception { + try { + node = + SCANodeFactory.newInstance().createSCANode("creditcard.composite", new SCAContribution("creditcard", "./target/classes")); + + node.start(); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + + @Test + public void testCreditCardPayment() { + SCAClient client = (SCAClient)node; + CreditCardPayment cc = client.getService(CreditCardPayment.class, "CreditCardPayment"); + + ObjectFactory objectFactory = new ObjectFactory(); + CreditCardDetailsType ccDetails = objectFactory.createCreditCardDetailsType(); + ccDetails.setCreditCardType(CreditCardTypeType.fromValue("Visa")); + PayerType ccOwner = objectFactory.createPayerType(); + ccOwner.setName("Fred"); + ccDetails.setCardOwner(ccOwner); + + try { + System.out.println(cc.authorize(ccDetails, 100.00f)); + } catch (AuthorizeFault_Exception e) { + System.err.println("Fault: " + e.getFaultInfo().getErrorCode()); + } + } + + @Test + @Ignore + public void testWaitForInput() { + System.out.println("Press a key to end"); + try { + System.in.read(); + } catch (Exception ex) { + } + System.out.println("Shutting down"); + } + + /** + * @throws java.lang.Exception + */ + @AfterClass + public static void tearDownAfterClass() throws Exception { + if (node != null) { + node.stop(); + node = null; + } + } + +} -- cgit v1.2.3