mirror of https://github.com/apache/maven.git
[MNG-3747] integration test.
git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@693340 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4bb9018ec3
commit
68c97b6ad9
|
@ -76,6 +76,7 @@ MavenITmng3415JunkRepositoryMetadataTest
|
|||
MavenITmng3645POMSyntaxErrorTest
|
||||
*/
|
||||
|
||||
suite.addTestSuite( MavenITmng3747PrefixedPathExpressionTest.class );
|
||||
suite.addTestSuite( MavenITmng3746POMPropertyOverrideTest.class );
|
||||
suite.addTestSuite( MavenITmng3743ForkWithPluginManagementTest.class );
|
||||
suite.addTestSuite( MavenITmng3740SelfReferentialReactorProjectsTest.class );
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* 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 org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
|
||||
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-3747">MNG-3747</a>.
|
||||
*
|
||||
* @todo Fill in a better description of what this test verifies!
|
||||
*
|
||||
* @author <a href="mailto:brianf@apache.org">Brian Fox</a>
|
||||
* @author jdcasey
|
||||
*
|
||||
*/
|
||||
public class MavenITmng3747PrefixedPathExpressionTest
|
||||
extends AbstractMavenIntegrationTestCase
|
||||
{
|
||||
public MavenITmng3747PrefixedPathExpressionTest()
|
||||
throws InvalidVersionSpecificationException
|
||||
{
|
||||
super( "(2.0.8,)" ); // only test in 2.0.9+
|
||||
}
|
||||
|
||||
public void testitMNG3747 ()
|
||||
throws Exception
|
||||
{
|
||||
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3747-prefixedPathExpression" );
|
||||
File pluginDir = new File( testDir, "maven-mng3747-plugin" );
|
||||
File projectDir = new File( testDir, "project" );
|
||||
|
||||
Verifier verifier;
|
||||
|
||||
verifier = new Verifier( pluginDir.getAbsolutePath() );
|
||||
verifier.executeGoal( "install" );
|
||||
verifier.verifyErrorFreeLog();
|
||||
verifier.resetStreams();
|
||||
|
||||
verifier = new Verifier( projectDir.getAbsolutePath() );
|
||||
verifier.executeGoal( "validate" );
|
||||
verifier.verifyErrorFreeLog();
|
||||
verifier.resetStreams();
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.apache.maven.its.mng3747</groupId>
|
||||
<artifactId>maven-mng3747-plugin</artifactId>
|
||||
<packaging>maven-plugin</packaging>
|
||||
<name>maven-mng3747-plugin Maven Mojo</name>
|
||||
<version>1</version>
|
||||
<url>http://maven.apache.org</url>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-api</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,56 @@
|
|||
package jar;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed 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 java.io.File;
|
||||
|
||||
import org.apache.maven.plugin.AbstractMojo;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
|
||||
/**
|
||||
* @goal test
|
||||
*/
|
||||
public class MyMojo
|
||||
extends AbstractMojo
|
||||
{
|
||||
/**
|
||||
* Location of the file.
|
||||
* @parameter default-value="${project.build.directory}"
|
||||
* @readonly
|
||||
*/
|
||||
private File buildDirectory;
|
||||
|
||||
/**
|
||||
* @parameter
|
||||
* @required
|
||||
*/
|
||||
private String config;
|
||||
|
||||
public void execute()
|
||||
throws MojoExecutionException
|
||||
{
|
||||
if ( !buildDirectory.isAbsolute() )
|
||||
{
|
||||
throw new MojoExecutionException( "The expression 'project.build.directory' didn't render an absolute path when injected from a plugin parameter default value." );
|
||||
}
|
||||
|
||||
if ( config.indexOf( buildDirectory.getAbsolutePath() ) < 0 )
|
||||
{
|
||||
throw new MojoExecutionException( "The expression 'project.build.directory' didn't render an absolute path when used inside a plugin configuration of type String." );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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.mng3747</groupId>
|
||||
<artifactId>project</artifactId>
|
||||
<version>1</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<build>
|
||||
<directory>relative</directory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.its.mng3747</groupId>
|
||||
<artifactId>maven-mng3747-plugin</artifactId>
|
||||
<version>1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>test</id>
|
||||
<phase>validate</phase>
|
||||
<goals>
|
||||
<goal>test</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<config>path is: ${project.build.directory}/somepath</config>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1 @@
|
|||
Fill this in with a description of the scenario this test attempts to check. Also include instructions for running the test manually from the command line.
|
Loading…
Reference in New Issue