diff --git a/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractorTest.java b/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractorTest.java index 9400bba..20a17f0 100644 --- a/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractorTest.java +++ b/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractorTest.java @@ -155,22 +155,6 @@ public class JavaMojoDescriptorExtractorTest return descriptor.getMojos(); } - public void testShouldFindTwoMojoDescriptorsInTestSourceDirectory() - throws Exception - { - List results = extract( "source" ); - - assertEquals( "Extracted mojos", 2, results.size() ); - - for ( MojoDescriptor mojoDescriptor : results ) - { - assertEquals( 1, mojoDescriptor.getParameters().size() ); - Parameter parameter = (Parameter) mojoDescriptor.getParameters().get( 0 ); - assertEquals( "project", parameter.getName() ); - assertEquals( "java.lang.String[]", parameter.getType() ); - } - } - public void testShouldPropagateImplementationParameter() throws Exception { diff --git a/maven-plugin-tools-java/src/test/resources/source/JavaExtractorTestOne.java b/maven-plugin-tools-java/src/test/resources/source/JavaExtractorTestOne.java deleted file mode 100644 index 52155ed..0000000 --- a/maven-plugin-tools-java/src/test/resources/source/JavaExtractorTestOne.java +++ /dev/null @@ -1,48 +0,0 @@ -package source; - -/* - * 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 org.apache.maven.plugin.AbstractMojo; - -/** - * Create an IDEA project file from a Maven project. - * - * @goal ideaOne - * @requiresDependencyResolution - */ -public class JavaExtractorTestOne - extends AbstractMojo -{ - /** - * Maven project used to generate IDEA project files. - * - * @parameter - * @required - */ - protected String[] project; - - public JavaExtractorTestOne() - { - } - - public void execute() - { - } -} diff --git a/maven-plugin-tools-java/src/test/resources/source/JavaExtractorTestTwo.java b/maven-plugin-tools-java/src/test/resources/source/jdoc/Default.java similarity index 70% rename from maven-plugin-tools-java/src/test/resources/source/JavaExtractorTestTwo.java rename to maven-plugin-tools-java/src/test/resources/source/jdoc/Default.java index 665dc6c..53d99e0 100644 --- a/maven-plugin-tools-java/src/test/resources/source/JavaExtractorTestTwo.java +++ b/maven-plugin-tools-java/src/test/resources/source/jdoc/Default.java @@ -1,4 +1,4 @@ -package source; +package source.jdoc; /* * Licensed to the Apache Software Foundation (ASF) under one @@ -20,34 +20,40 @@ package source; */ import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.tools.plugin.scanner.MojoScanner; /** - * Create an IDEA project file from a Maven project. + * Test default values. * - * @goal ideaTwo - * @requiresDependencyResolution compile + * @goal default-values */ -public class JavaExtractorTestTwo +public class Default extends AbstractMojo { - /** - * Maven project used to generate IDEA project files. + * A parameter. * * @parameter - * @required */ - private String[] project; + protected String[] parameter; - public JavaExtractorTestTwo() + /** + * An attribute not published as parameter. + */ + protected String[] attribute; + + /** + * A component. + * + * @component + */ + private MojoScanner component; + + public Default() { } public void execute() { - if ( getLog() != null ) - { - getLog().info( "projects: " + project ); - } } } diff --git a/maven-plugin-tools-java/src/test/resources/source/jdoc/Full.java b/maven-plugin-tools-java/src/test/resources/source/jdoc/Full.java new file mode 100644 index 0000000..f239ea1 --- /dev/null +++ b/maven-plugin-tools-java/src/test/resources/source/jdoc/Full.java @@ -0,0 +1,84 @@ +package source.jdoc; + +/* + * 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 org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.tools.plugin.scanner.MojoScanner; + +/** + * Test defining every javadoc annotation. + * + * @goal full-annotations + * @aggregator + * @configurator "role-hint" + * @execute phase="site-deploy" lifecycle="site" + * @executionStrategy always + * @inheritByDefault false + * @instantiationStrategy singleton + * @phase install + * @requiresDependencyResolution compile+runtime + * @requiresDependencyCollection test + * @requiresDirectInvocation true + * @requiresOnline true + * @requiresProject false + * @requiresReports true + * @threadSafe + * @since now + * @deprecated deprecation text test + */ +public class Full + extends AbstractMojo +{ + /** + * A parameter. + * + * @parameter + */ + protected String[] parameter; + + /** + * @parameter alias="myAlias" expression="${aSystemProperty}" default-value="${anExpression}" + * @readonly + * @required + * @since tomorrow + * @deprecated after tomorrow + */ + private File file; + + /** + * A component. + * + * @component role="role" roleHint="hint" + * @readonly + * @required + * @since tomorrow + * @deprecated after tomorrow + */ + private MojoScanner component; + + public Full() + { + } + + public void execute() + { + } +} diff --git a/maven-plugin-tools-java/src/test/resources/source/plugin-expected.xml b/maven-plugin-tools-java/src/test/resources/source/plugin-expected.xml index 4b13937..6ed507d 100644 --- a/maven-plugin-tools-java/src/test/resources/source/plugin-expected.xml +++ b/maven-plugin-tools-java/src/test/resources/source/plugin-expected.xml @@ -30,54 +30,84 @@ true - ideaOne - Create an IDEA project file from a Maven project. - runtime + default-values + Test default values. false true false false false true - source.JavaExtractorTestOne + source.jdoc.Default java per-lookup once-per-session false - project + parameter java.lang.String[] - true + false true - Maven project used to generate IDEA project files. + A parameter. + + + org.apache.maven.tools.plugin.scanner.MojoScanner + component + + - ideaTwo - Create an IDEA project file from a Maven project. - compile - false - true - false - false - false - true - source.JavaExtractorTestTwo + full-annotations + Test defining every javadoc annotation. + compile+runtime + true + false + true + true + true + false + install + site-deploy + site + source.jdoc.Full java - per-lookup + "role-hint" + singleton once-per-session - false + deprecation text test + test + true - project - java.lang.String[] + file + myAlias + java.io.File + after tomorrow true + false + + + + parameter + java.lang.String[] + false true - Maven project used to generate IDEA project files. + A parameter. + + ${aSystemProperty} + + + + role + hint + component + +