cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r724486 - in /cxf/branches/2.1.x-fixes: ./ tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/ tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/in...
Date Mon, 08 Dec 2008 21:15:34 GMT
Author: dkulp
Date: Mon Dec  8 13:15:33 2008
New Revision: 724486

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

........
  r724481 | dkulp | 2008-12-08 16:04:41 -0500 (Mon, 08 Dec 2008) | 2 lines
  
  [CXF-1935] Bunch of issues with enableAsyncMapping not being picked up all the time.
........

Added:
    cxf/branches/2.1.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/hello_world_async_noservice.wsdl
      - copied unchanged from r724481, cxf/trunk/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/hello_world_async_noservice.wsdl
Modified:
    cxf/branches/2.1.x-fixes/   (props changed)
    cxf/branches/2.1.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/JAXWSBinding.java
    cxf/branches/2.1.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/OperationProcessor.java
    cxf/branches/2.1.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java
    cxf/branches/2.1.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
    cxf/branches/2.1.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Dec  8 13:15:33 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,707902,708035,708044,708074,708410,708417,708550,708554,709353-709354,709425,710076,710150,71015
 4,711193,711388,711410,711490,711635,711949,711975,712194,712198,712238,712272,712299,712312,712670,712893,713082,713095-713096,713099,713584,713597,713737,713804,713899,714167-714168,714245,714255,717937-717961,718281-718448,718565,718620,718640,718665,718970,719017,719210,719215-719218,719222-719273,719305,719327-719680,720053,720119-720218,720238,720293-720316,720497,721221,721241,721501,722117,722129,723024,723338,723716-723791,724333-724372,724433-724438,724449
+/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,708035,708044,708074,708410,708417,708550,708554,709353-709354,709425,710076,710150,71015
 4,711193,711388,711410,711490,711635,711949,711975,712194,712198,712238,712272,712299,712312,712670,712893,713082,713095-713096,713099,713584,713597,713737,713804,713899,714167-714168,714245,714255,717937-717961,718281-718448,718565,718620,718640,718665,718970,719017,719210,719215-719218,719222-719273,719305,719327-719680,720053,720119-720218,720238,720293-720316,720497,721221,721241,721501,722117,722129,723024,723338,723716-723791,724333-724372,724433-724438,724449,724481

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

Modified: cxf/branches/2.1.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/JAXWSBinding.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/JAXWSBinding.java?rev=724486&r1=724485&r2=724486&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/JAXWSBinding.java
(original)
+++ cxf/branches/2.1.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/JAXWSBinding.java
Mon Dec  8 13:15:33 2008
@@ -28,15 +28,14 @@
 
 public class JAXWSBinding implements ExtensibilityElement, Serializable {
 
-    private boolean enableAsyncMapping;
-
-    private boolean enableMime;
+    private Boolean enableAsyncMapping;
+    private Boolean enableWrapperStyle;
+    private Boolean enableMime;
 
     private Element element;
     private boolean required;
     private QName elementType;
 
-    private boolean enableWrapperStyle = true;
 
     private String documentBaseURI;
 
@@ -87,25 +86,31 @@
     }
 
     public boolean isEnableMime() {
-        return enableMime;
+        return enableMime == null ? false : enableMime;
+    }
+    public boolean isSetEnableMime() {
+        return enableMime != null;
     }
-
     public void setEnableMime(boolean enableMime) {
         this.enableMime = enableMime;
     }
 
     public boolean isEnableAsyncMapping() {
-        return this.enableAsyncMapping;
+        return enableAsyncMapping == null ? false : enableAsyncMapping;
+    }
+    public boolean isSetEnableAsyncMapping() {
+        return enableAsyncMapping != null;
     }
-
     public void setEnableAsyncMapping(boolean enableAsync) {
         this.enableAsyncMapping = enableAsync;
     }
 
     public boolean isEnableWrapperStyle() {
-        return enableWrapperStyle;
+        return enableWrapperStyle == null ? true : enableWrapperStyle;
+    }
+    public boolean isSetEnableWrapperStyle() {
+        return enableWrapperStyle != null;
     }
-
     public void setEnableWrapperStyle(boolean pEnableWrapperStyle) {
         this.enableWrapperStyle = pEnableWrapperStyle;
     }

Modified: cxf/branches/2.1.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/OperationProcessor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/OperationProcessor.java?rev=724486&r1=724485&r2=724486&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/OperationProcessor.java
(original)
+++ cxf/branches/2.1.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/OperationProcessor.java
Mon Dec  8 13:15:33 2008
@@ -59,7 +59,9 @@
     public void process(JavaInterface intf, OperationInfo operation) throws ToolException
{
         JavaMethod method = new MethodMapper().map(operation);
         method.setInterface(intf);
-        processMethod(method, operation, null);
+        
+        processMethod(method, operation);
+        
         Collection<FaultInfo> faults = operation.getFaults();
         FaultProcessor faultProcessor = new FaultProcessor(context);
         faultProcessor.process(method, faults);
@@ -69,8 +71,8 @@
         intf.addMethod(method);
     }
 
