This is an automated email from the ASF dual-hosted git repository.

tibordigana pushed a commit to branch SUREFIRE-1617
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git


The following commit(s) were added to refs/heads/SUREFIRE-1617 by this push:
     new e477ea2  IT fix
e477ea2 is described below

commit e477ea22ca9fb63a3b51ca543143acdf5db0baa5
Author: tibordigana <[email protected]>
AuthorDate: Thu May 9 17:07:17 2019 +0200

    IT fix
---
 .../org/apache/maven/surefire/its/UmlautDirIT.java | 54 +++++++++++++++++-----
 1 file changed, 43 insertions(+), 11 deletions(-)

diff --git 
a/surefire-its/src/test/java/org/apache/maven/surefire/its/UmlautDirIT.java 
b/surefire-its/src/test/java/org/apache/maven/surefire/its/UmlautDirIT.java
index 1c53807..3690492 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/UmlautDirIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/UmlautDirIT.java
@@ -28,10 +28,14 @@ import org.junit.Test;
 
 import java.io.File;
 import java.io.IOException;
-import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
+import static java.nio.file.Files.copy;
+import static java.nio.file.Files.createDirectories;
+import static java.nio.file.Files.exists;
+import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
+import static java.util.Objects.requireNonNull;
 import static org.apache.commons.lang3.SystemUtils.IS_OS_LINUX;
 import static org.junit.Assume.assumeTrue;
 
@@ -40,8 +44,7 @@ import static org.junit.Assume.assumeTrue;
  *
  * @author <a href="mailto:[email protected]";>Dan Fabulich</a>
  */
-public class UmlautDirIT
-    extends SurefireJUnit4IntegrationTestCase
+public class UmlautDirIT extends SurefireJUnit4IntegrationTestCase
 {
     private String localRepo;
 
@@ -65,7 +68,8 @@ public class UmlautDirIT
     }
 
     @Test
-    public void surefire1617() throws Exception
+    public void surefire1617()
+            throws Exception
     {
         assumeTrue( IS_OS_LINUX );
         unpackWithNewLocalRepo()
@@ -94,23 +98,51 @@ public class UmlautDirIT
                 .assertTestSuiteResults( 1, 0, 0, 0 );
     }
 
-    private SurefireLauncher unpackToGermanUmplautDirectory( String postfix )
-        throws IOException
+    private SurefireLauncher unpackToGermanUmplautDirectory( String postfix ) 
throws IOException
     {
         SurefireLauncher unpack = unpack( "junit-pathWithUmlaut" );
         MavenLauncher maven = unpack.maven();
 
-        File dest = new File( maven.getUnpackedAt().getParentFile().getPath(), 
"/junit-pathWith\u00DCmlaut_" + postfix );
+        File dest = new File( maven.getUnpackedAt().getParentFile().getPath(),
+                "/junit-pathWith\u00DCmlaut_" + postfix );
         maven.moveUnpackTo( dest );
         return unpack;
     }
 
     private SurefireLauncher unpackWithNewLocalRepo() throws IOException
     {
-        Path newLocalRepo = Paths.get( System.getProperty( "user.dir" ), 
"target", "local repo for : SUREFIRE-1617" );
-        Path defaultLocalRepo = Paths.get( new MavenLauncher( getClass(), "", 
null ).getLocalRepository() );
-        Files.createSymbolicLink( newLocalRepo, defaultLocalRepo );
-        System.setProperty( "maven.repo.local", newLocalRepo.toString() );
+        String newLocalRepo =
+                Paths.get( System.getProperty( "user.dir" ), "target", "local 
repo for : SUREFIRE-1617" ).toString();
+        String defaultLocalRepo = new MavenLauncher( getClass(), "", null 
).getLocalRepository();
+
+        copyFolder( Paths.get( defaultLocalRepo, "org", "apache", "maven", 
"surefire" ),
+                Paths.get( newLocalRepo, "org", "apache", "maven", "surefire" 
) );
+
+        copyFolder( Paths.get( defaultLocalRepo, "org", "apache", "maven", 
"plugins", "maven-surefire-plugin" ),
+                Paths.get( newLocalRepo, "org", "apache", "maven", "plugins", 
"maven-surefire-plugin" ) );
+
+        System.setProperty( "maven.repo.local", newLocalRepo );
         return unpack( "junit-pathWithUmlaut" );
     }
+
+    private static void copyFolder( Path src, Path dest ) throws IOException
+    {
+        if ( !exists( dest ) )
+        {
+            createDirectories( dest );
+        }
+
+        for ( File from : requireNonNull( src.toFile().listFiles() ) )
+        {
+            Path to = dest.resolve( from.getName() );
+            if ( from.isDirectory() )
+            {
+                copyFolder( from.toPath(), to );
+            }
+            else if ( from.isFile() )
+            {
+                copy( from.toPath(), to, REPLACE_EXISTING );
+            }
+        }
+    }
 }

Reply via email to