diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-05 21:14:49 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-05 21:14:49 +0000 |
commit | 8c049462ff6387d8c3f69f4e42a4c4b36e38a90c (patch) | |
tree | 3e6b1ec1ab2e2a724d9228ca55052394c3034060 /sandbox/travelsample/contributions/payment-java-policy/src | |
parent | 68c3920fc0ba41c6a9ebf062bd41e5ebf647e51b (diff) |
Format the code
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@833174 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sandbox/travelsample/contributions/payment-java-policy/src')
5 files changed, 24 insertions, 25 deletions
diff --git a/sandbox/travelsample/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java b/sandbox/travelsample/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java index fdced0d659..b08f76e0fa 100644 --- a/sandbox/travelsample/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java +++ b/sandbox/travelsample/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/customer/CustomerNotFoundException.java @@ -19,7 +19,6 @@ package com.tuscanyscatours.customer; - public class CustomerNotFoundException extends Exception { private static final long serialVersionUID = -129752837478357452L; diff --git a/sandbox/travelsample/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java b/sandbox/travelsample/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java index 6364701b9c..26926c7764 100644 --- a/sandbox/travelsample/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java +++ b/sandbox/travelsample/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/customer/impl/CustomerRegistryImpl.java @@ -64,12 +64,12 @@ public class CustomerRegistryImpl implements CustomerRegistry { cc.setExpYear(2012); createCustomer("John Smith", "john@xyz.com", cc); } - + @Destroy public void destroy() { // Save the customers } - + public Customer createCustomer(String name, String email, CreditCardDetailsType creditCard) { Customer customer = new Customer(); customer.setId("c-" + idGenerator++); @@ -90,11 +90,11 @@ public class CustomerRegistryImpl implements CustomerRegistry { public Customer getCustomer(String id) throws CustomerNotFoundException { Customer customer = customers.get(id); - - if (customer == null){ + + if (customer == null) { throw new CustomerNotFoundException("Customer " + id + " not found"); } - + return customer; } diff --git a/sandbox/travelsample/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java b/sandbox/travelsample/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java index ac7255ef59..d9798e436a 100644 --- a/sandbox/travelsample/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java +++ b/sandbox/travelsample/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/emailgateway/impl/EmailGatewayImpl.java @@ -20,6 +20,7 @@ package com.tuscanyscatours.emailgateway.impl; import org.osoa.sca.annotations.Service; + import com.tuscanyscatours.emailgateway.EmailGateway; @Service(EmailGateway.class) diff --git a/sandbox/travelsample/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java b/sandbox/travelsample/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java index 16e91d7284..b3eb95b44b 100644 --- a/sandbox/travelsample/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java +++ b/sandbox/travelsample/contributions/payment-java-policy/src/main/java/com/tuscanyscatours/payment/impl/PaymentImpl.java @@ -19,10 +19,6 @@ package com.tuscanyscatours.payment.impl; -import javax.annotation.security.RolesAllowed; -import javax.annotation.security.RunAs; - -import org.osoa.sca.annotations.Authentication; import org.osoa.sca.annotations.Property; import org.osoa.sca.annotations.Reference; import org.osoa.sca.annotations.Requires; @@ -61,11 +57,10 @@ public class PaymentImpl implements Payment { public String makePaymentMember(String customerId, float amount) { try { Customer customer = customerRegistry.getCustomer(customerId); - String status = creditCardPayment.authorize(customer.getCreditCard(), - amount + transactionFee); - emailGateway.sendEmail("order@tuscanyscatours.com", - customer.getEmail(), - "Status for your payment", + String status = creditCardPayment.authorize(customer.getCreditCard(), amount + transactionFee); + emailGateway.sendEmail("order@tuscanyscatours.com", + customer.getEmail(), + "Status for your payment", customer + " >>> Status = " + status); return status; } catch (CustomerNotFoundException ex) { @@ -74,6 +69,6 @@ public class PaymentImpl implements Payment { return e.getFaultInfo().getErrorCode(); } catch (Throwable t) { return "Payment failed due to system error " + t.getMessage(); - } + } } } diff --git a/sandbox/travelsample/contributions/payment-java-policy/src/test/java/scatours/payment/PaymentTestCase.java b/sandbox/travelsample/contributions/payment-java-policy/src/test/java/scatours/payment/PaymentTestCase.java index e408d89df9..5fd8900fce 100644 --- a/sandbox/travelsample/contributions/payment-java-policy/src/test/java/scatours/payment/PaymentTestCase.java +++ b/sandbox/travelsample/contributions/payment-java-policy/src/test/java/scatours/payment/PaymentTestCase.java @@ -19,7 +19,6 @@ 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; @@ -29,26 +28,31 @@ import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Test; +import com.tuscanyscatours.payment.Payment; + public class PaymentTestCase { private static SCANode node; @BeforeClass public static void setUpBeforeClass() throws Exception { - node = SCANodeFactory.newInstance().createSCANode(null, - new SCAContribution("payment", "./target/classes"), - new SCAContribution("creditcard", "../../contributions/creditcard-payment-jaxb/target/classes")); + node = + SCANodeFactory.newInstance() + .createSCANode(null, + new SCAContribution("payment", "./target/classes"), + new SCAContribution("creditcard", + "../../contributions/creditcard-payment-jaxb/target/classes")); node.start(); } - + @Test public void testPayment() { - SCAClient client = (SCAClient) node; + SCAClient client = (SCAClient)node; Payment payment = client.getService(Payment.class, "Payment"); - + System.out.println("\n\nSuccessful Payment - Status = \n\n" + payment.makePaymentMember("c-0", 100.00f)); System.out.println("\n\nFailed Payment - Status = \n\n" + payment.makePaymentMember("c-1", 100.00f)); } - + @Test @Ignore public void testWaitForInput() { @@ -58,7 +62,7 @@ public class PaymentTestCase { } catch (Exception ex) { } System.out.println("Shutting down"); - } + } @AfterClass public static void tearDownAfterClass() throws Exception { |