maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r692535 - /maven/plugins/branches/MRESOURCES-56/src/test/java/org/apache/maven/plugin/resources/ResourcesMojoTest.java
Date Fri, 05 Sep 2008 20:33:03 GMT
Author: olamy
Date: Fri Sep  5 13:33:02 2008
New Revision: 692535

URL: http://svn.apache.org/viewvc?rev=692535&view=rev
Log:
fix unit on windows

Modified:
    maven/plugins/branches/MRESOURCES-56/src/test/java/org/apache/maven/plugin/resources/ResourcesMojoTest.java

Modified: maven/plugins/branches/MRESOURCES-56/src/test/java/org/apache/maven/plugin/resources/ResourcesMojoTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/MRESOURCES-56/src/test/java/org/apache/maven/plugin/resources/ResourcesMojoTest.java?rev=692535&r1=692534&r2=692535&view=diff
==============================================================================
--- maven/plugins/branches/MRESOURCES-56/src/test/java/org/apache/maven/plugin/resources/ResourcesMojoTest.java
(original)
+++ maven/plugins/branches/MRESOURCES-56/src/test/java/org/apache/maven/plugin/resources/ResourcesMojoTest.java
Fri Sep  5 13:33:02 2008
@@ -21,10 +21,12 @@
 
 import java.io.BufferedReader;
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.FileReader;
 import java.io.IOException;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Properties;
 
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.plugin.resources.stub.MavenProjectResourcesStub;
@@ -304,7 +306,7 @@
 
         assertNotNull( mojo );
 
-        project.addFile( "file4.txt", "current working directory = ${user.dir}" );
+        project.addFile( "file4.txt", "current-working-directory = ${user.dir}" );
         project.setResourceFiltering( 0, true );
         project.setupBuildEnvironment();
 
@@ -318,9 +320,15 @@
         mojo.execute();
 
         String resourcesDir = project.getOutputDirectory();
-        String checkString = "current working directory = " + (String) System.getProperty(
"user.dir" );
 
-        assertContent( resourcesDir + "/file4.txt", checkString );
+        File userDir = new File( System.getProperty( "user.dir" ) );
+        assertTrue( userDir.exists() );
+        
+        Properties props = new Properties();
+        props.load( new FileInputStream( new File( resourcesDir + "/file4.txt" ) ) );
+        File fileFromFiltering = new File( props.getProperty( "current-working-directory"
) );
+        assertTrue( fileFromFiltering.exists() );
+        assertEquals( userDir.getAbsolutePath(), fileFromFiltering.getAbsolutePath() );
     }
 
     /**
@@ -453,6 +461,7 @@
         setVariableValueToObject(mojo, "filters", filterList);
         mojo.execute();
         final String resourcesDir = project.getOutputDirectory();
+        
         final String checkString = "current working directory=foobar";
 
         assertContent(resourcesDir + "/file4.properties", checkString);



Mime
View raw message