From b17c2d6917e1561500d30cbcf7ea40a1fdeebbd1 Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Tue, 30 Mar 2010 21:25:27 +0000 Subject: [PATCH] [MNG-3477] Authentication failures on dependency download aren't reported o Added IT git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@929297 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/maven/it/IntegrationTestSuite.java | 1 + ...7DependencyResolutionErrorMessageTest.java | 81 +++++++++++++++++++ .../src/test/resources/mng-3477/pom.xml | 61 ++++++++++++++ .../src/test/resources/mng-3477/settings.xml | 43 ++++++++++ 4 files changed, 186 insertions(+) create mode 100644 its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3477DependencyResolutionErrorMessageTest.java create mode 100644 its/core-it-suite/src/test/resources/mng-3477/pom.xml create mode 100644 its/core-it-suite/src/test/resources/mng-3477/settings.xml 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 7bc8771820..d422ab7e39 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 @@ -339,6 +339,7 @@ public class IntegrationTestSuite suite.addTestSuite( MavenITmng3498ForkToOtherMojoTest.class ); suite.addTestSuite( MavenITmng3485OverrideWagonExtensionTest.class ); suite.addTestSuite( MavenITmng3482DependencyPomInterpolationTest.class ); + suite.addTestSuite( MavenITmng3477DependencyResolutionErrorMessageTest.class ); suite.addTestSuite( MavenITmng3475BaseAlignedDirTest.class ); suite.addTestSuite( MavenITmng3461MirrorMatchingTest.class ); suite.addTestSuite( MavenITmng3441MetadataUpdatedFromDeploymentRepositoryTest.class ); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3477DependencyResolutionErrorMessageTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3477DependencyResolutionErrorMessageTest.java new file mode 100644 index 0000000000..b5a205b7c9 --- /dev/null +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng3477DependencyResolutionErrorMessageTest.java @@ -0,0 +1,81 @@ +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-3477. + * + * @version $Id$ + */ +public class MavenITmng3477DependencyResolutionErrorMessageTest + extends AbstractMavenIntegrationTestCase +{ + + public MavenITmng3477DependencyResolutionErrorMessageTest() + { + super( "[2.1.0,3.0-alpha-1),[3.0-alpha-8,)" ); + } + + /** + * Tests that dependency resolution errors tell the underlying transport issue. + */ + public void testit() + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3477" ); + + Verifier verifier = new Verifier( testDir.getAbsolutePath() ); + verifier.setAutoclean( false ); + verifier.deleteArtifacts( "org.apache.maven.its.mng3477" ); + verifier.getCliOptions().add( "--settings" ); + verifier.getCliOptions().add( "settings.xml" ); + try + { + verifier.executeGoal( "validate" ); + fail( "Build should have failed to resolve dependency" ); + } + 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( ".*org.apache.maven.its.mng3477:dep:jar:1.0.*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-3477/pom.xml b/its/core-it-suite/src/test/resources/mng-3477/pom.xml new file mode 100644 index 0000000000..e3ee767702 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-3477/pom.xml @@ -0,0 +1,61 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng3477 + test + jar + 1 + + Maven Integration Test :: MNG-3477 + + Tests that dependency resolution errors tell the underlying transport issue. + + + + + org.apache.maven.its.mng3477 + dep + 1.0 + + + + + + + org.apache.maven.its.plugins + maven-it-plugin-dependency-resolution + 2.1-SNAPSHOT + + + test + validate + + compile + + + + + + + diff --git a/its/core-it-suite/src/test/resources/mng-3477/settings.xml b/its/core-it-suite/src/test/resources/mng-3477/settings.xml new file mode 100644 index 0000000000..7aa4908b65 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-3477/settings.xml @@ -0,0 +1,43 @@ + + + + + + + + maven-core-it-repo + + + central + http://localhost:54312/repo + + ignore + + + false + + + + + + + maven-core-it-repo + +