You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by br...@apache.org on 2006/12/27 01:11:52 UTC
svn commit: r490410 -
/maven/shared/trunk/file-management/src/test/java/org/apache/maven/shared/model/fileset/util/FileSetUtilsTest.java
Author: brett
Date: Tue Dec 26 16:11:51 2006
New Revision: 490410
URL: http://svn.apache.org/viewvc?view=rev&rev=490410
Log:
[MNG-2701] FileSetUtilsTest.operatingSystemAllowsLinking fails on windows
Submitted by: Baerrach bonDierne
Modified:
maven/shared/trunk/file-management/src/test/java/org/apache/maven/shared/model/fileset/util/FileSetUtilsTest.java
Modified: maven/shared/trunk/file-management/src/test/java/org/apache/maven/shared/model/fileset/util/FileSetUtilsTest.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/file-management/src/test/java/org/apache/maven/shared/model/fileset/util/FileSetUtilsTest.java?view=diff&rev=490410&r1=490409&r2=490410
==============================================================================
--- maven/shared/trunk/file-management/src/test/java/org/apache/maven/shared/model/fileset/util/FileSetUtilsTest.java (original)
+++ maven/shared/trunk/file-management/src/test/java/org/apache/maven/shared/model/fileset/util/FileSetUtilsTest.java Tue Dec 26 16:11:51 2006
@@ -20,8 +20,7 @@
public class FileSetUtilsTest
extends TestCase
{
- private static final List LINK_ENABLED_OSES = Arrays.asList( new String[]{ "unix", "osx", "bsd" } );
-
+
private Set testDirectories = new HashSet();
private Set linkFiles = new HashSet();
@@ -59,53 +58,51 @@
public void testIncludesDontFollowSymlinks() throws IOException, InterruptedException, CommandLineException
{
- if ( operatingSystemAllowsLinking() )
+ File directory = setupTestDirectory( "testIncludesDontFollowSymlinks" );
+ File subdir = new File( directory, "linked-to-self" );
+
+ if ( !createSymlink( directory, subdir ) )
{
- File directory = setupTestDirectory( "testIncludesDontFollowSymlinks" );
- File subdir = new File( directory, "linked-to-self" );
-
- if ( !createSymlink( directory, subdir ) )
- {
- fail( "Cannot create symlink." );
- }
-
- FileSet set = new FileSet();
- set.setDirectory( directory.getPath() );
- set.addInclude( "**/included.txt" );
- set.setFollowSymlinks( false );
-
- FileSetManager fileSetManager = new FileSetManager();
-
- String[] included = fileSetManager.getIncludedFiles( set );
-
- Assert.assertEquals( 1, included.length );
- }
+ // assume failure to create a sym link is because the system does not support them
+ // and not because the sym link creation failed.
+ return;
+ }
+
+ FileSet set = new FileSet();
+ set.setDirectory( directory.getPath() );
+ set.addInclude( "**/included.txt" );
+ set.setFollowSymlinks( false );
+
+ FileSetManager fileSetManager = new FileSetManager();
+
+ String[] included = fileSetManager.getIncludedFiles( set );
+
+ Assert.assertEquals( 1, included.length );
}
public void testDeleteDontFollowSymlinks() throws IOException, InterruptedException, CommandLineException
{
- if ( operatingSystemAllowsLinking() )
+ File directory = setupTestDirectory( "testDeleteDontFollowSymlinks" );
+ File subdir = new File( directory, "linked-to-self" );
+
+ if ( !createSymlink( directory, subdir ) )
{
- File directory = setupTestDirectory( "testDeleteDontFollowSymlinks" );
- File subdir = new File( directory, "linked-to-self" );
-
- if ( !createSymlink( directory, subdir ) )
- {
- fail( "Cannot create symlink." );
- }
-
- FileSet set = new FileSet();
- set.setDirectory( directory.getPath() );
- set.addInclude( "**/included.txt" );
- set.addInclude( "**/linked-to-self" );
- set.setFollowSymlinks( false );
-
- FileSetManager fileSetManager = new FileSetManager();
-
- fileSetManager.delete( set );
-
- Assert.assertFalse( subdir.exists() );
- }
+ // assume failure to create a sym link is because the system does not support them
+ // and not because the sym link creation failed.
+ return;
+ }
+
+ FileSet set = new FileSet();
+ set.setDirectory( directory.getPath() );
+ set.addInclude( "**/included.txt" );
+ set.addInclude( "**/linked-to-self" );
+ set.setFollowSymlinks( false );
+
+ FileSetManager fileSetManager = new FileSetManager();
+
+ fileSetManager.delete( set );
+
+ Assert.assertFalse( subdir.exists() );
}
public void testDelete() throws IOException
@@ -125,13 +122,6 @@
Assert.assertFalse( "file in marked subdirectory still exists.", subdirFile.exists() );
}
- private boolean operatingSystemAllowsLinking()
- {
- String osFamily = System.getProperty( "os.family", "unix" );
-
- return LINK_ENABLED_OSES.contains( osFamily );
- }
-
private boolean createSymlink( File from, File to ) throws InterruptedException, CommandLineException
{
if ( to.exists() )