You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2012/01/03 12:52:11 UTC

svn commit: r1226748 - in /axis/axis1/java/trunk: axis-maven-plugin/src/main/java/org/apache/axis/maven/ integration/ integration/src/test/wsdl/_import/ test/wsdl/_import/

Author: veithen
Date: Tue Jan  3 11:52:10 2012
New Revision: 1226748

URL: http://svn.apache.org/viewvc?rev=1226748&view=rev
Log:
Mavenized test/wsdl/_import.

Added:
    axis/axis1/java/trunk/integration/src/test/wsdl/_import/
      - copied from r1226740, axis/axis1/java/trunk/test/wsdl/_import/
Removed:
    axis/axis1/java/trunk/integration/src/test/wsdl/_import/build.xml
    axis/axis1/java/trunk/test/wsdl/_import/
Modified:
    axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/axis/maven/AbstractWsdl2JavaMojo.java
    axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/axis/maven/Wsdl2JavaMojo.java
    axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/axis/maven/Wsdl2JavaTestMojo.java
    axis/axis1/java/trunk/integration/pom.xml

Modified: axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/axis/maven/AbstractWsdl2JavaMojo.java
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/axis/maven/AbstractWsdl2JavaMojo.java?rev=1226748&r1=1226747&r2=1226748&view=diff
==============================================================================
--- axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/axis/maven/AbstractWsdl2JavaMojo.java (original)
+++ axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/axis/maven/AbstractWsdl2JavaMojo.java Tue Jan  3 11:52:10 2012
@@ -147,12 +147,6 @@ public abstract class AbstractWsdl2JavaM
         emitter.setOutputDir(output.getAbsolutePath());
         emitter.setServerSide(serverSide);
         emitter.setSkeletonWanted(skeleton);
-        // In a Maven build, generated sources are always written to a directory other than
-        // the source directory. By default, the emitter would generate an empty implementation
-        // because it doesn't see the implementation provided by the developer. We don't want this
-        // because these two classes would collide. Therefore implementationWanted is hardcoded
-        // to false:
-        emitter.setImplementationWanted(false);
 //        emitter.setVerbose(verbose);
 //        emitter.setDebug(debug);
 //        emitter.setQuiet(quiet);
@@ -177,7 +171,9 @@ public abstract class AbstractWsdl2JavaM
 //                    Project.MSG_VERBOSE);
 //            ClassUtils.setDefaultClassLoader(cl);
 //        }
-
+        
+        configureEmitter(emitter);
+        
         try {
             emitter.run(wsdlUrl);
         } catch (Exception ex) {
@@ -187,5 +183,6 @@ public abstract class AbstractWsdl2JavaM
         addSourceRoot(project, output.getAbsolutePath());
     }
     
+    protected abstract void configureEmitter(Emitter emitter);
     protected abstract void addSourceRoot(MavenProject project, String path);
 }

Modified: axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/axis/maven/Wsdl2JavaMojo.java
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/axis/maven/Wsdl2JavaMojo.java?rev=1226748&r1=1226747&r2=1226748&view=diff
==============================================================================
--- axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/axis/maven/Wsdl2JavaMojo.java (original)
+++ axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/axis/maven/Wsdl2JavaMojo.java Tue Jan  3 11:52:10 2012
@@ -18,6 +18,7 @@
  */
 package org.apache.axis.maven;
 
