Added testcase for MRESOURCES-18. This should really go into

the resources-plugin itself using the new framework, but 
committing anyway for future reference and regression testing.


git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@398452 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Kenney Westerhof 2006-04-30 22:01:04 +00:00
parent 2095f80305
commit 7d5d3668fe
7 changed files with 89 additions and 0 deletions

View File

@ -0,0 +1 @@
-Dparam=PARAM

View File

@ -0,0 +1 @@
target/classes/test.properties

View File

View File

@ -0,0 +1 @@
test

View File

@ -0,0 +1,34 @@
<project xmlns="http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>testing</groupId>
<artifactId>maven-core-it-it0105</artifactId>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<type>jar</type>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<!-- Enabling this will fix the problem for
maven-resources-plugin 2.2-20060403.015736-1 and earlier.
<filters>
<filter>filter.properties</filter>
</filters>
-->
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<properties>
<my.property>foo</my.property>
</properties>
</project>

View File

@ -0,0 +1,3 @@
systemProperty=${user.home}
param=${param}
pom.property=${my.property}

View File

@ -0,0 +1,49 @@
package org.apache.maven.it0105;
import junit.framework.TestCase;
import java.util.Properties;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
public class FilterTest
extends TestCase
{
private String basedir;
private Properties properties;
protected void setUp()
throws Exception
{
basedir = System.getProperty( "basedir" );
properties = new Properties();
File testPropertiesFile = new File( basedir, "target/classes/test.properties" );
assertTrue( testPropertiesFile.exists() );
properties.load( new FileInputStream( testPropertiesFile ) );
}
public void testSystemPropertyInterpolation()
throws IOException
{
assertEquals( "System property", System.getProperty( "user.home" ), properties.getProperty( "systemProperty" ) );
}
public void testParameterInterpolation()
throws IOException
{
assertEquals( "Parameter", System.getProperty( "parameter" ), properties.getProperty( "parameter" ) );
}
public void testPomPropertyInterpolation()
throws IOException
{
assertEquals( "Pom Property", "foo", properties.getProperty( "pom.property" ) );
}
}