[MNG-4275] Adding integration test to verify that a warning is output when a direct dependency has been relocated.

git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@801438 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2009-08-05 22:09:06 +00:00
parent bdc516fab9
commit 5808d99545
10 changed files with 266 additions and 0 deletions

View File

@ -90,6 +90,7 @@ public class IntegrationTestSuite
suite.addTestSuite( MavenITmng4281PreferLocalSnapshotTest.class );
suite.addTestSuite( MavenITmng4279WagonProviderFailoverTest.class );
suite.addTestSuite( MavenITmng4276WrongTransitivePlexusUtilsTest.class );
suite.addTestSuite( MavenITmng4275RelocationWarningTest.class );
suite.addTestSuite( MavenITmng4274PluginRealmArtifactsTest.class );
suite.addTestSuite( MavenITmng4273RestrictedCoreRealmAccessForPluginTest.class );
suite.addTestSuite( MavenITmng4270ArtifactHandlersFromPluginDepsTest.class );

View File

@ -0,0 +1,88 @@
package org.apache.maven.it;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.maven.it.util.ResourceExtractor;
import java.io.File;
import java.util.Iterator;
import java.util.List;
/**
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-4275">MNG-4275</a>.
*
* @author John Casey
*/
public class MavenITmng4275RelocationWarningTest
extends AbstractMavenIntegrationTestCase
{
public MavenITmng4275RelocationWarningTest()
{
super( "[2.0,2.0.9)(2.2.0,2.99.99]" );
}
public void testit()
throws Exception
{
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4275" );
File depsDir = new File( testDir, "dependencies" );
File projectDir = new File( testDir, "project" );
Verifier verifier = new Verifier( depsDir.getAbsolutePath() );
verifier.deleteArtifacts( "org.apache.maven.it.mng4275" );
verifier.executeGoal( "install" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
// now, build the project that depends on the above.
verifier = new Verifier( projectDir.getAbsolutePath() );
verifier.executeGoal( "install" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
List lines = verifier.loadFile( new File( projectDir, verifier.getLogFileName() ), false );
boolean foundWarning = false;
for ( Iterator it = lines.iterator(); it.hasNext(); )
{
String line = (String) it.next();
if ( foundWarning )
{
assertTrue(
"Relocation target should have been logged right after warning.",
line.indexOf( "This artifact has been relocated to org.apache.maven.it.mng4275:relocated:1" ) > -1 );
break;
}
else if ( line.startsWith( "[WARNING] While downloading org.apache.maven.it.mng4275:relocation:1" ) )
{
foundWarning = true;
}
}
assertTrue( "Relocation warning should haven been logged.", foundWarning );
}
}

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.it.mng4275</groupId>
<artifactId>dependencies</artifactId>
<version>1</version>
<packaging>pom</packaging>
<modules>
<module>relocation</module>
<module>relocated</module>
</modules>
</project>

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<artifactId>relocated</artifactId>
<groupId>org.apache.maven.it.mng4275</groupId>
<version>1</version>
<name>relocated</name>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,13 @@
package org.apache.maven.it.mng4275.relocated;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World: Relocated." );
}
}

View File

@ -0,0 +1,38 @@
package org.apache.maven.it.mng4275.relocated;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.it.mng4275</groupId>
<version>1</version>
<artifactId>relocation</artifactId>
<properties>
<maven.test.skip>true</maven.test.skip>
</properties>
<distributionManagement>
<relocation>
<groupId>org.apache.maven.it.mng4275</groupId>
<artifactId>relocated</artifactId>
<version>1</version>
<message>Relocation Test!</message>
</relocation>
</distributionManagement>
</project>

View File

@ -0,0 +1,22 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.it.mng4275</groupId>
<artifactId>project</artifactId>
<packaging>jar</packaging>
<version>1</version>
<name>project</name>
<dependencies>
<dependency>
<groupId>org.apache.maven.it.mng4275</groupId>
<artifactId>relocation</artifactId>
<version>1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,15 @@
package org.apache.maven.it.mng4275.project;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
org.apache.maven.it.mng4275.relocated.App.main( args );
}
}

View File

@ -0,0 +1,38 @@
package org.apache.maven.it.mng4275.project;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
App.main( new String[]{} );
}
}