From 786b2469d08000da284165c50049303aebf7cb87 Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Sat, 24 Oct 2009 15:42:07 +0000 Subject: [PATCH] [MNG-4404] Throw validation error upon duplicate profile id o Added IT git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@829389 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/maven/it/IntegrationTestSuite.java | 1 + .../it/MavenITmng4404UniqueProfileIdTest.java | 69 +++++++++++++++++++ .../apache/maven/its/mng4403/b/0.1/b-0.1.pom | 6 +- .../src/test/resources/mng-4404/pom.xml | 43 ++++++++++++ 4 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4404UniqueProfileIdTest.java create mode 100644 its/core-it-suite/src/test/resources/mng-4404/pom.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 18f5ababeb..cfcd66ac6d 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 @@ -85,6 +85,7 @@ public class IntegrationTestSuite // suite.addTestSuite( MavenIT0109ReleaseUpdateTest.class ); // suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137 + suite.addTestSuite( MavenITmng4404UniqueProfileIdTest.class ); suite.addTestSuite( MavenITmng4403LenientDependencyPomParsingTest.class ); suite.addTestSuite( MavenITmng4402DuplicateChildModuleTest.class ); suite.addTestSuite( MavenITmng4401RepositoryOrderForParentPomTest.class ); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4404UniqueProfileIdTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4404UniqueProfileIdTest.java new file mode 100644 index 0000000000..29485767e2 --- /dev/null +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4404UniqueProfileIdTest.java @@ -0,0 +1,69 @@ +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-4404. + * + * @author Benjamin Bentmann + */ +public class MavenITmng4404UniqueProfileIdTest + extends AbstractMavenIntegrationTestCase +{ + + public MavenITmng4404UniqueProfileIdTest() + { + super( "[3.0-alpha-3,)" ); + } + + /** + * Verify that non-unique profile ids cause a model validation error during project building. + */ + public void testit() + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4404" ); + + Verifier verifier = new Verifier( testDir.getAbsolutePath() ); + verifier.setAutoclean( false ); + verifier.deleteDirectory( "target" ); + try + { + verifier.executeGoal( "validate" ); + verifier.verifyErrorFreeLog(); + fail( "Duplicate profile id did not cause validation error" ); + } + catch ( VerificationException e ) + { + // expected + } + finally + { + verifier.resetStreams(); + } + } + +} diff --git a/its/core-it-suite/src/test/resources/mng-4403/repo/org/apache/maven/its/mng4403/b/0.1/b-0.1.pom b/its/core-it-suite/src/test/resources/mng-4403/repo/org/apache/maven/its/mng4403/b/0.1/b-0.1.pom index a014a4d56f..25df929b27 100644 --- a/its/core-it-suite/src/test/resources/mng-4403/repo/org/apache/maven/its/mng4403/b/0.1/b-0.1.pom +++ b/its/core-it-suite/src/test/resources/mng-4403/repo/org/apache/maven/its/mng4403/b/0.1/b-0.1.pom @@ -98,7 +98,7 @@ under the License. - test + non-unique-id @@ -121,5 +121,9 @@ under the License. + + + non-unique-id + diff --git a/its/core-it-suite/src/test/resources/mng-4404/pom.xml b/its/core-it-suite/src/test/resources/mng-4404/pom.xml new file mode 100644 index 0000000000..7e47a4cfe8 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4404/pom.xml @@ -0,0 +1,43 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng4404 + test + 0.1 + pom + + Maven Integration Test :: MNG-4404 + + Verify that non-unique profile ids cause a model validation error during project building. + + + + + non-unique-id + + + non-unique-id + + +