From bdc516fab915b6fe15ef4e5de2f2f7b22aead87d Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Wed, 5 Aug 2009 21:46:15 +0000 Subject: [PATCH] [MNG-4283] [regression] Parent POM with packaging other than "pom" is not rejected o Added IT git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@801425 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/maven/it/IntegrationTestSuite.java | 1 + .../MavenITmng4283ParentPomPackagingTest.java | 68 +++++++++++++++++++ .../src/test/resources/mng-4283/pom.xml | 35 ++++++++++ .../src/test/resources/mng-4283/sub/pom.xml | 40 +++++++++++ 4 files changed, 144 insertions(+) create mode 100644 its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4283ParentPomPackagingTest.java create mode 100644 its/core-it-suite/src/test/resources/mng-4283/pom.xml create mode 100644 its/core-it-suite/src/test/resources/mng-4283/sub/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 bb4438ae28..56d443768a 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 @@ -86,6 +86,7 @@ public class IntegrationTestSuite // suite.addTestSuite( MavenIT0109ReleaseUpdateTest.class ); // suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137 + suite.addTestSuite( MavenITmng4283ParentPomPackagingTest.class ); suite.addTestSuite( MavenITmng4281PreferLocalSnapshotTest.class ); suite.addTestSuite( MavenITmng4279WagonProviderFailoverTest.class ); suite.addTestSuite( MavenITmng4276WrongTransitivePlexusUtilsTest.class ); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4283ParentPomPackagingTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4283ParentPomPackagingTest.java new file mode 100644 index 0000000000..8b05306b20 --- /dev/null +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng4283ParentPomPackagingTest.java @@ -0,0 +1,68 @@ +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.Properties; + +/** + * This is a test set for MNG-4283. + * + * @author Benjamin Bentmann + */ +public class MavenITmng4283ParentPomPackagingTest + extends AbstractMavenIntegrationTestCase +{ + + public MavenITmng4283ParentPomPackagingTest() + { + super( ALL_MAVEN_VERSIONS ); + } + + /** + * Test that the model builder fails when a parent POM has not "pom" packaging. + */ + public void testit() + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4283" ); + + Verifier verifier = new Verifier( new File( testDir, "sub" ).getAbsolutePath() ); + verifier.setAutoclean( false ); + try + { + verifier.executeGoal( "validate" ); + verifier.verifyErrorFreeLog(); + fail( "Invalid packaging of parent POM did not fail the build." ); + } + catch ( VerificationException e ) + { + // expected + } + finally + { + verifier.resetStreams(); + } + } + +} diff --git a/its/core-it-suite/src/test/resources/mng-4283/pom.xml b/its/core-it-suite/src/test/resources/mng-4283/pom.xml new file mode 100644 index 0000000000..1695245591 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4283/pom.xml @@ -0,0 +1,35 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng4283 + parent + 0.1 + + jar + + Maven Integration Test :: MNG-4283 + + Test that the model builder fails when a parent POM has not "pom" packaging. + + diff --git a/its/core-it-suite/src/test/resources/mng-4283/sub/pom.xml b/its/core-it-suite/src/test/resources/mng-4283/sub/pom.xml new file mode 100644 index 0000000000..eca47eb37d --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-4283/sub/pom.xml @@ -0,0 +1,40 @@ + + + + + + 4.0.0 + + + org.apache.maven.its.mng4283 + parent + 0.1 + + + org.apache.maven.its.mng4283 + test + 0.1 + jar + + Maven Integration Test :: MNG-4283 + + Test that the model builder fails when a parent POM has not "pom" packaging. + +