cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r709631 - in /cxf/branches/2.1.x-fixes: ./ common/common/src/main/java/org/apache/cxf/common/xmlschema/ rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/map/ rt/javascript/src/main/java/org/apache/cxf/javascript/ rt/javasc...
Date Sat, 01 Nov 2008 03:26:23 GMT
Author: ningjiang
Date: Fri Oct 31 20:26:22 2008
New Revision: 709631

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

........
  r707902 | bimargulies | 2008-10-26 04:43:58 +0800 (Sun, 26 Oct 2008) | 2 lines
  
  Add test case for generic of generics. It passes, perhaps issue was already fixed. Initial
swat at supporting inheritance.
........

Added:
    cxf/branches/2.1.x-fixes/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/InheritanceTestBase.java
      - copied unchanged from r707902, cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/InheritanceTestBase.java
    cxf/branches/2.1.x-fixes/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/InheritanceTestDerived.java
      - copied unchanged from r707902, cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/InheritanceTestDerived.java
Modified:
    cxf/branches/2.1.x-fixes/   (props changed)
    cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/common/xmlschema/SchemaCollection.java
    cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/map/StudentServiceDocLiteral.java
    cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/map/StudentServiceDocLiteralImpl.java
    cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/map/StudentTest.java
    cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/Messages.properties
    cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/XmlSchemaUtils.java
    cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java
    cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
    cxf/branches/2.1.x-fixes/rt/javascript/src/test/java/org/apache/cxf/javascript/DocLitWrappedClientTest.java
    cxf/branches/2.1.x-fixes/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitWrapped.java
    cxf/branches/2.1.x-fixes/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitWrappedImpl.java

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Oct 31 20:26:22 2008
@@ -1 +1 @@
-/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690289,691246,691271,691295,691338,691355,691488,691602,691646,691706,691728,692116,692157,692310,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694795,694869,694981,694987,694993,695041,695096,695396,695484,695537,695552,695561,695619,695684,695835,695840,695868,695935,695977,696016,696094,696433,696720,697085,697868,698128,699289,700261,700507,700602,700981,701316,701783,701830,701862,702187,702205-702248,702267,702547,702561,702580,702602,702609,702616,702653,702656,702957,703191,703239,703309,703501,703513,703548,704584,704937,704997,705150,705235,705274,705340,705446,705548,705614,705692,705708,706482,706631,706675,706900,706909,707034,707089,707100,709353-709354
+/cxf/trunk:686333-686363,686764,686820,687096,687194,687363,687387,687463,687543,687722,687798,687814,687817,687891,687910,687914,688086,688102,688133,688596,688735,688870,689572,689596,689855,689924,690067,690289,691246,691271,691295,691338,691355,691488,691602,691646,691706,691728,692116,692157,692310,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694795,694869,694981,694987,694993,695041,695096,695396,695484,695537,695552,695561,695619,695684,695835,695840,695868,695935,695977,696016,696094,696433,696720,697085,697868,698128,699289,700261,700507,700602,700981,701316,701783,701830,701862,702187,702205-702248,702267,702547,702561,702580,702602,702609,702616,702653,702656,702957,703191,703239,703309,703501,703513,703548,704584,704937,704997,705150,705235,705274,705340,705446,705548,705614,705692,705708,706482,706631,706675,706900,706909,707034,707089,707100,707902,709353-709354

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

Modified: cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/common/xmlschema/SchemaCollection.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/common/xmlschema/SchemaCollection.java?rev=709631&r1=709630&r2=709631&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/common/xmlschema/SchemaCollection.java
(original)
+++ cxf/branches/2.1.x-fixes/common/common/src/main/java/org/apache/cxf/common/xmlschema/SchemaCollection.java
Fri Oct 31 20:26:22 2008
@@ -86,7 +86,7 @@
     public XmlSchemaElement getElementByQName(QName qname) {
         return schemaCollection.getElementByQName(qname);
     }
