public class TestingServer extends Object implements Closeable
Constructor and Description |
---|
TestingServer()
Create the server using a random port
|
TestingServer(boolean start)
Create the server using a random port
|
TestingServer(InstanceSpec spec,
boolean start)
Create the server using the given port
|
TestingServer(int port)
Create and start the server using the given port
|
TestingServer(int port,
boolean start)
Create the server using the given port
|
TestingServer(int port,
File tempDirectory)
Create and start the server using the given port
|
TestingServer(int port,
File tempDirectory,
boolean start)
Create the server using the given port
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the server and any open clients and delete the temp directory
|
String |
getConnectString()
Returns the connection string to use
|
int |
getPort()
Return the port being used or will be used.
|
File |
getTempDirectory()
Returns the temp directory being used
|
void |
restart()
Restart the server.
|
void |
start()
Start the server
|
void |
stop()
Stop the server without deleting the temp directory
|
public TestingServer() throws Exception
Exception
- errorspublic TestingServer(boolean start) throws Exception
start
- True if the server should be started, false otherwiseException
- errorspublic TestingServer(int port) throws Exception
port
- the portException
- errorspublic TestingServer(int port, boolean start) throws Exception
port
- the portstart
- True if the server should be started, false otherwiseException
- errorspublic TestingServer(int port, File tempDirectory) throws Exception
port
- the porttempDirectory
- directory to useException
- errorspublic TestingServer(int port, File tempDirectory, boolean start) throws Exception
port
- the porttempDirectory
- directory to usestart
- True if the server should be started, false otherwiseException
- errorspublic TestingServer(InstanceSpec spec, boolean start) throws Exception
spec
- instance detailsstart
- True if the server should be started, false otherwiseException
- errorspublic int getPort()
IllegalStateException
- if server is configured to bind to port 0 but not startedpublic File getTempDirectory()
public void stop() throws IOException
IOException
public void restart() throws Exception
Exception
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public String getConnectString()
IllegalStateException
- if server is configured to bind to port 0 but not startedCopyright © 2011–2023 The Apache Software Foundation. All rights reserved.