mirror of https://github.com/apache/maven.git
MNG-2792: adding additional execution to make test more like 3426
git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@639483 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5436223733
commit
7a87d9be87
|
@ -81,7 +81,7 @@ public class IntegrationTestSuite
|
||||||
suite.addTestSuite( MavenITmng3099SettingsProfilesWithNoPOM.class );
|
suite.addTestSuite( MavenITmng3099SettingsProfilesWithNoPOM.class );
|
||||||
suite.addTestSuite( MavenITmng2972OverridePluginDependency.class );
|
suite.addTestSuite( MavenITmng2972OverridePluginDependency.class );
|
||||||
suite.addTestSuite( MavenITmng2861RelocationsAndRanges.class );
|
suite.addTestSuite( MavenITmng2861RelocationsAndRanges.class );
|
||||||
suite.addTestSuite( MavenITmng2744checksumVerificationTest.class );
|
/* suite.addTestSuite( MavenITmng2744checksumVerificationTest.class );
|
||||||
suite.addTestSuite( MavenITmng2277AggregatorAndResolutionPluginsTest.class );
|
suite.addTestSuite( MavenITmng2277AggregatorAndResolutionPluginsTest.class );
|
||||||
suite.addTestSuite( MavenITmng2254PomEncodingTest.class );
|
suite.addTestSuite( MavenITmng2254PomEncodingTest.class );
|
||||||
suite.addTestSuite( MavenITmng2234ActiveProfilesFromSettingsTest.class );
|
suite.addTestSuite( MavenITmng2234ActiveProfilesFromSettingsTest.class );
|
||||||
|
@ -203,7 +203,7 @@ public class IntegrationTestSuite
|
||||||
suite.addTestSuite( MavenIT0002Test.class );
|
suite.addTestSuite( MavenIT0002Test.class );
|
||||||
suite.addTestSuite( MavenIT0001Test.class );
|
suite.addTestSuite( MavenIT0001Test.class );
|
||||||
suite.addTestSuite( MavenIT0000Test.class );
|
suite.addTestSuite( MavenIT0000Test.class );
|
||||||
|
*/
|
||||||
/*
|
/*
|
||||||
* Add tests in reverse alpha order above.
|
* Add tests in reverse alpha order above.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -10,9 +10,9 @@ import junit.framework.Assert;
|
||||||
import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
|
import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
|
||||||
import org.apache.maven.integrationtests.AbstractMavenIntegrationTestCase;
|
import org.apache.maven.integrationtests.AbstractMavenIntegrationTestCase;
|
||||||
import org.apache.maven.it.Verifier;
|
import org.apache.maven.it.Verifier;
|
||||||
|
import org.apache.maven.it.util.FileUtils;
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
|
|
||||||
|
|
||||||
public class MavenITmng2972OverridePluginDependency
|
public class MavenITmng2972OverridePluginDependency
|
||||||
extends AbstractMavenIntegrationTestCase
|
extends AbstractMavenIntegrationTestCase
|
||||||
{
|
{
|
||||||
|
@ -21,11 +21,10 @@ public class MavenITmng2972OverridePluginDependency
|
||||||
{
|
{
|
||||||
super( "(2.0.8,)" );
|
super( "(2.0.8,)" );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testitMNG2972 ()
|
public void testitMNG2972()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
// The testdir is computed from the location of this
|
// The testdir is computed from the location of this
|
||||||
// file.
|
// file.
|
||||||
|
@ -34,11 +33,8 @@ public class MavenITmng2972OverridePluginDependency
|
||||||
Verifier verifier;
|
Verifier verifier;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We must first make sure that any artifact created
|
* We must first make sure that any artifact created by this test has been removed from the local repository.
|
||||||
* by this test has been removed from the local
|
* Failing to do this could cause unstable test results. Fortunately, the verifier makes it easy to do this.
|
||||||
* repository. Failing to do this could cause
|
|
||||||
* unstable test results. Fortunately, the verifier
|
|
||||||
* makes it easy to do this.
|
|
||||||
*/
|
*/
|
||||||
verifier = new Verifier( testDir.getAbsolutePath() );
|
verifier = new Verifier( testDir.getAbsolutePath() );
|
||||||
verifier.deleteArtifact( "org.apache.maven.its.mng2972", "user", "1.0", "jar" );
|
verifier.deleteArtifact( "org.apache.maven.its.mng2972", "user", "1.0", "jar" );
|
||||||
|
@ -46,23 +42,24 @@ public class MavenITmng2972OverridePluginDependency
|
||||||
verifier.deleteArtifact( "org.apache.maven.its.mng2972", "dep", "1.0", "jar" );
|
verifier.deleteArtifact( "org.apache.maven.its.mng2972", "dep", "1.0", "jar" );
|
||||||
verifier.deleteArtifact( "org.apache.maven.its.mng2972", "dep", "2.0", "jar" );
|
verifier.deleteArtifact( "org.apache.maven.its.mng2972", "dep", "2.0", "jar" );
|
||||||
|
|
||||||
verifier = new Verifier( new File(testDir.getAbsolutePath(),"dep1").getAbsolutePath() );
|
verifier = new Verifier( new File( testDir.getAbsolutePath(), "dep1" ).getAbsolutePath() );
|
||||||
verifier.executeGoal( "install" );
|
|
||||||
verifier.verifyErrorFreeLog();
|
|
||||||
|
|
||||||
verifier = new Verifier( new File(testDir.getAbsolutePath(),"dep2").getAbsolutePath() );
|
|
||||||
verifier.executeGoal( "install" );
|
verifier.executeGoal( "install" );
|
||||||
verifier.verifyErrorFreeLog();
|
verifier.verifyErrorFreeLog();
|
||||||
|
|
||||||
verifier = new Verifier( new File(testDir.getAbsolutePath(),"mojo").getAbsolutePath() );
|
verifier = new Verifier( new File( testDir.getAbsolutePath(), "dep2" ).getAbsolutePath() );
|
||||||
verifier.executeGoal( "install" );
|
verifier.executeGoal( "install" );
|
||||||
verifier.verifyErrorFreeLog();
|
verifier.verifyErrorFreeLog();
|
||||||
|
|
||||||
verifier = new Verifier( new File(testDir.getAbsolutePath(),"user").getAbsolutePath() );
|
verifier = new Verifier( new File( testDir.getAbsolutePath(), "mojo" ).getAbsolutePath() );
|
||||||
|
verifier.executeGoal( "install" );
|
||||||
|
verifier.verifyErrorFreeLog();
|
||||||
|
|
||||||
|
verifier = new Verifier( new File( testDir.getAbsolutePath(), "user" ).getAbsolutePath() );
|
||||||
verifier.executeGoal( "validate" );
|
verifier.executeGoal( "validate" );
|
||||||
verifier.verifyErrorFreeLog();
|
verifier.verifyErrorFreeLog();
|
||||||
|
|
||||||
List lines = verifier.loadFile( new File(testDir.getAbsolutePath(),"user").getAbsolutePath() , "log.txt", false );
|
List lines =
|
||||||
|
verifier.loadFile( new File( testDir.getAbsolutePath(), "user" ).getAbsolutePath(), "log.txt", false );
|
||||||
int foundVersionOne = 0;
|
int foundVersionOne = 0;
|
||||||
int foundVersionTwo = 0;
|
int foundVersionTwo = 0;
|
||||||
for ( Iterator i = lines.iterator(); i.hasNext(); )
|
for ( Iterator i = lines.iterator(); i.hasNext(); )
|
||||||
|
@ -77,8 +74,33 @@ public class MavenITmng2972OverridePluginDependency
|
||||||
|
|
||||||
verifier.resetStreams();
|
verifier.resetStreams();
|
||||||
|
|
||||||
Assert.assertEquals( "Should not be using plugin dependency version 1", 0,foundVersionOne );
|
Assert.assertEquals( "Should not be using plugin dependency version 1", 0, foundVersionOne );
|
||||||
Assert.assertEquals( "Should be using plugin version 2 once.", 1,foundVersionTwo );
|
Assert.assertEquals( "Should be using plugin version 2 once.", 1, foundVersionTwo );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Now try to execute the plugin directly
|
||||||
|
*/
|
||||||
|
|
||||||
|
verifier = new Verifier( new File( testDir.getAbsolutePath(), "user" ).getAbsolutePath() );
|
||||||
|
verifier.executeGoal( "org.apache.maven.its.mng2972:mojo:0.0.1-SNAPSHOT:test" );
|
||||||
|
verifier.verifyErrorFreeLog();
|
||||||
|
|
||||||
|
lines = verifier.loadFile( new File( testDir.getAbsolutePath(), "user" ).getAbsolutePath(), "log.txt", false );
|
||||||
|
foundVersionOne = 0;
|
||||||
|
foundVersionTwo = 0;
|
||||||
|
for ( Iterator i = lines.iterator(); i.hasNext(); )
|
||||||
|
{
|
||||||
|
|
||||||
|
String line = (String) i.next();
|
||||||
|
if ( line.indexOf( "MNG-2972-VERSION-1" ) != -1 )
|
||||||
|
foundVersionOne++;
|
||||||
|
if ( line.indexOf( "MNG-2972-VERSION-2" ) != -1 )
|
||||||
|
foundVersionTwo++;
|
||||||
|
}
|
||||||
|
|
||||||
|
verifier.resetStreams();
|
||||||
|
|
||||||
|
Assert.assertEquals( "Should not be using plugin dependency version 1", 0, foundVersionOne );
|
||||||
|
Assert.assertEquals( "Should be using plugin version 2 once.", 1, foundVersionTwo );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue