Java源码示例:org.apache.giraph.graph.BasicComputation
示例1
@Before
public void setUp() throws IOException, InterruptedException {
rr = mock(RecordReader.class);
GiraphConfiguration giraphConf = new GiraphConfiguration();
giraphConf.setComputationClass(BasicComputation.class);
giraphConf.set(DGALongEdgeValueInputFormat.LINE_TOKENIZE_VALUE, ",");
conf = new ImmutableClassesGiraphConfiguration<Text, Text, Text>(giraphConf);
tac = mock(TaskAttemptContext.class);
when(tac.getConfiguration()).thenReturn(conf);
}
示例2
@Before
public void setUp() throws IOException, InterruptedException {
rr = mock(RecordReader.class);
GiraphConfiguration giraphConf = new GiraphConfiguration();
giraphConf.setComputationClass(BasicComputation.class);
giraphConf.set(DGALongEdgeValueInputFormat.LINE_TOKENIZE_VALUE, ",");
conf = new ImmutableClassesGiraphConfiguration<Text, Text, Text>(giraphConf);
tac = mock(TaskAttemptContext.class);
when(tac.getConfiguration()).thenReturn(conf);
}
示例3
@Before
public void setUp() throws Exception {
tw = mock(RecordWriter.class);
GiraphConfiguration giraphConfiguration = new GiraphConfiguration();
giraphConfiguration.setComputationClass(BasicComputation.class);
conf = new ImmutableClassesGiraphConfiguration<Text, VertexData, Text>(giraphConfiguration);
vertex = mock(Vertex.class);
vertex2 = mock(Vertex.class);
when(vertex.getId()).thenReturn(new Text("1"));
when(vertex.getValue()).thenReturn(new VertexData());
when(vertex2.getId()).thenReturn(new Text("2"));
vertexData = new VertexData();
vertexData.setApproxBetweenness(1.0);
when(vertex2.getValue()).thenReturn(vertexData);
}