25
25
import org .apache .logging .log4j .Logger ;
26
26
import org .junit .jupiter .api .Assertions ;
27
27
28
+ import javax .annotation .Nullable ;
28
29
import java .io .File ;
29
30
import java .io .IOException ;
30
31
import java .util .Arrays ;
@@ -43,19 +44,22 @@ public class ExternalServer {
43
44
public static final String EXTERNAL_SERVER_PROPERTY_NAME = "yaml_testing_external_server" ;
44
45
private static final boolean SAVE_SERVER_OUTPUT = false ;
45
46
47
+ @ Nullable
46
48
private final File serverJar ;
47
49
private final int grpcPort ;
48
50
private final int httpPort ;
49
51
private SemanticVersion version ;
50
52
private Process serverProcess ;
51
- private String clusterFile ;
53
+ @ Nullable
54
+ private final String clusterFile ;
52
55
53
56
/**
54
57
* Create a new instance that will run a specific jar.
55
58
*
56
59
* @param serverJar the path to the jar to run
57
60
*/
58
- public ExternalServer (File serverJar , final int grpcPort , final int httpPort , final String clusterFile ) {
61
+ public ExternalServer (@ Nullable File serverJar , final int grpcPort , final int httpPort ,
62
+ @ Nullable final String clusterFile ) {
59
63
this .serverJar = serverJar ;
60
64
this .grpcPort = grpcPort ;
61
65
this .httpPort = httpPort ;
@@ -123,7 +127,9 @@ public void start() throws Exception {
123
127
ProcessBuilder .Redirect .DISCARD ;
124
128
processBuilder .redirectOutput (out );
125
129
processBuilder .redirectError (err );
126
- processBuilder .environment ().put ("FDB_CLUSTER_FILE" , clusterFile );
130
+ if (clusterFile != null ) {
131
+ processBuilder .environment ().put ("FDB_CLUSTER_FILE" , clusterFile );
132
+ }
127
133
128
134
if (!startServer (processBuilder )) {
129
135
Assertions .fail ("Failed to start the external server" );
0 commit comments