cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r545430 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/tools/common/ buildtools/src/main/resources/ tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/ tools/javato/src/test/java/ tools/javato/src/test/java/org...
Date Fri, 08 Jun 2007 06:03:30 GMT
Author: ema
Date: Thu Jun  7 23:03:29 2007
New Revision: 545430

URL: http://svn.apache.org/viewvc?view=rev&rev=545430
Log:
*Fixed the issue with java2wsdl tool , when  set classpath and call JavaToProcessor.processor()
for multi times, tool sometimes will load the wrong class

* Added a test case for generating wsdl for the class missing package declaration

Added:
    incubator/cxf/trunk/tools/javato/src/test/java/HelloNoPackage.java
Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/tools/common/ToolConstants.java
    incubator/cxf/trunk/buildtools/src/main/resources/cxf-checkstyle-suppressions.xml
    incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessor.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=545430&r1=545429&r2=545430
==============================================================================
--- 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 23:03:29 2007
@@ -199,5 +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";
+    public static final String DEFAULT_PACKAGE_NAME = "defaultnamespace";
 }

Modified: incubator/cxf/trunk/buildtools/src/main/resources/cxf-checkstyle-suppressions.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/buildtools/src/main/resources/cxf-checkstyle-suppressions.xml?view=diff&rev=545430&r1=545429&r2=545430
==============================================================================
--- incubator/cxf/trunk/buildtools/src/main/resources/cxf-checkstyle-suppressions.xml (original)
+++ incubator/cxf/trunk/buildtools/src/main/resources/cxf-checkstyle-suppressions.xml Thu
Jun  7 23:03:29 2007
@@ -24,4 +24,5 @@
     <suppress checks=".*"
               files=".+[\\\/]generated[\\\/].+\.java"
               />
+    <suppress checks=".*" files="HelloNoPackage.java"/>
 </suppressions>

Modified: incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessor.java?view=diff&rev=545430&r1=545429&r2=545430
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessor.java
(original)
+++ incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessor.java
Thu Jun  7 23:03:29 2007
@@ -73,6 +73,11 @@
     }
     
     public void process() throws ToolException {
+        String oldClassPath = System.getProperty("java.class.path");
+        if (context.get(ToolConstants.CFG_CLASSPATH) != null) {
+            String newCp = (String)context.get(ToolConstants.CFG_CLASSPATH);
+            System.setProperty("java.class.path", newCp + File.pathSeparator + oldClassPath);
+        }
         ServiceBuilder builder = getServiceBuilder();
         ServiceInfo service = builder.build();
 
@@ -88,6 +93,7 @@
         generators.add(getFaultBeanGenerator());
         
         generate(service, outputDir);
+        System.setProperty("java.class.path", oldClassPath);
     }
 
     private AbstractGenerator getWrapperBeanGenerator() {
@@ -123,7 +129,7 @@
     }
 
     public ServiceBuilder getServiceBuilder() throws ToolException {
-        init();
+        
         ServiceBuilderFactory builderFactory = ServiceBuilderFactory.getInstance();
         builderFactory.setServiceClass(getServiceClass());
         // TODO check if user specify the style from cli arguments
@@ -251,14 +257,6 @@
 
     public ToolContext getEnvironment() {
         return this.context;
-    }
-
-    protected void init() {
-        if (context.get(ToolConstants.CFG_CLASSPATH) != null) {
-            String newCp = (String)context.get(ToolConstants.CFG_CLASSPATH);
-            String classpath = System.getProperty("java.class.path");
-            System.setProperty("java.class.path", newCp + File.pathSeparator + classpath);
-        }
     }
 
 }

Added: incubator/cxf/trunk/tools/javato/src/test/java/HelloNoPackage.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/HelloNoPackage.java?view=auto&rev=545430
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/HelloNoPackage.java (added)
+++ incubator/cxf/trunk/tools/javato/src/test/java/HelloNoPackage.java Thu Jun  7 23:03:29
2007
@@ -0,0 +1,21 @@
+/**
+ * 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.
+ */
+public interface HelloNoPackage {
+    String sayHi(String arg);
+}

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=545430&r1=545429&r2=545430
==============================================================================
--- 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 23:03:29 2007
@@ -270,4 +270,22 @@
         assertTrue("Generate Wsdl Fail", wsdlFile.exists());
 
     }
+    
+    public void testHelloNoPackage() throws Exception {
+        env.put(ToolConstants.CFG_OUTPUTFILE, output.getPath() + "/hello-no-package.wsdl");
+        env.put(ToolConstants.CFG_CLASSNAME, "HelloNoPackage");
+        processor.setEnvironment(env);
+        processor.process();
+        
+        File wsdlFile = new File(output, "hello-no-package.wsdl");
+        assertTrue("Generate Wsdl Fail", wsdlFile.exists());
+        
+        
+        String pkgBase = "defaultnamespace";
+        File requestWrapperClass = new File(output, pkgBase + "/SayHi.java");
+        File responseWrapperClass = new File(output, pkgBase + "/SayHiResponse.java");
+        assertTrue(requestWrapperClass.exists());
+        assertTrue(responseWrapperClass.exists());
+    }
+    
 }



Mime
View raw message