org.apache.bookkeeper.util
Class ClientBase

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.bookkeeper.util.ClientBase
All Implemented Interfaces:
junit.framework.Test

public abstract class ClientBase
extends junit.framework.TestCase

Base class for tests.


Nested Class Summary
protected static class ClientBase.CountdownWatcher
           
protected  class ClientBase.NullWatcher
          In general don't use this.
 
Field Summary
static int CONNECTION_TIMEOUT
           
protected  String hostPort
           
protected static org.apache.log4j.Logger LOG
           
protected  NIOServerCnxn.Factory serverFactory
           
protected  File tmpDir
           
 
Constructor Summary
ClientBase()
           
ClientBase(String name)
           
 
Method Summary
protected  ZooKeeper createClient()
           
protected  ZooKeeper createClient(ClientBase.CountdownWatcher watcher, String hp)
           
protected  ZooKeeper createClient(String hp)
           
static File createTmpDir()
           
protected  void setUp()
           
static void setupTestEnv()
          Test specific setup
protected  void tearDown()
           
static boolean waitForServerDown(String hp, long timeout)
           
static boolean waitForServerUp(String hp, long timeout)
           
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LOG

protected static final org.apache.log4j.Logger LOG

CONNECTION_TIMEOUT

public static final int CONNECTION_TIMEOUT
See Also:
Constant Field Values

hostPort

protected String hostPort

serverFactory

protected NIOServerCnxn.Factory serverFactory

tmpDir

protected File tmpDir
Constructor Detail

ClientBase

public ClientBase()

ClientBase

public ClientBase(String name)
Method Detail

createClient

protected ZooKeeper createClient()
                          throws IOException,
                                 InterruptedException
Throws:
IOException
InterruptedException

createClient

protected ZooKeeper createClient(String hp)
                          throws IOException,
                                 InterruptedException
Throws:
IOException
InterruptedException

createClient

protected ZooKeeper createClient(ClientBase.CountdownWatcher watcher,
                                 String hp)
                          throws IOException,
                                 InterruptedException
Throws:
IOException
InterruptedException

waitForServerUp

public static boolean waitForServerUp(String hp,
                                      long timeout)

waitForServerDown

public static boolean waitForServerDown(String hp,
                                        long timeout)

createTmpDir

public static File createTmpDir()
                         throws IOException
Throws:
IOException

setupTestEnv

public static void setupTestEnv()
Test specific setup


setUp

protected void setUp()
              throws Exception
Overrides:
setUp in class junit.framework.TestCase
Throws:
Exception

tearDown

protected void tearDown()
                 throws Exception
Overrides:
tearDown in class junit.framework.TestCase
Throws:
Exception