diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java b/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java index 283014fb65..7bc8771820 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java @@ -392,6 +392,7 @@ public class IntegrationTestSuite suite.addTestSuite( MavenITmng2790LastUpdatedMetadataTest.class ); suite.addTestSuite( MavenITmng2749ExtensionAvailableToPluginTest.class ); suite.addTestSuite( MavenITmng2744checksumVerificationTest.class ); + suite.addTestSuite( MavenITmng2741PluginMetadataResolutionErrorMessageTest.class ); suite.addTestSuite( MavenITmng2739RequiredRepositoryElementsTest.class ); suite.addTestSuite( MavenITmng2720SiblingClasspathArtifactsTest.class ); suite.addTestSuite( MavenITmng2695OfflinePluginSnapshotsTest.class ); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2741PluginMetadataResolutionErrorMessageTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2741PluginMetadataResolutionErrorMessageTest.java new file mode 100644 index 0000000000..42f4b631e7 --- /dev/null +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng2741PluginMetadataResolutionErrorMessageTest.java @@ -0,0 +1,96 @@ +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.Verifier; +import org.apache.maven.it.util.ResourceExtractor; + +import java.io.File; +import java.util.List; + +/** + * This is a test set for MNG-2741. + * + * @version $Id$ + */ +public class MavenITmng2741PluginMetadataResolutionErrorMessageTest + extends AbstractMavenIntegrationTestCase +{ + + public MavenITmng2741PluginMetadataResolutionErrorMessageTest() + { + super( "[2.1.0,3.0-alpha-1),[3.0-alpha-8,)" ); + } + + /** + * Tests that plugin prefix metadata resolution errors tell the underlying transport issue. + */ + public void testitPrefix() + throws Exception + { + testit( "prefix", "foo:bar" ); + } + + /** + * Tests that plugin version metadata resolution errors tell the underlying transport issue. + */ + public void testitVersion() + throws Exception + { + testit( "version", "org.apache.maven.its.mng2741:maven-it-plugin:foo" ); + } + + private void testit( String test, String goal ) + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-2741" ); + + Verifier verifier = new Verifier( testDir.getAbsolutePath() ); + verifier.setAutoclean( false ); + verifier.setLogFileName( "log-" + test + ".txt" ); + verifier.getCliOptions().add( "--settings" ); + verifier.getCliOptions().add( "settings.xml" ); + try + { + verifier.executeGoal( goal ); + fail( "Build should have failed to resolve plugin prefix" ); + } + catch ( VerificationException e ) + { + boolean foundCause = false; + List lines = verifier.loadLines( verifier.getLogFileName(), "UTF-8" ); + for ( int i = 0; i < lines.size(); i++ ) + { + String line = lines.get( i ).toString(); + if ( line.matches( ".*Connection refused.*" ) ) + { + foundCause = true; + break; + } + } + assertTrue( "Transfer error cause was not found", foundCause ); + } + finally + { + verifier.resetStreams(); + } + } + +} diff --git a/its/core-it-suite/src/test/resources/mng-2741/pom.xml b/its/core-it-suite/src/test/resources/mng-2741/pom.xml new file mode 100644 index 0000000000..4f7fd5f548 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-2741/pom.xml @@ -0,0 +1,34 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng2741 + test + jar + 1 + + Maven Integration Test :: MNG-2741 + + Tests that plugin prefix/version metadata resolution errors tell the underlying transport issue. + + diff --git a/its/core-it-suite/src/test/resources/mng-2741/settings.xml b/its/core-it-suite/src/test/resources/mng-2741/settings.xml new file mode 100644 index 0000000000..d1b5eb4ab6 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-2741/settings.xml @@ -0,0 +1,58 @@ + + + + + + + org.apache.maven.its.mng2741 + + + + maven-core-it-repo + + + central + http://localhost:54312/repo + + ignore + + + ignore + + + + + + central + http://localhost:54312/repo + + ignore + + + ignore + + + + + + + maven-core-it-repo + +