org.apache.accumulo.minicluster
Class MiniAccumuloCluster

java.lang.Object
  extended by org.apache.accumulo.minicluster.MiniAccumuloCluster

public class MiniAccumuloCluster
extends Object

A utility class that will create Zookeeper and Accumulo processes that write all of their data to a single local directory. This class makes it easy to test code against a real Accumulo instance. Its much more accurate for testing than MockAccumulo, but much slower than MockAccumulo.

Since:
1.5.0

Constructor Summary
MiniAccumuloCluster(File dir, String rootPassword)
           
MiniAccumuloCluster(MiniAccumuloConfig config)
           
 
Method Summary
 String getInstanceName()
           
 String getZooKeepers()
           
 void start()
          Starts Accumulo and Zookeeper processes.
 void stop()
          Stops Accumulo and Zookeeper processes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MiniAccumuloCluster

public MiniAccumuloCluster(File dir,
                           String rootPassword)
                    throws IOException
Parameters:
dir - An empty or nonexistant temp directoy that Accumulo and Zookeeper can store data in. Creating the directory is left to the user. Java 7, Guava, and Junit provide methods for creating temporary directories.
rootPassword - Initial root password for instance.
Throws:
IOException

MiniAccumuloCluster

public MiniAccumuloCluster(MiniAccumuloConfig config)
                    throws IOException
Parameters:
config - initial configuration
Throws:
IOException
Method Detail

start

public void start()
           throws IOException,
                  InterruptedException
Starts Accumulo and Zookeeper processes. Can only be called once.

Throws:
IOException
InterruptedException
IllegalStateException - if already started

getInstanceName

public String getInstanceName()
Returns:
Accumulo instance name

getZooKeepers

public String getZooKeepers()
Returns:
zookeeper connection string

stop

public void stop()
          throws IOException,
                 InterruptedException
Stops Accumulo and Zookeeper processes. If stop is not called, there is a shutdown hook that is setup to kill the processes. Howerver its probably best to call stop in a finally block as soon as possible.

Throws:
IOException
InterruptedException


Copyright © 2013 Apache Accumulo Project. All Rights Reserved.