Author: jdcasey Date: Tue Sep 9 16:44:33 2008 New Revision: 693657 URL: http://svn.apache.org/viewvc?rev=693657&view=rev Log: [MNG-3748] integration test
Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3748BadSettingsXmlTest.java (with props) maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3748-badSettingsXml/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3748-badSettingsXml/pom.xml (with props) maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3748-badSettingsXml/settings.xml (with props) Modified: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java Modified: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java?rev=693657&r1=693656&r2=693657&view=diff ============================================================================== --- maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java (original) +++ maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java Tue Sep 9 16:44:33 2008 @@ -76,6 +76,7 @@ MavenITmng3645POMSyntaxErrorTest */ + suite.addTestSuite( MavenITmng3748BadSettingsXmlTest.class ); suite.addTestSuite( MavenITmng3747PrefixedPathExpressionTest.class ); suite.addTestSuite( MavenITmng3746POMPropertyOverrideTest.class ); suite.addTestSuite( MavenITmng3743ForkWithPluginManagementTest.class ); Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3748BadSettingsXmlTest.java URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3748BadSettingsXmlTest.java?rev=693657&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3748BadSettingsXmlTest.java (added) +++ maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3748BadSettingsXmlTest.java Tue Sep 9 16:44:33 2008 @@ -0,0 +1,79 @@ +/* + * 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. + */ + +package org.apache.maven.integrationtests; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException; +import org.apache.maven.integrationtests.AbstractMavenIntegrationTestCase; +import org.apache.maven.it.VerificationException; +import org.apache.maven.it.Verifier; +import org.apache.maven.it.util.ResourceExtractor; + +/** + * This is a test set for <a href="http://jira.codehaus.org/browse/MNG-3748">MNG-3748</a>. + * + * Verifies that the settings.xml file is parsed using strict mode, such that invalid + * xml will cause an error (specifically, when repositories are not contained within a profile declaration) + * + * @author jdcasey + * + */ +public class MavenITmng3748BadSettingsXmlTest + extends AbstractMavenIntegrationTestCase +{ + public MavenITmng3748BadSettingsXmlTest() + throws InvalidVersionSpecificationException + { + super( "(2.0.8,)" ); // only test in 2.0.9+ + } + + public void testitMNG3748 () + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3748-badSettingsXml" ); + + Verifier verifier; + + verifier = new Verifier( testDir.getAbsolutePath() ); + + List cliOptions = new ArrayList(); + cliOptions.add( "-s" ); + cliOptions.add( "settings.xml" ); + + verifier.setCliOptions( cliOptions ); + + try + { + verifier.executeGoal( "validate" ); + verifier.verifyErrorFreeLog(); + + fail( "build should fail if settings.xml doesn't contain valid xml." ); + } + catch ( VerificationException e ) + { + // expected + } + + verifier.resetStreams(); + } +} Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3748BadSettingsXmlTest.java ------------------------------------------------------------------------------ svn:eol-style = native Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3748-badSettingsXml/pom.xml URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3748-badSettingsXml/pom.xml?rev=693657&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3748-badSettingsXml/pom.xml (added) +++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3748-badSettingsXml/pom.xml Tue Sep 9 16:44:33 2008 @@ -0,0 +1,14 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>org.apache.maven.its.mng3748</groupId> + <artifactId>mng-3748</artifactId> + <packaging>pom</packaging> + <version>1</version> + + <name>Integration Test Project for MNG-3748</name> + <description> + This project verifies that MNG-3748 is fixed. It is controlled by a JUnit test called org.apache.maven.integrationtests.MNG3748Test + </description> + + <url>http://jira.codehaus.org/browse/MNG-3748</url> +</project> Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3748-badSettingsXml/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3748-badSettingsXml/settings.xml URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3748-badSettingsXml/settings.xml?rev=693657&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3748-badSettingsXml/settings.xml (added) +++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3748-badSettingsXml/settings.xml Tue Sep 9 16:44:33 2008 @@ -0,0 +1,14 @@ +<settings> + <repositories> + <repository> + <id>central</id> + <url>http://central</url> + <releases> + <enabled>true</enabled> + </releases> + <snapshots> + <enabled>true</enabled> + </snapshots> + </repository> + </repositories> +</settings> \ No newline at end of file Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3748-badSettingsXml/settings.xml ------------------------------------------------------------------------------ svn:eol-style = native