Skip to content

Commit

Permalink
Revert "[SUREFIRE-1964] Support for method filtering on excludesFile …
Browse files Browse the repository at this point in the history
…and includesFile"

This reverts commit 342ff2b.
  • Loading branch information
Tibor17 committed Mar 17, 2022
1 parent 722fa93 commit 064d554
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 432 deletions.
Expand Up @@ -2194,110 +2194,78 @@ private boolean isSpecificTestSpecified()
}
}

@Nonnull
private List<String> getExcludedScanList()
throws MojoFailureException
private void maybeAppendList( List<String> base, List<String> list )
{
return getExcludeList( true );
}

@Nonnull
private List<String> getExcludeList()
throws MojoFailureException
{
return getExcludeList( false );
if ( list != null )
{
base.addAll( list );
}
}

/**
* Computes a merge list of test exclusions.
* Used only in {@link #getExcludeList()} and {@link #getExcludedScanList()}.
* @param asScanList true if dependency or directory scanner
* @return list of patterns
* @throws MojoFailureException if the excludes breaks a pattern format
*/
@Nonnull
private List<String> getExcludeList( boolean asScanList )
@Nonnull private List<String> getExcludeList()
throws MojoFailureException
{
List<String> excludes;
List<String> actualExcludes = null;
if ( isSpecificTestSpecified() )
{
excludes = Collections.emptyList();
actualExcludes = Collections.emptyList();
}
else
{
excludes = new ArrayList<>();
if ( asScanList )
if ( getExcludesFile() != null )
{
if ( getExcludes() != null )
{
excludes.addAll( getExcludes() );
}
checkMethodFilterInIncludesExcludes( excludes );
actualExcludes = readListFromFile( getExcludesFile() );
}

if ( getExcludesFile() != null )
if ( actualExcludes == null )
{
excludes.addAll( readListFromFile( getExcludesFile() ) );
actualExcludes = getExcludes();
}
else
{
maybeAppendList( actualExcludes, getExcludes() );
}

checkMethodFilterInIncludesExcludes( actualExcludes );

if ( asScanList && excludes.isEmpty() )
if ( actualExcludes == null || actualExcludes.isEmpty() )
{
excludes = Collections.singletonList( getDefaultExcludes() );
actualExcludes = Collections.singletonList( getDefaultExcludes() );
}
}
return filterNulls( excludes );
}

@Nonnull
private List<String> getIncludedScanList()
throws MojoFailureException
{
return getIncludeList( true );
return filterNulls( actualExcludes );
}

@Nonnull
private List<String> getIncludeList()
throws MojoFailureException
{
return getIncludeList( false );
}

/**
* Computes a merge list of test inclusions.
* Used only in {@link #getIncludeList()} and {@link #getIncludedScanList()}.
* @param asScanList true if dependency or directory scanner
* @return list of patterns
* @throws MojoFailureException if the includes breaks a pattern format
*/
@Nonnull
private List<String> getIncludeList( boolean asScanList )
throws MojoFailureException
{
final List<String> includes = new ArrayList<>();
List<String> includes = null;
if ( isSpecificTestSpecified() )
{
includes = new ArrayList<>();
addAll( includes, split( getTest(), "," ) );
}
else
{
if ( asScanList )
if ( getIncludesFile() != null )
{
if ( getIncludes() != null )
{
includes.addAll( getIncludes() );
}
checkMethodFilterInIncludesExcludes( includes );
includes = readListFromFile( getIncludesFile() );
}

if ( getIncludesFile() != null )
if ( includes == null )
{
includes.addAll( readListFromFile( getIncludesFile() ) );
includes = getIncludes();
}
else
{
maybeAppendList( includes, getIncludes() );
}

checkMethodFilterInIncludesExcludes( includes );

if ( asScanList && includes.isEmpty() )
if ( includes == null || includes.isEmpty() )
{
addAll( includes, getDefaultIncludes() );
includes = asList( getDefaultIncludes() );
}
}

Expand All @@ -2307,12 +2275,16 @@ private List<String> getIncludeList( boolean asScanList )
private void checkMethodFilterInIncludesExcludes( Iterable<String> patterns )
throws MojoFailureException
{
for ( String pattern : patterns )
if ( patterns != null )
{
if ( pattern != null && pattern.contains( "#" ) )
for ( String pattern : patterns )
{
throw new MojoFailureException( "Method filter prohibited in includes|excludes parameter: "
+ pattern );
if ( pattern != null && pattern.contains( "#" ) )
{
throw new MojoFailureException( "Method filter prohibited in "
+ "includes|excludes|includesFile|excludesFile parameter: "
+ pattern );
}
}
}
}
Expand All @@ -2322,18 +2294,16 @@ private TestListResolver getIncludedAndExcludedTests()
{
if ( includedExcludedTests == null )
{
includedExcludedTests = new TestListResolver( getIncludedScanList(), getExcludedScanList() );
getConsoleLogger().debug( "Resolved included and excluded patterns: " + includedExcludedTests );
includedExcludedTests = new TestListResolver( getIncludeList(), getExcludeList() );
}
return includedExcludedTests;
}

public TestListResolver getSpecificTests()
throws MojoFailureException
{
if ( specificTests == null )
{
specificTests = new TestListResolver( getIncludeList(), getExcludeList() );
specificTests = new TestListResolver( getTest() );
}
return specificTests;
}
Expand Down

0 comments on commit 064d554

Please sign in to comment.