add it test for MNG-5224

git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@1227299 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-01-04 20:23:55 +00:00
parent 8976ccf030
commit bceb6fd42b
6 changed files with 185 additions and 0 deletions

View File

@ -106,6 +106,7 @@ public class IntegrationTestSuite
// -------------------------------------------------------------------------------------------------------------
// suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137
suite.addTestSuite( MavenITmng5224InjectedSettings.class );
suite.addTestSuite( MavenITmng5214DontMapWsdlToJar.class );
suite.addTestSuite( MavenITmng5137ReactorResolutionInForkedBuildTest.class );
suite.addTestSuite( MavenITmng5135AggregatorDepResolutionModuleExtensionTest.class );

View File

@ -0,0 +1,27 @@
<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.mng5224</groupId>
<artifactId>test-project</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>test-project</name>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.its.plugins</groupId>
<artifactId>maven-it-plugin-settings</artifactId>
<version>2.1-SNAPSHOT</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>settings-read</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,27 @@
<settings>
<profiles>
<profile>
<id>apache</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<run-its>true</run-its>
</properties>
</profile>
<profile>
<id>release</id>
<properties>
<gpg.passphrase>verycomplicatedpassphrase</gpg.passphrase>
</properties>
</profile>
<profile>
<id>fast</id>
<properties>
<maven.test.skip>true</maven.test.skip>
<skipTests>true</skipTests>
</properties>
</profile>
</profiles>
</settings>

View File

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>maven-it-plugins</artifactId>
<groupId>org.apache.maven.its.plugins</groupId>
<version>2.1-SNAPSHOT</version>
</parent>
<artifactId>maven-it-plugin-settings</artifactId>
<packaging>maven-plugin</packaging>
<name>Maven IT Plugin :: Touch</name>
<inceptionYear>2001</inceptionYear>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-settings</artifactId>
<version>2.0</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,79 @@
package org.apache.maven.plugin.coreit;
/*
* 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.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.settings.Settings;
import org.apache.maven.settings.io.xpp3.SettingsXpp3Writer;
import org.codehaus.plexus.util.IOUtil;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
/**
* @goal settings-read
* @phase validate
* @description Goal which read settings and dump it to a file
*/
public class SettingsReadItMojo
extends AbstractMojo
{
/**
* @parameter expression="${settings}"
* @required
* @readonly
*/
private Settings settings;
/**
* @parameter default-value="target/settings-dump.xml"
* @required
*/
private File dumpFile;
public void execute()
throws MojoExecutionException
{
if ( dumpFile.exists() )
{
dumpFile.delete();
}
dumpFile.getParentFile().mkdirs();
FileWriter fw = null;
try
{
fw = new FileWriter( dumpFile );
SettingsXpp3Writer writer = new SettingsXpp3Writer();
writer.write( fw, settings );
}
catch ( IOException e )
{
throw new MojoExecutionException( e.getMessage(), e );
}
finally
{
IOUtil.close( fw );
}
}
}

View File

@ -75,6 +75,7 @@ under the License.
<module>maven-it-plugin-extension1</module>
<module>maven-it-plugin-extension2</module>
<module>maven-it-plugin-plexus-lifecycle</module>
<module>maven-it-plugin-settings</module>
</modules>
<scm>