maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tibordig...@apache.org
Subject [maven-surefire] branch SUREFIRE-1617 updated: IT fix
Date Thu, 09 May 2019 01:06:15 GMT
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 891a239  IT fix
891a239 is described below

commit 891a23954d01f6bbdb091169bb04257c64c89f44
Author: tibordigana <tibordigana@apache.org>
AuthorDate: Thu May 9 03:06:06 2019 +0200

    IT fix
---
 .../java/org/apache/maven/surefire/its/UmlautDirIT.java  | 16 +++++++++-------
 .../apache/maven/surefire/its/fixture/MavenLauncher.java |  7 ++++++-
 2 files changed, 15 insertions(+), 8 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 28cecf2..1c53807 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,6 +28,9 @@ 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 org.apache.commons.lang3.SystemUtils.IS_OS_LINUX;
 import static org.junit.Assume.assumeTrue;
@@ -62,7 +65,7 @@ public class UmlautDirIT
     }
 
     @Test
-    public void surefire1617()
+    public void surefire1617() throws Exception
     {
         assumeTrue( IS_OS_LINUX );
         unpackWithNewLocalRepo()
@@ -102,13 +105,12 @@ public class UmlautDirIT
         return unpack;
     }
 
-    private SurefireLauncher unpackWithNewLocalRepo()
+    private SurefireLauncher unpackWithNewLocalRepo() throws IOException
     {
-        File target = new File( System.getProperty( "user.dir" ), "target" );
-        File newLocalRepo = new File( target, "local repo for : SUREFIRE-1617" );
-        //noinspection ResultOfMethodCallIgnored
-        newLocalRepo.mkdir();
-        System.setProperty( "maven.repo.local", newLocalRepo.getPath() );
+        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() );
         return unpack( "junit-pathWithUmlaut" );
     }
 }
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/MavenLauncher.java
b/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/MavenLauncher.java
index c36da47..586ce8c 100755
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/MavenLauncher.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/MavenLauncher.java
@@ -77,7 +77,7 @@ public final class MavenLauncher
         resetCliOptions();
     }
 
-    MavenLauncher( Class testClass, String resourceName, String suffix )
+    public MavenLauncher( Class testClass, String resourceName, String suffix )
     {
         this( testClass, resourceName, suffix, null );
     }
@@ -376,6 +376,11 @@ public final class MavenLauncher
         getVerifier().setForkJvm( forkJvm );
     }
 
+    public String getLocalRepository()
+    {
+        return getVerifier().getLocalRepository();
+    }
+
     private Verifier getVerifier()
     {
         if ( verifier == null )


Mime
View raw message