Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MCLEAN-110] Replaced Utils.createSymlink with Java 7 Files.createSymbolicLink #59

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/it/dangling-symlinks/setup.bsh
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,28 @@
* under the License.
*/

import java.io.*;
import java.nio.file.*;
import java.nio.file.attribute.*;
import java.util.*;
import java.util.jar.*;
import java.util.regex.*;
import org.apache.maven.plugins.clean.*;

try
{
File targetDir = new File( basedir, "target" );
File link = new File( targetDir, "link" );
File target = new File( targetDir, "link-target.txt" );
Path targetDir = basedir.toPath().resolve( "target" );
Path link = targetDir.resolve( "link" );
Path target = targetDir.resolve( "link-target.txt" );

System.out.println( "Creating symlink " + link + " -> " + target );
if ( !Utils.createSymlink( target, link ) || !link.exists() )
Files.createSymbolicLink( link, target, new FileAttribute[0] );
if ( !Files.exists( link, new LinkOption[0] ) )
{
System.out.println( "FAILURE, platform does not support symlinks, skipping test." );
}

System.out.println( "Deleting symlink target " + target );
target.delete();
Files.delete( target );
}
catch( Throwable t )
{
Expand Down
10 changes: 6 additions & 4 deletions src/it/symlink-dont-follow/setup.bsh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
* under the License.
*/

import java.io.*;
import java.nio.file.*;
import java.nio.file.attribute.*;
import java.util.*;
import java.util.jar.*;
import java.util.regex.*;
Expand All @@ -33,10 +34,11 @@ String[][] pairs =

for ( String[] pair : pairs )
{
File target = new File( basedir, pair[0] );
File link = new File( basedir, pair[1] );
Path target = basedir.toPath().resolve( pair[0] );
Path link = basedir.toPath().resolve( pair[1] );
System.out.println( "Creating symlink " + link + " -> " + target );
if ( !Utils.createSymlink( target, link ) || !link.exists() )
Files.createSymbolicLink( link, target, new FileAttribute[0] );
if ( !Files.exists( link, new LinkOption[0] ) )
{
System.out.println( "FAILURE, platform does not support symlinks, skipping test." );
return;
Expand Down
53 changes: 0 additions & 53 deletions src/test/java/org/apache/maven/plugins/clean/Utils.java

This file was deleted.