cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r504833 - in /incubator/cxf/trunk: rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ rt/frontend/jaxws/src/...
Date Thu, 08 Feb 2007 09:14:13 GMT
Author: ffang
Date: Thu Feb  8 01:14:12 2007
New Revision: 504833

URL: http://svn.apache.org/viewvc?view=rev&rev=504833
Log:
[CXF-184] add system test scenario for ParaOrder issue, fix minor bug in HolderOutInteceptor
                        

Modified:
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/HolderOutInterceptor.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/HeaderTest.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/header/HeaderClientServerTest.java
    incubator/cxf/trunk/testutils/src/main/java/org/apache/header_test/TestHeaderImpl.java
    incubator/cxf/trunk/testutils/src/main/resources/wsdl/soapheader.wsdl

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/HolderOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/HolderOutInterceptor.java?view=diff&rev=504833&r1=504832&r2=504833
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/HolderOutInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/HolderOutInterceptor.java
Thu Feb  8 01:14:12 2007
@@ -72,25 +72,16 @@
             LOG.fine("client invocation");
             // Extract the Holders and store them for later
             List<Holder> holders = new ArrayList<Holder>();
-            int size = op.getInput().size() + op.getOutput().size();
+            //int size = op.getInput().size() + op.getOutput().size();
+            int size = outObjects.size();
             List<Object> newObjects = new ArrayList<Object>(size);
             for (int i = 0; i < size; i++) {
                 newObjects.add(null);
             }
-            
-            for (MessagePartInfo part : parts) {
-                int idx = part.getIndex();
-                LOG.fine("part name: " + part.getName() + ", index: " + idx);
-                if (idx >= 0) {
-                    Holder holder = (Holder) outObjects.get(idx);
-                    if (part.getProperty(ReflectionServiceFactoryBean.MODE_INOUT) != null)
{
-                        newObjects.set(idx, holder.value);
-                    }
-                    holders.add(holder);
-                }
-            }
+            int[] argsOffset = removeOutHolderFromParaList(outObjects, parts, holders, size,
newObjects);
             
             if (holders.size() == 0) {
+                
                 return;
             }
             
@@ -104,6 +95,7 @@
                 List<String> ordering = part.getMessageInfo().getOperation().getParameterOrdering();
                 if (ordering != null && ordering.size() > 0) {
                     int orderIdx = -1;
+                    int argsIndex = 0;
                     for (int j = 0; j < ordering.size(); j++) {
                         if (ordering.get(j).equals(part.getName().getLocalPart())) {
                             orderIdx = j;
@@ -111,9 +103,10 @@
                         }
                     }
                     if (orderIdx != -1) {                        
-                        newObjects.set(part.getIndex(), outObjects.get(orderIdx));
+                        newObjects.set(part.getIndex() + argsOffset[argsIndex++], outObjects.get(orderIdx));
+                        
                     } else {
-                        newObjects.set(part.getIndex(), outObjects.get(i));
+                        newObjects.set(part.getIndex() + argsOffset[argsIndex++], outObjects.get(i));
                     }                    
                 } else {
                     newObjects.set(part.getIndex(), outObjects.get(i));
@@ -150,5 +143,38 @@
             }
         }
     }
