Author: jdcasey
Date: Fri Aug 22 15:45:09 2008
New Revision: 688209
URL: http://svn.apache.org/viewvc?rev=688209&view=rev
Log:
[MNG-3723] Adding integration test (issue is already fixed in the RC branch).
Added:
maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3723ConcreteParentProjectTest.java
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3723-concreteParentProject/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3723-concreteParentProject/maven-mng3723-plugin/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3723-concreteParentProject/maven-mng3723-plugin/pom.xml
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3723-concreteParentProject/maven-mng3723-plugin/src/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3723-concreteParentProject/maven-mng3723-plugin/src/main/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3723-concreteParentProject/maven-mng3723-plugin/src/main/java/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3723-concreteParentProject/maven-mng3723-plugin/src/main/java/jar/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3723-concreteParentProject/maven-mng3723-plugin/src/main/java/jar/MyMojo.java
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3723-concreteParentProject/projects/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3723-concreteParentProject/projects/child/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3723-concreteParentProject/projects/child/pom.xml
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3723-concreteParentProject/projects/pom.xml
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=688209&r1=688208&r2=688209&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
Fri Aug 22 15:45:09 2008
@@ -76,6 +76,7 @@
MavenITmng3645POMSyntaxErrorTest
*/
+ suite.addTestSuite( MavenITmng3723ConcreteParentProjectTest.class );
suite.addTestSuite( MavenITmng3716AggregatorForkingTest.class );
suite.addTestSuite( MavenITmng3710PollutedClonedPluginsTest.class );
suite.addTestSuite( MavenITmng3704LifecycleExecutorWrapperTest.class );
Added:
maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3723ConcreteParentProjectTest.java
URL:
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3723ConcreteParentProjectTest.java?rev=688209&view=auto
==============================================================================
---
maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3723ConcreteParentProjectTest.java
(added)
+++
maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3723ConcreteParentProjectTest.java
Fri Aug 22 15:45:09 2008
@@ -0,0 +1,72 @@
+/*
+ * 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-3723">MNG-3723</a>.
+ *
+ * Tests that the parent MavenProject instance of the current project has been
+ * transitioned into a concrete state before a mojo is executed. If this is
true,
+ * then injecting ${project} into the mojo and traversing to
project.getParent().getBasedir()
+ * should retrieve a File instance that is interpolated and exists (since
we're
+ * going to be using a parent-child project set in the projects directory).
+ *
+ * @author jdcasey
+ *
+ */
+public class MavenITmng3723ConcreteParentProjectTest
+ extends AbstractMavenIntegrationTestCase
+{
+ public MavenITmng3723ConcreteParentProjectTest()
+ throws InvalidVersionSpecificationException
+ {
+ super( "(2.0.8,)" ); // only test in 2.0.9+
+ }
+
+ public void testitMNG3723 ()
+ throws Exception
+ {
+ // The testdir is computed from the location of this
+ // file.
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(),
"/mng-3723-concreteParentProject" );
+ File pluginDir = new File( testDir, "maven-mng3723-plugin" );
+ File projectDir = new File( testDir, "projects" );
+
+ 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();
+ }
+}
Added:
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3723-concreteParentProject/maven-mng3723-plugin/pom.xml
URL:
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3723-concreteParentProject/maven-mng3723-plugin/pom.xml?rev=688209&view=auto
==============================================================================
---
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3723-concreteParentProject/maven-mng3723-plugin/pom.xml
(added)
+++
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3723-concreteParentProject/maven-mng3723-plugin/pom.xml
Fri Aug 22 15:45:09 2008
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?><project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.its.mng3723</groupId>
+ <artifactId>maven-mng3723-plugin</artifactId>
+ <packaging>maven-plugin</packaging>
+ <name>maven-mng3723-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>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-project</artifactId>
+ <version>2.0.9</version>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Added:
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3723-concreteParentProject/maven-mng3723-plugin/src/main/java/jar/MyMojo.java
URL:
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3723-concreteParentProject/maven-mng3723-plugin/src/main/java/jar/MyMojo.java?rev=688209&view=auto
==============================================================================
---
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3723-concreteParentProject/maven-mng3723-plugin/src/main/java/jar/MyMojo.java
(added)
+++
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3723-concreteParentProject/maven-mng3723-plugin/src/main/java/jar/MyMojo.java
Fri Aug 22 15:45:09 2008
@@ -0,0 +1,49 @@
+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 org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * @goal run
+ */
+public class MyMojo
+ extends AbstractMojo
+{
+ /**
+ * Location of the file.
+ * @parameter expression="${project}"
+ * @required
+ * @readonly
+ */
+ private MavenProject project;
+
+ public void execute()
+ throws MojoExecutionException
+ {
+ String parentBuildDir = project.getParent().getBuild().getDirectory();
+
+ getLog().info( "parent build dir is: " + parentBuildDir );
+
+ if ( parentBuildDir.indexOf( "${" ) > -1 )
+ {
+ throw new MojoExecutionException( "Parent-project's build dir is
not interpolated." );
+ }
+ }
+}
Added:
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3723-concreteParentProject/projects/child/pom.xml
URL:
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3723-concreteParentProject/projects/child/pom.xml?rev=688209&view=auto
==============================================================================
---
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3723-concreteParentProject/projects/child/pom.xml
(added)
+++
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3723-concreteParentProject/projects/child/pom.xml
Fri Aug 22 15:45:09 2008
@@ -0,0 +1,32 @@
+<?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>
+ <parent>
+ <artifactId>projects</artifactId>
+ <groupId>org.apache.maven.its.mng3723</groupId>
+ <version>1</version>
+ </parent>
+ <groupId>org.apache.maven.its.mng3723</groupId>
+ <artifactId>child</artifactId>
+ <version>1</version>
+ <packaging>pom</packaging>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.mng3723</groupId>
+ <artifactId>maven-mng3723-plugin</artifactId>
+ <version>1</version>
+ <executions>
+ <execution>
+ <id>test</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added:
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3723-concreteParentProject/projects/pom.xml
URL:
http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3723-concreteParentProject/projects/pom.xml?rev=688209&view=auto
==============================================================================
---
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3723-concreteParentProject/projects/pom.xml
(added)
+++
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3723-concreteParentProject/projects/pom.xml
Fri Aug 22 15:45:09 2008
@@ -0,0 +1,11 @@
+<?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.mng3723</groupId>
+ <artifactId>projects</artifactId>
+ <version>1</version>
+ <packaging>pom</packaging>
+ <modules>
+ <module>child</module>
+ </modules>
+</project>