org.apache.giraph.utils
Class MockUtils

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

public class MockUtils
extends Object

simplify mocking for unit testing vertices


Nested Class Summary
static class MockUtils.MockedEnvironment<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable,M extends org.apache.hadoop.io.Writable>
          mocks and holds "environment objects" that are injected into a vertex
 
Method Summary
static ServerData<org.apache.hadoop.io.IntWritable,org.apache.hadoop.io.IntWritable,org.apache.hadoop.io.IntWritable> createNewServerData(ImmutableClassesGiraphConfiguration conf, org.apache.hadoop.mapreduce.Mapper.Context context)
           
static CentralizedServiceWorker<org.apache.hadoop.io.IntWritable,org.apache.hadoop.io.IntWritable,org.apache.hadoop.io.IntWritable> mockServiceGetVertexPartitionOwner(int numOfPartitions)
           
static
<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable,M extends org.apache.hadoop.io.Writable>
MockUtils.MockedEnvironment<I,V,E,M>
prepareVertexAndComputation(Vertex<I,V,E> vertex, I vertexId, V vertexValue, boolean isHalted, Computation<I,V,E,M,M> computation, long superstep)
          prepare a vertex and computation for use in a unit test by setting its internal state and injecting mocked dependencies,
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

prepareVertexAndComputation

public static <I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable,M extends org.apache.hadoop.io.Writable> MockUtils.MockedEnvironment<I,V,E,M> prepareVertexAndComputation(Vertex<I,V,E> vertex,
                                                                                                                                                                                                                                                           I vertexId,
                                                                                                                                                                                                                                                           V vertexValue,
                                                                                                                                                                                                                                                           boolean isHalted,
                                                                                                                                                                                                                                                           Computation<I,V,E,M,M> computation,
                                                                                                                                                                                                                                                           long superstep)
                                                                                                                                                                                                                                          throws Exception
prepare a vertex and computation for use in a unit test by setting its internal state and injecting mocked dependencies,

Type Parameters:
I - vertex id
V - vertex data
E - edge data
M - message data
Parameters:
vertex - Vertex
vertexId - initial vertex id
vertexValue - initial vertex value
isHalted - initial halted state of the vertex
computation - Computation
superstep - Superstep
Returns:
Throws:
Exception

mockServiceGetVertexPartitionOwner

public static CentralizedServiceWorker<org.apache.hadoop.io.IntWritable,org.apache.hadoop.io.IntWritable,org.apache.hadoop.io.IntWritable> mockServiceGetVertexPartitionOwner(int numOfPartitions)

createNewServerData

public static ServerData<org.apache.hadoop.io.IntWritable,org.apache.hadoop.io.IntWritable,org.apache.hadoop.io.IntWritable> createNewServerData(ImmutableClassesGiraphConfiguration conf,
                                                                                                                                                 org.apache.hadoop.mapreduce.Mapper.Context context)


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