+import org.apache.axis.wsdl.toJava.Emitter;
 import org.apache.maven.project.MavenProject;
 
 /**
@@ -27,6 +28,15 @@ import org.apache.maven.project.MavenPro
  * @phase generate-sources
  */
 public class Wsdl2JavaMojo extends AbstractWsdl2JavaMojo {
+    protected void configureEmitter(Emitter emitter) {
+        // In a Maven build, generated sources are always written to a directory other than
+        // the source directory. By default, the emitter would generate an empty implementation
+        // because it doesn't see the implementation provided by the developer. We don't want this
+        // because these two classes would collide. Therefore implementationWanted is hardcoded
+        // to false:
+        emitter.setImplementationWanted(false);
+    }
+
     protected void addSourceRoot(MavenProject project, String path) {
         project.addCompileSourceRoot(path);
     }

Modified: axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/axis/maven/Wsdl2JavaTestMojo.java
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/axis/maven/Wsdl2JavaTestMojo.java?rev=1226748&r1=1226747&r2=1226748&view=diff
==============================================================================
--- axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/axis/maven/Wsdl2JavaTestMojo.java (original)
+++ axis/axis1/java/trunk/axis-maven-plugin/src/main/java/org/apache/axis/maven/Wsdl2JavaTestMojo.java Tue Jan  3 11:52:10 2012
@@ -18,6 +18,7 @@
  */
 package org.apache.axis.maven;
 
+import org.apache.axis.wsdl.toJava.Emitter;
 import org.apache.maven.project.MavenProject;
 
 /**
@@ -27,6 +28,25 @@ import org.apache.maven.project.MavenPro
  * @phase generate-test-sources
  */
 public class Wsdl2JavaTestMojo extends AbstractWsdl2JavaMojo {
+    /**
+     * Flag indicating whether a default (empty) implementation should be generated.
+     * 
+     * @parameter default-value="false"
+     */
+    private boolean implementation;
+    
+    /**
+     * Flag indicating whether a basic unit test should be generated.
+     * 
+     * @parameter default-value="false"
+     */
+    private boolean testCase;
+    
+    protected void configureEmitter(Emitter emitter) {
+        emitter.setImplementationWanted(implementation);
+        emitter.setTestCaseWanted(testCase);
+    }
+
     protected void addSourceRoot(MavenProject project, String path) {
         project.addTestCompileSourceRoot(path);
     }

Modified: axis/axis1/java/trunk/integration/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis1/java/trunk/integration/pom.xml?rev=1226748&r1=1226747&r2=1226748&view=diff
==============================================================================
--- axis/axis1/java/trunk/integration/pom.xml (original)
+++ axis/axis1/java/trunk/integration/pom.xml Tue Jan  3 11:52:10 2012
@@ -90,6 +90,96 @@
                             </mappings>
                         </configuration>
                     </execution>
+                    <!-- Import Test 1:  some namespace->package mappings from the -->
+                    <!--                 command line, some generated, some from   -->
+                    <!--                 NStoPkg.properties.                       -->
+                    <execution>
+                        <id>_import-1</id>
+                        <goals>
+                            <goal>wsdl2java-test</goal>
+                        </goals>
+                        <configuration>
+                            <file>src/test/wsdl/_import/Import.wsdl</file>
+                            <serverSide>true</serverSide>
+                            <skeleton>true</skeleton>
+                            <implementation>true</implementation>
+                            <testCase>true</testCase>
+                            <mappings>
+                                <mapping>
+                                    <namespace>urn:import</namespace>
+                                    <package>test.wsdl.import</package>
+                                </mapping>
+                                <mapping>
+                                    <namespace>urn:importBinding1</namespace>
+                                    <package>test.wsdl.import.binding1</package>
+                                </mapping>
+                                <mapping>
+                                    <namespace>urn:importBinding2</namespace>
+                                    <package>test.wsdl.import.binding2</package>
+                                </mapping>
+                            </mappings>
+                        </configuration>
+                    </execution>
+                    <!-- Import Test 2:  all namespace->package mappings from the -->
+                    <!--                 command line.                            -->
+                    <execution>
+                        <id>_import-2</id>
+                        <goals>
+                            <goal>wsdl2java-test</goal>
+                        </goals>
+                        <configuration>
+                            <file>src/test/wsdl/_import/Import.wsdl</file>
+                            <serverSide>true</serverSide>
+                            <skeleton>true</skeleton>
+                            <implementation>true</implementation>
+                            <testCase>true</testCase>
+                            <mappings>
+                                <mapping>
+                                    <namespace>urn:import</namespace>
+                                    <package>test.import2</package>
+                                </mapping>
+                                <mapping>
+                                    <namespace>urn:importBinding1</namespace>
+                                    <package>test.import2.binding1</package>
+                                </mapping>
+                                <mapping>
+                                    <namespace>urn:importBinding2</namespace>
+                                    <package>test.import2.binding2</package>
+                                </mapping>
+                                <mapping>
+                                    <namespace>urn:types.import.test</namespace>
+                                    <package>test.import2.types</package>
+                                </mapping>
+                                <mapping>
+                                    <namespace>urn:iface.import.test</namespace>
+                                    <package>test.import2.iface</package>
+                                </mapping>
+                                <mapping>
+                                    <namespace>urn:messages.import.test</namespace>
+                                    <package>test.import2.messages</package>
+                                </mapping>
+                            </mappings>
+                        </configuration>
+                    </execution>
+                    <!-- Import Test 3:  all namespace->package mappings from the -->
+                    <!--                 command line.  Make sure an xsd:import   -->
+                    <!--                 statement inside a schema inside a type  -->
+                    <!--                 works properly.                          -->
+                    <execution>
+                        <id>_import-3</id>
+                        <goals>
+                            <goal>wsdl2java-test</goal>
+                        </goals>
+                        <configuration>
+                            <file>src/test/wsdl/_import/ImportMessagesXSDImport.wsdl</file>
+                            <mappings>
+                                <mapping>
+                                    <namespace>urn:types.import.test</namespace>
+                                    <package>test.import.test3</package>
+                                </mapping>
+                            </mappings>
+                        </configuration>
+                    </execution>
                     <execution>
                         <id>wrapped</id>
                         <goals>
@@ -173,7 +263,7 @@
                         </goals>
                         <configuration>
                             <includes>
-                                <include>test/wsdl/**/*TestCase.java</include>
+                                <include>**/*TestCase.java</include>
                             </includes>
                         </configuration>
                     </execution>