-
+    
     public XmlSchemaAttribute getAttributeByQName(QName qname) {
         String uri = qname.getNamespaceURI();
         for (XmlSchema schema : schemaCollection.getXmlSchemas()) {

Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/map/StudentServiceDocLiteral.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/map/StudentServiceDocLiteral.java?rev=709631&r1=709630&r2=709631&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/map/StudentServiceDocLiteral.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/map/StudentServiceDocLiteral.java
Fri Oct 31 20:26:22 2008
@@ -18,9 +18,11 @@
  */
 package org.apache.cxf.aegis.type.java5.map;
 
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+
 import javax.jws.WebService;
 
 @WebService(targetNamespace = "uri:org.apache.cxf.aegis.test.map", 
@@ -34,5 +36,8 @@
     List<Student> getStudents(Map<String, String> filters);
 
     List<Student> getStudentsByIds(List<String> ids);
+    
+    //CHECKSTYLE:OFF
+    void takeMapMap(HashMap<String, HashMap<String, Student>> myComplexData);
 
 }

Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/map/StudentServiceDocLiteralImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/map/StudentServiceDocLiteralImpl.java?rev=709631&r1=709630&r2=709631&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/map/StudentServiceDocLiteralImpl.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/map/StudentServiceDocLiteralImpl.java
Fri Oct 31 20:26:22 2008
@@ -63,4 +63,9 @@
         return studentMap;
     }
 
+    //CHECKSTYLE:OFF
+    public void takeMapMap(HashMap<String, HashMap<String, Student>> myComplexData)
{
+        // original failure was explosion on this, no need to bother to fill it in.
+    }
+
 }

Modified: cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/map/StudentTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/map/StudentTest.java?rev=709631&r1=709630&r2=709631&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/map/StudentTest.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/map/StudentTest.java
Fri Oct 31 20:26:22 2008
@@ -18,12 +18,15 @@
  */
 package org.apache.cxf.aegis.type.java5.map;
 
+import java.util.HashMap;
 import java.util.Map;
 
 import org.w3c.dom.Document;
 
 import org.apache.cxf.aegis.AbstractAegisTest;
 import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.frontend.ClientProxyFactoryBean;
+import org.apache.cxf.frontend.ServerFactoryBean;
 import org.apache.cxf.interceptor.LoggingInInterceptor;
 import org.apache.cxf.interceptor.LoggingOutInterceptor;
 import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
@@ -74,6 +77,35 @@
     }
 
     @Test 
+    public void testMapMap() throws Exception {
+
+        ServerFactoryBean sf = new ServerFactoryBean();
+        sf.setServiceClass(StudentServiceDocLiteral.class);
+        sf.setServiceBean(new StudentServiceDocLiteralImpl());
+        sf.setAddress("local://StudentServiceDocLiteral");
+        setupAegis(sf);
+        Server server = sf.create();
+        server.getEndpoint().getInInterceptors().add(new LoggingInInterceptor());
+        server.getEndpoint().getOutInterceptors().add(new LoggingOutInterceptor());
+        server.start();
+        
+        ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean();
+        proxyFac.setAddress("local://StudentServiceDocLiteral");
+        proxyFac.setServiceClass(StudentServiceDocLiteral.class);
+        proxyFac.setBus(getBus());
+        setupAegis(proxyFac.getClientFactoryBean());
+        //CHECKSTYLE:OFF
+        HashMap<String, Student> mss = new HashMap<String, Student>();
+        mss.put("Alice", new Student());
+        HashMap<String, HashMap<String, Student>> mmss = new HashMap<String,
HashMap<String, Student>>();
+        mmss.put("Bob", mss);
+        
+        StudentServiceDocLiteral clientInterface = (StudentServiceDocLiteral)proxyFac.create();
+        clientInterface.takeMapMap(mmss);
+        //CHECKSTYLE:ON
+    }
+    
+    @Test 
     public void testReturnMapDocLiteral() throws Exception {
 
         JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();

Modified: cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/Messages.properties
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/Messages.properties?rev=709631&r1=709630&r2=709631&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/Messages.properties
(original)
+++ cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/Messages.properties
Fri Oct 31 20:26:22 2008
@@ -31,3 +31,4 @@
 IMPOSSIBLE_GLOBAL_ITEM= JavaScript limitation: Element or xs:any at {0} used in a context
that requires a global name, but it, and its type, are anonymous.
 MISSING_TYPE=Type {0} is missing from the WSDL schema for element {1}. {2}
 ATTRIBUTE_DANGLING_REFERENCE=Attribute {0} refers to undefined attribute {1}.
+ELEMENT_DANGLING_REFERENCE= Element {0} refers to undefined element {1}.

Modified: cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/XmlSchemaUtils.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/XmlSchemaUtils.java?rev=709631&r1=709630&r2=709631&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/XmlSchemaUtils.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/XmlSchemaUtils.java
Fri Oct 31 20:26:22 2008
@@ -32,7 +32,10 @@
 import org.apache.ws.commons.schema.XmlSchemaAny;
 import org.apache.ws.commons.schema.XmlSchemaAnyAttribute;
 import org.apache.ws.commons.schema.XmlSchemaAttribute;
+import org.apache.ws.commons.schema.XmlSchemaComplexContentExtension;
 import org.apache.ws.commons.schema.XmlSchemaComplexType;
+import org.apache.ws.commons.schema.XmlSchemaContent;
+import org.apache.ws.commons.schema.XmlSchemaContentModel;
 import org.apache.ws.commons.schema.XmlSchemaElement;
 import org.apache.ws.commons.schema.XmlSchemaForm;
 import org.apache.ws.commons.schema.XmlSchemaObject;
@@ -87,6 +90,52 @@
         
     }
     
