public class ServerProcessUtils
extends java.lang.Object
Constructor and Description |
---|
ServerProcessUtils() |
Modifier and Type | Method and Description |
---|---|
static java.util.Map<java.lang.Long,java.lang.String> |
getRunningContainers(SpringXDTemplate template)
Return a map of running containers.
|
static com.oracle.tools.runtime.java.JavaApplication<com.oracle.tools.runtime.java.SimpleJavaApplication> |
startAdmin(java.util.Properties properties)
Start an instance of the admin server.
|
static com.oracle.tools.runtime.java.JavaApplication<com.oracle.tools.runtime.java.SimpleJavaApplication> |
startContainer(java.util.Properties properties)
Start a container instance.
|
static com.oracle.tools.runtime.java.JavaApplication<com.oracle.tools.runtime.java.SimpleJavaApplication> |
startHsql(java.util.Properties systemProperties)
Start an instance of HSQL.
|
static org.apache.curator.test.TestingServer |
startZooKeeper(int port)
Start an instance of ZooKeeper.
|
static java.util.Map<java.lang.Long,java.lang.String> |
waitForContainers(SpringXDTemplate template,
java.util.Set<java.lang.Long> pids)
Block the executing thread until all of the indicated process IDs
have been identified in the list of runtime containers as indicated
by the admin server.
|
public static org.apache.curator.test.TestingServer startZooKeeper(int port) throws java.lang.Exception
TestingServer.stop()
should be invoked
to shut down the server.port
- ZooKeeper portjava.lang.Exception
public static com.oracle.tools.runtime.java.JavaApplication<com.oracle.tools.runtime.java.SimpleJavaApplication> startAdmin(java.util.Properties properties) throws java.io.IOException, java.lang.InterruptedException
Application.close()
should be invoked to shut down the server.properties
- system properties to pass to the container; at minimum
must contain key zk.client.connect
to indicate
the ZooKeeper connect string and key server.port
to indicate the admin server portjava.io.IOException
- if an exception is thrown launching the processjava.lang.InterruptedException
- if the executing thread is interruptedpublic static com.oracle.tools.runtime.java.JavaApplication<com.oracle.tools.runtime.java.SimpleJavaApplication> startContainer(java.util.Properties properties) throws java.io.IOException
Application.close()
should be invoked to shut down the server. This method may also be
invoked as part of failover testing.
Note that this method returns immediately. In order to verify
that the container was started, invoke waitForContainers(org.springframework.xd.rest.client.impl.SpringXDTemplate, java.util.Set<java.lang.Long>)
to block until the container(s) are started.properties
- system properties to pass to the admin server; at minimum
must contain key zk.client.connect
to indicate
the ZooKeeper connect stringjava.io.IOException
- if an exception is thrown launching the processwaitForContainers(org.springframework.xd.rest.client.impl.SpringXDTemplate, java.util.Set<java.lang.Long>)
public static com.oracle.tools.runtime.java.JavaApplication<com.oracle.tools.runtime.java.SimpleJavaApplication> startHsql(java.util.Properties systemProperties) throws java.io.IOException
Application.close()
should be invoked to shut down the server.systemProperties
- system properties for new processjava.io.IOException
- if an exception is thrown launching the processpublic static java.util.Map<java.lang.Long,java.lang.String> waitForContainers(SpringXDTemplate template, java.util.Set<java.lang.Long> pids) throws java.lang.InterruptedException, java.lang.IllegalStateException
template
- REST template used to communicate with the admin serverpids
- set of process IDs for the expected containersjava.lang.InterruptedException
- if the executing thread is interruptedjava.lang.IllegalStateException
- if the number of containers identified
does not match the number of PIDs providedpublic static java.util.Map<java.lang.Long,java.lang.String> getRunningContainers(SpringXDTemplate template)
template
- REST template used to communicate with the admin server