View Javadoc
1   package org.codehaus.plexus.components.io.resources;
2   
3   import java.io.File;
4   import java.io.IOException;
5   
6   import org.codehaus.plexus.components.io.attributes.FileAttributes;
7   import org.codehaus.plexus.components.io.attributes.PlexusIoResourceAttributes;
8   
9   import junit.framework.TestCase;
10  import org.codehaus.plexus.components.io.attributes.SymlinkUtils;
11  import org.codehaus.plexus.util.Os;
12  
13  public class PlexusIoPlexusIoFileResourceTest
14      extends TestCase {
15  
16      public void testRealSymlink()
17          throws IOException
18      {
19          if ( Os.isFamily( Os.FAMILY_WINDOWS ) )
20              return;
21          final File file = new File( "src/test/resources/symlinks/src/symDir" );
22          PlexusIoResourceAttributes attrs = FileAttributes.uncached( file );
23          assertTrue( attrs.isSymbolicLink() );
24          PlexusIoFileResource r = new PlexusIoFileResource( file, "symDir", attrs );
25          assertTrue( r.isSymbolicLink() );
26          final File target = SymlinkUtils.readSymbolicLink( file );
27          assertTrue( target.getName().endsWith( "targetDir" ) );
28      }
29  }