summaryrefslogtreecommitdiffstats
path: root/sandbox/rfeng/scatours-creditcard-payment-dosgi-contribution/src/test/java
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-05-26 17:58:40 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-05-26 17:58:40 +0000
commit403ff4abf708d2beb7a97babb60f8c0318ff8450 (patch)
treefec9a5991a7e775a8c67a7a0a6dfb40c767fce84 /sandbox/rfeng/scatours-creditcard-payment-dosgi-contribution/src/test/java
parente2153aa948efc7d8b05c641784b30a665c598748 (diff)
Adding CurrencyConverter
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@778816 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--sandbox/rfeng/scatours-creditcard-payment-dosgi-contribution/src/test/java/payment/creditcard/test/CreditCardPaymentTestCase.java75
-rw-r--r--sandbox/rfeng/scatours-creditcard-payment-dosgi-contribution/src/test/java/scatours/payment/creditcard/test/CreditCardPaymentOSGiTestCase.java (renamed from sandbox/rfeng/scatours-creditcard-payment-dosgi-contribution/src/test/java/payment/creditcard/test/CreditCardPaymentOSGiTestCase.java)32
-rw-r--r--sandbox/rfeng/scatours-creditcard-payment-dosgi-contribution/src/test/java/scatours/payment/creditcard/test/OSGiTestUtils.java (renamed from sandbox/rfeng/scatours-creditcard-payment-dosgi-contribution/src/test/java/payment/creditcard/test/OSGiTestUtils.java)2
3 files changed, 28 insertions, 81 deletions
diff --git a/sandbox/rfeng/scatours-creditcard-payment-dosgi-contribution/src/test/java/payment/creditcard/test/CreditCardPaymentTestCase.java b/sandbox/rfeng/scatours-creditcard-payment-dosgi-contribution/src/test/java/payment/creditcard/test/CreditCardPaymentTestCase.java
deleted file mode 100644
index 5149aac90d..0000000000
--- a/sandbox/rfeng/scatours-creditcard-payment-dosgi-contribution/src/test/java/payment/creditcard/test/CreditCardPaymentTestCase.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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 payment.creditcard.test;
-
-import org.apache.tuscany.sca.node.Node;
-import org.apache.tuscany.sca.node.NodeFactory;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import payment.creditcard.CreditCardDetailsType;
-import payment.creditcard.CreditCardPayment;
-import payment.creditcard.CreditCardTypeType;
-import payment.creditcard.ObjectFactory;
-import payment.creditcard.PayerType;
-
-/**
- *
- */
-public class CreditCardPaymentTestCase {
- private static Node node;
-
- /**
- * @throws java.lang.Exception
- */
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- NodeFactory factory = NodeFactory.newInstance();
- node = factory.createNode("creditcard.composite", CreditCardPayment.class.getClassLoader());
- node.start();
- }
-
- @Test
- public void testCreditCardPayment() {
- CreditCardPayment cc = node.getService(CreditCardPayment.class, "CreditCardPaymentComponent/CreditCardPayment");
-
- ObjectFactory objectFactory = new ObjectFactory();
- CreditCardDetailsType ccDetails = objectFactory.createCreditCardDetailsType();
- ccDetails.setCreditCardType(CreditCardTypeType.fromValue("Visa"));
- PayerType ccOwner = objectFactory.createPayerType();
- ccOwner.setName("Fred");
- ccDetails.setCardOwner(ccOwner);
-
- System.out.println(cc.authorize(ccDetails, 100.00f));
- }
-
- /**
- * @throws java.lang.Exception
- */
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- if (node != null) {
- node.stop();
- node = null;
- }
- }
-
-}
diff --git a/sandbox/rfeng/scatours-creditcard-payment-dosgi-contribution/src/test/java/payment/creditcard/test/CreditCardPaymentOSGiTestCase.java b/sandbox/rfeng/scatours-creditcard-payment-dosgi-contribution/src/test/java/scatours/payment/creditcard/test/CreditCardPaymentOSGiTestCase.java
index 122e380164..f981e31efa 100644
--- a/sandbox/rfeng/scatours-creditcard-payment-dosgi-contribution/src/test/java/payment/creditcard/test/CreditCardPaymentOSGiTestCase.java
+++ b/sandbox/rfeng/scatours-creditcard-payment-dosgi-contribution/src/test/java/scatours/payment/creditcard/test/CreditCardPaymentOSGiTestCase.java
@@ -17,9 +17,9 @@
* under the License.
*/
-package payment.creditcard.test;
+package scatours.payment.creditcard.test;
-import static payment.creditcard.test.OSGiTestUtils.bundleStatus;
+import static scatours.payment.creditcard.test.OSGiTestUtils.bundleStatus;
import java.io.InputStream;
import java.io.InputStreamReader;
@@ -30,11 +30,19 @@ import org.apache.tuscany.sca.node.equinox.launcher.EquinoxHost;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
+import org.junit.Ignore;
import org.junit.Test;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
+import scatours.payment.creditcard.CreditCardDetailsType;
+import scatours.payment.creditcard.CreditCardPayment;
+import scatours.payment.creditcard.CreditCardPaymentService;
+import scatours.payment.creditcard.CreditCardTypeType;
+import scatours.payment.creditcard.ObjectFactory;
+import scatours.payment.creditcard.PayerType;
+
/**
*
*/
@@ -83,9 +91,7 @@ public class CreditCardPaymentOSGiTestCase {
}
@Test
- /**
- * Test the Web service exposed by the Calculator
- */
+ @Ignore("Now we use the testClient")
public void testWS() throws Exception {
URL url = new URL("http://localhost:8086/CreditCardPayment?wsdl");
InputStream is = url.openStream();
@@ -106,6 +112,22 @@ public class CreditCardPaymentOSGiTestCase {
}
/**
+ * Test the Web service exposed by the Calculator
+ */
+ @Test
+ public void testClient() {
+ CreditCardPaymentService service = new CreditCardPaymentService();
+ ObjectFactory objectFactory = new ObjectFactory();
+ CreditCardDetailsType ccDetails = objectFactory.createCreditCardDetailsType();
+ ccDetails.setCreditCardType(CreditCardTypeType.fromValue("Visa"));
+ PayerType ccOwner = objectFactory.createPayerType();
+ ccOwner.setName("Fred");
+ ccDetails.setCardOwner(ccOwner);
+ CreditCardPayment cc = service.getCreditCardPaymentPort();
+ System.out.println(cc.authorize(ccDetails, 100.00f));
+ }
+
+ /**
* @throws java.lang.Exception
*/
@AfterClass
diff --git a/sandbox/rfeng/scatours-creditcard-payment-dosgi-contribution/src/test/java/payment/creditcard/test/OSGiTestUtils.java b/sandbox/rfeng/scatours-creditcard-payment-dosgi-contribution/src/test/java/scatours/payment/creditcard/test/OSGiTestUtils.java
index 1fe64b80a4..de8a77a818 100644
--- a/sandbox/rfeng/scatours-creditcard-payment-dosgi-contribution/src/test/java/payment/creditcard/test/OSGiTestUtils.java
+++ b/sandbox/rfeng/scatours-creditcard-payment-dosgi-contribution/src/test/java/scatours/payment/creditcard/test/OSGiTestUtils.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package payment.creditcard.test;
+package scatours.payment.creditcard.test;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;