@@ -43,24 +43,20 @@ package org.graalvm.buildtools.maven
43
43
44
44
import org.eclipse.jetty.server.Server
45
45
import org.eclipse.jetty.server.ServerConnector
46
- import org.eclipse.jetty.server.SymlinkAllowedResourceAliasChecker
47
46
import org.eclipse.jetty.server.handler.ContextHandler
48
47
import org.eclipse.jetty.server.handler.ResourceHandler
49
48
import spock.lang.Specification
50
49
import spock.lang.TempDir
51
50
52
- import java.nio.file.FileVisitResult
53
51
import java.nio.file.Files
54
52
import java.nio.file.Path
55
- import java.nio.file.SimpleFileVisitor
56
53
import java.nio.file.StandardCopyOption
57
- import java.nio.file.attribute.BasicFileAttributes
58
54
59
55
abstract class AbstractGraalVMMavenFunctionalTest extends Specification {
60
-
56
+ @TempDir
61
57
Path testDirectory
62
58
63
- Path testOrigin;
59
+ Path testOrigin
64
60
65
61
private IsolatedMavenExecutor executor
66
62
@@ -69,18 +65,11 @@ abstract class AbstractGraalVMMavenFunctionalTest extends Specification {
69
65
Server server
70
66
ServerConnector connector
71
67
72
- boolean IS_WINDOWS = System . getProperty(" os.name" , " unknown" ). contains(" Windows" );
73
- boolean IS_LINUX = System . getProperty(" os.name" , " unknown" ). contains(" Linux" );
74
- boolean IS_MAC = System . getProperty(" os.name" , " unknown" ). contains(" Mac" );
68
+ boolean IS_WINDOWS = System . getProperty(" os.name" , " unknown" ). contains(" Windows" )
69
+ boolean IS_LINUX = System . getProperty(" os.name" , " unknown" ). contains(" Linux" )
70
+ boolean IS_MAC = System . getProperty(" os.name" , " unknown" ). contains(" Mac" )
75
71
76
72
def setup () {
77
- Path HomeDir = Path . of(System . getProperty(" user.home" ))
78
- testDirectory = HomeDir . resolve(" tests" )
79
-
80
- if (Files . notExists(testDirectory)) {
81
- Files . createDirectory(testDirectory)
82
- }
83
-
84
73
executor = new IsolatedMavenExecutor (
85
74
new File (System . getProperty(" java.executable" )),
86
75
testDirectory. resolve(" m2-home" ). toFile(),
@@ -89,19 +78,6 @@ abstract class AbstractGraalVMMavenFunctionalTest extends Specification {
89
78
}
90
79
91
80
def cleanup () {
92
- Files . walkFileTree(testDirectory, new SimpleFileVisitor<Path > () {
93
- @Override
94
- FileVisitResult visitFile (Path file , BasicFileAttributes attrs ) throws IOException {
95
- Files . delete(file);
96
- return FileVisitResult . CONTINUE ;
97
- }
98
- @Override
99
- FileVisitResult postVisitDirectory (Path dir , IOException exc ) throws IOException {
100
- Files . delete(dir);
101
- return FileVisitResult . CONTINUE ;
102
- }
103
- });
104
-
105
81
if (server != null ) {
106
82
server. stop()
107
83
server. destroy()
@@ -177,12 +153,13 @@ abstract class AbstractGraalVMMavenFunctionalTest extends Specification {
177
153
}
178
154
179
155
void mvn (List<String > args , Map<String , String > systemProperties ) {
180
- System . out . println (" Running copy of maven project ` " + testOrigin + " ` with " + args);
156
+ println (" Running copy of maven project ${ testOrigin} in ${ testDirectory } with $ args " )
181
157
var resultingSystemProperties = [
182
158
" common.repo.uri" : System . getProperty(" common.repo.uri" ),
183
159
" seed.repo.uri" : System . getProperty(" seed.repo.uri" ),
184
- " maven.repo.local" : testDirectory. resolve(" local repo" ). toFile(). absolutePath
160
+ " maven.repo.local" : testDirectory. resolve(" local- repo" ). toFile(). absolutePath
185
161
]
162
+ println " Using local repo: ${ resultingSystemProperties['maven.repo.local']} "
186
163
resultingSystemProperties. putAll(systemProperties)
187
164
188
165
result = executor. execute(
@@ -192,7 +169,7 @@ abstract class AbstractGraalVMMavenFunctionalTest extends Specification {
192
169
* args],
193
170
new File (System . getProperty(" maven.settings" ))
194
171
)
195
- System . out . println ( " Exit code is ${ result.exitCode} " )
172
+ println " Exit code is ${ result.exitCode} "
196
173
197
174
}
198
175
0 commit comments