You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2008/01/03 17:34:40 UTC

svn commit: r608552 [2/2] - in /incubator/cxf/branches/2.0.x-fixes: ./ maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/ tools/common/ tools/common/src/main/java/org/apache/cxf/tools/common/model/ tools/common/src/test/java/org/ap...

Modified: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebMethodAnnotatorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebMethodAnnotatorTest.java?rev=608552&r1=608551&r2=608552&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebMethodAnnotatorTest.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebMethodAnnotatorTest.java Thu Jan  3 08:34:38 2008
@@ -19,10 +19,11 @@
 
 package org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.annotator;
 
+import java.util.List;
 import java.util.Map;
 
-
-import org.apache.cxf.tools.common.model.JavaAnnotation;
+import org.apache.cxf.tools.common.model.JAnnotation;
+import org.apache.cxf.tools.common.model.JAnnotationElement;
 import org.apache.cxf.tools.common.model.JavaMethod;
 import org.junit.Assert;
 import org.junit.Test;
@@ -35,7 +36,7 @@
         method.setName("echoFoo");
         method.setOperationName("echoFoo");
         method.annotate(new WebMethodAnnotator());
-        Map<String, JavaAnnotation> annotations = method.getAnnotationMap();
+        Map<String, JAnnotation> annotations = method.getAnnotationMap();
         assertNotNull(annotations);
         assertEquals(1, annotations.size());
         assertEquals("WebMethod", annotations.keySet().iterator().next());
@@ -45,15 +46,16 @@
     public void testAddWebResultAnnotation() throws Exception {
         JavaMethod method = new JavaMethod();
         method.annotate(new WebResultAnnotator());
-        Map<String, JavaAnnotation> annotations = method.getAnnotationMap();
+        Map<String, JAnnotation> annotations = method.getAnnotationMap();
         assertNotNull(annotations);
         assertEquals(1, annotations.size());
         assertEquals("WebResult", annotations.keySet().iterator().next());
-        JavaAnnotation resultAnnotation = annotations.values().iterator().next();
-        Map<String, String> arguments = resultAnnotation.getArguments();
-        assertNotNull(arguments);
-        assertEquals(1, arguments.size());
-        assertEquals("name", arguments.keySet().iterator().next());
-        assertEquals("\"return\"", arguments.values().iterator().next());
+        JAnnotation resultAnnotation = annotations.get("WebResult");
+        assertEquals("@WebResult(name = \"return\")", resultAnnotation.toString());
+        List<JAnnotationElement> elements = resultAnnotation.getElements();
+        assertNotNull(elements);
+        assertEquals(1, elements.size());
+        assertEquals("name", elements.get(0).getName());
+        assertEquals("return", elements.get(0).getValue());
     }
 }

Modified: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebParamAnnotatorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebParamAnnotatorTest.java?rev=608552&r1=608551&r2=608552&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebParamAnnotatorTest.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/test/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/annotator/WebParamAnnotatorTest.java Thu Jan  3 08:34:38 2008
@@ -19,12 +19,13 @@
 
 package org.apache.cxf.tools.wsdlto.frontend.jaxws.processor.internal.annotator;
 
-import java.util.Map;
+import java.util.List;
 
 import javax.jws.soap.SOAPBinding;
 import javax.xml.namespace.QName;
 
-import org.apache.cxf.tools.common.model.JavaAnnotation;
+import org.apache.cxf.tools.common.model.JAnnotation;
+import org.apache.cxf.tools.common.model.JAnnotationElement;
 import org.apache.cxf.tools.common.model.JavaMethod;
 import org.apache.cxf.tools.common.model.JavaParameter;
 import org.junit.Assert;
@@ -58,11 +59,13 @@
         init(method, parameter, SOAPBinding.Style.DOCUMENT, true);
         parameter.annotate(new WebParamAnnotator());
 
-        JavaAnnotation annotation = parameter.getAnnotation();
-        Map<String, String> args = annotation.getArguments();
-        assertEquals(2, args.size());
-        assertEquals("\"http://apache.org/cxf\"", args.get("targetNamespace"));
-        assertEquals("\"x\"", args.get("name"));
+        JAnnotation annotation = parameter.getAnnotation();
+        assertEquals("@WebParam(name = \"x\", targetNamespace = \"http://apache.org/cxf\")", 
+                         annotation.toString());
+        List<JAnnotationElement> elements = annotation.getElements();
+        assertEquals(2, elements.size());
+        assertEquals("http://apache.org/cxf", elements.get(1).getValue());
+        assertEquals("x", elements.get(0).getValue());
         // XXX - order that attributes are appended to the string
         //       differs with the ibmjdk...
         //assertEquals("@WebParam(targetNamespace = \"http://apache.org/cxf\", name = \"x\")",
@@ -75,12 +78,12 @@
 
         parameter.annotate(new WebParamAnnotator());
 
-        JavaAnnotation annotation = parameter.getAnnotation();
-        Map<String, String> args = annotation.getArguments();
-        assertEquals(3, args.size());
-        assertEquals("\"http://apache.org/cxf\"", args.get("targetNamespace"));
-        assertEquals("\"y\"", args.get("partName"));
-        assertEquals("\"x\"", args.get("name"));
+        JAnnotation annotation = parameter.getAnnotation();
+        assertEquals("@WebParam(partName = \"y\", name = \"x\", " 
+                     + "targetNamespace = \"http://apache.org/cxf\")", 
+                         annotation.toString());
+        List<JAnnotationElement> elements = annotation.getElements();
+        assertEquals(3, elements.size());
         // XXX - order that attributes are appended to the string
         //       differs with the ibmjdk...
         //assertEquals(
