[MNG-2387] <active> on <proxy> in settings is misleading - integration test

git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@747690 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Porter 2009-02-25 07:13:13 +00:00
parent a39ac10891
commit 758934d4af
7 changed files with 259 additions and 0 deletions

View File

@ -244,6 +244,7 @@ public class IntegrationTestSuite
suite.addTestSuite( MavenITmng2591MergeInheritedPluginConfigTest.class );
suite.addTestSuite( MavenITmng2562TimestampTest.class );
suite.addTestSuite( MavenITmng2539PluginDependenciesComeFromPluginReposTest.class );
suite.addTestSuite( MavenITmng2387InactiveProxyTest.class );
suite.addTestSuite( MavenITmng2362DeployedPomEncodingTest.class );
suite.addTestSuite( MavenITmng2339BadProjectInterpolationTest.class );
suite.addTestSuite( MavenITmng2318LocalParentResolutionTest.class );

View File

@ -0,0 +1,105 @@
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 java.io.File;
import java.net.InetAddress;
import java.util.Properties;
import org.apache.maven.it.util.ResourceExtractor;
import org.mortbay.jetty.Handler;
import org.mortbay.jetty.Server;
import org.mortbay.jetty.handler.DefaultHandler;
import org.mortbay.jetty.handler.HandlerList;
import org.mortbay.jetty.handler.ResourceHandler;
/**
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-2387">MNG-2387</a>.
*
* @author Brett Porter
* @version $Id$
*/
public class MavenITmng2387InactiveProxyTest
extends AbstractMavenIntegrationTestCase
{
private Server server;
private int port;
private File testDir;
public MavenITmng2387InactiveProxyTest()
{
// TODO: re-instate feature in 3.0
super( "[2.0.11,2.1.0-M1),[2.1.0,)" ); // 2.0.11+, 2.1.0+
}
public void setUp()
throws Exception
{
testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2387" );
ResourceHandler resource_handler = new ResourceHandler();
resource_handler.setResourceBase( new File( testDir, "repo" ).getAbsolutePath() );
HandlerList handlers = new HandlerList();
handlers.setHandlers( new Handler[] { resource_handler, new DefaultHandler() } );
server = new Server( 0 );
server.setHandler( handlers );
server.start();
port = server.getConnectors()[0].getLocalPort();
}
protected void tearDown()
throws Exception
{
super.tearDown();
server.stop();
}
/**
* Test that mirror definitions are properly evaluated. In particular, the first matching mirror definition
* from the settings should win, i.e. ordering of mirror definitions matters.
*/
public void testitFirstMatchWins()
throws Exception
{
Verifier verifier = new Verifier( testDir.getAbsolutePath() );
Properties properties = verifier.newDefaultFilterProperties();
properties.setProperty( "@host@", InetAddress.getLocalHost().getCanonicalHostName() );
properties.setProperty( "@port@", Integer.toString( port ) );
verifier.filterFile( "pom-unfiltered.xml", "pom.xml", "UTF-8", properties );
verifier.setAutoclean( false );
verifier.deleteArtifacts( "org.apache.maven.its.mng2387" );
verifier.getCliOptions().add( "--settings" );
verifier.getCliOptions().add( "settings.xml" );
verifier.executeGoal( "validate" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
verifier.assertArtifactPresent( "org.apache.maven.its.mng2387", "a", "0.1", "jar" );
}
}

View File

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.its.mng2387</groupId>
<artifactId>test-1</artifactId>
<version>0.1</version>
<name>Maven Integration Test :: MNG-2387</name>
<description>
Test that mirror definitions are properly evaluated. In particular, the first matching mirror definition
from the settings should win, i.e. ordering of mirror definitions matters.
</description>
<dependencies>
<dependency>
<!-- Provided by repo maven-core-it-a and only this repo -->
<groupId>org.apache.maven.its.mng2387</groupId>
<artifactId>a</artifactId>
<version>0.1</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>central</id>
<url>http://@host@:@port@/</url>
<releases>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-dependency-resolution</artifactId>
<version>2.1-SNAPSHOT</version>
<executions>
<execution>
<id>test</id>
<phase>validate</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.its.mng2387</groupId>
<artifactId>a</artifactId>
<version>0.1</version>
<packaging>jar</packaging>
<distributionManagement>
<repository>
<id>maven-core-it</id>
<url>file:///${basedir}/repo</url>
</repository>
</distributionManagement>
</project>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?><metadata>
<groupId>org.apache.maven.its.mng2387</groupId>
<artifactId>a</artifactId>
<version>0.1</version>
<versioning>
<versions>
<version>0.1</version>
</versions>
<lastUpdated>20090109150820</lastUpdated>
</versioning>
</metadata>

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<settings>
<proxies>
<proxy>
<active>false</active>
<protocol>http</protocol>
<host>localhost</host>
<port>0</port>
</proxy>
</proxies>
</settings>