+    public static QName getBaseType(XmlSchemaComplexType type) {
+        XmlSchemaContentModel model = type.getContentModel();
+        if (model == null) {
+            return null;
+        }
+        XmlSchemaContent content = model.getContent();
+        if (content == null) {
+            return null;
+        }
+        
+        if (!(content instanceof XmlSchemaComplexContentExtension)) {
+            return null;
+        }
+
+        XmlSchemaComplexContentExtension ext = (XmlSchemaComplexContentExtension)content;
+        QName baseTypeName = ext.getBaseTypeName();
+        return baseTypeName;
+    }
+    
+    public static XmlSchemaSequence getContentSequence(XmlSchemaComplexType type) {
+        XmlSchemaContentModel model = type.getContentModel();
+        if (model == null) {
+            return null;
+        }
+        XmlSchemaContent content = model.getContent();
+        if (content == null) {
+            return null;
+        }
+        if (!(content instanceof XmlSchemaComplexContentExtension)) {
+            return null;
+        }
+
+        XmlSchemaComplexContentExtension ext = (XmlSchemaComplexContentExtension)content;
+        XmlSchemaParticle particle = ext.getParticle();
+        if (particle == null) {
+            return null;
+        }
+        XmlSchemaSequence sequence = null;
+        try {
+            sequence = (XmlSchemaSequence) particle;
+        } catch (ClassCastException cce) {
+            unsupportedConstruct("NON_SEQUENCE_PARTICLE", type);
+        }
+        return sequence;
+    }
+    
     public static XmlSchemaSequence getSequence(XmlSchemaComplexType type) {
         XmlSchemaParticle particle = type.getParticle();
         XmlSchemaSequence sequence = null;

Modified: cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java?rev=709631&r1=709630&r2=709631&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java
Fri Oct 31 20:26:22 2008
@@ -188,7 +188,7 @@
                 }
                 // If the element uses a named type, we use the functions for the type.
                 XmlSchemaComplexType elementType = (XmlSchemaComplexType)element.getSchemaType();
