cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r568509 - in /incubator/cxf/trunk/tools/javato/ws/src: main/java/org/apache/cxf/tools/java2ws/ main/java/org/apache/cxf/tools/java2wsdl/processor/ test/java/org/apache/cxf/tools/java2ws/
Date Wed, 22 Aug 2007 08:37:25 GMT
Author: ema
Date: Wed Aug 22 01:37:23 2007
New Revision: 568509

URL: http://svn.apache.org/viewvc?rev=568509&view=rev
Log:
[CXF-892, CXF-933]Now java2ws tool can generate wsdl ,server side and client side code for
jaxws frontend  

Modified:
    incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/JavaToWSContainer.java
    incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/java2ws.xml
    incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/ServiceInfoToJavaProcessor.java
    incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/JavaToWSTest.java

Modified: incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/JavaToWSContainer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/JavaToWSContainer.java?rev=568509&r1=568508&r2=568509&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/JavaToWSContainer.java
(original)
+++ incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/JavaToWSContainer.java
Wed Aug 22 01:37:23 2007
@@ -60,9 +60,11 @@
                 processor.setEnvironment(env);
                 processor.process();
                 
-                processor = new ServiceInfoToJavaProcessor();
-                processor.setEnvironment(env);
-                processor.process();
+                if (env.optionSet(ToolConstants.CFG_SERVER) || env.optionSet(ToolConstants.CFG_CLIENT))
{
+                    processor = new ServiceInfoToJavaProcessor();
+                    processor.setEnvironment(env);
+                    processor.process();
+                }
                 
             }
         } catch (ToolException ex) {

Modified: incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/java2ws.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/java2ws.xml?rev=568509&r1=568508&r2=568509&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/java2ws.xml
(original)
+++ incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2ws/java2ws.xml
Wed Aug 22 01:37:23 2007
@@ -58,13 +58,12 @@
 			<option id="server" maxOccurs="1">
 				<annotation>Specify to genearte server side code</annotation>
 				<switch>server</switch>
-			</option>
-			
+			</option>			
+						
 			<option id="wsdl" maxOccurs="1">
 				<annotation>Specify generating wsdl</annotation>
-				<switch>wsdl</switch>W
+				<switch>wsdl</switch>
 			</option>
-
 
 			<option id="outputfile" maxOccurs="1">
 				<annotation>

Modified: incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/ServiceInfoToJavaProcessor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/ServiceInfoToJavaProcessor.java?rev=568509&r1=568508&r2=568509&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/ServiceInfoToJavaProcessor.java
(original)
+++ incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/ServiceInfoToJavaProcessor.java
Wed Aug 22 01:37:23 2007
@@ -18,6 +18,10 @@
  */
 package org.apache.cxf.tools.java2wsdl.processor;
 
+import java.util.List;
+
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.tools.common.Processor;
 import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolContext;
@@ -31,9 +35,26 @@
     public void process() {
         env.put(FrontEndProfile.class, PluginLoader.getInstance().getFrontEndProfile("jaxws"));
         env.put(DataBindingProfile.class, PluginLoader.getInstance().getDataBindingProfile("jaxb"));
-        env.put(ToolConstants.CFG_GEN_CLIENT, ToolConstants.CFG_GEN_CLIENT);
-        env.put(ToolConstants.CFG_GEN_SERVER, ToolConstants.CFG_GEN_SERVER);
-        env.put(ToolConstants.CFG_WSDLURL, "dummy");
+        
+        if (env.optionSet(ToolConstants.CFG_CLIENT)) {
+            env.put(ToolConstants.CFG_GEN_SERVICE, ToolConstants.CFG_GEN_SERVICE);
+            env.put(ToolConstants.CFG_GEN_CLIENT, ToolConstants.CFG_GEN_CLIENT);
+        }
+        
+        if (env.optionSet(ToolConstants.CFG_SERVER)) {
+            env.put(ToolConstants.CFG_GEN_SERVER, ToolConstants.CFG_GEN_SERVER);
+            if (env.optionSet(ToolConstants.CFG_IMPL)) {
+                env.put(ToolConstants.CFG_GEN_IMPL, ToolConstants.CFG_GEN_IMPL);       
+            }
+        }
+        List<ServiceInfo> services = (List<ServiceInfo>)env.get(ToolConstants.SERVICE_LIST);
+        ServiceInfo serviceInfo = services.get(0);
+        if (serviceInfo.getEndpoints().iterator().hasNext()) {
+            EndpointInfo endpointInfo = serviceInfo.getEndpoints().iterator().next();
+            env.put(ToolConstants.CFG_WSDLURL, endpointInfo.getAddress() + "?wsdl");
+        } else {
+            env.put(ToolConstants.CFG_WSDLURL, "dummy");
+        }
         try {
             WSDLToJavaContainer w2j = new WSDLToJavaContainer("wsdl2java", null);
             w2j.setContext(env);

Modified: incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/JavaToWSTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/JavaToWSTest.java?rev=568509&r1=568508&r2=568509&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/JavaToWSTest.java
(original)
+++ incubator/cxf/trunk/tools/javato/ws/src/test/java/org/apache/cxf/tools/java2ws/JavaToWSTest.java
Wed Aug 22 01:37:23 2007
@@ -48,7 +48,7 @@
 
     @After
     public void tearDown() {
-        //super.tearDown();
+        super.tearDown();
         System.setProperty("java.class.path", cp);
     }
 
@@ -62,14 +62,37 @@
     @Test
     public void testFlagWSDL() throws Exception {
         String[] args = new String[] {"-wsdl", "-o", output.getPath() + "/tmp.wsdl",
-                                      "-d", output.getPath(),
+                                      "-d", output.getPath(), "-client", "-server",
                                       "org.apache.hello_world_soap12_http.Greeter"};
         JavaToWS.main(args);
         File wsdlFile = new File(output.getPath() + "/tmp.wsdl");
         assertTrue("wsdl is not generated", wsdlFile.exists());
+    }
+    
+    
+    @Test 
+    
+    public void testGenServerAndClient() throws Exception {
+        String[] args = new String[] {"-d", output.getPath(), "-client", "-server",
+                                      "org.apache.hello_world_soap12_http.Greeter"};
+        JavaToWS.main(args);
+        File client = new File(output.getPath()
+                               + "/org/apache/hello_world_soap12_http/Greeter_GreeterPort_Client.java");
 
+        assertTrue("Client is not generated", client.exists());
 
+        File service = new File(output.getPath() + "/org/apache/hello_world_soap12_http/GreeterService.java");
+        assertTrue("GreeterService is not generated", service.exists());
+        File server = new File(output.getPath()
+                               + "/org/apache/hello_world_soap12_http/Greeter_GreeterPort_Server.java");
+        assertTrue("Greeter_GreeterPort_Server.java is not generated", server.exists());
     }
+    
+    
+    
+    
+    
+    
 
     @Ignore
     public void testInvalidFlag() throws Exception {



Mime
View raw message