diff --git a/its/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java b/its/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java index 7481656c68..74c9fae48e 100644 --- a/its/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java +++ b/its/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java @@ -81,7 +81,7 @@ public class IntegrationTestSuite suite.addTestSuite( MavenITmng3099SettingsProfilesWithNoPOM.class ); suite.addTestSuite( MavenITmng2972OverridePluginDependency.class ); suite.addTestSuite( MavenITmng2861RelocationsAndRanges.class ); - suite.addTestSuite( MavenITmng2744checksumVerificationTest.class ); + /* suite.addTestSuite( MavenITmng2744checksumVerificationTest.class ); suite.addTestSuite( MavenITmng2277AggregatorAndResolutionPluginsTest.class ); suite.addTestSuite( MavenITmng2254PomEncodingTest.class ); suite.addTestSuite( MavenITmng2234ActiveProfilesFromSettingsTest.class ); @@ -203,7 +203,7 @@ public class IntegrationTestSuite suite.addTestSuite( MavenIT0002Test.class ); suite.addTestSuite( MavenIT0001Test.class ); suite.addTestSuite( MavenIT0000Test.class ); - +*/ /* * Add tests in reverse alpha order above. */ diff --git a/its/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng2972OverridePluginDependency.java b/its/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng2972OverridePluginDependency.java index 1289790e8d..3375376eaa 100644 --- a/its/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng2972OverridePluginDependency.java +++ b/its/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng2972OverridePluginDependency.java @@ -10,9 +10,9 @@ import junit.framework.Assert; import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; import org.apache.maven.integrationtests.AbstractMavenIntegrationTestCase; import org.apache.maven.it.Verifier; +import org.apache.maven.it.util.FileUtils; import org.apache.maven.it.util.ResourceExtractor; - public class MavenITmng2972OverridePluginDependency extends AbstractMavenIntegrationTestCase { @@ -21,11 +21,10 @@ public class MavenITmng2972OverridePluginDependency { super( "(2.0.8,)" ); } - - public void testitMNG2972 () + + public void testitMNG2972() throws Exception { - // The testdir is computed from the location of this // file. @@ -34,11 +33,8 @@ public class MavenITmng2972OverridePluginDependency Verifier verifier; /* - * We must first make sure that any artifact created - * by this test has been removed from the local - * repository. Failing to do this could cause - * unstable test results. Fortunately, the verifier - * makes it easy to do this. + * We must first make sure that any artifact created by this test has been removed from the local 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.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", "2.0", "jar" ); - verifier = new Verifier( new File(testDir.getAbsolutePath(),"dep1").getAbsolutePath() ); - verifier.executeGoal( "install" ); - verifier.verifyErrorFreeLog(); - - verifier = new Verifier( new File(testDir.getAbsolutePath(),"dep2").getAbsolutePath() ); + verifier = new Verifier( new File( testDir.getAbsolutePath(), "dep1" ).getAbsolutePath() ); verifier.executeGoal( "install" ); verifier.verifyErrorFreeLog(); - verifier = new Verifier( new File(testDir.getAbsolutePath(),"mojo").getAbsolutePath() ); + verifier = new Verifier( new File( testDir.getAbsolutePath(), "dep2" ).getAbsolutePath() ); verifier.executeGoal( "install" ); 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.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 foundVersionTwo = 0; for ( Iterator i = lines.iterator(); i.hasNext(); ) @@ -77,8 +74,33 @@ public class MavenITmng2972OverridePluginDependency 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 ); + Assert.assertEquals( "Should not be using plugin dependency version 1", 0, foundVersionOne ); + 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 ); } }