cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r604243 - in /incubator/cxf/branches/2.0.x-fixes: ./ rt/core/src/main/java/org/apache/cxf/interceptor/ rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/ systests/src/test/java/org/apache/cxf/systest/aegis/ testutils/src/m...
Date Fri, 14 Dec 2007 17:42:21 GMT
Author: dkulp
Date: Fri Dec 14 09:42:20 2007
New Revision: 604243

URL: http://svn.apache.org/viewvc?rev=604243&view=rev
Log:
Merged revisions 604238 via svnmerge from 
https://svn.apache.org/repos/asf/incubator/cxf/trunk

........
  r604238 | dkulp | 2007-12-14 12:30:07 -0500 (Fri, 14 Dec 2007) | 2 lines
  
  [CXF-1251] Fix issues with Aegis and wrapped parts with minOccurs=0
........

Modified:
    incubator/cxf/branches/2.0.x-fixes/   (props changed)
    incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java
    incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java
    incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/XMLStreamDataWriter.java
    incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/aegis/AegisClientServerTest.java
    incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/aegis/SportsService.java
    incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/aegis/SportsServiceImpl.java
    incubator/cxf/branches/2.0.x-fixes/testutils/src/main/resources/wsdl/locator.wsdl

Propchange: incubator/cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java?rev=604243&r1=604242&r2=604243&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java
Fri Dec 14 09:42:20 2007
@@ -38,7 +38,6 @@
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageContentsList;
 import org.apache.cxf.phase.Phase;
-import org.apache.cxf.service.Service;
 import org.apache.cxf.service.model.BindingMessageInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.EndpointInfo;
