org.apache.curator.test
Class TestingServer

java.lang.Object
  extended by org.apache.curator.test.TestingServer
All Implemented Interfaces:
Closeable

public class TestingServer
extends Object
implements Closeable

manages an internally running ZooKeeper server. FOR TESTING PURPOSES ONLY


Constructor Summary
TestingServer()
          Create the server using a random port
TestingServer(InstanceSpec spec)
           
TestingServer(int port)
          Create the server using the given port
TestingServer(int port, File tempDirectory)
          Create the server using the given port
 
Method Summary
 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
 File getTempDirectory()
          Returns the temp directory being used
 void stop()
          Stop the server without deleting the temp directory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestingServer

public TestingServer()
              throws Exception
Create the server using a random port

Throws:
Exception - errors

TestingServer

public TestingServer(int port)
              throws Exception
Create the server using the given port

Parameters:
port - the port
Throws:
Exception - errors

TestingServer

public TestingServer(int port,
                     File tempDirectory)
              throws Exception
Create the server using the given port

Parameters:
port - the port
tempDirectory - directory to use
Throws:
Exception - errors

TestingServer

public TestingServer(InstanceSpec spec)
              throws Exception
Throws:
Exception
Method Detail

getPort

public int getPort()
Return the port being used

Returns:
port

getTempDirectory

public File getTempDirectory()
Returns the temp directory being used

Returns:
directory

stop

public void stop()
          throws IOException
Stop the server without deleting the temp directory

Throws:
IOException

close

public void close()
           throws IOException
Close the server and any open clients and delete the temp directory

Specified by:
close in interface Closeable
Throws:
IOException

getConnectString

public String getConnectString()
Returns the connection string to use

Returns:
connection string


Copyright © 2011-2013 The Apache Software Foundation. All Rights Reserved.