コード例 #1
0
 @Test
 public void getTestDb() throws Exception {
   Iterable<String> results;
   GiraphConfiguration conf = new GiraphConfiguration();
   GIRAPH_GORA_DATASTORE_CLASS.set(conf, "org.apache.gora.memory.store.MemStore");
   GIRAPH_GORA_KEYS_FACTORY_CLASS.set(conf, "org.apache.giraph.io.gora.utils.DefaultKeyFactory");
   GIRAPH_GORA_KEY_CLASS.set(conf, "java.lang.String");
   GIRAPH_GORA_PERSISTENT_CLASS.set(conf, "org.apache.giraph.io.gora.generated.GEdge");
   GIRAPH_GORA_START_KEY.set(conf, "1");
   GIRAPH_GORA_END_KEY.set(conf, "4");
   conf.set(
       "io.serializations",
       "org.apache.hadoop.io.serializer.WritableSerialization,"
           + "org.apache.hadoop.io.serializer.JavaSerialization");
   conf.setComputationClass(EmptyComputation.class);
   conf.setEdgeInputFormatClass(GoraTestEdgeInputFormat.class);
   conf.setVertexOutputFormatClass(IdWithValueTextOutputFormat.class);
   results = InternalVertexRunner.run(conf, new String[0], new String[0]);
   Assert.assertNotNull(results);
   Assert.assertEquals(3, ((ArrayList<?>) results).size());
   if (results instanceof Collection<?> & (((Collection<?>) results).size() == 2)) {
     Assert.assertEquals("33\t0.0", ((ArrayList<?>) results).get(0).toString());
     Assert.assertEquals("22\t0.0", ((ArrayList<?>) results).get(1).toString());
     Assert.assertEquals("11\t0.0", ((ArrayList<?>) results).get(2).toString());
   }
 }
コード例 #2
0
 @Test
 public void getEmptyDb() throws Exception {
   Iterable<String> results;
   Iterator<String> result;
   GiraphConfiguration conf = new GiraphConfiguration();
   GIRAPH_GORA_DATASTORE_CLASS.set(conf, "org.apache.gora.memory.store.MemStore");
   GIRAPH_GORA_KEYS_FACTORY_CLASS.set(conf, "org.apache.giraph.io.gora.utils.DefaultKeyFactory");
   GIRAPH_GORA_KEY_CLASS.set(conf, "java.lang.String");
   GIRAPH_GORA_PERSISTENT_CLASS.set(conf, "org.apache.giraph.io.gora.generated.GEdge");
   GIRAPH_GORA_START_KEY.set(conf, "1");
   GIRAPH_GORA_END_KEY.set(conf, "3");
   conf.set(
       "io.serializations",
       "org.apache.hadoop.io.serializer.WritableSerialization,"
           + "org.apache.hadoop.io.serializer.JavaSerialization");
   conf.setComputationClass(EmptyComputation.class);
   conf.setEdgeInputFormatClass(GoraGEdgeEdgeInputFormat.class);
   results = InternalVertexRunner.run(conf, new String[0], new String[0]);
   Assert.assertNotNull(results);
   result = results.iterator();
   Assert.assertFalse(result.hasNext());
 }