cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r831364 - in /cxf/trunk: common/common/src/main/java/org/apache/cxf/common/util/ rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/ rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/ rt/frontend/jaxws/src/test/java/org/apache/cxf/jax...
Date Fri, 30 Oct 2009 16:08:45 GMT
Author: dkulp
Date: Fri Oct 30 16:08:44 2009
New Revision: 831364

URL: http://svn.apache.org/viewvc?rev=831364&view=rev
Log:
[CXF-2509] Testcase and fixes for wacky generics things

Added:
    cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/Entity.java   (with
props)
    cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/GenericsService.java
  (with props)
    cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/QueryResult.java
  (with props)
    cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/QuerySummary.java
  (with props)
Modified:
    cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/ASMHelper.java
    cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
    cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstTest.java

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/ASMHelper.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/ASMHelper.java?rev=831364&r1=831363&r2=831364&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/ASMHelper.java (original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/ASMHelper.java Fri Oct
30 16:08:44 2009
@@ -25,6 +25,7 @@
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 import java.lang.reflect.TypeVariable;
+import java.lang.reflect.WildcardType;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
@@ -118,6 +119,20 @@
             }
             a.append(">;");
             return a.toString();
+        } else if (type instanceof WildcardType) {
+            WildcardType wt = (WildcardType)type;
+            StringBuilder a = new StringBuilder();
+            Type[] lowBounds = wt.getLowerBounds();
+            Type[] upBounds = wt.getUpperBounds();
+            for (Type t : upBounds) {
+                a.append("+");
+                a.append(getClassCode(t));
+            }
+            for (Type t : lowBounds) {
+                a.append("-");
+                a.append(getClassCode(t));
+            }
+            return a.toString();
         }
         return null;
     }

Modified: cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java?rev=831364&r1=831363&r2=831364&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
(original)
+++ cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java
Fri Oct 30 16:08:44 2009
@@ -28,6 +28,7 @@
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 import java.lang.reflect.TypeVariable;
+import java.lang.reflect.WildcardType;
 import java.util.Collection;
 import java.util.Set;
 
@@ -178,6 +179,7 @@
                 addClass((Class)cls);
             }
         } else if (cls instanceof ParameterizedType) {
+            addType(((ParameterizedType)cls).getRawType());
             for (Type t2 : ((ParameterizedType)cls).getActualTypeArguments()) {
                 addType(t2);
             }
@@ -203,6 +205,17 @@
             ct = Array.newInstance(ct, 0).getClass();
 
             addClass(ct);
+        } else if (cls instanceof WildcardType) {
+            for (Type t : ((WildcardType)cls).getUpperBounds()) {
+                addType(t);
+            }
+            for (Type t : ((WildcardType)cls).getLowerBounds()) {
+                addType(t);
+            }
+        } else if (cls instanceof TypeVariable) {
+            for (Type t : ((TypeVariable)cls).getBounds()) {
+                addType(t);
+            }
         }
     }
 

Modified: cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstTest.java?rev=831364&r1=831363&r2=831364&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstTest.java (original)
+++ cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/CodeFirstTest.java Fri
Oct 30 16:08:44 2009
@@ -38,9 +38,13 @@
 import org.apache.cxf.interceptor.LoggingOutInterceptor;
 import org.apache.cxf.jaxws.service.ArrayService;
 import org.apache.cxf.jaxws.service.ArrayServiceImpl;
+import org.apache.cxf.jaxws.service.Entity;
 import org.apache.cxf.jaxws.service.FooServiceImpl;
+import org.apache.cxf.jaxws.service.GenericsService;
 import org.apache.cxf.jaxws.service.Hello;
 import org.apache.cxf.jaxws.service.HelloInterface;
+import org.apache.cxf.jaxws.service.QueryResult;
+import org.apache.cxf.jaxws.service.QuerySummary;
 import org.apache.cxf.jaxws.service.SayHi;
 import org.apache.cxf.jaxws.service.SayHiImpl;
 import org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean;
@@ -310,4 +314,23 @@
         assertValid("//xsd:schema[@targetNamespace='http://namespace5']", doc);
     }
     
+    @Test
+    public void testCXF2509() throws Exception {
+        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean(); 
+        //factory.setServiceClass(serviceInterface); 
+        factory.setServiceBean(new GenericsServiceImpl()); 
+        factory.setAddress("local://localhost/test"); 
+        Server server = factory.create();
+        Document doc = getWSDLDocument(server);
+        //XMLUtils.printDOM(doc);
+        assertValid("//xsd:schema/xsd:complexType[@name='entity']", doc);
+    }
+    
+    public static class GenericsServiceImpl implements GenericsService<Entity<String>,
QuerySummary> {
+
+        public QueryResult<Entity<String>, QuerySummary> read(String query, String
uc) {
+            return null;
+        }
+        
+    }
 }

Added: cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/Entity.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/Entity.java?rev=831364&view=auto
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/Entity.java (added)
+++ cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/Entity.java Fri
Oct 30 16:08:44 2009
@@ -0,0 +1,34 @@
+/**
+ * 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 org.apache.cxf.jaxws.service;
+
+/**
+ * 
+ */
+public class Entity<T> {
+    T ent;
+    
+    public T getEnt() {
+        return ent;
+    }
+    public void setEnt(T e) {
+        ent = e;
+    }
+}

Propchange: cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/Entity.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/Entity.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/GenericsService.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/GenericsService.java?rev=831364&view=auto
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/GenericsService.java
(added)
+++ cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/GenericsService.java
Fri Oct 30 16:08:44 2009
@@ -0,0 +1,32 @@
+/**
+ * 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 org.apache.cxf.jaxws.service;
+
+import java.io.Serializable;
+
+import javax.jws.WebService;
+
+/**
+ * 
+ */
+@WebService(targetNamespace = "http://jaxws.cxf.apache.org/")
+public interface GenericsService<DTO extends Entity<? extends Serializable>, QS
extends QuerySummary> {
+    QueryResult<DTO, QS> read(String query, String uc); 
+}

Propchange: cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/GenericsService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/GenericsService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/QueryResult.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/QueryResult.java?rev=831364&view=auto
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/QueryResult.java
(added)
+++ cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/QueryResult.java
Fri Oct 30 16:08:44 2009
@@ -0,0 +1,43 @@
+/**
+ * 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 org.apache.cxf.jaxws.service;
+
+
+/**
+ * 
+ */
+public class QueryResult<Q, T> {
+    Q q;
+    T t;
+    
+    public Q getQ() {
+        return q;
+    }
+    public void setQ(Q q) {
+        this.q = q;
+    }
+    public T getT() {
+        return t;
+    }
+    public void setT(T t) {
+        this.t = t;
+    }
+    
+}

Propchange: cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/QueryResult.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/QueryResult.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/QuerySummary.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/QuerySummary.java?rev=831364&view=auto
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/QuerySummary.java
(added)
+++ cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/QuerySummary.java
Fri Oct 30 16:08:44 2009
@@ -0,0 +1,32 @@
+/**
+ * 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 org.apache.cxf.jaxws.service;
+
+public class QuerySummary {
+    String text;
+
+    public String getText() {
+        return text;
+    }
+
+    public void setText(String text) {
+        this.text = text;
+    }
+    
+}

Propchange: cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/QuerySummary.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/service/QuerySummary.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



Mime
View raw message