You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jd...@apache.org on 2008/09/08 23:54:52 UTC
svn commit: r693296 - in
/maven/core-integration-testing/trunk/core-integration-tests/src/test:
java/org/apache/maven/integrationtests/
resources/mng-3535-selfReferentialProperties/
resources/mng-3535-selfReferentialProperties/failure/ resources/mng-35...
Author: jdcasey
Date: Mon Sep 8 14:54:51 2008
New Revision: 693296
URL: http://svn.apache.org/viewvc?rev=693296&view=rev
Log:
[MNG-3535][MNG-3746] Improve integration tests for MNG-3535 to include an expected failure case, and add an integration test for a similar problem where POM properties legitimately should override system properties for interpolation.
Added:
maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3746POMPropertyOverrideTest.java (with props)
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3535-selfReferentialProperties/failure/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3535-selfReferentialProperties/failure/pom.xml (with props)
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3535-selfReferentialProperties/success/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3535-selfReferentialProperties/success/pom.xml (props changed)
- copied unchanged from r691774, maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3535-selfReferentialProperties/pom.xml
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3746-pomPropertyOverride/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3746-pomPropertyOverride/maven-mng3746-plugin/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3746-pomPropertyOverride/maven-mng3746-plugin/pom.xml (with props)
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3746-pomPropertyOverride/maven-mng3746-plugin/src/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3746-pomPropertyOverride/maven-mng3746-plugin/src/main/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3746-pomPropertyOverride/maven-mng3746-plugin/src/main/java/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3746-pomPropertyOverride/maven-mng3746-plugin/src/main/java/jar/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3746-pomPropertyOverride/maven-mng3746-plugin/src/main/java/jar/MyMojo.java (with props)
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3746-pomPropertyOverride/project/
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3746-pomPropertyOverride/project/pom.xml (with props)
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3746-pomPropertyOverride/readme.txt (with props)
Removed:
maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3535-selfReferentialProperties/pom.xml
Modified:
maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/IntegrationTestSuite.java
maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3535SelfReferentialProperties.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=693296&r1=693295&r2=693296&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 Mon Sep 8 14:54:51 2008
@@ -76,6 +76,7 @@
MavenITmng3645POMSyntaxErrorTest
*/
+ suite.addTestSuite( MavenITmng3746POMPropertyOverrideTest.class );
suite.addTestSuite( MavenITmng3743ForkWithPluginManagementTest.class );
suite.addTestSuite( MavenITmng3740SelfReferentialReactorProjectsTest.class );
suite.addTestSuite( MavenITmng3729MultiForkAggregatorsTest.class );
Modified: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3535SelfReferentialProperties.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3535SelfReferentialProperties.java?rev=693296&r1=693295&r2=693296&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3535SelfReferentialProperties.java (original)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3535SelfReferentialProperties.java Mon Sep 8 14:54:51 2008
@@ -8,27 +8,61 @@
import java.util.ArrayList;
import java.util.List;
-public class MavenITmng3535SelfReferentialProperties extends AbstractMavenIntegrationTestCase {
+public class MavenITmng3535SelfReferentialProperties
+ extends AbstractMavenIntegrationTestCase
+{
+
+ public MavenITmng3535SelfReferentialProperties()
+ throws InvalidVersionSpecificationException
+ {
+ super( "(2.0.9,)" );
+ }
+
+ public void testitMNG3535_ShouldSucceed()
+ throws Exception
+ {
+ File testDir =
+ ResourceExtractor.simpleExtractResources( getClass(), "/mng-3535-selfReferentialProperties/success" );
- public MavenITmng3535SelfReferentialProperties()
- throws InvalidVersionSpecificationException
- {
- super( "(2.0.9,)");
- }
-
- public void testitMNG3535() throws Exception {
- File testDir = ResourceExtractor.simpleExtractResources(getClass(),
- "/mng-3535-selfReferentialProperties");
- Verifier verifier = new Verifier(testDir.getAbsolutePath());
+ Verifier verifier = new Verifier( testDir.getAbsolutePath() );
List opts = new ArrayList();
opts.add( "-X" );
verifier.setCliOptions( opts );
verifier.setAutoclean( false );
- verifier.executeGoal("verify");
+ verifier.executeGoal( "verify" );
verifier.verifyErrorFreeLog();
verifier.resetStreams();
}
+
+ public void testitMNG3535_ShouldFail()
+ throws Exception
+ {
+ File testDir =
+ ResourceExtractor.simpleExtractResources( getClass(), "/mng-3535-selfReferentialProperties/failure" );
+
+ Verifier verifier = new Verifier( testDir.getAbsolutePath() );
+
+ List opts = new ArrayList();
+ opts.add( "-X" );
+ verifier.setCliOptions( opts );
+
+ verifier.setAutoclean( false );
+
+ try
+ {
+ verifier.executeGoal( "verify" );
+
+ verifier.verifyErrorFreeLog();
+ fail( "There is a self-referential property in this build; it should fail." );
+ }
+ catch ( Exception e )
+ {
+ // should fail this verification, because there truly is a self-referential property.
+ }
+
+ verifier.resetStreams();
+ }
}
Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3746POMPropertyOverrideTest.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3746POMPropertyOverrideTest.java?rev=693296&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3746POMPropertyOverrideTest.java (added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3746POMPropertyOverrideTest.java Mon Sep 8 14:54:51 2008
@@ -0,0 +1,67 @@
+/*
+ * 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-3746">MNG-3746</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 MavenITmng3746POMPropertyOverrideTest
+ extends AbstractMavenIntegrationTestCase
+{
+ public MavenITmng3746POMPropertyOverrideTest()
+ throws InvalidVersionSpecificationException
+ {
+ super( "(2.0.8,)" ); // only test in 2.0.9+
+ }
+
+ public void testitMNG3746 ()
+ throws Exception
+ {
+ // The testdir is computed from the location of this
+ // file.
+ File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3746-pomPropertyOverride" );
+ File pluginDir = new File( testDir, "maven-mng3746-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();
+ }
+}
Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3746POMPropertyOverrideTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3535-selfReferentialProperties/failure/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3535-selfReferentialProperties/failure/pom.xml?rev=693296&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3535-selfReferentialProperties/failure/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3535-selfReferentialProperties/failure/pom.xml Mon Sep 8 14:54:51 2008
@@ -0,0 +1,74 @@
+<!--
+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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>test</groupId>
+ <artifactId>mng3535-selfReferentialProperties</artifactId>
+ <packaging>pom</packaging>
+ <version>1.0</version>
+ <name>Apache Maven: mng3535-selfReferentialProperties</name>
+
+ <repositories>
+ <repository>
+ <id>test-plugins</id>
+ <url>http://people.apache.org/repo/m2-snapshot-repository/</url>
+ <releases><enabled>false</enabled></releases>
+ <snapshots><enabled>true</enabled></snapshots>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>test-plugins</id>
+ <url>http://people.apache.org/repo/m2-snapshot-repository/</url>
+ <releases><enabled>false</enabled></releases>
+ <snapshots><enabled>true</enabled></snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.plugins</groupId>
+ <version>2.1-SNAPSHOT</version>
+ <artifactId>maven-it-plugin-project-interpolation</artifactId>
+ <executions>
+ <execution>
+ <phase>install</phase>
+ <goals>
+ <goal>verify-property</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <properties>
+ <property>
+ <name>java.specification.version</name>
+ <value>${my.specification.version}</value>
+ </property>
+ </properties>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <properties>
+ <my.specification.version>${my.specification.version}</my.specification.version>
+ </properties>
+</project>
\ No newline at end of file
Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3535-selfReferentialProperties/failure/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3535-selfReferentialProperties/success/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3535-selfReferentialProperties/success/pom.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3535-selfReferentialProperties/success/pom.xml
------------------------------------------------------------------------------
svn:mergeinfo =
Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3746-pomPropertyOverride/maven-mng3746-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3746-pomPropertyOverride/maven-mng3746-plugin/pom.xml?rev=693296&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3746-pomPropertyOverride/maven-mng3746-plugin/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3746-pomPropertyOverride/maven-mng3746-plugin/pom.xml Mon Sep 8 14:54:51 2008
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?><project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.its.mng3746</groupId>
+ <artifactId>maven-mng3746-plugin</artifactId>
+ <packaging>maven-plugin</packaging>
+ <name>maven-mng3746-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>
+ </dependencies>
+</project>
\ No newline at end of file
Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3746-pomPropertyOverride/maven-mng3746-plugin/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3746-pomPropertyOverride/maven-mng3746-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-3746-pomPropertyOverride/maven-mng3746-plugin/src/main/java/jar/MyMojo.java?rev=693296&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3746-pomPropertyOverride/maven-mng3746-plugin/src/main/java/jar/MyMojo.java (added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3746-pomPropertyOverride/maven-mng3746-plugin/src/main/java/jar/MyMojo.java Mon Sep 8 14:54:51 2008
@@ -0,0 +1,67 @@
+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.util.Properties;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+
+/**
+ * @goal test
+ */
+public class MyMojo
+ extends AbstractMojo
+{
+ /**
+ * @parameter
+ * @required
+ */
+ private String check;
+
+ /**
+ * @parameter default-value="${project.properties}"
+ * @readonly
+ */
+ private Properties properties;
+
+ public void execute()
+ throws MojoExecutionException
+ {
+ String sysProp = System.getProperty( "java.version" );
+ String pomProp = properties.getProperty( "java.version" );
+
+ boolean fail = false;
+
+ if ( check.equals( sysProp ) )
+ {
+ getLog().error( "Check value is the same as the system property; interpolation failed! (value: " + check + ")" );
+ fail = true;
+ }
+
+ if ( !check.equals( pomProp ) )
+ {
+ getLog().error( "Check value is NOT the same as the POM property; interpolation failed! (value: " + check + ")" );
+ fail = true;
+ }
+
+ if ( fail )
+ {
+ throw new MojoExecutionException( "Failed to verify interpolation with POM override of a system property. See console output for more information." );
+ }
+ }
+}
Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3746-pomPropertyOverride/maven-mng3746-plugin/src/main/java/jar/MyMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3746-pomPropertyOverride/project/pom.xml
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3746-pomPropertyOverride/project/pom.xml?rev=693296&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3746-pomPropertyOverride/project/pom.xml (added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3746-pomPropertyOverride/project/pom.xml Mon Sep 8 14:54:51 2008
@@ -0,0 +1,34 @@
+<?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.mng3746</groupId>
+ <artifactId>project</artifactId>
+ <version>1</version>
+ <packaging>pom</packaging>
+
+ <properties>
+ <java.version>overridden</java.version>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.mng3746</groupId>
+ <artifactId>maven-mng3746-plugin</artifactId>
+ <version>1</version>
+ <executions>
+ <execution>
+ <id>test</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <check>${java.version}</check>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3746-pomPropertyOverride/project/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3746-pomPropertyOverride/readme.txt
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3746-pomPropertyOverride/readme.txt?rev=693296&view=auto
==============================================================================
--- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3746-pomPropertyOverride/readme.txt (added)
+++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3746-pomPropertyOverride/readme.txt Mon Sep 8 14:54:51 2008
@@ -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.
\ No newline at end of file
Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3746-pomPropertyOverride/readme.txt
------------------------------------------------------------------------------
svn:eol-style = native