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
This commit is contained in:
parent
ae27417c3e
commit
4732b74e3a
14 changed files with 232 additions and 45 deletions
|
@ -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>
|
|
@ -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";
|
||||
}
|
||||
|
||||
}
|
|
@ -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);
|
|
@ -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>
|
||||
<?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>
|
|
@ -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>
|
|
@ -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"/>
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
|
@ -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>
|
|
@ -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>
|
|
@ -80,7 +80,7 @@
|
|||
<module>scatours</module>
|
||||
<module>payment-java</module>
|
||||
<module>payment-java-policy</module>
|
||||
<module>payment-spring-contribution</module>
|
||||
<module>payment-spring</module>
|
||||
<module>payment-spring-scatag-contribution</module>
|
||||
<module>payment-bpel-contribution</module>
|
||||
<module>payment-groovy-contribution</module>
|
||||
|
|
Loading…
Add table
Reference in a new issue