-                if (elementType.getQName() != null) {
+                if (elementType != null && elementType.getQName() != null) {
                     name = elementType.getQName();
                 }
                 utils.appendLine("this.globalElementSerializers['" + name.toString() + "']
= "

Modified: cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java?rev=709631&r1=709630&r2=709631&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
Fri Oct 31 20:26:22 2008
@@ -53,8 +53,6 @@
  * Generate Javascript for a schema, and provide information needed for the
  * service builder. As of this pass, there is no support for non-sequence types
  * or for attribute mappings.
- * 
- * @author bimargulies
  */
 public class SchemaJavascriptBuilder {
 
@@ -349,8 +347,20 @@
      */
     protected void complexTypeSerializerBody(XmlSchemaComplexType type, String elementPrefix,
                                              JavascriptUtils bodyUtils) {
+        XmlSchemaSequence sequence = null;
+        // deal with type extension.
+        QName baseTypeName = XmlSchemaUtils.getBaseType(type);
+        if (baseTypeName !=  null) {
+            XmlSchemaType baseType = xmlSchemaCollection.getTypeByQName(baseTypeName);
+            XmlSchemaComplexType baseComplexType = (XmlSchemaComplexType) baseType;
+            // I think we can recurse ...?
+            complexTypeSerializerBody(baseComplexType, elementPrefix, bodyUtils);
+            sequence = XmlSchemaUtils.getContentSequence(type);
+        }
 
-        XmlSchemaSequence sequence = XmlSchemaUtils.getSequence(type);
+        if (sequence == null) {
+            sequence = XmlSchemaUtils.getSequence(type);
+        }
 
         for (int i = 0; i < sequence.getItems().getCount(); i++) {
             XmlSchemaObject sequenceItem = (XmlSchemaObject)sequence.getItems().getItem(i);

Modified: cxf/branches/2.1.x-fixes/rt/javascript/src/test/java/org/apache/cxf/javascript/DocLitWrappedClientTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/javascript/src/test/java/org/apache/cxf/javascript/DocLitWrappedClientTest.java?rev=709631&r1=709630&r2=709631&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/javascript/src/test/java/org/apache/cxf/javascript/DocLitWrappedClientTest.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/javascript/src/test/java/org/apache/cxf/javascript/DocLitWrappedClientTest.java
Fri Oct 31 20:26:22 2008
@@ -233,6 +233,18 @@
     }
     
     @Test
+    public void inheritedProperties() {
+        testUtilities.runInsideContext(Void.class, new JSRunnable<Void>() {
+
+            public Void run(Context context) {
+                return null;
+            }
+            
+        });
+    }
+
+    
+    @Test
     public void callTest2WithNullString() {
         testUtilities.runInsideContext(Void.class, new JSRunnable<Void>() {
             public Void run(Context context) {
@@ -298,4 +310,5 @@
         testUtilities.rhinoCallMethod(rv, "setStringItem", beanTwoItem.stringItem);
         return rv;
     }
+    
 }

Modified: cxf/branches/2.1.x-fixes/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitWrapped.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitWrapped.java?rev=709631&r1=709630&r2=709631&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitWrapped.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitWrapped.java
Fri Oct 31 20:26:22 2008
@@ -70,4 +70,7 @@
     @WebMethod
     void genericTestFunction(@WebParam(name = "g1") SpecificGenericClass sgc,
                              @WebParam(name = "g2") GenericGenericClass<Double> ggc);
+    
+    @WebMethod 
+    void inheritanceTestFunction(@WebParam(name = "d") InheritanceTestDerived d);
 }

Modified: cxf/branches/2.1.x-fixes/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitWrappedImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitWrappedImpl.java?rev=709631&r1=709630&r2=709631&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitWrappedImpl.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitWrappedImpl.java
Fri Oct 31 20:26:22 2008
@@ -37,6 +37,7 @@
     private TestBean1[] lastBean1Array;
     private SpecificGenericClass lastSpecificGeneric;
     private GenericGenericClass<Double> lastGenericGeneric;
+    private InheritanceTestDerived lastInheritanceTestDerived;
 
     /** {@inheritDoc}*/
     public int basicTypeFunctionReturnInt(String s, int i, long l, float f, double d) {
@@ -119,6 +120,10 @@
         lastSpecificGeneric = sgc;
         lastGenericGeneric = ggc;
     }
+    
+    public void inheritanceTestFunction(InheritanceTestDerived d) {
+        lastInheritanceTestDerived = d;
+    }
 
     public SpecificGenericClass getLastSpecificGeneric() {
         return lastSpecificGeneric;
@@ -127,4 +132,9 @@
     public GenericGenericClass<Double> getLastGenericGeneric() {
         return lastGenericGeneric;
     }
+
+    public InheritanceTestDerived getLastInheritanceTestDerived() {
+        return lastInheritanceTestDerived;
+    }
+
 }



Mime
View raw message