+
+    private int[] removeOutHolderFromParaList(List<Object> outObjects, 
+                                            List<MessagePartInfo> parts, 
+                                            List<Holder> holders, 
+                                            int size, 
+                                            List<Object> newObjects) {
+        int rmCount = 0;
+        int[] argsOffset = new int[size];
+        int argsIndex = 0;
+        for (MessagePartInfo part : parts) {
+            int idx = part.getIndex();
+            LOG.fine("part name: " + part.getName() + ", index: " + idx);
+            
+            if (idx >= 0) {
+                Holder holder = (Holder) outObjects.get(idx);
+                if (part.getProperty(ReflectionServiceFactoryBean.MODE_INOUT) != null) {
+                    newObjects.set(idx, holder.value);
+                    argsOffset[argsIndex++] = rmCount;
+                    
+                }
+                if (part.getProperty(ReflectionServiceFactoryBean.MODE_OUT) != null) {
+                    newObjects.remove(idx + rmCount);
+                    rmCount--;
+                    argsOffset[argsIndex] = rmCount;
+                }
+                
+                holders.add(holder);
+            }
+        }
+        return argsOffset;
+    }
+    
+    
     
 }

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java?view=diff&rev=504833&r1=504832&r2=504833
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
Thu Feb  8 01:14:12 2007
@@ -230,6 +230,7 @@
         } else if (!isIn && isOut) {
             QName name = getOutPartName(o, method, i);
             part = o.getOutput().getMessagePart(name);
+            part.setProperty(ReflectionServiceFactoryBean.MODE_OUT, Boolean.TRUE);
             initializeParameter(part, paramType, genericType);
             part.setIndex(i);
         } else if (isIn && isOut) {

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/HeaderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/HeaderTest.java?view=diff&rev=504833&r1=504832&r2=504833
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/HeaderTest.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/HeaderTest.java
Thu Feb  8 01:14:12 2007
@@ -34,6 +34,7 @@
 import org.apache.cxf.transport.local.LocalTransportFactory;
 import org.apache.header_test.TestHeaderImpl;
 import org.apache.header_test.types.TestHeader5;
+import org.apache.header_test.types.TestHeader5ResponseBody;
 
 public class HeaderTest extends AbstractJaxWsTest {
     public void testInvocation() throws Exception {
@@ -56,9 +57,13 @@
         assertEquals(TestHeader5.class, part.getTypeClass());
         
         parts = op.getOutput().getMessageParts();
-        assertEquals(1, parts.size());
+        assertEquals(2, parts.size());
         
         part = parts.get(0);
+        assertNotNull(part.getTypeClass());
+        assertEquals(TestHeader5ResponseBody.class, part.getTypeClass());
+        
+        part = parts.get(1);
         assertNotNull(part.getTypeClass());
         assertEquals(TestHeader5.class, part.getTypeClass());
           

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/header/HeaderClientServerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/header/HeaderClientServerTest.java?view=diff&rev=504833&r1=504832&r2=504833
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/header/HeaderClientServerTest.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/header/HeaderClientServerTest.java
Thu Feb  8 01:14:12 2007
@@ -47,12 +47,12 @@
 import org.apache.header_test.types.TestHeader3;
 import org.apache.header_test.types.TestHeader3Response;
 import org.apache.header_test.types.TestHeader5;
+import org.apache.header_test.types.TestHeader5ResponseBody;
 import org.apache.header_test.types.TestHeader6;
 import org.apache.header_test.types.TestHeader6Response;
 
 
 public class HeaderClientServerTest extends AbstractJaxWsTest {
-
     private final QName serviceName = new QName("http://apache.org/header_test",
                                                 "SOAPHeaderService");    
     private final QName portName = new QName("http://apache.org/header_test",
@@ -164,16 +164,16 @@
         assertNotNull(service);
         TestHeader proxy = service.getPort(portName, TestHeader.class);
         try {
+            Holder<TestHeader5ResponseBody> out = new Holder<TestHeader5ResponseBody>();
+            Holder<TestHeader5> outHeader = new Holder<TestHeader5>();
             TestHeader5 in = new TestHeader5();
             String val = new String(TestHeader5.class.getSimpleName());
             for (int idx = 0; idx < 2; idx++) {
-                val += idx;                
+                val += idx;            
                 in.setRequestType(val);
-                TestHeader5 returnVal = proxy.testHeader5(in);
-
-                //in copied to return                
-                assertNotNull(returnVal);
-                assertEquals(val, returnVal.getRequestType());
+                proxy.testHeader5(out, outHeader, in);
+                assertEquals(1000, out.value.getResponseType());
+                assertEquals(val, outHeader.value.getRequestType());
             }
         } catch (UndeclaredThrowableException ex) {
             throw (Exception)ex.getCause();

Modified: incubator/cxf/trunk/testutils/src/main/java/org/apache/header_test/TestHeaderImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/java/org/apache/header_test/TestHeaderImpl.java?view=diff&rev=504833&r1=504832&r2=504833
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/java/org/apache/header_test/TestHeaderImpl.java
(original)
+++ incubator/cxf/trunk/testutils/src/main/java/org/apache/header_test/TestHeaderImpl.java
Thu Feb  8 01:14:12 2007
@@ -19,6 +19,7 @@
 
 package org.apache.header_test;
 
+
 import javax.jws.WebService;
 import javax.xml.ws.Holder;
 
@@ -29,6 +30,7 @@
 import org.apache.header_test.types.TestHeader3;
 import org.apache.header_test.types.TestHeader3Response;
 import org.apache.header_test.types.TestHeader5;
+import org.apache.header_test.types.TestHeader5ResponseBody;
 import org.apache.header_test.types.TestHeader6;
 import org.apache.header_test.types.TestHeader6Response;
 
@@ -61,7 +63,6 @@
         TestHeader2 in,
         Holder<TestHeader2Response> out,
         Holder<TestHeader2Response> outHeader) {
-        
         TestHeader2Response outVal = new TestHeader2Response();
         outVal.setResponseType(in.getRequestType());
         out.value = outVal;
@@ -94,9 +95,17 @@
         
     }
 
-    public TestHeader5 testHeader5(
-        TestHeader5 in) {
-        return in;
+    public void testHeader5(Holder<TestHeader5ResponseBody> out,
+                            Holder<TestHeader5> outHeader,
+                            org.apache.header_test.types.TestHeader5 in) {
+        TestHeader5ResponseBody outVal = new TestHeader5ResponseBody();
+        outVal.setResponseType(1000);
+        out.value = outVal;
+        
+        TestHeader5 outHeaderVal = new TestHeader5();
+        outHeaderVal.setRequestType(in.getRequestType());
+        outHeader.value = outHeaderVal;
+        
     }
     
     public TestHeader6Response testHeaderPartBeforeBodyPart(

Modified: incubator/cxf/trunk/testutils/src/main/resources/wsdl/soapheader.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/resources/wsdl/soapheader.wsdl?view=diff&rev=504833&r1=504832&r2=504833
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/resources/wsdl/soapheader.wsdl (original)
+++ incubator/cxf/trunk/testutils/src/main/resources/wsdl/soapheader.wsdl Thu Feb  8 01:14:12
2007
@@ -82,6 +82,13 @@
                     </sequence>
                 </complexType>
             </element>
+            <element name="testHeader5ResponseBody">
+                <complexType>
+                    <sequence>
+                        <element name="responseType" type="int"/>
+                    </sequence>
+                </complexType>
+            </element>
             <element name="testHeader6">
                 <complexType>
                     <sequence>
@@ -131,6 +138,7 @@
     </wsdl:message>
     <wsdl:message name="testHeader5Response">
         <wsdl:part name="outHeader" element="x1:testHeader5"/>
+        <wsdl:part name="out" element="x1:testHeader5ResponseBody"/>
     </wsdl:message>
     <wsdl:message name="testHeaderPartBeforeBodyPart">
         <wsdl:part name="inoutHeader" element="x1:testHeader3"/>
@@ -160,7 +168,7 @@
             <wsdl:input name="testHeader4Request" message="tns:testHeader4Request"/>
             <wsdl:output name="testHeader4Response" message="tns:testHeader4Response"/>
         </wsdl:operation>
-        <wsdl:operation name="testHeader5">
+        <wsdl:operation name="testHeader5" parameterOrder="out outHeader in">
             <wsdl:input name="testHeader5Request" message="tns:testHeader5Request"/>
             <wsdl:output name="testHeader5Response" message="tns:testHeader5Response"/>
         </wsdl:operation>
@@ -221,7 +229,7 @@
                 <soap:body use="literal"/>
             </wsdl:input>
             <wsdl:output>
-                <soap:body parts="" use="literal"/>
+                <soap:body parts="out" use="literal"/>
                 <soap:header message="tns:testHeader5Response" part="outHeader" use="literal"/>
             </wsdl:output>
         </wsdl:operation>



Mime
View raw message