Extend MavenITmng7470ResolverTransportTest (#160)

To cover the default case as well (nothing set), and make sure
Wagon is used.
This commit is contained in:
Tamas Cservenak 2022-05-13 10:31:07 +02:00 committed by GitHub
parent 07f35e0aa9
commit 1c034e2b65
1 changed files with 21 additions and 6 deletions

View File

@ -13,8 +13,6 @@ import org.apache.maven.it.util.ResourceExtractor;
public class MavenITmng7470ResolverTransportTest
extends AbstractMavenIntegrationTestCase
{
private File testDir;
private File projectDir;
private HttpServer server;
@ -30,7 +28,7 @@ public class MavenITmng7470ResolverTransportTest
protected void setUp()
throws Exception
{
testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-7470-resolver-transport" );
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-7470-resolver-transport" );
projectDir = new File( testDir, "project" );
server = HttpServer.builder()
@ -57,20 +55,31 @@ public class MavenITmng7470ResolverTransportTest
}
}
private void performTest( final String transport, final String logSnippet ) throws Exception
private void performTest( /* nullable */ final String transport, final String logSnippet ) throws Exception
{
Verifier verifier = newVerifier( projectDir.getAbsolutePath() );
Map<String, String> properties = new HashMap<>();
properties.put( "@port@", Integer.toString( port ) );
verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", properties );
verifier.setLogFileName( transport + "-transport.log" );
if ( transport == null )
{
verifier.setLogFileName( "default-transport.log" );
}
else
{
verifier.setLogFileName( transport + "-transport.log" );
}
verifier.deleteDirectory( "target" );
verifier.deleteArtifacts( "org.apache.maven.resolver.resolver-demo-maven-plugin" );
verifier.deleteArtifacts( "org.apache.maven.its.resolver-transport" );
verifier.addCliOption( "-X" );
verifier.addCliOption( "-s" );
verifier.addCliOption( new File( projectDir, "settings.xml" ).getAbsolutePath() );
verifier.addCliOption( "-Pmaven-core-it-repo" );
verifier.addCliOption( "-Dmaven.resolver.transport=" + transport );
if ( transport != null )
{
verifier.addCliOption( "-Dmaven.resolver.transport=" + transport );
}
// Maven will fail if project dependencies cannot be resolved.
// As dependency exists ONLY in HTTP repo, it MUST be reached using selected transport and
// successfully resolved from it.
@ -81,6 +90,12 @@ public class MavenITmng7470ResolverTransportTest
verifier.resetStreams();
}
public void testResolverTransportDefault()
throws Exception
{
performTest( null, "[DEBUG] Using transporter WagonTransporter" );
}
public void testResolverTransportWagon()
throws Exception
{