You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by em...@apache.org on 2007/04/03 05:56:48 UTC

svn commit: r525016 - in /incubator/cxf/trunk/tools/wsdlto: frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/client.vm test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java

Author: ema
Date: Mon Apr  2 20:56:48 2007
New Revision: 525016

URL: http://svn.apache.org/viewvc?view=rev&rev=525016
Log:
[CXF-508]Corrected service QName in client code 

Modified:
    incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/client.vm
    incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java

Modified: incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/client.vm
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/client.vm?view=diff&rev=525016&r1=525015&r2=525016
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/client.vm (original)
+++ incubator/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/template/client.vm Mon Apr  2 20:56:48 2007
@@ -41,7 +41,7 @@
 
 public final class ${clientClassName} {
 
-    private static final QName SERVICE_NAME = new QName("$intf.Namespace", "$service.ServiceName");
+    private static final QName SERVICE_NAME = new QName("$service.Namespace", "$service.ServiceName");
 
     private ${clientClassName}() {
     }

Modified: incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java?view=diff&rev=525016&r1=525015&r2=525016
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java (original)
+++ incubator/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java Mon Apr  2 20:56:48 2007
@@ -19,6 +19,7 @@
 package org.apache.cxf.tools.wsdlto.jaxws;
 
 import java.io.BufferedInputStream;
+import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
 import java.lang.reflect.Modifier;
@@ -92,7 +93,6 @@
 
     }
 
-
     public void testBug305700() throws Exception {
         env.put(ToolConstants.CFG_COMPILE, "compile");
         env.put(ToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
@@ -121,8 +121,6 @@
         files = types.listFiles();
         assertEquals(17, files.length);
 
-        //Class clz = classLoader.loadClass("org.cxf.Greeter");
-        //assertTrue("Generate " + clz.getName() + "error", clz.isInterface());
         Class clz = classLoader.loadClass("org.apache.types.GreetMe");
         assertNotNull(clz);
     }
@@ -181,7 +179,7 @@
         assertTrue("wsdl location should be url style in build.xml", content.indexOf("param1=\"file:") > -1);
 
     }
-    
+
     public void testExcludeNSWithPackageName() throws Exception {
 
         String[] args = new String[] {"-d", output.getCanonicalPath(), "-nexclude",
@@ -310,20 +308,19 @@
             e.printStackTrace();
         }
     }
-    
-    
-    public void testLocatorWithJaxbBinding() throws Exception {      
+
+    public void testLocatorWithJaxbBinding() throws Exception {
         env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/locator_with_jaxbbinding.wsdl"));
         processor.setContext(env);
-        processor.execute();      
+        processor.execute();
     }
 
-    public void testWsdlNoService() throws Exception {      
+    public void testWsdlNoService() throws Exception {
         env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/helloworld_withnoservice.wsdl"));
         processor.setContext(env);
         processor.execute();
     }
-    
+
     public void testNoServiceImport() throws Exception {
         env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/helloworld_noservice_import.wsdl"));
         processor.setContext(env);
@@ -332,21 +329,37 @@
         assertNotNull(cls);
         cls = classLoader.loadClass("org.apache.hello_world2.Greeter2");
     }
-    
+
     public void testServiceNS() throws Exception {
         env.put(ToolConstants.CFG_ALL, ToolConstants.CFG_ALL);
-        env.put(ToolConstants.CFG_WSDLURL, 
+        env.put(ToolConstants.CFG_WSDLURL,
                 getLocation("/wsdl2java_wsdl/bug321/hello_world_different_ns_service.wsdl"));
         processor.setContext(env);
         processor.execute();
-        
+
         Class clz = classLoader.loadClass("org.apache.hello_world_soap_http.service.SOAPServiceTest1");
-        WebServiceClient webServiceClient = 
-            AnnotationUtil.getPrivClassAnnotation(clz, WebServiceClient.class);
+        WebServiceClient webServiceClient = AnnotationUtil
+            .getPrivClassAnnotation(clz, WebServiceClient.class);
         assertEquals("http://apache.org/hello_world_soap_http/service", webServiceClient.targetNamespace());
-      
+        File file = new File(output, "org/apache/hello_world_soap_http/GreeterClient.java");
+        FileInputStream fin = new FileInputStream(file);
+        byte[] buffer = new byte[30000];
+        int index = -1;
+        int size = fin.read(buffer);
+        ByteArrayOutputStream bout = new ByteArrayOutputStream();
+        while (size != -1) {
+            bout.write(buffer, 0, size);
+            index = bout.toString()
+                .indexOf("new QName(\"http://apache.org/hello_world_soap_http/service\"," 
+                        + " \"SOAPService_Test1\")");
+            if (index > 0) {
+                break;
+            }
+            size = fin.read(buffer);
+        }
+        assertTrue("Service QName in client is not correct", index > -1);
     }
-    
+
     public void testNoServiceNOPortType() throws Exception {
         env.put(ToolConstants.CFG_ALL, ToolConstants.CFG_ALL);
         env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/no_port_or_service.wsdl"));
@@ -355,11 +368,11 @@
         Class clz = classLoader.loadClass("org.apache.cxf.no_port_or_service.types.TheComplexType");
         assertNotNull(clz);
     }
-    //CXF-492
+
+    // CXF-492
     public void testDefatultNsMap() throws Exception {
         env.put(ToolConstants.CFG_ALL, ToolConstants.CFG_ALL);
-        env.put(ToolConstants.CFG_WSDLURL, 
-                getLocation("/wsdl2java_wsdl/cxf492/locator.wsdl"));
+        env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/cxf492/locator.wsdl"));
         processor.setContext(env);
         processor.execute();
         File org = new File(output, "org");
@@ -373,6 +386,5 @@
         File address = new File(ws, "addressing");
         assertTrue(address.exists());
     }
-    
-    
+
 }