Skip to content

Commit

Permalink
[MPLUGIN-431] Remove deprecated items from new maven-plugin-report-pl…
Browse files Browse the repository at this point in the history
…ugin
  • Loading branch information
slawekjaranowski committed Oct 26, 2022
1 parent 8a76400 commit 664c16e
Show file tree
Hide file tree
Showing 13 changed files with 51 additions and 430 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,11 @@ else if ( !goalPrefix.equals( defaultGoalPrefix ) )
static String getDefaultGoalPrefix( MavenProject project )
{
String defaultGoalPrefix;
if ( "maven-plugin".equalsIgnoreCase( project.getArtifactId() ) )
if ( "maven-plugin-report-plugin".equalsIgnoreCase( project.getArtifactId() ) )
{
defaultGoalPrefix = "plugin-report";
}
else if ( "maven-plugin".equalsIgnoreCase( project.getArtifactId() ) )
{
defaultGoalPrefix = project.getGroupId().substring( project.getGroupId().lastIndexOf( '.' ) + 1 );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,39 @@
* under the License.
*/

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.CoreMatchers.is;
import java.util.stream.Stream;

import org.apache.maven.project.MavenProject;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.params.provider.Arguments.arguments;

// at least one test class must be public for test-javadoc report
public class DescriptorGeneratorMojoTest
{
@Test
void defaultGoalPrefix()
public static Stream<Arguments> goalPrefixes()
{
return Stream.of(
arguments( null, "maven-plugin-plugin", "plugin" ),
arguments( null, "maven-plugin-report-plugin", "plugin-report" ),
arguments( null, "maven-default-plugin", "default" ),
arguments( null, "default-maven-plugin", "default" ),
arguments( null, "default-maven-plugin", "default" ),
arguments( "foo.bar", "maven-plugin", "bar" ),
arguments( "foo", "maven-plugin", "foo" )
);
}

@ParameterizedTest
@MethodSource("goalPrefixes")
void defaultGoalPrefix(String groupId, String artifactId, String expectedGoal)
{
assertThat( DescriptorGeneratorMojo.getDefaultGoalPrefix( newProject( null, "maven-plugin-plugin" ) ),
is( "plugin" ) );
assertThat( DescriptorGeneratorMojo.getDefaultGoalPrefix( newProject( null, "maven-default-plugin" ) ),
is( "default" ) );
assertThat( DescriptorGeneratorMojo.getDefaultGoalPrefix( newProject( null, "default-maven-plugin" ) ),
is( "default" ) );
assertThat( DescriptorGeneratorMojo.getDefaultGoalPrefix( newProject( "foo.bar", "maven-plugin" ) ),
is( "bar" ) );
assertThat( DescriptorGeneratorMojo.getDefaultGoalPrefix( newProject( "foo", "maven-plugin" ) ), is( "foo" ) );
assertThat( DescriptorGeneratorMojo.getDefaultGoalPrefix( newProject( groupId, artifactId ) ),
is( expectedGoal ) );
}

private MavenProject newProject( final String groupId, final String artifactId )
Expand Down
1 change: 0 additions & 1 deletion maven-plugin-report-plugin/src/it/plugin-info-jdk/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ under the License.
<module>propertyRelease</module>
<module>pluginManagement</module>
<module>plugin</module>
<module>requirement</module>
</modules>

<build>
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,5 @@ assert new File( basedir, 'property/target/site/plugin-info.html' ).text.contain
assert new File( basedir, 'propertyRelease/target/site/plugin-info.html' ).text.contains( '<td>8</td>' )
assert new File( basedir, 'pluginManagement/target/site/plugin-info.html' ).text.contains( '<td>1.4</td>' )
assert new File( basedir, 'plugin/target/site/plugin-info.html' ).text.contains( '<td>1.5</td>' )
assert new File( basedir, 'requirement/target/site/plugin-info.html' ).text.contains( '<td>1.8</td>' )

return true;
return true;
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ assert pluginInfo.isFile()

assert !pluginInfo.text.contains('Memory')
assert !pluginInfo.text.contains('Disk Space')
assert !pluginInfo.text.contains('No minimum requirement.')
// missing prerequisites in pom
assert pluginInfo.text.contains('No minimum requirement.')
Loading

0 comments on commit 664c16e

Please sign in to comment.