本文整理汇总了Java中org.apache.giraph.io.EdgeReader.initialize方法的典型用法代码示例。如果您正苦于以下问题:Java EdgeReader.initialize方法的具体用法?Java EdgeReader.initialize怎么用?Java EdgeReader.initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.giraph.io.EdgeReader
的用法示例。
在下文中一共展示了EdgeReader.initialize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testInputParserWithDefaultWeight
import org.apache.giraph.io.EdgeReader; //导入方法依赖的package包/类
@Test
public void testInputParserWithDefaultWeight() throws IOException, InterruptedException {
String input = "1,2";
when(rr.getCurrentValue()).thenReturn(new Text(input));
EdgeReader ter = createEdgeReader(rr);
ter.setConf(conf);
ter.initialize(null, tac);
assertEquals(ter.getCurrentSourceId(), new Text("1"));
assertEquals(ter.getCurrentEdge().getTargetVertexId(), new Text("2"));
assertEquals(ter.getCurrentEdge().getValue(), new Text(""));
}
示例2: testInputParserWithDefaultWeightAndOverriddenSeparator
import org.apache.giraph.io.EdgeReader; //导入方法依赖的package包/类
@Test
public void testInputParserWithDefaultWeightAndOverriddenSeparator() throws IOException, InterruptedException {
String input = "1\t2";
when(rr.getCurrentValue()).thenReturn(new Text(input));
EdgeReader ter = createEdgeReader(rr);
conf.set(LINE_TOKENIZE_VALUE, "\t");
ter.setConf(conf);
ter.initialize(null, tac);
assertEquals(ter.getCurrentSourceId(), new Text("1"));
assertEquals(ter.getCurrentEdge().getTargetVertexId(), new Text("2"));
assertEquals(ter.getCurrentEdge().getValue(), new Text());
}
示例3: testInputParserWithCustomWeight
import org.apache.giraph.io.EdgeReader; //导入方法依赖的package包/类
@Test
public void testInputParserWithCustomWeight() throws IOException, InterruptedException {
String input = "1,2,10";
when(rr.getCurrentValue()).thenReturn(new Text(input));
EdgeReader ter = createEdgeReader(rr);
ter.setConf(conf);
ter.initialize(null, tac);
assertEquals(ter.getCurrentSourceId(), new Text("1"));
assertEquals(ter.getCurrentEdge().getTargetVertexId(), new Text("2"));
assertEquals(ter.getCurrentEdge().getValue(), new Text("10"));
}
示例4: testInputParserIgnoreWeight
import org.apache.giraph.io.EdgeReader; //导入方法依赖的package包/类
@Test
public void testInputParserIgnoreWeight() throws IOException, InterruptedException {
String input = "1,2,10";
conf.set(IO_IGNORE_THIRD, "true");
when(rr.getCurrentValue()).thenReturn(new Text(input));
EdgeReader ter = createEdgeReader(rr);
ter.setConf(conf);
ter.initialize(null, tac);
assertEquals(ter.getCurrentSourceId(), new Text("1"));
assertEquals(ter.getCurrentEdge().getTargetVertexId(), new Text("2"));
assertEquals(ter.getCurrentEdge().getValue(), new Text(""));
}
示例5: testInputParserWithCustomWeightAndOverriddenSeparator
import org.apache.giraph.io.EdgeReader; //导入方法依赖的package包/类
@Test
public void testInputParserWithCustomWeightAndOverriddenSeparator() throws IOException, InterruptedException {
String input = "1\t2\t10";
when(rr.getCurrentValue()).thenReturn(new Text(input));
EdgeReader ter = createEdgeReader(rr);
conf.set(LINE_TOKENIZE_VALUE, "\t");
ter.setConf(conf);
ter.initialize(null, tac);
assertEquals(ter.getCurrentSourceId(), new Text("1"));
assertEquals(ter.getCurrentEdge().getTargetVertexId(), new Text("2"));
assertEquals(ter.getCurrentEdge().getValue(), new Text("10"));
}
示例6: testInputParserWithDelimiterInData
import org.apache.giraph.io.EdgeReader; //导入方法依赖的package包/类
@Test
public void testInputParserWithDelimiterInData() throws IOException, InterruptedException {
String input = "te\\[email protected]\[email protected]\t10";
when(rr.getCurrentValue()).thenReturn(new Text(input));
EdgeReader ter = createEdgeReader(rr);
conf.set(LINE_TOKENIZE_VALUE, "\t");
ter.setConf(conf);
ter.initialize(null, tac);
assertEquals(ter.getCurrentSourceId(), new Text("te\\[email protected]"));
assertEquals(ter.getCurrentEdge().getTargetVertexId(), new Text("[email protected]"));
assertEquals(ter.getCurrentEdge().getValue(), new Text("10"));
}
示例7: testInputParserWithDelimiterInDataNoEscape
import org.apache.giraph.io.EdgeReader; //导入方法依赖的package包/类
@Test
public void testInputParserWithDelimiterInDataNoEscape() throws IOException, InterruptedException {
String input = "te\[email protected]\[email protected]\t10";
when(rr.getCurrentValue()).thenReturn(new Text(input));
EdgeReader ter = createEdgeReader(rr);
conf.set(LINE_TOKENIZE_VALUE, "\t");
ter.setConf(conf);
ter.initialize(null, tac);
assertEquals(ter.getCurrentSourceId(), new Text("te"));
assertEquals(ter.getCurrentEdge().getTargetVertexId(), new Text("[email protected]"));
assertEquals(ter.getCurrentEdge().getValue(), new Text("[email protected]"));
}
示例8: testInputParserWithMalformedLine
import org.apache.giraph.io.EdgeReader; //导入方法依赖的package包/类
@Test(expected=IOException.class)
public void testInputParserWithMalformedLine() throws IOException, InterruptedException {
String input = "1";
when(rr.getCurrentValue()).thenReturn(new Text(input));
EdgeReader ter = createEdgeReader(rr);
ter.setConf(conf);
ter.initialize(null, tac);
assertEquals(ter.getCurrentSourceId(), new Text("1"));
assertEquals(ter.getCurrentEdge().getTargetVertexId(), new Text());
assertEquals(ter.getCurrentEdge().getValue(), new Text());
}
示例9: testInputParserWithMalformedLineAndDelimiter
import org.apache.giraph.io.EdgeReader; //导入方法依赖的package包/类
@Test(expected=IOException.class)
public void testInputParserWithMalformedLineAndDelimiter() throws IOException, InterruptedException {
String input = "1,";
when(rr.getCurrentValue()).thenReturn(new Text(input));
EdgeReader ter = createEdgeReader(rr);
ter.setConf(conf);
ter.initialize(null, tac);
assertEquals(ter.getCurrentSourceId(), new Text("1"));
assertEquals(ter.getCurrentEdge().getTargetVertexId(), new Text());
assertEquals(ter.getCurrentEdge().getValue(), new Text());
}
示例10: testInputParserWithMalformedLineAndDelimiterNoSource
import org.apache.giraph.io.EdgeReader; //导入方法依赖的package包/类
@Test(expected=IOException.class)
public void testInputParserWithMalformedLineAndDelimiterNoSource() throws IOException, InterruptedException {
String input = ",1";
when(rr.getCurrentValue()).thenReturn(new Text(input));
EdgeReader ter = createEdgeReader(rr);
ter.setConf(conf);
ter.initialize(null, tac);
assertEquals(ter.getCurrentSourceId(), new Text());
assertEquals(ter.getCurrentEdge().getTargetVertexId(), new Text("1"));
assertEquals(ter.getCurrentEdge().getValue(), new Text());
}
示例11: testInputParserWithDefaultWeight
import org.apache.giraph.io.EdgeReader; //导入方法依赖的package包/类
@Test
public void testInputParserWithDefaultWeight() throws IOException, InterruptedException {
String input = "1,2";
when(rr.getCurrentValue()).thenReturn(new Text(input));
EdgeReader ter = createEdgeReader(rr);
ter.setConf(conf);
ter.initialize(null, tac);
assertEquals(ter.getCurrentSourceId(), new Text("1"));
assertEquals(ter.getCurrentEdge().getTargetVertexId(), new Text("2"));
assertEquals(ter.getCurrentEdge().getValue(), new LongWritable(1L));
}
示例12: testInputParserWithDefaultWeightAndOverriddenSeparator
import org.apache.giraph.io.EdgeReader; //导入方法依赖的package包/类
@Test
public void testInputParserWithDefaultWeightAndOverriddenSeparator() throws IOException, InterruptedException {
String input = "1\t2";
when(rr.getCurrentValue()).thenReturn(new Text(input));
EdgeReader ter = createEdgeReader(rr);
conf.set(LINE_TOKENIZE_VALUE, "\t");
ter.setConf(conf);
ter.initialize(null, tac);
assertEquals(ter.getCurrentSourceId(), new Text("1"));
assertEquals(ter.getCurrentEdge().getTargetVertexId(), new Text("2"));
assertEquals(ter.getCurrentEdge().getValue(), new LongWritable(1L));
}
示例13: testInputParserWithCustomWeight
import org.apache.giraph.io.EdgeReader; //导入方法依赖的package包/类
@Test
public void testInputParserWithCustomWeight() throws IOException, InterruptedException {
String input = "1,2,10";
when(rr.getCurrentValue()).thenReturn(new Text(input));
EdgeReader ter = createEdgeReader(rr);
ter.setConf(conf);
ter.initialize(null, tac);
assertEquals(ter.getCurrentSourceId(), new Text("1"));
assertEquals(ter.getCurrentEdge().getTargetVertexId(), new Text("2"));
assertEquals(ter.getCurrentEdge().getValue(), new LongWritable(10L));
}
示例14: testInputParserWithCustomWeightAndOverriddenSeparator
import org.apache.giraph.io.EdgeReader; //导入方法依赖的package包/类
@Test
public void testInputParserWithCustomWeightAndOverriddenSeparator() throws IOException, InterruptedException {
String input = "1\t2\t10";
when(rr.getCurrentValue()).thenReturn(new Text(input));
EdgeReader ter = createEdgeReader(rr);
conf.set(LINE_TOKENIZE_VALUE, "\t");
ter.setConf(conf);
ter.initialize(null, tac);
assertEquals(ter.getCurrentSourceId(), new Text("1"));
assertEquals(ter.getCurrentEdge().getTargetVertexId(), new Text("2"));
assertEquals(ter.getCurrentEdge().getValue(), new LongWritable(10L));
}
示例15: testInputParserWithDelimiterInData
import org.apache.giraph.io.EdgeReader; //导入方法依赖的package包/类
@Test
public void testInputParserWithDelimiterInData() throws IOException, InterruptedException {
String input = "te\\[email protected]\[email protected]\t10";
when(rr.getCurrentValue()).thenReturn(new Text(input));
EdgeReader ter = createEdgeReader(rr);
conf.set(LINE_TOKENIZE_VALUE, "\t");
ter.setConf(conf);
ter.initialize(null, tac);
assertEquals(ter.getCurrentSourceId(), new Text("te\\[email protected]"));
assertEquals(ter.getCurrentEdge().getTargetVertexId(), new Text("[email protected]"));
assertEquals(ter.getCurrentEdge().getValue(), new LongWritable(10L));
}