// Path: src/main/java/org/trend/hgraph/mapreduce/pagerank/CalculatePageRankReducer.java
// static boolean pageRankEquals(double src, double dest, int scale) {
//   BigDecimal a = new BigDecimal(src);
//   BigDecimal b = new BigDecimal(dest);
//   a = a.setScale(scale, RoundingMode.DOWN);
//   b = b.setScale(scale, RoundingMode.DOWN);
//   return a.compareTo(b) == 0 ? true : false;
// }
// 
// Path: src/main/java/org/trend/hgraph/HBaseGraphConstants.java
// public class HBaseGraphConstants {
//   
//   public static final String HBASE_GRAPH_TABLE_VERTEX_NAME_KEY = "hbase.graph.table.vertex.name";
//   
//   public static final String HBASE_GRAPH_TABLE_EDGE_NAME_KEY = "hbase.graph.table.edge.name";
//   
//   public static final String HBASE_GRAPH_TABLE_COLFAM_PROPERTY_NAME = "property";
//   
//   public static final String HBASE_GRAPH_TABLE_COLFAM_PROPERTY_NAME_DELIMITER = "@";
// 
//   public static final String HBASE_GRAPH_TABLE_EDGE_DELIMITER_1 = "-->";
// 
//   public static final String HBASE_GRAPH_TABLE_EDGE_DELIMITER_2 = "-->";
// }


import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.trend.hgraph.HBaseGraphConstants;
import static org.trend.hgraph.mapreduce.pagerank.CalculatePageRankReducer.pageRankEquals;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.io.IOUtils;
import org.apache.commons.io.LineIterator;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.junit.After;
import org.junit.AfterClass;
 DriverTest.class.getClassLoader().getResourceAsStream(vertexData);
    LineIterator it = IOUtils.lineIterator(new InputStreamReader(data));

    // load all Vs
    List<V> vs = new ArrayList<V>();
    String record = null;
    String[] values = null;
    V v = null;
    while (it.hasNext()) {
      record = it.next();
      values = record.split("\\|");
      Assert.assertNotNull(values);
      Assert.assertEquals(2, values.length);
      v = new V();
      v.key = values[0];
      v.pr = Double.parseDouble(values[1]);
      vs.add(v);
    }
    LineIterator.closeQuietly(it);
    IOUtils.closeQuietly(data);

    // build adjacency list
    data = DriverTest.class.getClassLoader().getResourceAsStream(edgeData);
    it = IOUtils.lineIterator(new InputStreamReader(data));
    while (it.hasNext()) {
      record = it.next();
      values = record.split("\\|");
      Assert.assertNotNull(values);
      Assert.assertEquals(2, values.length);

// Path: src/main/java/org/trend/hgraph/mapreduce/pagerank/CalculatePageRankReducer.java
// static boolean pageRankEquals(double src, double dest, int scale) {
//   BigDecimal a = new BigDecimal(src);
//   BigDecimal b = new BigDecimal(dest);
//   a = a.setScale(scale, RoundingMode.DOWN);
//   b = b.setScale(scale, RoundingMode.DOWN);
//   return a.compareTo(b) == 0 ? true : false;
// }
// 
// Path: src/main/java/org/trend/hgraph/HBaseGraphConstants.java
// public class HBaseGraphConstants {
//   
//   public static final String HBASE_GRAPH_TABLE_VERTEX_NAME_KEY = "hbase.graph.table.vertex.name";
//   
//   public static final String HBASE_GRAPH_TABLE_EDGE_NAME_KEY = "hbase.graph.table.edge.name";
//   
//   public static final String HBASE_GRAPH_TABLE_COLFAM_PROPERTY_NAME = "property";
//   
//   public static final String HBASE_GRAPH_TABLE_COLFAM_PROPERTY_NAME_DELIMITER = "@";
// 
//   public static final String HBASE_GRAPH_TABLE_EDGE_DELIMITER_1 = "-->";
// 
//   public static final String HBASE_GRAPH_TABLE_EDGE_DELIMITER_2 = "-->";
// }


// Path: src/test/java/org/trend/hgraph/mapreduce/pagerank/LocalPrTest.java
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.trend.hgraph.HBaseGraphConstants;
import static org.trend.hgraph.mapreduce.pagerank.CalculatePageRankReducer.pageRankEquals;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.io.IOUtils;
import org.apache.commons.io.LineIterator;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.junit.After;
import org.junit.AfterClass;

 DriverTest.class.getClassLoader().getResourceAsStream(vertexData);
    LineIterator it = IOUtils.lineIterator(new InputStreamReader(data));

    // load all Vs
    List<V> vs = new ArrayList<V>();
    String record = null;
    String[] values = null;
    V v = null;
    while (it.hasNext()) {
      record = it.next();
      values = record.split("\\|");
      Assert.assertNotNull(values);
      Assert.assertEquals(2, values.length);
      v = new V();
      v.key = values[0];
      v.pr = Double.parseDouble(values[1]);
      vs.add(v);
    }
    LineIterator.closeQuietly(it);
    IOUtils.closeQuietly(data);

    // build adjacency list
    data = DriverTest.class.getClassLoader().getResourceAsStream(edgeData);
    it = IOUtils.lineIterator(new InputStreamReader(data));
    while (it.hasNext()) {
      record = it.next();
      values = record.split("\\|");
      Assert.assertNotNull(values);
      Assert.assertEquals(2, values.length);

      values = values[0].split(HBaseGraphConstants.HBASE_GRAPH_TABLE_EDGE_DELIMITER_1);