You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by oc...@apache.org on 2006/05/24 08:53:38 UTC
svn commit: r409081 - in /maven/plugins/trunk/maven-javadoc-plugin/src:
main/java/org/apache/maven/plugin/javadoc/
test/java/org/apache/maven/plugin/javadoc/
test/java/org/apache/maven/plugin/javadoc/stubs/
test/resources/unit/custom-configuration/ tes...
Author: oching
Date: Tue May 23 23:53:37 2006
New Revision: 409081
URL: http://svn.apache.org/viewvc?rev=409081&view=rev
Log:
PR: MJAVADOC-68
Revised the quotedPathArgument method to accomodate the paths that contain quotes. Created additional testing for the changes made.
Added:
maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/stubs/QuotedPathMavenProjectStub.java
maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/custom-configuration/custom/configuration/exclude1/
maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/custom-configuration/custom/configuration/exclude1/Exclude1App.java
maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/custom-configuration/custom/configuration/exclude1/subexclude/
maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/custom-configuration/custom/configuration/exclude1/subexclude/SubexcludeApp.java
maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/custom-configuration/custom/configuration/exclude2/
maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/custom-configuration/custom/configuration/exclude2/Exclude2App.java
maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/quotedpath'test/
maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/quotedpath'test/quotedpath/
maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/quotedpath'test/quotedpath-test-plugin-config.xml
maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/quotedpath'test/quotedpath/test/
maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/quotedpath'test/quotedpath/test/App.java
maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/quotedpath'test/quotedpath/test/AppSample.java
Modified:
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java
maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/JavadocReportTest.java
maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/stubs/CustomConfigurationMavenProjectStub.java
maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/custom-configuration/custom-configuration-plugin-config.xml
Modified: maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java?rev=409081&r1=409080&r2=409081&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java Tue May 23 23:53:37 2006
@@ -1424,10 +1424,30 @@
private String quotedPathArgument( String value )
{
String path = value;
+
if ( !StringUtils.isEmpty( path ) )
{
- path = "'" + path.replace( '\\', '/' ) + "'";
+ path = path.replace( '\\', '/' );
+ if( path.indexOf( "\'" ) != -1 )
+ {
+ String split[] = path.split( "\'" );
+ path = "";
+
+ for( int i = 0; i < split.length; i++ )
+ {
+ if( i != split.length - 1)
+ {
+ path = path + split[i] + "\\'";
+ }
+ else
+ {
+ path = path + split[i];
+ }
+ }
+ }
+ path = "'" + path + "'";
}
+
return path;
}
Modified: maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/JavadocReportTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/JavadocReportTest.java?rev=409081&r1=409080&r2=409081&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/JavadocReportTest.java (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/JavadocReportTest.java Tue May 23 23:53:37 2006
@@ -265,6 +265,20 @@
//nohelp == true
assertTrue( str.toUpperCase().indexOf( "/help-doc.html".toUpperCase() ) == -1 );
+
+ //check the wildcard (*) package exclusions -- excludePackageNames parameter
+ generatedFile = new File( getBasedir(),
+ "target/test/unit/custom-configuration/target/site/apidocs/custom/configuration/exclude1/Exclude1App.html" );
+ assertTrue( FileUtils.fileExists( generatedFile.getAbsolutePath() ) );
+
+ generatedFile = new File( getBasedir(),
+ "target/test/unit/custom-configuration/target/site/apidocs/custom/configuration/exclude1/subexclude/SubexcludeApp.html" );
+ assertTrue( !FileUtils.fileExists( generatedFile.getAbsolutePath() ) );
+
+ generatedFile = new File( getBasedir(),
+ "target/test/unit/custom-configuration/target/site/apidocs/custom/configuration/exclude2/Exclude2App.html" );
+ assertTrue( !FileUtils.fileExists( generatedFile.getAbsolutePath() ) );
+
}
/**
@@ -332,6 +346,51 @@
generatedFile = new File( getBasedir(),
"target/test/unit/aggregate-test/target/site/apidocs/aggregate/test/project2/Project2Test.html" );
+ assertTrue( FileUtils.fileExists( generatedFile.getAbsolutePath() ) );
+
+ }
+
+ /**
+ * Method to test when the path to the project sources has an apostrophe (')
+ *
+ * @throws Exception
+ */
+ public void testQuotedPath()
+ throws Exception
+ {
+ File testPom =
+ new File( getBasedir(), "src/test/resources/unit/quotedpath'test/quotedpath-test-plugin-config.xml" );
+ JavadocReport mojo = (JavadocReport) lookupMojo( "javadoc", testPom );
+ mojo.execute();
+
+ //package level generated javadoc files
+ File generatedFile = new File( getBasedir(),
+ "target/test/unit/quotedpath'test/target/site/apidocs/quotedpath/test/App.html" );
+ assertTrue( FileUtils.fileExists( generatedFile.getAbsolutePath() ) );
+
+ generatedFile = new File( getBasedir(),
+ "target/test/unit/quotedpath'test/target/site/apidocs/quotedpath/test/AppSample.html" );
+ assertTrue( FileUtils.fileExists( generatedFile.getAbsolutePath() ) );
+
+ //project level generated javadoc files
+ generatedFile =
+ new File( getBasedir(), "target/test/unit/quotedpath'test/target/site/apidocs/index-all.html" );
+ assertTrue( FileUtils.fileExists( generatedFile.getAbsolutePath() ) );
+
+ generatedFile =
+ new File( getBasedir(), "target/test/unit/quotedpath'test/target/site/apidocs/index.html" );
+ assertTrue( FileUtils.fileExists( generatedFile.getAbsolutePath() ) );
+
+ generatedFile =
+ new File( getBasedir(), "target/test/unit/quotedpath'test/target/site/apidocs/overview-tree.html" );
+ assertTrue( FileUtils.fileExists( generatedFile.getAbsolutePath() ) );
+
+ generatedFile =
+ new File( getBasedir(), "target/test/unit/quotedpath'test/target/site/apidocs/package-list" );
+ assertTrue( FileUtils.fileExists( generatedFile.getAbsolutePath() ) );
+
+ generatedFile =
+ new File( getBasedir(), "target/test/unit/quotedpath'test/target/site/apidocs/stylesheet.css" );
assertTrue( FileUtils.fileExists( generatedFile.getAbsolutePath() ) );
}
Modified: maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/stubs/CustomConfigurationMavenProjectStub.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/stubs/CustomConfigurationMavenProjectStub.java?rev=409081&r1=409080&r2=409081&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/stubs/CustomConfigurationMavenProjectStub.java (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/stubs/CustomConfigurationMavenProjectStub.java Tue May 23 23:53:37 2006
@@ -60,7 +60,13 @@
String basedir = getBasedir().getAbsolutePath();
List compileSourceRoots = new ArrayList();
- compileSourceRoots.add( basedir + "/src/test/resources/unit/custom-configuration/custom/configuration" );
+ String temp = basedir + "/src/test/resources/unit/custom-configuration";
+ if( !temp.startsWith( "/" ) )
+ {
+ temp = temp.replace( '/', '\\' );
+ }
+
+ compileSourceRoots.add( temp );
setCompileSourceRoots( compileSourceRoots );
MavenXpp3Reader pomReader = new MavenXpp3Reader();
Added: maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/stubs/QuotedPathMavenProjectStub.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/stubs/QuotedPathMavenProjectStub.java?rev=409081&view=auto
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/stubs/QuotedPathMavenProjectStub.java (added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/stubs/QuotedPathMavenProjectStub.java Tue May 23 23:53:37 2006
@@ -0,0 +1,98 @@
+package org.apache.maven.plugin.javadoc.stubs;
+
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed 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.
+*/
+
+import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
+import org.apache.maven.model.Scm;
+import org.apache.maven.model.Build;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.io.FileReader;
+import java.io.File;
+
+/**
+ * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
+ */
+public class QuotedPathMavenProjectStub
+ extends MavenProjectStub
+{
+ private Scm scm;
+
+ private Build build;
+
+ public QuotedPathMavenProjectStub()
+ {
+ setGroupId( "quotedpath.test" );
+ setArtifactId( "quotedpath-test" );
+ setVersion( "1.0-SNAPSHOT" );
+ setName( "Maven Javadoc Plugin Quoted Path Test" );
+ setUrl( "http://maven.apache.org" );
+ setPackaging( "jar" );
+
+ Scm scm = new Scm();
+ scm.setConnection( "scm:svn:http://svn.apache.org/maven/sample/trunk" );
+ setScm( scm );
+
+ Build build = new Build();
+ build.setFinalName( "quotedpath-test" );
+ build.setDirectory( getBasedir() + "/target/test/unit/quotedpath'test/target" );
+ setBuild( build );
+
+ String basedir = getBasedir().getAbsolutePath();
+ List compileSourceRoots = new ArrayList();
+ compileSourceRoots.add( basedir + "/src/test/resources/unit/quotedpath'test/quotedpath/test" );
+ setCompileSourceRoots( compileSourceRoots );
+
+ MavenXpp3Reader pomReader = new MavenXpp3Reader();
+
+ try
+ {
+ Model model = pomReader.read( new FileReader( new File( getBasedir() +
+ "/src/test/resources/unit/quotedpath'test/quotedpath-test-plugin-config.xml" ) ) );
+ setModel( model );
+ }
+ catch ( Exception e )
+ {
+
+ }
+ }
+
+ public Scm getScm()
+ {
+ return scm;
+ }
+
+ public void setScm( Scm scm )
+ {
+ this.scm = scm;
+ }
+
+ public Build getBuild()
+ {
+ return build;
+ }
+
+ public void setBuild( Build build )
+ {
+ this.build = build;
+ }
+
+
+}
Modified: maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/custom-configuration/custom-configuration-plugin-config.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/custom-configuration/custom-configuration-plugin-config.xml?rev=409081&r1=409080&r2=409081&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/custom-configuration/custom-configuration-plugin-config.xml (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/custom-configuration/custom-configuration-plugin-config.xml Tue May 23 23:53:37 2006
@@ -79,6 +79,7 @@
<footer>MAVEN JAVADOC PLUGIN TEST FOOTER</footer>
<locale>en_US</locale>
<isOffline>true</isOffline>
+ <excludePackageNames>*.exclude2:custom.configuration.exclude1.*</excludePackageNames>
</configuration>
</plugin>
</plugins>
Added: maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/custom-configuration/custom/configuration/exclude1/Exclude1App.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/custom-configuration/custom/configuration/exclude1/Exclude1App.java?rev=409081&view=auto
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/custom-configuration/custom/configuration/exclude1/Exclude1App.java (added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/custom-configuration/custom/configuration/exclude1/Exclude1App.java Tue May 23 23:53:37 2006
@@ -0,0 +1,28 @@
+package custom.configuration.exclude1;
+
+/**
+ * Sample method
+ */
+public class Exclude1App
+{
+ /**
+ * Main method
+ *
+ * @param args argument string
+ */
+ public static void main( String[] args )
+ {
+ System.out.println( "Sample Application." );
+ }
+
+ /**
+ * Sample method with javadoc
+ *
+ * @param str
+ */
+ protected void sampleMethod( String str )
+ {
+ System.out.println( str );
+ }
+
+}
\ No newline at end of file
Added: maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/custom-configuration/custom/configuration/exclude1/subexclude/SubexcludeApp.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/custom-configuration/custom/configuration/exclude1/subexclude/SubexcludeApp.java?rev=409081&view=auto
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/custom-configuration/custom/configuration/exclude1/subexclude/SubexcludeApp.java (added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/custom-configuration/custom/configuration/exclude1/subexclude/SubexcludeApp.java Tue May 23 23:53:37 2006
@@ -0,0 +1,24 @@
+package custom.configuration.exclude1.subexclude;
+
+/**
+ * Sample class
+ */
+public class SubexcludeApp
+{
+ /**
+ * Main method
+ *
+ * @param args
+ */
+ public static void main( String[] args )
+ {
+ System.out.println( "Sample Application." );
+ }
+
+
+ protected void sampleMethod( String str )
+ {
+ System.out.println( str );
+ }
+
+}
\ No newline at end of file
Added: maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/custom-configuration/custom/configuration/exclude2/Exclude2App.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/custom-configuration/custom/configuration/exclude2/Exclude2App.java?rev=409081&view=auto
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/custom-configuration/custom/configuration/exclude2/Exclude2App.java (added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/custom-configuration/custom/configuration/exclude2/Exclude2App.java Tue May 23 23:53:37 2006
@@ -0,0 +1,20 @@
+package custom.configuration.exclude2;
+
+/**
+ * Sample class
+ */
+public class Exclude2App
+{
+
+ public static void main( String[] args )
+ {
+ System.out.println( "Sample Application." );
+ }
+
+
+ protected void sampleMethod( String str )
+ {
+ System.out.println( str );
+ }
+
+}
\ No newline at end of file
Added: maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/quotedpath'test/quotedpath-test-plugin-config.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/quotedpath%27test/quotedpath-test-plugin-config.xml?rev=409081&view=auto
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/quotedpath'test/quotedpath-test-plugin-config.xml (added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/quotedpath'test/quotedpath-test-plugin-config.xml Tue May 23 23:53:37 2006
@@ -0,0 +1,55 @@
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>quotedpath.test</groupId>
+ <artifactId>quotedpath-test</artifactId>
+ <packaging>jar</packaging>
+ <version>1.0-SNAPSHOT</version>
+ <inceptionYear>2006</inceptionYear>
+ <name>Maven Javadoc Plugin Quoted Path Test</name>
+ <url>http://maven.apache.org</url>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <project implementation="org.apache.maven.plugin.javadoc.stubs.QuotedPathMavenProjectStub"/>
+ <localRepository>${localRepository}</localRepository>
+ <outputDirectory>${basedir}/target/test/unit/quotedpath'test/target/site/apidocs</outputDirectory>
+ <breakiterator>false</breakiterator>
+ <old>false</old>
+ <show>protected</show>
+ <quiet>false</quiet>
+ <verbose>false</verbose>
+ <author>true</author>
+ <charset>ISO-8859-1</charset>
+ <docfilessubdirs>false</docfilessubdirs>
+ <linksource>false</linksource>
+ <nocomment>false</nocomment>
+ <nodeprecated>false</nodeprecated>
+ <nodeprecatedlist>false</nodeprecatedlist>
+ <nohelp>false</nohelp>
+ <noindex>false</noindex>
+ <nonavbar>false</nonavbar>
+ <nosince>false</nosince>
+ <notree>false</notree>
+ <serialwarn>false</serialwarn>
+ <splitindex>false</splitindex>
+ <stylesheet>java</stylesheet>
+ <groups>
+ <group/>
+ </groups>
+ <tags>
+ <tag/>
+ </tags>
+ <use>true</use>
+ <version>true</version>
+ <windowtitle>Maven Javadoc Plugin Quoted Path Test 1.0-SNAPSHOT API</windowtitle>
+ <links>
+ <param>http://java.sun.com/j2se/1.4.2/docs/api</param>
+ </links>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/quotedpath'test/quotedpath/test/App.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/quotedpath%27test/quotedpath/test/App.java?rev=409081&view=auto
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/quotedpath'test/quotedpath/test/App.java (added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/quotedpath'test/quotedpath/test/App.java Tue May 23 23:53:37 2006
@@ -0,0 +1,17 @@
+package quotedpath.test;
+
+public class App
+{
+
+ public static void main( String[] args )
+ {
+ System.out.println( "Sample Application." );
+ }
+
+
+ protected void sampleMethod( String str )
+ {
+ System.out.println( str );
+ }
+
+}
\ No newline at end of file
Added: maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/quotedpath'test/quotedpath/test/AppSample.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/quotedpath%27test/quotedpath/test/AppSample.java?rev=409081&view=auto
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/quotedpath'test/quotedpath/test/AppSample.java (added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/quotedpath'test/quotedpath/test/AppSample.java Tue May 23 23:53:37 2006
@@ -0,0 +1,20 @@
+package quotedpath.test;
+
+/**
+ * @author Maria Odea Ching
+ * @since 1.4
+ * @version %I%, %G%
+ */
+public class AppSample
+{
+
+ /**
+ * The main method
+ *
+ * @param args an array of strings that contains the arguments
+ */
+ public static void main( String[] args )
+ {
+ System.out.println( "Another Sample Application" );
+ }
+}
\ No newline at end of file