-    void processMethod(JavaMethod method, OperationInfo operation,
-                              JAXWSBinding globalBinding) throws ToolException {
+    void processMethod(JavaMethod method, 
+                       OperationInfo operation) throws ToolException {
         if (isAsyncMethod(method)) {
             return;
         }
@@ -102,21 +104,43 @@
         method.annotate(new WebResultAnnotator());
 
         JAXWSBinding opBinding = (JAXWSBinding)operation.getExtensor(JAXWSBinding.class);
-
+        JAXWSBinding ptBinding = operation.getInterface().getExtensor(JAXWSBinding.class);
+        JAXWSBinding defBinding = operation.getInterface().getService()
+            .getDescription().getExtensor(JAXWSBinding.class);
+        
         boolean enableAsync = false;
-        if (globalBinding != null && globalBinding.isEnableAsyncMapping()
-            || opBinding != null && opBinding.isEnableAsyncMapping()) {
-            enableAsync = true;
+        boolean enableMime = false;
+        if (defBinding != null) {
+            if (defBinding.isSetEnableMime()) {
+                enableMime = defBinding.isEnableMime();
+            }
+            if (defBinding.isSetEnableAsyncMapping()) {
+                enableAsync = defBinding.isEnableAsyncMapping();
+            }
         }
-
-
+        if (ptBinding != null) {
+            if (ptBinding.isSetEnableMime()) {
+                enableMime = ptBinding.isEnableMime();
+            }
+            if (ptBinding.isSetEnableAsyncMapping()) {
+                enableAsync = ptBinding.isEnableAsyncMapping();
+            }
+        }
+        if (opBinding != null) {
+            if (opBinding.isSetEnableMime()) {
+                enableMime = opBinding.isEnableMime();
+            }
+            if (opBinding.isSetEnableAsyncMapping()) {
+                enableAsync = opBinding.isEnableAsyncMapping();
+            }
+        }
+        
         if (!method.isOneWay()
-            && enableAsync && !isAddedAsyMethod(method)) {
+            && enableAsync && !isAddedAsycMethod(method)) {
             addAsyncMethod(method);
         }
 
-        if (globalBinding != null && globalBinding.isEnableMime()
-            || opBinding != null && opBinding.isEnableMime()) {
+        if (enableMime) {
             method.setMimeEnable(true);
         }
     }
@@ -154,9 +178,14 @@
     }
 
     private boolean isAsyncMethod(JavaMethod method) {
-        if (method.getName().toLowerCase()
-            .equals((method.getOperationName() + ToolConstants.ASYNC_METHOD_SUFFIX).toLowerCase()))
{
-            return true;
+        if (method.getName().endsWith(ToolConstants.ASYNC_METHOD_SUFFIX)) {
+            if (method.getReturn().getClassName().startsWith("Response<")) {
+                return true;
+            } else if (method.getParameterCount() > 0
+                && method.getParameters().get(method.getParameterCount() - 1)
+                    .getClassName().startsWith("AsyncHandler<")) {
+                return true;
+            }
         }
         return false;
     }
@@ -256,7 +285,7 @@
         return sb.toString();
     }
 
-    private boolean isAddedAsyMethod(JavaMethod method) {
+    private boolean isAddedAsycMethod(JavaMethod method) {
         List<JavaMethod> jmethods = method.getInterface().getMethods();
         int counter = 0;
         for (JavaMethod jm : jmethods) {

Modified: cxf/branches/2.1.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java?rev=724486&r1=724485&r2=724486&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java
(original)
+++ cxf/branches/2.1.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java
Mon Dec  8 13:15:33 2008
@@ -383,12 +383,12 @@
                     // changed wrapper style
 
                     jm.setWrapperStyle(false);
-                    processor.processMethod(jm, bop.getOperationInfo(), jaxwsBinding);
+                    processor.processMethod(jm, bop.getOperationInfo());
                     jm.getAnnotationMap().remove("ResponseWrapper");
                     jm.getAnnotationMap().remove("RequestWrapper");
 
                 } else {
-                    processor.processMethod(jm, bop.getOperationInfo(), jaxwsBinding);
+                    processor.processMethod(jm, bop.getOperationInfo());
 
                 }
 

Modified: cxf/branches/2.1.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java?rev=724486&r1=724485&r2=724486&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
(original)
+++ cxf/branches/2.1.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
Mon Dec  8 13:15:33 2008
@@ -536,7 +536,11 @@
         env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/bug627/hello_world.wsdl"));
         env.put(ToolConstants.CFG_BINDING, getLocation("/wsdl2java_wsdl/bug627/async_binding.xml"));
         processor.setContext(env);
-        processor.execute();
+        try {
+            processor.execute();
+        } catch (Exception ex) {
+            //ignore
+        }
 
 
         Class clz = classLoader.loadClass("org.apache.cxf.w2j.hello_world_soap_http.Greeter");

Modified: cxf/branches/2.1.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java?rev=724486&r1=724485&r2=724486&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
(original)
+++ cxf/branches/2.1.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
Mon Dec  8 13:15:33 2008
@@ -283,7 +283,7 @@
     }
 
     @Test
-    public void testAsynMethod() throws Exception {
+    public void testAsyncMethod() throws Exception {
         env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/hello_world_async.wsdl"));
         processor.setContext(env);
         processor.execute();
@@ -322,6 +322,81 @@
     }
 
     @Test
+    public void testAsyncMethodNoService() throws Exception {
+        env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/hello_world_async_noservice.wsdl"));
+        processor.setContext(env);
+        processor.execute();
+
+        assertNotNull(output);
+
+        File org = new File(output, "org");
+        assertTrue(org.exists());
+        File apache = new File(org, "apache");
+        assertTrue(apache.exists());
+        File cxf = new File(apache, "cxf");
+        assertTrue(cxf.exists());
+        File w2j = new File(cxf, "w2j");
+        assertTrue(w2j.exists());
+        File async = new File(w2j, "hello_world_async_soap_http");
+        assertTrue(async.exists());
+
+        File[] files = async.listFiles();
+        assertEquals(Arrays.asList(files).toString(), 9, files.length);
+
+        Class<?> clz = classLoader.loadClass("org.apache.cxf.w2j.hello_world_async_soap_http.GreeterAsync");
+
+        Method method1 = clz.getMethod("greetMeSometimeAsync", new Class[] {java.lang.String.class,
+                                                                            javax.xml.ws.AsyncHandler.class});
+        WebMethod webMethodAnno1 = AnnotationUtil.getPrivMethodAnnotation(method1, WebMethod.class);
+
+        assertEquals(method1.getName() + "()" + " Annotation : WebMethod.operationName ",
"greetMeSometime",
+                     webMethodAnno1.operationName());
+
+        java.lang.reflect.Method method2 = clz.getMethod("greetMeSometimeAsync",
+                                                         new Class[] {java.lang.String.class});
+        WebMethod webMethodAnno2 = AnnotationUtil.getPrivMethodAnnotation(method2, WebMethod.class);
+        assertEquals(method2.getName() + "()" + " Annotation : WebMethod.operationName ",
"greetMeSometime",
+                     webMethodAnno2.operationName());
+
+        method1 = clz.getMethod("greetMeSometimeAsync", new Class[] {java.lang.String.class,
+                                                                     javax.xml.ws.AsyncHandler.class});
+        try {
+            method1 = clz.getMethod("testIntAsync", new Class[] {Integer.TYPE,
+                                                                 javax.xml.ws.AsyncHandler.class});
+            fail("Should not have generated testIntAsync");
+        } catch (NoSuchMethodException ex) {
+            //ignore
+        }
+
+        
+        clz = classLoader.loadClass("org.apache.cxf.w2j.hello_world_async_soap_http.GreeterDAsync");
+        method1 = clz.getMethod("greetMeSometimeAsync", new Class[] {java.lang.String.class,
+                                                                     javax.xml.ws.AsyncHandler.class});
+        
+        clz = classLoader.loadClass("org.apache.cxf.w2j.hello_world_async_soap_http.GreeterCAsync");
+        try {
+            method1 = clz.getMethod("greetMeSometimeAsync", new Class[] {java.lang.String.class,
+                                                                         javax.xml.ws.AsyncHandler.class});
+            fail("Should not have generated greetMeSometimeAsync");
+        } catch (NoSuchMethodException ex) {
+            //ignore
+        }
+        method1 = clz.getMethod("testIntAsync", new Class[] {Integer.TYPE,
+                                                             javax.xml.ws.AsyncHandler.class});
+        
+        clz = classLoader.loadClass("org.apache.cxf.w2j.hello_world_async_soap_http.GreeterBAsync");
+        try {
+            method1 = clz.getMethod("greetMeSometimeAsync", new Class[] {java.lang.String.class,
+                                                                         javax.xml.ws.AsyncHandler.class});
+            fail("Should not have generated greetMeSometimeAsync");
+        } catch (NoSuchMethodException ex) {
+            //ignore
+        }
+        method1 = clz.getMethod("testIntAsync", new Class[] {Integer.TYPE,
+                                                             javax.xml.ws.AsyncHandler.class});
+    }    
+    
+    @Test
     public void testHelloWorldSoap12() throws Exception {
         env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/hello_world_soap12.wsdl"));
         processor.setContext(env);



Mime
View raw message