@@ -92,8 +95,8 @@
     public void testAnnotateRPC() throws Exception {
         init(method, parameter, SOAPBinding.Style.RPC, true);
         parameter.annotate(new WebParamAnnotator());
-        JavaAnnotation annotation = parameter.getAnnotation();
-        assertEquals(2, annotation.getArguments().size());
+        JAnnotation annotation = parameter.getAnnotation();
+        assertEquals(2, annotation.getElements().size());
         assertEquals("@WebParam(partName = \"y\", name = \"y\")",
                      annotation.toString());
     }

Modified: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java?rev=608552&r1=608551&r2=608552&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java Thu Jan  3 08:34:38 2008
@@ -506,14 +506,11 @@
                                       getLocation("/wsdl2java_wsdl/hello-mime.wsdl")};
 
         WSDLToJava.main(args);
+
         assertFileEquals(getClass().getResource("expected/expected_hello_mime").getFile(),
                          output.getCanonicalPath() + "/org/apache/hello_world_mime/Hello.java");
-
-
-
     }
 
-
     @Test
     public void testWebResult() throws Exception {
 
@@ -521,9 +518,12 @@
         processor.setContext(env);
         processor.execute();
 
-        assertFileEquals(getClass().getResource("expected/expected_sayHi").getFile(),
-                         output.getCanonicalPath() + "/org/apache/sayhi/SayHi.java");
-
+        String results = getStringFromFile(new File(output.getCanonicalPath(), 
+                                                    "org/apache/sayhi/SayHi.java"));
+        assertTrue(results.trim().length() > 0);
+        assertTrue(results.indexOf("@WebResult(name  =  \"return\",  " 
+                                   + "targetNamespace  =  \"http://apache.org/sayHi\")") != -1);
+        assertTrue(results.indexOf("@WebResult(name  =  \"return\",  targetNamespace  =  \"\")") != -1);
     }
 
 
@@ -731,7 +731,8 @@
         String results = getStringFromFile(new File(output.getCanonicalPath(), 
                                                     "soapinterface/ems/esendex/com/AccountServiceSoap.java"));
         assertTrue(results.indexOf("public  int  getMessageLimit") != -1);
-        assertTrue(results.indexOf("header  =  true,  name  =  \"MessengerHeader") != -1);
+        assertTrue(results.indexOf("name  =  \"MessengerHeader") != -1);
+        assertTrue(results.indexOf("header  =  true") != -1);
     }
     
     @Test

Modified: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java?rev=608552&r1=608551&r2=608552&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java Thu Jan  3 08:34:38 2008
@@ -1142,5 +1142,5 @@
         processor.setContext(env);
         processor.execute();
     }
-    
+
 }

Modified: incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/expected/expected_hello_mime
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/expected/expected_hello_mime?rev=608552&r1=608551&r2=608552&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/expected/expected_hello_mime (original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/expected/expected_hello_mime Thu Jan  3 08:34:38 2008
@@ -16,15 +16,17 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
+
 package org.apache.hello_world_mime;
 
-import javax.jws.WebParam.Mode;
+import javax.jws.WebMethod;
 import javax.jws.WebParam;
+import javax.jws.WebParam.Mode;
+import javax.jws.WebResult;
 import javax.jws.WebService;
-import javax.jws.soap.SOAPBinding.Style;
 import javax.jws.soap.SOAPBinding;
-import javax.jws.WebMethod;
-import javax.jws.WebResult;
+import javax.jws.soap.SOAPBinding.ParameterStyle;
 import javax.xml.ws.RequestWrapper;
 import javax.xml.ws.ResponseWrapper;
 
@@ -34,28 +36,28 @@
 public interface Hello {
 
     @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
-    @WebResult(targetNamespace = "http://apache.org/hello_world_mime/types", partName = "mime", name = "addressRes")
+    @WebResult(name = "addressRes", targetNamespace = "http://apache.org/hello_world_mime/types", partName = "mime")
     @WebMethod
     public javax.xml.transform.Source address(
-        @WebParam(targetNamespace = "http://apache.org/hello_world_mime/types", partName = "mime", name = "address")
+        @WebParam(partName = "mime", name = "address", targetNamespace = "http://apache.org/hello_world_mime/types")
         org.apache.cxf.mime.Address mime
     );
 
     @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
     @WebMethod
     public void helloMime(
-        @WebParam(targetNamespace = "http://apache.org/hello_world_mime/types", partName = "body", name = "body")
+        @WebParam(partName = "body", name = "body", targetNamespace = "http://apache.org/hello_world_mime/types")
         java.lang.String body,
-        @WebParam(targetNamespace = "", mode = Mode.INOUT, partName = "mime", name = "mime")
+        @WebParam(partName = "mime", mode = WebParam.Mode.INOUT, name = "mime", targetNamespace = "")
         javax.xml.ws.Holder<java.awt.Image> mime
     );
 
     @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
     @WebMethod
     public void hello(
-        @WebParam(targetNamespace = "http://apache.org/hello_world_mime/types", partName = "body", name = "body")
+        @WebParam(partName = "body", name = "body", targetNamespace = "http://apache.org/hello_world_mime/types")
         java.lang.String body,
-        @WebParam(targetNamespace = "", mode = Mode.INOUT, partName = "mime", name = "mime")
+        @WebParam(partName = "mime", mode = WebParam.Mode.INOUT, name = "mime", targetNamespace = "")
         javax.xml.ws.Holder<byte[]> mime
     );
 }