mirror of https://github.com/apache/maven.git
[MNG-1412] check that dependencies order in classpath matches pom.xml
git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@617974 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f6c8aaa7d5
commit
1487acfa31
|
@ -141,7 +141,7 @@ public class IntegrationTestSuite
|
|||
suite.addTestSuite( MavenIT0087Test.class );
|
||||
suite.addTestSuite( MavenIT0088Test.class );
|
||||
suite.addTestSuite( MavenIT0089Test.class );
|
||||
suite.addTestSuite( MavenIT0090Test.class);
|
||||
suite.addTestSuite( MavenIT0090Test.class );
|
||||
suite.addTestSuite( MavenIT0092Test.class );
|
||||
suite.addTestSuite( MavenIT0094Test.class );
|
||||
suite.addTestSuite( MavenIT0095Test.class );
|
||||
|
@ -159,10 +159,11 @@ public class IntegrationTestSuite
|
|||
suite.addTestSuite( MavenIT0113ServerAuthzAvailableToWagonMgrInPlugin.class );
|
||||
suite.addTestSuite( MavenIT0114ExtensionThatProvidesResources.class );
|
||||
suite.addTestSuite( MavenIT0118AttachedArtifactsInReactor.class );
|
||||
suite.addTestSuite( MavenITmng2254PomEncodingTest.class);
|
||||
suite.addTestSuite( MavenITmng2254PomEncodingTest.class );
|
||||
suite.addTestSuite( MavenIT0129ResourceProvidedToAPluginAsAPluginDependency.class );
|
||||
suite.addTestSuite( MavenITmng2045testJarDependenciesBrokenInReactorTest.class);
|
||||
suite.addTestSuite( MavenITmng2277AggregatorAndResolutionPluginsTest.class);
|
||||
suite.addTestSuite( MavenITmng2045testJarDependenciesBrokenInReactorTest.class );
|
||||
suite.addTestSuite( MavenITmng2277AggregatorAndResolutionPluginsTest.class );
|
||||
suite.addTestSuite( MavenITmng1412DependenciesOrderTest.class );
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------
|
||||
// Tests that need to be fixed.
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
package org.apache.maven.integrationtests;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
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.ResourceExtractor;
|
||||
|
||||
/**
|
||||
* Test that dependencies order in classpath matches pom.xml.
|
||||
*
|
||||
* @author <a href="mailto:hboutemy@apache.org">Herve Boutemy</a>
|
||||
*
|
||||
*/
|
||||
public class MavenITmng1412DependenciesOrderTest
|
||||
extends AbstractMavenIntegrationTestCase
|
||||
{
|
||||
public MavenITmng1412DependenciesOrderTest()
|
||||
throws InvalidVersionSpecificationException
|
||||
{
|
||||
super( "(2.0.8,)" ); // 2.0.9+
|
||||
}
|
||||
|
||||
public void testitMNG1412()
|
||||
throws Exception
|
||||
{
|
||||
// The testdir is computed from the location of this file.
|
||||
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-1412-DependenciesOrder" );
|
||||
|
||||
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
|
||||
|
||||
List cliOptions = new ArrayList();
|
||||
cliOptions.add( "-N" );
|
||||
verifier.executeGoal( "test" );
|
||||
|
||||
verifier.verifyErrorFreeLog();
|
||||
|
||||
verifier.resetStreams();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.apache.maven.its</groupId>
|
||||
<artifactId>maven-it-MNG1412-DependenciesOrder</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<description>Check that dependencies are available in classpath in same order as declared in POM</description>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>commons-net</groupId>
|
||||
<artifactId>commons-net</artifactId>
|
||||
<version>1.4.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-collections</groupId>
|
||||
<artifactId>commons-collections</artifactId>
|
||||
<version>3.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>2.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>1.3.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,55 @@
|
|||
package org.apache.maven.its.itmng1412;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.Enumeration;
|
||||
import java.util.jar.Attributes;
|
||||
import java.util.jar.Manifest;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
* Test that dependencies order in classpath matches pom.xml.
|
||||
*
|
||||
* @author <a href="mailto:hboutemy@apache.org">Herve Boutemy</a>
|
||||
*
|
||||
*/
|
||||
public class ITmng1412DependenciesOrderTest
|
||||
extends TestCase
|
||||
{
|
||||
private final static String[] EXTENSIONS = {
|
||||
// same order as in pom.xml
|
||||
"commons-net",
|
||||
"commons-collections",
|
||||
"commons-lang",
|
||||
"commons-io",
|
||||
};
|
||||
|
||||
public void testOrder() throws IOException
|
||||
{
|
||||
String expected = StringUtils.join( EXTENSIONS, ',' );
|
||||
StringBuffer found = new StringBuffer();
|
||||
|
||||
Enumeration resources = this.getClass().getClassLoader().getResources( "META-INF/MANIFEST.MF" );
|
||||
while ( resources.hasMoreElements() )
|
||||
{
|
||||
URL url = (URL) resources.nextElement();
|
||||
|
||||
Manifest manifest = new Manifest( url.openStream() );
|
||||
Attributes attributes = manifest.getMainAttributes();
|
||||
String extensionName = attributes.getValue( "Extension-Name" );
|
||||
|
||||
if ( ( extensionName != null ) && extensionName.startsWith( "commons" ) )
|
||||
{
|
||||
if ( found.length() > 0 )
|
||||
{
|
||||
found.append( ',' );
|
||||
}
|
||||
found.append( extensionName );
|
||||
}
|
||||
}
|
||||
assertEquals( "dependencies order in classpath should match pom.xml", expected, found.toString() );
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue