cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject svn commit: r472797 - in /incubator/cxf/trunk/tools/common/src: main/java/org/apache/cxf/tools/common/model/ test/java/org/apache/cxf/tools/common/model/
Date Thu, 09 Nov 2006 07:03:41 GMT
Author: mmao
Date: Wed Nov  8 23:03:40 2006
New Revision: 472797

URL: http://svn.apache.org/viewvc?view=rev&rev=472797
Log:
CXF-172 
Fixed the client sample code not generate the holder parameter correctly.
Added unit test for java models.

Added:
    incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/
    incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JavaParameterTest.java
  (with props)
    incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JavaTypeTest.java
  (with props)
Modified:
    incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaParameter.java

Modified: incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaParameter.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaParameter.java?view=diff&rev=472797&r1=472796&r2=472797
==============================================================================
--- incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaParameter.java
(original)
+++ incubator/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/model/JavaParameter.java
Wed Nov  8 23:03:40 2006
@@ -97,4 +97,17 @@
         sb.append(partName);
         return sb.toString();
     }
+    
+    public String getDefaultTypeValue() {
+        if (isHolder()) {
+            StringBuffer sb = new StringBuffer();
+            sb.append("new ");
+            sb.append(getHolderName());
+            sb.append("<");
+            sb.append(getHolderClass());
+            sb.append(">()");
+            return sb.toString(); 
+        }
+        return super.getDefaultTypeValue();
+    }
 }

Added: incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JavaParameterTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JavaParameterTest.java?view=auto&rev=472797
==============================================================================
--- incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JavaParameterTest.java
(added)
+++ incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JavaParameterTest.java
Wed Nov  8 23:03:40 2006
@@ -0,0 +1,38 @@
+/**
+ * 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.tools.common.model;
+
+import junit.framework.TestCase;
+
+public class JavaParameterTest extends TestCase {
+    
+    public void testGetHolderDefaultTypeValue() throws Exception {
+        JavaParameter holderParameter = new JavaParameter("i", "java.lang.String", null);
+        holderParameter.setHolder(true);
+        holderParameter.setHolderName("javax.xml.ws.Holder");
+        holderParameter.setHolderClass("java.lang.String");
+        assertEquals("new javax.xml.ws.Holder<java.lang.String>()", 
+                     holderParameter.getDefaultTypeValue());
+        
+        holderParameter.setHolderClass("org.apache.cxf.tools.common.model.JavaParamter");
+        assertEquals("new javax.xml.ws.Holder<org.apache.cxf.tools.common.model.JavaParamter>()",

+                     holderParameter.getDefaultTypeValue());
+    }
+}
\ No newline at end of file

Propchange: incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JavaParameterTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JavaParameterTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JavaTypeTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JavaTypeTest.java?view=auto&rev=472797
==============================================================================
--- incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JavaTypeTest.java
(added)
+++ incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JavaTypeTest.java
Wed Nov  8 23:03:40 2006
@@ -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.tools.common.model;
+
+import junit.framework.TestCase;
+
+public class JavaTypeTest extends TestCase {
+    public void testGetPredefinedDefaultTypeValue() throws Exception {
+        assertEquals("0", new JavaType("i", int.class.getName(), null).getDefaultTypeValue());
+        assertEquals("false", new JavaType("i", boolean.class.getName(), null).getDefaultTypeValue());
+        assertEquals("new javax.xml.namespace.QName(\"\", \"\")",
+                     new JavaType("i", 
+                                  javax.xml.namespace.QName.class.getName(), null).getDefaultTypeValue());
+    }
+
+    public void testGetArrayDefaultTypeValue() throws Exception {
+        assertEquals("new int[0]", new JavaType("i", "int[]", null).getDefaultTypeValue());
+        assertEquals("new String[0]", new JavaType("i", "String[]", null).getDefaultTypeValue());
+    }
+
+    public void testGetClassDefaultTypeValue() throws Exception {
+        assertEquals("new org.apache.cxf.tools.common.model.JavaType()",
+                     new JavaType("i", "org.apache.cxf.tools.common.model.JavaType", null)
+                         .getDefaultTypeValue());
+    }
+}

Propchange: incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JavaTypeTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JavaTypeTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



Mime
View raw message