@@ -210,15 +209,10 @@
                 QName rname = xmlReader.getName();
                 while (part != null 
                     && !rname.equals(part.getConcreteName())) {
-                    String bindingType =
-                        message.getExchange().get(Service.class).getDataBinding().getClass().getName();
                     if (part.getXmlSchema() instanceof XmlSchemaElement) {
-                        if (bindingType.endsWith("AegisDatabinding")) {
-                            parameters.add(dr.read(part, xmlReader));
-                        } else {
-                            //should check minOccurs=0
-                            parameters.put(part, null);
-                        }
+                        //TODO - should check minOccurs=0 and throw validation exception
+                        //thing if the part needs to be here
+                        parameters.put(part, null);
                     } 
 
                     if (itr.hasNext()) {

Modified: incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java?rev=604243&r1=604242&r2=604243&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java
Fri Dec 14 09:42:20 2007
@@ -254,10 +254,13 @@
 
             Type type = getParameterType(s, serviceTM, part, partType);
 
-            if (type.isAbstract()) {
-                part.setTypeQName(type.getSchemaType());
-            } else {
-                part.setElementQName(type.getSchemaType());
+            if (part.getXmlSchema() == null) {
+                //schema hasn't been filled in yet
+                if (type.isAbstract()) {
+                    part.setTypeQName(type.getSchemaType());
+                } else {
+                    part.setElementQName(type.getSchemaType());
+                }
             }
 
             part2Type.put(part, type);
@@ -275,12 +278,14 @@
         SchemaCollection col = s.getXmlSchemaCollection();
         for (Iterator itr = container.getMessageParts().iterator(); itr.hasNext();) {
             MessagePartInfo part = (MessagePartInfo)itr.next();
-            if (part.isElement()) {
-                XmlSchemaAnnotated tp = col.getElementByQName(part.getElementQName());
-                part.setXmlSchema(tp);
-            } else {
-                XmlSchemaAnnotated tp = col.getTypeByQName(part.getTypeQName());
-                part.setXmlSchema(tp);
+            if (part.getXmlSchema() == null) {
+                if (part.isElement()) {
+                    XmlSchemaAnnotated tp = col.getElementByQName(part.getElementQName());
+                    part.setXmlSchema(tp);
+                } else {
+                    XmlSchemaAnnotated tp = col.getTypeByQName(part.getTypeQName());
+                    part.setXmlSchema(tp);
+                }
             }
         }
     }

Modified: incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/XMLStreamDataWriter.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/XMLStreamDataWriter.java?rev=604243&r1=604242&r2=604243&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/XMLStreamDataWriter.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/XMLStreamDataWriter.java
Fri Dec 14 09:42:20 2007
@@ -40,6 +40,7 @@
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Attachment;
 import org.apache.cxf.service.model.MessagePartInfo;
+import org.apache.ws.commons.schema.XmlSchemaElement;
 
 public class XMLStreamDataWriter implements DataWriter<XMLStreamWriter> {
 
@@ -90,14 +91,21 @@
         type = TypeUtil.getWriteType(context, obj, type);
         
         try {
+            if (obj == null) {
+                if (part.getXmlSchema() instanceof XmlSchemaElement
+                    && ((XmlSchemaElement)part.getXmlSchema()).getMinOccurs() ==
0) {
+                    //skip writing minOccurs=0 stuff if obj is null
+                    return;
+                } else if (type.isNillable() && type.isWriteOuter()) {
+                    ElementWriter writer = new ElementWriter(output);
+                    MessageWriter w2 = writer.getElementWriter(part.getConcreteName());
+                    w2.writeXsiNil();
+                    w2.close();
+                    return;
+                }
+            }
             ElementWriter writer = new ElementWriter(output);
             MessageWriter w2 = writer.getElementWriter(part.getConcreteName());
-            if (type.isNillable() && type.isWriteOuter() && obj == null)
{
-                w2.writeXsiNil();
-                w2.close();
-                return;
-            }
-
             type.writeObject(obj, w2, context);
             w2.close();
         } catch (DatabindingException e) {

Modified: incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/aegis/AegisClientServerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/aegis/AegisClientServerTest.java?rev=604243&r1=604242&r2=604243&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/aegis/AegisClientServerTest.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/aegis/AegisClientServerTest.java
Fri Dec 14 09:42:20 2007
@@ -44,7 +44,7 @@
     
     @BeforeClass
     public static void startServers() throws Exception {
-        assertTrue("server did not launch correctly", launchServer(AegisServer.class));
+        assertTrue("server did not launch correctly", launchServer(AegisServer.class, true));
     }
     
     @Test
@@ -142,9 +142,13 @@
         proxyFactory.setServiceClass(SportsService.class);
         proxyFactory.setWsdlLocation("http://localhost:9002/jaxwsAndAegisSports?wsdl");
         SportsService service = (SportsService) proxyFactory.create();
+
         Collection<Team> teams = service.getTeams();
         assertEquals(1, teams.size());
         assertEquals("Patriots", teams.iterator().next().getName());
-
+        
+        //CXF-1251
+        String s = service.testForMinOccurs0("A", null, "b");
+        assertEquals("Anullb", s);        
     }
 }

Modified: incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/aegis/SportsService.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/aegis/SportsService.java?rev=604243&r1=604242&r2=604243&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/aegis/SportsService.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/aegis/SportsService.java
Fri Dec 14 09:42:20 2007
@@ -27,4 +27,6 @@
 @WebService(targetNamespace = "http://cxf.apache.org/systest/aegis/sports")
 public interface SportsService {
     Collection<Team> getTeams() throws WebServiceException;
+    
+    String testForMinOccurs0(String a, Integer b, String c);
 }

Modified: incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/aegis/SportsServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/aegis/SportsServiceImpl.java?rev=604243&r1=604242&r2=604243&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/aegis/SportsServiceImpl.java
(original)
+++ incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/aegis/SportsServiceImpl.java
Fri Dec 14 09:42:20 2007
@@ -36,5 +36,9 @@
         teams.add(new Team("Patriots", "New England"));
         return teams;
     }
+    
+    public String testForMinOccurs0(String a, Integer b, String c) {
+        return a + b + c;
+    }
 
 }

Modified: incubator/cxf/branches/2.0.x-fixes/testutils/src/main/resources/wsdl/locator.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/testutils/src/main/resources/wsdl/locator.wsdl?rev=604243&r1=604242&r2=604243&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/testutils/src/main/resources/wsdl/locator.wsdl (original)
+++ incubator/cxf/branches/2.0.x-fixes/testutils/src/main/resources/wsdl/locator.wsdl Fri
Dec 14 09:42:20 2007
@@ -56,13 +56,7 @@
                     <xs:any maxOccurs="unbounded" minOccurs="0" namespace="##any" 
                         processContents="lax"/>
                 </xs:sequence>
-                <!--
-    Until anyAttribute is supported, explicitly include the
-             wsdlLocation attribute definition.
-
-    <xs:anyAttribute namespace="##other" processContents="lax"/>
--->
-                <xs:attribute name="wsdlLocation" type="xs:string" use="optional"/>
+                <xs:anyAttribute namespace="##other" processContents="lax"/>
             </xs:complexType>
             <xs:element name="MessageID" type="tns:AttributedURIType"/>
             <xs:element name="RelatesTo" type="tns:RelatesToType"/>



Mime
View raw message