cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r545110 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/tools/common/ tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/ tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws...
Date Thu, 07 Jun 2007 08:45:56 GMT
Author: ema
Date: Thu Jun  7 01:45:53 2007
New Revision: 545110

URL: http://svn.apache.org/viewvc?view=rev&rev=545110
Log:
Fixed issue CXF-704 and CXF-705

Added:
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/Hello.java
Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/tools/common/ToolConstants.java
    incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/BeanGenerator.java
    incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/FaultBeanGenerator.java
    incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/Wrapper.java
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/FaultBeanGeneratorTest.java
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/WrapperBeanGeneratorTest.java
    incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/tools/common/ToolConstants.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/tools/common/ToolConstants.java?view=diff&rev=545110&r1=545109&r2=545110
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/tools/common/ToolConstants.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/tools/common/ToolConstants.java Thu
Jun  7 01:45:53 2007
@@ -199,4 +199,5 @@
 
     // Suppress the code generation, in this case you can just get the generated code model
     public static final String CFG_SUPPRESS_GEN = "suppress";
+    public static final String DEFAULT_PACKAGE_NAME = "DefaultNamespace";
 }

Modified: incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/BeanGenerator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/BeanGenerator.java?view=diff&rev=545110&r1=545109&r2=545110
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/BeanGenerator.java
(original)
+++ incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/BeanGenerator.java
Thu Jun  7 01:45:53 2007
@@ -79,21 +79,18 @@
                 generator.clearAttributes();
             }
         
