Skip to content
This repository has been archived by the owner on Oct 14, 2020. It is now read-only.

Commit

Permalink
Making includes configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
velo committed May 3, 2011
1 parent a30c310 commit 03fc13a
Showing 1 changed file with 30 additions and 25 deletions.
Expand Up @@ -204,7 +204,7 @@ public class TestCompilerMojo
private File testSourceDirectory;

public Result buildTest( String testFilename, List<? extends String> testClasses, Integer testControlPort,
Integer testPort )
Integer testPort )
throws MojoExecutionException, MojoFailureException
{
getLog().info( "Compiling test class: " + testClasses );
Expand Down Expand Up @@ -260,29 +260,7 @@ public void execute()
return;
}

if ( test != null )
{
includeTestFiles = new String[] { test };
excludeTestFiles = null;
}

if ( includeTestFiles == null || includeTestFiles.length == 0 )
{
includeTestFiles = new String[] { "**/Test*.as", "**/*Test.as", "**/Test*.mxml", "**/*Test.mxml" };
}
else
{
for ( int i = 0; i < includeTestFiles.length; i++ )
{
String pattern = includeTestFiles[i];

if ( !pattern.endsWith( ".as" ) && !pattern.endsWith( ".mxml" ) )
{
pattern = pattern + ".as";
}
includeTestFiles[i] = "**/" + pattern;
}
}
initializeIncludes();

if ( !testOutputDirectory.exists() )
{
Expand Down Expand Up @@ -650,7 +628,7 @@ else if ( !testRunnerTemplate.exists() )
}
}

private List<String> getTestClasses()
protected List<String> getTestClasses()
{
getLog().debug( "Scanning for tests at " + testSourceDirectory + " for " + Arrays.toString( includeTestFiles )
+ " but " + Arrays.toString( excludeTestFiles ) );
Expand All @@ -676,6 +654,33 @@ private List<String> getTestClasses()
return testClasses;
}

protected void initializeIncludes()
{
if ( test != null )
{
includeTestFiles = new String[] { test };
excludeTestFiles = null;
}

if ( includeTestFiles == null || includeTestFiles.length == 0 )
{
includeTestFiles = new String[] { "**/Test*.as", "**/*Test.as", "**/Test*.mxml", "**/*Test.mxml" };
}
else
{
for ( int i = 0; i < includeTestFiles.length; i++ )
{
String pattern = includeTestFiles[i];

if ( !pattern.endsWith( ".as" ) && !pattern.endsWith( ".mxml" ) )
{
pattern = pattern + ".as";
}
includeTestFiles[i] = "**/" + pattern;
}
}
}

@Override
public boolean isUpdateSecuritySandbox()
{
Expand Down

0 comments on commit 03fc13a

Please sign in to comment.