summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/testing
diff options
context:
space:
mode:
authorscottkurz <scottkurz@13f79535-47bb-0310-9956-ffa450edef68>2011-01-24 20:07:38 +0000
committerscottkurz <scottkurz@13f79535-47bb-0310-9956-ffa450edef68>2011-01-24 20:07:38 +0000
commit0593ae1f96fed0317b9adb817ceea17a66cb38c3 (patch)
tree972ff51d637a8459e9b77c95c752e766930729ef /sca-java-2.x/trunk/testing
parent0d84cc78489ac547b2bacec57286a33a06dfcab3 (diff)
Add some tests (@Ignore'd) showing problems in void return type + Holder case.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1062956 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--sca-java-2.x/trunk/testing/itest/ws/holder-ws-service-multiple-outputs/src/main/java/org/example/orderservice/OrderService.java8
-rw-r--r--sca-java-2.x/trunk/testing/itest/ws/holder-ws-service-multiple-outputs/src/main/java/org/example/orderservice/OrderServiceForwardImpl.java61
-rw-r--r--sca-java-2.x/trunk/testing/itest/ws/holder-ws-service-multiple-outputs/src/main/java/org/example/orderservice/OrderServiceImpl.java13
-rw-r--r--sca-java-2.x/trunk/testing/itest/ws/holder-ws-service-multiple-outputs/src/test/java/org/example/orderservice/OrderServiceTestCase.java76
4 files changed, 130 insertions, 28 deletions
diff --git a/sca-java-2.x/trunk/testing/itest/ws/holder-ws-service-multiple-outputs/src/main/java/org/example/orderservice/OrderService.java b/sca-java-2.x/trunk/testing/itest/ws/holder-ws-service-multiple-outputs/src/main/java/org/example/orderservice/OrderService.java
index d3a8fce8c0..d738dd58fc 100644
--- a/sca-java-2.x/trunk/testing/itest/ws/holder-ws-service-multiple-outputs/src/main/java/org/example/orderservice/OrderService.java
+++ b/sca-java-2.x/trunk/testing/itest/ws/holder-ws-service-multiple-outputs/src/main/java/org/example/orderservice/OrderService.java
@@ -55,4 +55,12 @@ public interface OrderService {
@WebParam(name = "myOutParam", targetNamespace = "", mode = WebParam.Mode.INOUT)
Holder<Float> myOutParam,
Integer myCode);
+
+ public void reviewOrderTwoInOutsVoid(
+ @WebParam(name = "myData", targetNamespace = "", mode = WebParam.Mode.INOUT)
+ Holder<Order> myData,
+ @WebParam(name = "myOutParam", targetNamespace = "", mode = WebParam.Mode.INOUT)
+ Holder<Float> myOutParam);
+
+
}
diff --git a/sca-java-2.x/trunk/testing/itest/ws/holder-ws-service-multiple-outputs/src/main/java/org/example/orderservice/OrderServiceForwardImpl.java b/sca-java-2.x/trunk/testing/itest/ws/holder-ws-service-multiple-outputs/src/main/java/org/example/orderservice/OrderServiceForwardImpl.java
index eb9b355dfa..4c89fd59a7 100644
--- a/sca-java-2.x/trunk/testing/itest/ws/holder-ws-service-multiple-outputs/src/main/java/org/example/orderservice/OrderServiceForwardImpl.java
+++ b/sca-java-2.x/trunk/testing/itest/ws/holder-ws-service-multiple-outputs/src/main/java/org/example/orderservice/OrderServiceForwardImpl.java
@@ -8,34 +8,39 @@ import org.oasisopen.sca.annotation.Service;
@Service(OrderService.class)
public class OrderServiceForwardImpl implements OrderService {
- @Reference
- public OrderService ref;
-
- public String[] reviewOrder(Holder<Order> myData, Holder<Float> myOutParam) {
- String[] retVal = ref.reviewOrder(myData, myOutParam);
- return retVal;
- }
-
- @Override
- public String[] reviewOrderTwoInOuts(Holder<Order> myData,
- Holder<Float> myOutParam) {
- String[] retVal = ref.reviewOrderTwoInOuts(myData, myOutParam);
- return retVal;
- }
-
- @Override
- public String[] reviewOrderTwoOutHolders(Holder<Order> myData,
- Holder<Float> myOutParam) {
- String[] retVal = ref.reviewOrderTwoOutHolders(myData, myOutParam);
- return retVal;
- }
-
- @Override
- public String[] reviewOrderTwoInOutsThenIn(Holder<Order> myData,
- Holder<Float> myOutParam, Integer myCode) {
- String[] retVal = ref.reviewOrderTwoInOutsThenIn(myData, myOutParam, myCode);
- return retVal;
- }
+ @Reference
+ public OrderService ref;
+
+ public String[] reviewOrder(Holder<Order> myData, Holder<Float> myOutParam) {
+ String[] retVal = ref.reviewOrder(myData, myOutParam);
+ return retVal;
+ }
+
+ @Override
+ public String[] reviewOrderTwoInOuts(Holder<Order> myData,
+ Holder<Float> myOutParam) {
+ String[] retVal = ref.reviewOrderTwoInOuts(myData, myOutParam);
+ return retVal;
+ }
+
+ @Override
+ public String[] reviewOrderTwoOutHolders(Holder<Order> myData,
+ Holder<Float> myOutParam) {
+ String[] retVal = ref.reviewOrderTwoOutHolders(myData, myOutParam);
+ return retVal;
+ }
+
+ @Override
+ public String[] reviewOrderTwoInOutsThenIn(Holder<Order> myData,
+ Holder<Float> myOutParam, Integer myCode) {
+ String[] retVal = ref.reviewOrderTwoInOutsThenIn(myData, myOutParam, myCode);
+ return retVal;
+ }
+
+ @Override
+ public void reviewOrderTwoInOutsVoid(Holder<Order> myData, Holder<Float> myOutParam) {
+ ref.reviewOrderTwoInOutsVoid(myData, myOutParam);
+ }
}
diff --git a/sca-java-2.x/trunk/testing/itest/ws/holder-ws-service-multiple-outputs/src/main/java/org/example/orderservice/OrderServiceImpl.java b/sca-java-2.x/trunk/testing/itest/ws/holder-ws-service-multiple-outputs/src/main/java/org/example/orderservice/OrderServiceImpl.java
index c6c471c872..46eb8a6307 100644
--- a/sca-java-2.x/trunk/testing/itest/ws/holder-ws-service-multiple-outputs/src/main/java/org/example/orderservice/OrderServiceImpl.java
+++ b/sca-java-2.x/trunk/testing/itest/ws/holder-ws-service-multiple-outputs/src/main/java/org/example/orderservice/OrderServiceImpl.java
@@ -142,4 +142,17 @@ public class OrderServiceImpl implements OrderService {
return returnVal;
}
+ @Override
+ public void reviewOrderTwoInOutsVoid(Holder<Order> myData, Holder<Float> myOutParam) {
+ double total = myData.value.getTotal();
+ Order retOrder = new Order();
+ if (total < 50.1 && myOutParam.value < 50) {
+ myOutParam.value = new Float("1");
+ retOrder.setStatus(Status.APPROVED);
+ } else {
+ myOutParam.value = new Float("-1");
+ retOrder.setStatus(Status.REJECTED);
+ }
+ myData.value = retOrder;
+ }
}
diff --git a/sca-java-2.x/trunk/testing/itest/ws/holder-ws-service-multiple-outputs/src/test/java/org/example/orderservice/OrderServiceTestCase.java b/sca-java-2.x/trunk/testing/itest/ws/holder-ws-service-multiple-outputs/src/test/java/org/example/orderservice/OrderServiceTestCase.java
index cb18d1f265..0f6b858720 100644
--- a/sca-java-2.x/trunk/testing/itest/ws/holder-ws-service-multiple-outputs/src/test/java/org/example/orderservice/OrderServiceTestCase.java
+++ b/sca-java-2.x/trunk/testing/itest/ws/holder-ws-service-multiple-outputs/src/test/java/org/example/orderservice/OrderServiceTestCase.java
@@ -32,6 +32,7 @@ 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.Ignore;
import org.junit.Test;
/**
@@ -195,6 +196,44 @@ public class OrderServiceTestCase {
testOrderReviewOrderTwoInOutsThenIn(orderService);
}
+ @Ignore
+ @Test
+ public void testOrderReviewVoidApprovedSCA() throws IOException {
+ OrderService orderService =
+ node.getService(OrderService.class, "OrderServiceComponent/OrderService");
+ assertNotNull(orderService);
+ testOrderReviewVoidApproved(orderService);
+ }
+
+ @Ignore
+ @Test
+ public void testOrderReviewVoidApprovedWS() throws IOException {
+ OrderService orderService =
+ node.getService(OrderService.class, "OrderServiceForwardComponent/OrderService");
+ assertNotNull(orderService);
+ testOrderReviewVoidApproved(orderService);
+ }
+
+ @Ignore
+ @Test
+ public void testOrderReviewVoidRejectedSCA() throws IOException {
+ OrderService orderService =
+ node.getService(OrderService.class, "OrderServiceComponent/OrderService");
+ assertNotNull(orderService);
+ testOrderReviewVoidRejected(orderService);
+ }
+
+ @Ignore
+ @Test
+ public void testOrderReviewVoidRejectedWS() throws IOException {
+ OrderService orderService =
+ node.getService(OrderService.class, "OrderServiceForwardComponent/OrderService");
+ assertNotNull(orderService);
+ testOrderReviewVoidRejected(orderService);
+ }
+
+
+
private void testOrderReviewApproved(OrderService orderService, Holder<Float> outParam) throws IOException {
Order order = new Order();
order.setStatus( Status.CREATED );
@@ -295,6 +334,43 @@ public class OrderServiceTestCase {
assertTrue(outParam.value.floatValue() == 97);
}
+ private void testOrderReviewVoidApproved(OrderService orderService) throws IOException {
+ Order order = new Order();
+ order.setStatus( Status.CREATED );
+ order.setCustomerId("cust1234");
+ order.setTotal( 50.0 );
+
+ System.out.println( ">>> Order submitted=" + order );
+ Holder<Order> holder = new Holder<Order>(order);
+
+ Float parm2 = new Float("45");
+ Holder<Float> outParam = new Holder<Float>(parm2);
+
+ orderService.reviewOrderTwoInOutsVoid(holder, outParam );
+
+ assertTrue( holder.value.getStatus() == Status.APPROVED );
+ assertEquals(outParam.value, new Float("1"));
+ }
+
+ private void testOrderReviewVoidRejected(OrderService orderService) throws IOException {
+ Order order = new Order();
+ order.setStatus( Status.CREATED );
+ order.setCustomerId("cust2345");
+ order.setTotal( 50000.0 );
+
+ System.out.println( ">>> Order submitted=" + order );
+ Holder<Order> holder = new Holder<Order>(order);
+
+ Float parm2 = new Float("76");
+ Holder<Float> outParam = new Holder<Float>(parm2);
+
+ orderService.reviewOrderTwoInOutsVoid(holder, outParam );
+
+ assertTrue( holder.value.getStatus() == Status.REJECTED );
+ assertEquals(outParam.value, new Float("-1"));
+ }
+
+
@AfterClass
public static void stopServer() throws Exception {
if (node != null)