-
-            if (compileToDir != null) {
                 //compile the classes
-                Compiler compiler = new Compiler();
-
-                List<String> files = new ArrayList<String>(generatedFiles.size());
-                for (File file : generatedFiles) {
-                    files.add(file.getAbsolutePath());
-                }
-                if (!compiler.compileFiles(files.toArray(new String[files.size()]),
-                                           compileToDir)) {
-                    //TODO - compile issue
-                }
+            Compiler compiler = new Compiler();
 
+            List<String> files = new ArrayList<String>(generatedFiles.size());
+            for (File file : generatedFiles) {
+                files.add(file.getAbsolutePath());
             }
+            if (!compiler.compileFiles(files.toArray(new String[files.size()]), compileToDir))
{
+                // TODO - compile issue
+            }
+
+            
             
         } catch (Exception e) {
             e.printStackTrace();

Modified: incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/FaultBeanGenerator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/FaultBeanGenerator.java?view=diff&rev=545110&r1=545109&r2=545110
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/FaultBeanGenerator.java
(original)
+++ incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/FaultBeanGenerator.java
Thu Jun  7 01:45:53 2007
@@ -29,6 +29,7 @@
 
 import org.apache.cxf.service.model.OperationInfo;
 import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.model.JavaClass;
 import org.apache.cxf.tools.java2wsdl.processor.internal.jaxws.FaultBean;
 
@@ -36,7 +37,11 @@
 public final class FaultBeanGenerator extends BeanGenerator {
 
     private String getSEIPackage(final Method method) {
-        return method.getDeclaringClass().getPackage().getName();
+        Package pkg = method.getDeclaringClass().getPackage();
+        if (pkg == null) {
+            return ToolConstants.DEFAULT_PACKAGE_NAME;
+        }
+        return pkg.getName();
     }
     
     protected Collection<JavaClass> generateBeanClasses(final ServiceInfo serviceInfo)
{

Modified: incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/Wrapper.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/Wrapper.java?view=diff&rev=545110&r1=545109&r2=545110
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/Wrapper.java
(original)
+++ incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/Wrapper.java
Thu Jun  7 01:45:53 2007
@@ -30,6 +30,7 @@
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.service.model.OperationInfo;
+import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolException;
 import org.apache.cxf.tools.common.model.JavaField;
 import org.apache.cxf.tools.java2wsdl.generator.wsdl11.annotator.WrapperBeanAnnotator;
@@ -132,7 +133,11 @@
     }
 
     protected String getPackageName(final Method m) {
-        return m.getDeclaringClass().getPackage().getName();
+        Package pkg = m.getDeclaringClass().getPackage();
+        if (pkg == null) {
+            return ToolConstants.DEFAULT_PACKAGE_NAME;
+        }
+        return pkg.getName();
     }
 
     public boolean isWrapperAbsent() {

Added: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/Hello.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/Hello.java?view=auto&rev=545110
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/Hello.java
(added)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/Hello.java
Thu Jun  7 01:45:53 2007
@@ -0,0 +1,25 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.tools.fortest;
+
+public interface Hello {
+    String sayHi(String arg);
+}
+
+

Modified: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/FaultBeanGeneratorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/FaultBeanGeneratorTest.java?view=diff&rev=545110&r1=545109&r2=545110
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/FaultBeanGeneratorTest.java
(original)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/FaultBeanGeneratorTest.java
Thu Jun  7 01:45:53 2007
@@ -34,16 +34,19 @@
 
 public class FaultBeanGeneratorTest extends ProcessorTestBase {
     JavaToProcessor processor = new JavaToProcessor();
-
+    String classPath = "";
     @Before
     public void setUp() throws Exception {
         super.setUp();
+        classPath = System.getProperty("java.class.path");
+        System.setProperty("java.class.path", getClassPath());
         processor.setEnvironment(env);
     }
 
     @After
     public void tearDown() {
-        super.tearDown();
+        //super.tearDown();
+        System.setProperty("java.class.path", classPath);
     }
     
     private ServiceInfo getServiceInfo() {
@@ -61,7 +64,7 @@
         generator.generate(output);
 
         String pkgBase = "org/apache/cxf/tools/fortest/cxf523/jaxws";
-        assertEquals(1, new File(output, pkgBase).listFiles().length);
+        assertEquals(2, new File(output, pkgBase).listFiles().length);
         File faultBeanClass = new File(output, pkgBase + "/DBServiceFaultBean.java");
         assertTrue(faultBeanClass.exists());
 
@@ -80,7 +83,7 @@
         generator.generate(output);
 
         String pkgBase = "org/apache/cxf/tools/fortest/jaxws/rpc/types";
-        assertEquals(1, new File(output, pkgBase).listFiles().length);
+        assertEquals(2, new File(output, pkgBase).listFiles().length);
         File faultBeanClass = new File(output, pkgBase + "/FaultDetail.java");
         assertTrue(faultBeanClass.exists());
 

Modified: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/WrapperBeanGeneratorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/WrapperBeanGeneratorTest.java?view=diff&rev=545110&r1=545109&r2=545110
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/WrapperBeanGeneratorTest.java
(original)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/WrapperBeanGeneratorTest.java
Thu Jun  7 01:45:53 2007
@@ -33,16 +33,20 @@
 
 public class WrapperBeanGeneratorTest extends ProcessorTestBase {
     JavaToProcessor processor = new JavaToProcessor();
+    String classPath = "";
 
     @Before
     public void setUp() throws Exception {
         super.setUp();
+        classPath = System.getProperty("java.class.path");
+        System.setProperty("java.class.path", getClassPath());
         processor.setEnvironment(env);
     }
 
     @After
     public void tearDown() {
         super.tearDown();
+        System.setProperty("java.class.path", classPath);
     }
     
     private ServiceInfo getServiceInfo() {

Modified: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java?view=diff&rev=545110&r1=545109&r2=545110
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
(original)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
Thu Jun  7 01:45:53 2007
@@ -41,17 +41,24 @@
 import org.apache.cxf.tools.wsdlto.frontend.jaxws.JAXWSContainer;
 import org.apache.cxf.wsdl.WSDLConstants;
 import org.junit.After;
+import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
 
 public class JavaToProcessorTest extends ProcessorTestBase {
     JavaToProcessor processor = new JavaToProcessor();
+    String classPath = "";
     private WSDLHelper wsdlHelper = new WSDLHelper();
-
-    @After
-    public void tearDown() {
+    @Before
+    public void startUp() throws Exception {
         env = new ToolContext();
+        classPath = System.getProperty("java.class.path");
+        System.setProperty("java.class.path", getClassPath());
+    }
+    @After
+    public void tearDown() {      
         super.tearDown();
+        System.setProperty("java.class.path", classPath);
     }
         
     @Test
@@ -273,5 +280,19 @@
         File responseWrapperClass = new File(output, pkgBase + "/AddResponse.java");
         assertTrue(requestWrapperClass.exists());
         assertTrue(responseWrapperClass.exists());
+    }
+    
+    
+    @Test
+    //test for CXF-704 and CXF-705
+    public void testHello() throws Exception {
+        env.put(ToolConstants.CFG_OUTPUTFILE, output.getPath() + "/hello.wsdl");
+        env.put(ToolConstants.CFG_CLASSNAME, "org.apache.cxf.tools.fortest.Hello");
+        processor.setEnvironment(env);
+        processor.process();
+        
+        File wsdlFile = new File(output, "hello.wsdl");
+        assertTrue("Generate Wsdl Fail", wsdlFile.exists());
+
     }
 }



Mime
View raw message