Package org.infinispan.server.test.core
Class ForkedServer
- java.lang.Object
-
- org.infinispan.server.test.core.ForkedServer
-
public class ForkedServer extends Object
Forked server starts the server using batch scripts from the Infinispan Server distribution to start the server. The driver uses REST API to shutdown the server. Server log is cleaned before start and is not configurable. Appends random UUID for server process to identify the corresponding child Java process of the server. FIXME: Add proper Windows platform support. FIXME: The server.log file must be present before starting the server as the monitoring process is pointed to it - - groundwork for making the purging of the log directory optional.- Since:
- 11.0
- Author:
- Gustavo Lira <glira@redhat.com>, Radoslav Husar
-
-
Field Summary
Fields Modifier and Type Field Description static IntegerDEFAULT_SINGLE_PORTstatic intOFFSET_FACTORstatic intTIMEOUT_SECONDS
-
Constructor Summary
Constructors Constructor Description ForkedServer(String serverHome)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanup()longgetPid()Returns the process ID of the Java process as opposed to the pid of the shell script which started the actual Java process.FilegetServerLib()voidprintServerLog(Consumer<String> c)booleanrunWithTimeout(Function<String,Boolean> function, String logPattern)ForkedServersetJvmOptions(String jvmOptions)ForkedServersetPortsOffset(int numServer)ForkedServersetServerConfiguration(String serverConfiguration)ForkedServerstart()
-
-
-
Field Detail
-
TIMEOUT_SECONDS
public static final int TIMEOUT_SECONDS
-
DEFAULT_SINGLE_PORT
public static final Integer DEFAULT_SINGLE_PORT
-
OFFSET_FACTOR
public static final int OFFSET_FACTOR
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ForkedServer
public ForkedServer(String serverHome)
-
-
Method Detail
-
setServerConfiguration
public ForkedServer setServerConfiguration(String serverConfiguration)
-
setPortsOffset
public ForkedServer setPortsOffset(int numServer)
-
setJvmOptions
public ForkedServer setJvmOptions(String jvmOptions)
-
start
public ForkedServer start()
-
runWithTimeout
public boolean runWithTimeout(Function<String,Boolean> function, String logPattern)
-
cleanup
public void cleanup()
-
getServerLib
public File getServerLib()
-
getPid
public long getPid()
Returns the process ID of the Java process as opposed to the pid of the shell script which started the actual Java process. The process is matched containing the randomized UUID.- Returns:
- process ID (pid) of the server's Java process.
-
-