org.apache.giraph.utils
Class InternalVertexRunner

java.lang.Object
  extended by org.apache.giraph.utils.InternalVertexRunner

public class InternalVertexRunner
extends Object

A base class for running internal tests on a vertex Extending classes only have to invoke the run() method to test their vertex. All data is written to a local tmp directory that is removed afterwards. A local zookeeper instance is started in an extra thread and shutdown at the end. Heavily inspired from Apache Mahout's MahoutTestCase


Field Summary
static int LOCAL_ZOOKEEPER_PORT
          ZooKeeper port to use for tests
 
Method Summary
static Iterable<String> run(GiraphConfiguration conf, String[] vertexInputData)
          Attempts to run the vertex internally in the current JVM, reading from and writing to a temporary folder on local disk.
static Iterable<String> run(GiraphConfiguration conf, String[] vertexInputData, String[] edgeInputData)
          Attempts to run the vertex internally in the current JVM, reading from and writing to a temporary folder on local disk.
static
<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>
TestGraph<I,V,E>
run(GiraphConfiguration conf, TestGraph<I,V,E> graph)
          Attempts to run the vertex internally in the current JVM, reading and writing to an in-memory graph.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCAL_ZOOKEEPER_PORT

public static final int LOCAL_ZOOKEEPER_PORT
ZooKeeper port to use for tests

See Also:
Constant Field Values
Method Detail

run

public static Iterable<String> run(GiraphConfiguration conf,
                                   String[] vertexInputData)
                            throws Exception
Attempts to run the vertex internally in the current JVM, reading from and writing to a temporary folder on local disk. Will start its own zookeeper instance.

Parameters:
conf - GiraphClasses specifying which types to use
vertexInputData - linewise vertex input data
Returns:
linewise output data
Throws:
Exception - if anything goes wrong

run

public static Iterable<String> run(GiraphConfiguration conf,
                                   String[] vertexInputData,
                                   String[] edgeInputData)
                            throws Exception
Attempts to run the vertex internally in the current JVM, reading from and writing to a temporary folder on local disk. Will start its own zookeeper instance.

Parameters:
conf - GiraphClasses specifying which types to use
vertexInputData - linewise vertex input data
edgeInputData - linewise edge input data
Returns:
linewise output data
Throws:
Exception - if anything goes wrong

run

public static <I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable> TestGraph<I,V,E> run(GiraphConfiguration conf,
                                                                                                                                                                       TestGraph<I,V,E> graph)
                                                                                                                                                        throws Exception
Attempts to run the vertex internally in the current JVM, reading and writing to an in-memory graph. Will start its own zookeeper instance.

Type Parameters:
I - Vertex ID
V - Vertex Value
E - Edge Value
Parameters:
conf - GiraphClasses specifying which types to use
graph - input graph
Returns:
iterable output data
Throws:
Exception - if anything goes wrong


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