diff --git a/maven-plugin-tools-javadoc/pom.xml b/maven-plugin-tools-javadoc/pom.xml
index ce463fc..3bf53f6 100644
--- a/maven-plugin-tools-javadoc/pom.xml
+++ b/maven-plugin-tools-javadoc/pom.xml
@@ -54,8 +54,8 @@
java.vendor
Sun Microsystems Inc.
-
-
+
+
com.sun
@@ -63,106 +63,41 @@
1.4.2
system
${java.home}/../lib/tools.jar
-
-
-
-
- unit-tests
-
-
- maven.test.skip
- !true
-
-
-
-
-
- org.apache.maven.plugins
- maven-javadoc-plugin
- 2.3
- test
-
-
- org.apache.maven.plugin-testing
- maven-plugin-testing-harness
- test
-
-
- org.codehaus.plexus
- plexus-container-default
- test
-
+
+
+ run-its
- org.apache.maven.plugins
- maven-antrun-plugin
- 1.1
-
-
- it-test
- process-test-resources
-
- run
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-jar-plugin
-
-
- it-test
- process-test-classes
-
- jar
-
-
- ${project.build.finalName}-it
-
-
-
-
-
- org.apache.maven.plugins
- maven-install-plugin
- 2.2
+ maven-invoker-plugin
+ 1.3
+
+ true
+ ${project.build.directory}/it
+ setup.bsh
+ verify.bsh
+ ${project.build.directory}/local-repo
+ src/it/settings.xml
+ true
+
+ clean
+ javadoc:javadoc
+
+
- it-test
- process-test-classes
+ integration-test
- install-file
+ install
+ run
-
- ${project.build.directory}/${project.build.finalName}-it.jar
- ${project.groupId}
- ${project.artifactId}
- ${project.version}
- ${project.packaging}
- ${basedir}/pom.xml
- true
- ${project.build.directory}/local-repo
- it-local-repo
-
-
+
diff --git a/maven-plugin-tools-javadoc/src/test/resources/unit/javadoc/javadoc-plugin-config.xml b/maven-plugin-tools-javadoc/src/it/basic/pom.xml
similarity index 90%
rename from maven-plugin-tools-javadoc/src/test/resources/unit/javadoc/javadoc-plugin-config.xml
rename to maven-plugin-tools-javadoc/src/it/basic/pom.xml
index d3cd9d6..6b421b5 100644
--- a/maven-plugin-tools-javadoc/src/test/resources/unit/javadoc/javadoc-plugin-config.xml
+++ b/maven-plugin-tools-javadoc/src/it/basic/pom.xml
@@ -9,7 +9,7 @@ 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
+ 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
@@ -24,8 +24,9 @@ under the License.
org.apache.maven.tools.plugin.javadoc
test
- jar
1.0-SNAPSHOT
+ jar
+
2008
Test Mojo Tags
@@ -35,12 +36,6 @@ under the License.
maven-plugin-api
2.0
-
- junit
- junit
- 3.8.1
- test
-
@@ -50,9 +45,7 @@ under the License.
maven-javadoc-plugin
2.3
-
- ${localRepository}
- ${basedir}/target/test/unit/javadoc/target/site/apidocs
+ ${basedir}/target/site/apidocs
true
private
diff --git a/maven-plugin-tools-javadoc/src/test/resources/unit/javadoc/src/main/java/org/apache/maven/plugin/my/MyMojo.java b/maven-plugin-tools-javadoc/src/it/basic/src/main/java/org/apache/maven/plugin/my/MyMojo.java
similarity index 100%
rename from maven-plugin-tools-javadoc/src/test/resources/unit/javadoc/src/main/java/org/apache/maven/plugin/my/MyMojo.java
rename to maven-plugin-tools-javadoc/src/it/basic/src/main/java/org/apache/maven/plugin/my/MyMojo.java
diff --git a/maven-plugin-tools-javadoc/src/it/basic/verify.bsh b/maven-plugin-tools-javadoc/src/it/basic/verify.bsh
new file mode 100644
index 0000000..1674d2e
--- /dev/null
+++ b/maven-plugin-tools-javadoc/src/it/basic/verify.bsh
@@ -0,0 +1,66 @@
+import java.io.*;
+import java.util.*;
+import java.util.regex.*;
+
+import org.apache.maven.tools.plugin.javadoc.*;
+
+import org.codehaus.plexus.util.*;
+
+setAccessibility( true );
+
+File docsDir = new File( basedir, "target/site/apidocs" );
+System.out.println( "Checking for existence of: " + docsDir );
+if ( !docsDir.exists() )
+{
+ throw new FileNotFoundException( docsDir + " was not created" );
+}
+
+File docFile = new File( docsDir, "org/apache/maven/plugin/my/MyMojo.html" );
+System.out.println( "Checking for existence of: " + docFile );
+if ( !docFile.isFile() )
+{
+ throw new FileNotFoundException( docFile + " was not created" );
+}
+
+String html = FileUtils.fileRead( docFile, "ISO-8859-1").replaceAll( "(\r\n)|(\r)|(\n)", "" );
+
+System.out.println( "Checking for documentation of mojo type" );
+String mojoType = "- " + MojoAggregatorTypeTaglet.HEADER + "
- "
+ + MojoConfiguratorTypeTaglet.HEADER + ":
- roleHint
- " + MojoExecuteTypeTaglet.HEADER
+ + ":
- phase:
- validate
"
+ + "- lifecycle:
- default
- " + MojoExecutionStrategyTypeTaglet.HEADER
+ + ":
- always
" + "- " + MojoGoalTypeTaglet.HEADER + ":
- touch
"
+ + "- " + MojoInheritByDefaultTypeTaglet.HEADER + ":
- true
- "
+ + MojoInstantiationStrategyTypeTaglet.HEADER + ":
- per-lookup
- "
+ + MojoPhaseTypeTaglet.HEADER + ":
- phaseName
- "
+ + MojoRequiresDependencyResolutionTypeTaglet.HEADER + ":
- compile
- "
+ + MojoRequiresDirectInvocationTypeTaglet.HEADER + ":
- false
- "
+ + MojoRequiresOnLineTypeTaglet.HEADER + ":
- true
- "
+ + MojoRequiresProjectTypeTaglet.HEADER + ":
- true
- "
+ + MojoRequiresReportsTypeTaglet.HEADER + ":
- false
";
+if ( html.toLowerCase( Locale.ENGLISH ).indexOf( ( mojoType ).toLowerCase( Locale.ENGLISH ) ) < 0 )
+{
+ throw new IllegalStateException( "Mojo type doc wrong" );
+}
+
+System.out.println( "Checking for documentation of mojo fields" );
+String mojoField = "- " + MojoParameterFieldTaglet.HEADER
+ + ":
- default-value:
"
+ + "- value
- expression:
- ${project.build.directory}
- alias:"
+ + "
- myAlias
- " + MojoReadOnlyFieldTaglet.HEADER + "
- "
+ + MojoRequiredFieldTaglet.HEADER + "
- " + "
";
+if ( html.toLowerCase( Locale.ENGLISH ).indexOf( ( mojoField ).toLowerCase( Locale.ENGLISH ) ) < 0 )
+{
+ throw new IllegalStateException( "Mojo field doc wrong" );
+}
+
+mojoField = "- " + MojoComponentFieldTaglet.HEADER + ":
- role:"
+ + "
- org.apacha.maven.MyComponent
- roleHint:
- default
"
+ + "- " + MojoReadOnlyFieldTaglet.HEADER + "
- " + MojoRequiredFieldTaglet.HEADER
+ + "
- " + "
";
+if ( html.toLowerCase( Locale.ENGLISH ).indexOf( ( mojoField ).toLowerCase( Locale.ENGLISH ) ) < 0 )
+{
+ throw new IllegalStateException( "Mojo field doc wrong" );
+}
+
+return true;
diff --git a/maven-plugin-tools-javadoc/src/it/settings.xml b/maven-plugin-tools-javadoc/src/it/settings.xml
new file mode 100644
index 0000000..68f23d0
--- /dev/null
+++ b/maven-plugin-tools-javadoc/src/it/settings.xml
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+ it-repo
+
+ true
+
+
+
+ local.central
+ @localRepositoryUrl@
+
+ true
+
+
+ true
+
+
+
+ apache.snapshots
+ Apache Snapshot Repository
+ http://people.apache.org/repo/m2-snapshot-repository
+
+ false
+
+
+ true
+
+
+
+
+
+ local.central
+ @localRepositoryUrl@
+
+ true
+
+
+ true
+
+
+
+
+
+
diff --git a/maven-plugin-tools-javadoc/src/test/java/org/apache/maven/tools/plugin/javadoc/JavadocReportTest.java b/maven-plugin-tools-javadoc/src/test/java/org/apache/maven/tools/plugin/javadoc/JavadocReportTest.java
deleted file mode 100644
index cd376c2..0000000
--- a/maven-plugin-tools-javadoc/src/test/java/org/apache/maven/tools/plugin/javadoc/JavadocReportTest.java
+++ /dev/null
@@ -1,165 +0,0 @@
-package org.apache.maven.tools.plugin.javadoc;
-
-/*
- * 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.
- */
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.Collections;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.DefaultArtifactRepository;
-import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
-import org.apache.maven.artifact.resolver.ArtifactResolver;
-import org.apache.maven.plugin.javadoc.JavadocReport;
-import org.apache.maven.plugin.testing.AbstractMojoTestCase;
-import org.codehaus.plexus.configuration.PlexusConfiguration;
-import org.codehaus.plexus.util.FileUtils;
-
-/**
- * Test the taglets by running Maven Javadoc Plugin.
- *
- * @author Vincent Siveton
- * @version $Id$
- */
-public class JavadocReportTest
- extends AbstractMojoTestCase
-{
- private static final String LINE_SEPARATOR = "";
-
- /** {@inheritDoc} */
- protected void setUp()
- throws Exception
- {
- // required for mojo lookups to work
- super.setUp();
- createTestRepo();
- }
-
- /** {@inheritDoc} */
- protected void tearDown()
- throws Exception
- {
- super.tearDown();
- }
-
- /**
- * Create test repository in target directory.
- */
- private void createTestRepo()
- {
- File f = new File( getBasedir(), "target/local-repo/" );
- f.mkdirs();
- }
-
- /**
- * Convenience method that reads the contents of the specified file object into a string with a
- * "" as line separator.
- *
- * @see #LINE_SEPARATOR
- * @param file the file to be read
- * @return a String object that contains the contents of the file
- * @throws IOException if any
- */
- private static String readFile( File file )
- throws IOException
- {
- String str = "", strTmp = "";
- BufferedReader in = new BufferedReader( new InputStreamReader( new FileInputStream( file ), "ISO-8859-1" ) );
-
- while ( ( strTmp = in.readLine() ) != null )
- {
- str = str + LINE_SEPARATOR + strTmp;
- }
- in.close();
-
- return str;
- }
-
- /**
- * Test the default javadoc renderer using the Maven plugin
- * org.apache.maven.plugins:maven-javadoc-plugin:2.3
- *
- * @throws Exception
- */
- public void testMojoTaglets()
- throws Exception
- {
- File testPom = new File( getBasedir(), "target/test-classes/unit/javadoc/javadoc-plugin-config.xml" );
- PlexusConfiguration pluginConfiguration = extractPluginConfiguration( "maven-javadoc-plugin", testPom );
-
- JavadocReport mojo = (JavadocReport) lookupMojo( "org.apache.maven.plugins", "maven-javadoc-plugin", "2.3",
- "javadoc", pluginConfiguration );
-
- // Don't know why we need to specify that
- ArtifactRepository remoteRepositories = new DefaultArtifactRepository( "central",
- "http://repo1.maven.org/maven2",
- new DefaultRepositoryLayout() );
- setVariableValueToObject( mojo, "remoteRepositories", Collections.singletonList( remoteRepositories ) );
-
- ArtifactRepository localRepository = (ArtifactRepository) getVariableValueFromObject( mojo, "localRepository" );
- ArtifactResolver resolver = (ArtifactResolver) getVariableValueFromObject( mojo, "resolver" );
- ArtifactFactory factory = (ArtifactFactory) getVariableValueFromObject( mojo, "factory" );
- Artifact artifact = factory.createArtifact( "org.apache.maven", "maven-plugin-api", "2.0", "compile", "jar" );
- resolver.resolve( artifact, Collections.singletonList( remoteRepositories ), localRepository );
-
- mojo.execute();
-
- File generatedFile = new File( getBasedir(),
- "target/test/unit/javadoc/target/site/apidocs/org/apache/maven/plugin/my/MyMojo.html" );
- assertTrue( FileUtils.fileExists( generatedFile.getAbsolutePath() ) );
-
- String str = readFile( generatedFile );
-
- // Verify mojo type
- String mojoType = "- " + MojoAggregatorTypeTaglet.HEADER + "
- "
- + MojoConfiguratorTypeTaglet.HEADER + ":
- roleHint
- " + MojoExecuteTypeTaglet.HEADER
- + ":
- phase:
- validate
"
- + "- lifecycle:
- default
- " + MojoExecutionStrategyTypeTaglet.HEADER
- + ":
- always
" + "- " + MojoGoalTypeTaglet.HEADER + ":
- touch
"
- + "- " + MojoInheritByDefaultTypeTaglet.HEADER + ":
- true
- "
- + MojoInstantiationStrategyTypeTaglet.HEADER + ":
- per-lookup
- "
- + MojoPhaseTypeTaglet.HEADER + ":
- phaseName
- "
- + MojoRequiresDependencyResolutionTypeTaglet.HEADER + ":
- compile
- "
- + MojoRequiresDirectInvocationTypeTaglet.HEADER + ":
- false
- "
- + MojoRequiresOnLineTypeTaglet.HEADER + ":
- true
- "
- + MojoRequiresProjectTypeTaglet.HEADER + ":
- true
- "
- + MojoRequiresReportsTypeTaglet.HEADER + ":
- false
";
- assertTrue( str.toLowerCase().indexOf( ( mojoType ).toLowerCase() ) != -1 );
-
- // Verify mojo fields
- String mojoField = "- " + MojoParameterFieldTaglet.HEADER
- + ":
- default-value:
"
- + "- value
- expression:
- ${project.build.directory}
- alias:"
- + "
- myAlias
- " + MojoReadOnlyFieldTaglet.HEADER + "
- "
- + MojoRequiredFieldTaglet.HEADER + "
- " + "
";
- assertTrue( str.toLowerCase().indexOf( ( mojoField ).toLowerCase() ) != -1 );
-
- mojoField = "- " + MojoComponentFieldTaglet.HEADER + ":
- role:"
- + "
- org.apacha.maven.MyComponent
- roleHint:
- default
"
- + "- " + MojoReadOnlyFieldTaglet.HEADER + "
- " + MojoRequiredFieldTaglet.HEADER
- + "
- " + "
";
- assertTrue( str.toLowerCase().indexOf( ( mojoField ).toLowerCase() ) != -1 );
- }
-}
diff --git a/maven-plugin-tools-javadoc/src/test/java/org/apache/maven/tools/plugin/javadoc/stubs/DefaultMavenProjectStub.java b/maven-plugin-tools-javadoc/src/test/java/org/apache/maven/tools/plugin/javadoc/stubs/DefaultMavenProjectStub.java
deleted file mode 100644
index ac73b38..0000000
--- a/maven-plugin-tools-javadoc/src/test/java/org/apache/maven/tools/plugin/javadoc/stubs/DefaultMavenProjectStub.java
+++ /dev/null
@@ -1,132 +0,0 @@
-package org.apache.maven.tools.plugin.javadoc.stubs;
-
-/*
- * 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.
- */
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.DefaultArtifact;
-import org.apache.maven.artifact.handler.DefaultArtifactHandler;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.DefaultArtifactRepository;
-import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
-import org.apache.maven.artifact.versioning.VersionRange;
-import org.apache.maven.model.Build;
-import org.apache.maven.model.Model;
-import org.apache.maven.model.Resource;
-import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
-import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
-import org.codehaus.plexus.util.ReaderFactory;
-
-/**
- * @author Vincent Siveton
- * @version $Id$
- */
-public class DefaultMavenProjectStub
- extends MavenProjectStub
-{
- private Build build;
-
- public DefaultMavenProjectStub()
- {
- MavenXpp3Reader pomReader = new MavenXpp3Reader();
- Model model = null;
-
- try
- {
- File pomFile = new File( getBasedir(), "javadoc-plugin-config.xml" );
- model = pomReader.read( ReaderFactory.newXmlReader( pomFile ) );
- setModel( model );
- }
- catch ( Exception e )
- {
- throw new RuntimeException( e );
- }
-
- setGroupId( model.getGroupId() );
- setArtifactId( model.getArtifactId() );
- setVersion( model.getVersion() );
- setName( model.getName() );
- setUrl( model.getUrl() );
- setPackaging( model.getPackaging() );
-
- Build build = new Build();
-
- build.setFinalName( model.getArtifactId() );
- build.setSourceDirectory( getBasedir() + "/src/main/java" );
-
- Resource resource = new Resource();
- resource.setDirectory( getBasedir() + "/src/main/resources" );
- build.setResources( Collections.singletonList( resource ) );
- build.setDirectory( super.getBasedir() + "/target/test/unit/javadoc/target" );
- build.setOutputDirectory( super.getBasedir() + "/target/test/unit/javadoc/target/classes" );
-
- build.setTestSourceDirectory( getBasedir() + "/src/test/java" );
- resource = new Resource();
- resource.setDirectory( getBasedir() + "/src/test/resources" );
- build.setTestResources( Collections.singletonList( resource ) );
- build.setTestOutputDirectory( super.getBasedir() + "/target/test/unit/javadoc/target/test-classes" );
-
- setBuild( build );
-
- List compileSourceRoots = new ArrayList();
- compileSourceRoots.add( getBasedir() + "/src/main/java" );
- setCompileSourceRoots( compileSourceRoots );
- }
-
- /** {@inheritDoc} */
- public Build getBuild()
- {
- return build;
- }
-
- /** {@inheritDoc} */
- public void setBuild( Build build )
- {
- this.build = build;
- }
-
- /** {@inheritDoc} */
- public File getBasedir()
- {
- return new File( super.getBasedir() + "/src/test/resources/unit/javadoc" );
- }
-
- /** {@inheritDoc} */
- public List getRemoteArtifactRepositories()
- {
- ArtifactRepository repository = new DefaultArtifactRepository( "central", "http://repo1.maven.org/maven2",
- new DefaultRepositoryLayout() );
-
- return Collections.singletonList( repository );
- }
-
- /** {@inheritDoc} */
- public List getCompileArtifacts()
- {
- Artifact art = new DefaultArtifact( "org.apache.maven", "maven-plugin-api", VersionRange.createFromVersion( "2.0" ),
- Artifact.SCOPE_COMPILE, "jar", null, new DefaultArtifactHandler( "jar" ), false );
- art.setFile( new File( super.getBasedir() + "/target/local-repo/org/apache/maven/maven-plugin-api/2.0/maven-plugin-api-2.0.jar" ) );
- return Collections.singletonList( art );
- }
-}