cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r724727 - in /cxf/branches/2.0.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 Tue, 09 Dec 2008 14:58:15 GMT
Author: dkulp
Date: Tue Dec  9 06:58:14 2008
New Revision: 724727

URL: http://svn.apache.org/viewvc?rev=724727&view=rev
Log:
Merged revisions 724486 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/branches/2.1.x-fixes

................
  r724486 | dkulp | 2008-12-08 16:15:33 -0500 (Mon, 08 Dec 2008) | 9 lines
  
  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.0.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/hello_world_async_noservice.wsdl
      - copied unchanged from r724486, cxf/branches/2.1.x-fixes/tools/wsdlto/test/src/test/resources/wsdl2java_wsdl/hello_world_async_noservice.wsdl
Modified:
    cxf/branches/2.0.x-fixes/   (props changed)
    cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/JAXWSBinding.java
    cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/OperationProcessor.java
    cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java
    cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
    cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java

Propchange: cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Dec  9 06:58:14 2008
@@ -1,3 +1,3 @@
-/cxf/branches/2.1.x-fixes:673548,674485,674547,674551,674562,674601,674649,674764,674887,675644,675653,677048,677385,678004,678009,678559,678629,678808,678852,678891,678893,679248,679597,680435,681060,681165,681813,681816,682902,682951,683089,683290,683318,684099,684790-684793,684842,684862,684895-684918,685205,685253,686237,686283,686299,686333-686364,686765,686827,687097,687464-687465,689109,689112,689122,691316,691357,691491,691711,691715,691745,692162-692163,692468,692500,694466-694469,694472,694717,694748-694749,694870,695503,695509,695553,695555,695563,695875-695877,695940,695980,696436,696455,696721,697086,698129,701526,701634,702275,702443,702527,702582,702604,702610,702642-702643,702649,702760,702870,702873,702959,703193,703242,703523,704303,704587,704738,704998,705153,705280-705449,705455,709357,709641,709644,710177,710184,711736,712199,712225,712275,712600,712896,713083,713410,713413,713594,713599,713808,713901,714169-714171,718622,718929,719211,719221-719223,7192
 96,719300-719301,719303,719308,719332,719356,719363,719369-719383,719650,719695,720124,723545,724403-724404,724421,724448,724451
-/cxf/trunk:651669-686342,686344-686363,686764,686820,687096,687387,687463,688086,688102,688735,691271,691355,691488,691602,691706,691728,692116,692157,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694869,695396,695484,695537,695552,695561,695619,695684,695835,695935,695977,696094,696433,696720,697085,698128,700261,700602,701783,701830,701862,702267,702580,702602,702609,702616,702656,702957,703191,703239,703501,704584,704997,705150,705274,705340,705446,708550,708554,709353-709354,709425,710150,712194,712198,712272,712312,712670,712893,713082,713584,713597,713804,713899,714167-714168,718281,718565,718620,718640,718665,719017,719210,719215-719218,719222,719273,719327-719354,719362,719368,719382,719649,719680,720119-720217,723338,723717-723791,724334-724371,724433-724438,724449
+/cxf/branches/2.1.x-fixes:673548,674485,674547,674551,674562,674601,674649,674764,674887,675644,675653,677048,677385,678004,678009,678559,678629,678808,678852,678891,678893,679248,679597,680435,681060,681165,681813,681816,682902,682951,683089,683290,683318,684099,684790-684793,684842,684862,684895-684918,685205,685253,686237,686283,686299,686333-686364,686765,686827,687097,687464-687465,689109,689112,689122,691316,691357,691491,691711,691715,691745,692162-692163,692468,692500,694466-694469,694472,694717,694748-694749,694870,695503,695509,695553,695555,695563,695875-695877,695940,695980,696436,696455,696721,697086,698129,701526,701634,702275,702443,702527,702582,702604,702610,702642-702643,702649,702760,702870,702873,702959,703193,703242,703523,704303,704587,704738,704998,705153,705280-705449,705455,709357,709641,709644,710177,710184,711736,712199,712225,712275,712600,712896,713083,713410,713413,713594,713599,713808,713901,714169-714171,718622,718929,719211,719221-719223,7192
 96,719300-719301,719303,719308,719332,719356,719363,719369-719383,719650,719695,720124,723545,724403-724404,724421,724448,724451,724486
+/cxf/trunk:651669-686342,686344-686363,686764,686820,687096,687387,687463,688086,688102,688735,691271,691355,691488,691602,691706,691728,692116,692157,692466,692499,693653,693819,694179,694263,694417,694716,694744,694747,694869,695396,695484,695537,695552,695561,695619,695684,695835,695935,695977,696094,696433,696720,697085,698128,700261,700602,701783,701830,701862,702267,702580,702602,702609,702616,702656,702957,703191,703239,703501,704584,704997,705150,705274,705340,705446,708550,708554,709353-709354,709425,710150,712194,712198,712272,712312,712670,712893,713082,713584,713597,713804,713899,714167-714168,718281,718565,718620,718640,718665,719017,719210,719215-719218,719222,719273,719327-719354,719362,719368,719382,719649,719680,720119-720217,723338,723717-723791,724334-724371,724433-724438,724449,724481
 /incubator/cxf/trunk:434594-651668

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

Modified: cxf/branches/2.0.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.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/JAXWSBinding.java?rev=724727&r1=724726&r2=724727&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/JAXWSBinding.java
(original)
+++ cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/JAXWSBinding.java
Tue Dec  9 06:58:14 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;
 
@@ -81,25 +80,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.0.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.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/OperationProcessor.java?rev=724727&r1=724726&r2=724727&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/OperationProcessor.java
(original)
+++ cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/OperationProcessor.java
Tue Dec  9 06:58:14 2008
@@ -58,7 +58,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);
@@ -66,8 +68,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;
         }
@@ -99,21 +101,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);
         }
     }
@@ -151,9 +175,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;
     }
@@ -252,7 +281,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.0.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.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java?rev=724727&r1=724726&r2=724727&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java
(original)
+++ cxf/branches/2.0.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/internal/ServiceProcessor.java
Tue Dec  9 06:58:14 2008
@@ -370,12 +370,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.0.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.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java?rev=724727&r1=724726&r2=724727&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
(original)
+++ cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
Tue Dec  9 06:58:14 2008
@@ -551,7 +551,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.hello_world_soap_http.Greeter");

Modified: 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/cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java?rev=724727&r1=724726&r2=724727&view=diff
==============================================================================
--- cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
(original)
+++ cxf/branches/2.0.x-fixes/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenTest.java
Tue Dec  9 06:58:14 2008
@@ -311,7 +311,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();
@@ -346,6 +346,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