Skip to content

Commit

Permalink
Fix some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Jun 23, 2022
1 parent 99ea996 commit 0331512
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ public MavenITmng5889FindBasedir()
super( "[3.5.0,3.5.1)" );
}

protected MavenITmng5889FindBasedir( String constraint )
{
super( constraint );
}

/**
* check that <code>path/to/.mvn/</code> is found when path to POM set by <code>--file path/to/pom.xml</code>
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
* under the License.
*/

import java.io.File;
import java.util.Properties;

import org.apache.maven.it.util.ResourceExtractor;
import org.junit.jupiter.api.Test;

/**
Expand All @@ -27,7 +31,7 @@
* @see MavenITmng5889FindBasedir
*/
public class MavenITmng6223FindBasedir
extends MavenITmng5889FindBasedir
extends AbstractMavenIntegrationTestCase
{
public MavenITmng6223FindBasedir()
{
Expand Down Expand Up @@ -88,4 +92,32 @@ private void runCoreExtensionWithOptionToDir( String option, String subdir )
runCoreExtensionWithOption( option, subdir, false );
}

protected void runCoreExtensionWithOption( String option, String subdir, boolean pom )
throws Exception
{
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5889-find.mvn" );

File basedir = new File( testDir, "../mng-" + ( pom ? "5889" : "6223" ) + "-find.mvn" + option + ( pom ? "Pom" : "Dir" ) );
basedir.mkdir();

if ( subdir != null )
{
testDir = new File( testDir, subdir );
basedir = new File( basedir, subdir );
basedir.mkdirs();
}

Verifier verifier = newVerifier( basedir.getAbsolutePath() );
verifier.getCliOptions().add( "-Dexpression.outputFile=" + new File( basedir, "expression.properties" ).getAbsolutePath() );
verifier.getCliOptions().add( option ); // -f/--file client/pom.xml
verifier.getCliOptions().add( ( pom ? new File( testDir, "pom.xml" ) : testDir ).getAbsolutePath() );
verifier.setForkJvm( true ); // force forked JVM since we need the shell script to detect .mvn/ location
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();

Properties props = verifier.loadProperties( "expression.properties" );
assertEquals( "ok", props.getProperty( "project.properties.jvm-config" ) );
assertEquals( "ok", props.getProperty( "project.properties.maven-config" ) );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ public MavenITmng6255FixConcatLines()
super( "[3.5.3,)" );
}

protected MavenITmng6255FixConcatLines( String constraint )
{
super( constraint );
}

/**
* Check that <code>CR</code> line endings work.
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ public MavenITmng6256SpecialCharsAlternatePOMLocation()
super( "(3.6.0,)" );
}

protected MavenITmng6256SpecialCharsAlternatePOMLocation( String constraint )
{
super( constraint );
}

/**
* check script is working when path to POM is set to <code>directory-with- -space</code>
*
Expand Down
4 changes: 2 additions & 2 deletions core-it-support/core-it-plugins/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ under the License.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.6.4</version>
<version>3.6.0</version>
</plugin>
</plugins>
</pluginManagement>
Expand All @@ -121,7 +121,7 @@ under the License.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.6.4</version>
<version>3.6.0</version>
</plugin>
</plugins>
</reporting>
Expand Down

0 comments on commit 0331512

Please sign in to comment.