Author: bimargulies
Date: Fri Jan 30 23:41:24 2009
New Revision: 739451
URL: http://svn.apache.org/viewvc?rev=739451&view=rev
Log:
CXF-2017
Added:
cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/BeanWithGregorianDate.java
(with props)
Modified:
cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/Java5TypeCreator.java
cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionServiceInterface.java
cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionTest.java
Modified:
cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/Java5TypeCreator.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/Java5TypeCreator.java?rev=739451&r1=739450&r2=739451&view=diff
==============================================================================
---
cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/Java5TypeCreator.java
(original)
+++
cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/Java5TypeCreator.java
Fri Jan 30 23:41:24 2009
@@ -23,6 +23,8 @@
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.WildcardType;
import java.util.Collection;
+import java.util.Map;
+
import javax.xml.namespace.QName;
import org.apache.cxf.aegis.type.AbstractTypeCreator;
@@ -137,7 +139,7 @@
return createObjectType();
}
- if (!Collection.class.isAssignableFrom(clazz)) {
+ if (!Collection.class.isAssignableFrom(clazz) &&
!Map.class.isAssignableFrom(clazz)) {
return getTopCreator().createType(clazz);
}
Added:
cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/BeanWithGregorianDate.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/BeanWithGregorianDate.java?rev=739451&view=auto
==============================================================================
---
cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/BeanWithGregorianDate.java
(added)
+++
cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/BeanWithGregorianDate.java
Fri Jan 30 23:41:24 2009
@@ -0,0 +1,68 @@
+/**
+ * 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.aegis.type.java5;
+
+import javax.xml.datatype.XMLGregorianCalendar;
+
+public class BeanWithGregorianDate {
+ private static final long serialVersionUID = 1481418882118674796L;
+
+ private int id;
+ private String name;
+ private BeanWithGregorianDate parent;
+ private XMLGregorianCalendar date;
+
+ public final XMLGregorianCalendar getDate() {
+ return date;
+ }
+
+ public final void setDate(XMLGregorianCalendar date) {
+ this.date = date;
+ }
+
+ public final int getId() {
+ return id;
+ }
+
+ public final void setId(int id) {
+ this.id = id;
+ }
+
+ public final String getName() {
+ return name;
+ }
+
+ public final void setName(String name) {
+ this.name = name;
+ }
+
+ public final BeanWithGregorianDate getParent() {
+ return parent;
+ }
+
+ public final void setParent(BeanWithGregorianDate parent) {
+ this.parent = parent;
+ }
+
+ @Override
+ public String toString() {
+ return "BeanWithGregorianDate[id:" + id + ",name:" + name + ",date:" +
date + "]";
+ }
+}
Propchange:
cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/BeanWithGregorianDate.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/BeanWithGregorianDate.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified:
cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionServiceInterface.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionServiceInterface.java?rev=739451&r1=739450&r2=739451&view=diff
==============================================================================
---
cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionServiceInterface.java
(original)
+++
cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionServiceInterface.java
Fri Jan 30 23:41:24 2009
@@ -22,6 +22,7 @@
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
import java.util.SortedSet;
import java.util.Stack;
@@ -46,4 +47,6 @@
//CHECKSTYLE:ON
void method1(List<String> headers1);
+
+ void mapOfMapWithStringAndPojo(Map<String, Map<String,
BeanWithGregorianDate>> bigParam);
}
Modified:
cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionTest.java?rev=739451&r1=739450&r2=739451&view=diff
==============================================================================
---
cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionTest.java
(original)
+++
cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/java5/CollectionTest.java
Fri Jan 30 23:41:24 2009
@@ -23,8 +23,10 @@
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import java.util.SortedSet;
import java.util.Stack;
@@ -41,6 +43,7 @@
import org.apache.cxf.aegis.type.Type;
import org.apache.cxf.aegis.type.TypeCreationOptions;
import org.apache.cxf.aegis.type.collection.CollectionType;
+import org.apache.cxf.aegis.type.collection.MapType;
import org.apache.cxf.aegis.type.java5.dto.CollectionDTO;
import org.apache.cxf.aegis.type.java5.dto.DTOService;
import org.apache.cxf.aegis.type.java5.dto.ObjectDTO;
@@ -216,7 +219,7 @@
/**
* CXF-1833 complained of a bizarre schema when @@WebParaming a parameter
of List<String>. This regression
- * test captures the fact that we don't, in fact, have this problem with
correct us of JAX-WS.
+ * test captures the fact that we don't, in fact, have this problem with
correct use of JAX-WS.
* @throws Exception
*/
@Test
@@ -254,9 +257,60 @@
assertEquals("2", countString);
//CHECKSTYLE:ON
}
+
+ @Test
+ public void testNestedMapType() throws Exception {
+ Method m =
CollectionService.class.getMethod("mapOfMapWithStringAndPojo",
+ new Class[] {Map.class});
+ Type type = creator.createType(m, 0);
+ tm.register(type);
+ assertTrue(type instanceof MapType);
+ MapType mapType = (MapType) type;
+ Type valueType = mapType.getValueType();
+ assertFalse(valueType.getSchemaType().getLocalPart().contains("any"));
+ }
+
+ /**
+ * CXF-2017
+ * @throws Exception
+ */
+ @Test
+ public void testNestedMap() throws Exception {
+ CollectionService impl = new CollectionService();
+ createService(CollectionServiceInterface.class, impl, null);
+
+ ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean();
+ proxyFac.getServiceFactory().getServiceConfigurations().add(0,
+ new
XFireCompatibilityServiceConfiguration());
+ proxyFac.setServiceClass(CollectionServiceInterface.class);
+ proxyFac.setDataBinding(new AegisDatabinding());
+ proxyFac.setAddress("local://CollectionServiceInterface");
+ proxyFac.setBus(getBus());
+
+ CollectionServiceInterface csi =
(CollectionServiceInterface)proxyFac.create();
+
+ Map<String, Map<String, BeanWithGregorianDate>> complexMap;
+ complexMap = new HashMap<String, Map<String, BeanWithGregorianDate>>();
+ Map<String, BeanWithGregorianDate> innerMap = new HashMap<String,
BeanWithGregorianDate>();
+ BeanWithGregorianDate bean = new BeanWithGregorianDate();
+ bean.setName("shem bean");
+ bean.setId(42);
+ innerMap.put("firstBean", bean);
+ complexMap.put("firstKey", innerMap);
+ csi.mapOfMapWithStringAndPojo(complexMap);
+
+ Map<String, Map<String, BeanWithGregorianDate>> gotMap =
impl.getLastComplexMap();
+ assertTrue(gotMap.containsKey("firstKey"));
+ Map<String, BeanWithGregorianDate> v = gotMap.get("firstKey");
+ BeanWithGregorianDate b = v.get("firstBean");
+ assertNotNull(b);
+
+ }
public class CollectionService implements CollectionServiceInterface {
+ private Map<String, Map<String, BeanWithGregorianDate>> lastComplexMap;
+
/** {...@inheritdoc}*/
public Collection<String> getStrings() {
return null;
@@ -303,5 +357,13 @@
}
//CHECKSTYLE:ON
+ public void mapOfMapWithStringAndPojo(Map<String, Map<String,
BeanWithGregorianDate>> bigParam) {
+ lastComplexMap = bigParam;
+ }
+
+ protected Map<String, Map<String, BeanWithGregorianDate>>
getLastComplexMap() {
+ return lastComplexMap;
+ }
+
}
}