@@ -26,20 +26,20 @@ import org.gradle.api.GradleException
26
26
import org.gradle.api.Task
27
27
import org.gradle.api.tasks.Exec
28
28
import org.gradle.api.tasks.Input
29
+ import org.gradle.api.tasks.Internal
29
30
30
31
/**
31
32
* A fixture for integration tests which runs in a separate process launched by Ant.
32
33
*/
33
- public class AntFixture extends AntTask implements Fixture {
34
+ class AntFixture extends AntTask implements Fixture {
34
35
35
36
/* * The path to the executable that starts the fixture. */
36
- @Input
37
+ @Internal
37
38
String executable
38
39
39
40
private final List<Object > arguments = new ArrayList<> ()
40
41
41
- @Input
42
- public void args (Object ... args ) {
42
+ void args (Object ... args ) {
43
43
arguments. addAll(args)
44
44
}
45
45
@@ -49,16 +49,15 @@ public class AntFixture extends AntTask implements Fixture {
49
49
*/
50
50
private final Map<String , Object > environment = new HashMap<> ()
51
51
52
- @Input
53
- public void env (String key , Object value ) {
52
+ void env (String key , Object value ) {
54
53
environment. put(key, value)
55
54
}
56
55
57
56
/* * A flag to indicate whether the command should be executed from a shell. */
58
- @Input
57
+ @Internal
59
58
boolean useShell = false
60
59
61
- @Input
60
+ @Internal
62
61
int maxWaitInSeconds = 30
63
62
64
63
/**
@@ -72,6 +71,7 @@ public class AntFixture extends AntTask implements Fixture {
72
71
* as well as a groovy AntBuilder, to enable running ant condition checks. The default wait
73
72
* condition is for http on the http port.
74
73
*/
74
+ @Internal
75
75
Closure waitCondition = { AntFixture fixture , AntBuilder ant ->
76
76
File tmpFile = new File (fixture. cwd, ' wait.success' )
77
77
ant. get(src : " http://${ fixture.addressAndPort} " ,
@@ -83,13 +83,14 @@ public class AntFixture extends AntTask implements Fixture {
83
83
84
84
private final Task stopTask
85
85
86
- public AntFixture () {
86
+ AntFixture () {
87
87
stopTask = createStopTask()
88
88
finalizedBy(stopTask)
89
89
}
90
90
91
91
@Override
92
- public Task getStopTask () {
92
+ @Internal
93
+ Task getStopTask () {
93
94
return stopTask
94
95
}
95
96
@@ -168,6 +169,7 @@ public class AntFixture extends AntTask implements Fixture {
168
169
}
169
170
170
171
/* * Returns a debug string used to log information about how the fixture was run. */
172
+ @Internal
171
173
protected String getCommandString () {
172
174
String commandString = " \n ${ name} configuration:\n "
173
175
commandString + = " -----------------------------------------\n "
@@ -247,46 +249,55 @@ public class AntFixture extends AntTask implements Fixture {
247
249
* A path relative to the build dir that all configuration and runtime files
248
250
* will live in for this fixture
249
251
*/
252
+ @Internal
250
253
protected File getBaseDir () {
251
254
return new File (project. buildDir, " fixtures/${ name} " )
252
255
}
253
256
254
257
/* * Returns the working directory for the process. Defaults to "cwd" inside baseDir. */
258
+ @Internal
255
259
protected File getCwd () {
256
260
return new File (baseDir, ' cwd' )
257
261
}
258
262
259
263
/* * Returns the file the process writes its pid to. Defaults to "pid" inside baseDir. */
264
+ @Internal
260
265
protected File getPidFile () {
261
266
return new File (baseDir, ' pid' )
262
267
}
263
268
264
269
/* * Reads the pid file and returns the process' pid */
265
- public int getPid () {
270
+ @Internal
271
+ int getPid () {
266
272
return Integer . parseInt(pidFile. getText(' UTF-8' ). trim())
267
273
}
268
274
269
275
/* * Returns the file the process writes its bound ports to. Defaults to "ports" inside baseDir. */
276
+ @Internal
270
277
protected File getPortsFile () {
271
278
return new File (baseDir, ' ports' )
272
279
}
273
280
274
281
/* * Returns an address and port suitable for a uri to connect to this node over http */
275
- public String getAddressAndPort () {
282
+ @Internal
283
+ String getAddressAndPort () {
276
284
return portsFile. readLines(" UTF-8" ). get(0 )
277
285
}
278
286
279
287
/* * Returns a file that wraps around the actual command when {@code spawn == true}. */
288
+ @Internal
280
289
protected File getWrapperScript () {
281
290
return new File (cwd, Os . isFamily(Os . FAMILY_WINDOWS ) ? ' run.bat' : ' run' )
282
291
}
283
292
284
293
/* * Returns a file that the wrapper script writes when the command failed. */
294
+ @Internal
285
295
protected File getFailureMarker () {
286
296
return new File (cwd, ' run.failed' )
287
297
}
288
298
289
299
/* * Returns a file that the wrapper script writes when the command failed. */
300
+ @Internal
290
301
protected File getRunLog () {
291
302
return new File (cwd, ' run.log' )
292
303
}
0 commit comments