/** * Does a deep comparison of two Results, down to the byte arrays. * @param res1 first result to compare * @param res2 second result to compare * @throws Exception Every difference is throwing an exception */ public static void compareResults(Result res1, Result res2) throws Exception { if (res2 == null) { throw new Exception("There wasn't enough rows, we stopped at " + Bytes.toStringBinary(res1.getRow())); } if (res1.size() != res2.size()) { throw new Exception("This row doesn't have the same number of KVs: " + res1.toString() + " compared to " + res2.toString()); } Cell[] ourKVs = res1.rawCells(); Cell[] replicatedKVs = res2.rawCells(); for (int i = 0; i < res1.size(); i++) { if (!ourKVs[i].equals(replicatedKVs[i]) || !CellUtil.matchingValue(ourKVs[i], replicatedKVs[i])) { throw new Exception("This result was different: " + res1.toString() + " compared to " + res2.toString()); } } }
private static void assertRowCount(Table t, int expected) throws IOException { try (ResultScanner scanner = t.getScanner(new Scan())) { int i = 0; for (Result r: scanner) { LOG.info(r.toString()); i++; } assertEquals(expected, i); } }
if (c == null) { throw new IllegalArgumentException("Result did not contain the expected column " + QUOTA_POLICY_COLUMN + ", " + result.toString());
LOG.info("Dumping contents of hbase:quota table"); while ((result = scanner.next()) != null) { LOG.info(Bytes.toString(result.getRow()) + " => " + result.toString());
LOG.info("Dumping contents of hbase:quota table"); while ((result = scanner.next()) != null) { LOG.info(Bytes.toString(result.getRow()) + " => " + result.toString());
get.addFamily(f); r = ht.get(get); assertTrue(r.toString(), r.containsColumn(f, f));
assertTrue("Row is deleted, but we get" + result.toString(), (result == null) || result.isEmpty());
try { for (Result rr = null; (rr = s.next()) != null;) { System.out.println(rr.toString()); count += 1;
/** * Does a deep comparison of two Results, down to the byte arrays. * @param res1 first result to compare * @param res2 second result to compare * @throws Exception Every difference is throwing an exception */ public static void compareResults(Result res1, Result res2) throws Exception { if (res2 == null) { throw new Exception("There wasn't enough rows, we stopped at " + Bytes.toStringBinary(res1.getRow())); } if (res1.size() != res2.size()) { throw new Exception("This row doesn't have the same number of KVs: " + res1.toString() + " compared to " + res2.toString()); } Cell[] ourKVs = res1.rawCells(); Cell[] replicatedKVs = res2.rawCells(); for (int i = 0; i < res1.size(); i++) { if (!ourKVs[i].equals(replicatedKVs[i]) || !CellUtil.matchingValue(ourKVs[i], replicatedKVs[i])) { throw new Exception("This result was different: " + res1.toString() + " compared to " + res2.toString()); } } }
if (c == null) { throw new IllegalArgumentException("Result did not contain the expected column " + QUOTA_POLICY_COLUMN + ", " + result.toString());
@Override public String mapRow(Result result, int rowNum) throws Exception { return result.toString(); } });
public static String resultToString(Result result) { System.out.println(" ______________________ "); System.out.println(" Result.toString() " + result.toString()); StringBuilder strBuilder = new StringBuilder(); strBuilder.append("Result with rowKey " + Bytes.toString(result.getRow()) + " : "); for (Cell kv : result.rawCells()) { System.out.println(" Cell.toString() " + kv.toString()); strBuilder.append(" Family - " + Bytes.toString(CellUtil.cloneFamily(kv))); strBuilder.append(" : Qualifier - " + Bytes.toString(CellUtil.cloneQualifier(kv))); strBuilder.append(" : Value: " + Bytes.toLong(CellUtil.cloneValue(kv)) + " "); } System.out.println(" ______________________ "); return strBuilder.toString(); }
/** * Does a deep comparison of two Results, down to the byte arrays. * @param res1 first result to compare * @param res2 second result to compare * @throws Exception Every difference is throwing an exception */ public static void compareResults(Result res1, Result res2) throws Exception { if (res2 == null) { throw new Exception("There wasn't enough rows, we stopped at " + Bytes.toStringBinary(res1.getRow())); } if (res1.size() != res2.size()) { throw new Exception("This row doesn't have the same number of KVs: " + res1.toString() + " compared to " + res2.toString()); } Cell[] ourKVs = res1.rawCells(); Cell[] replicatedKVs = res2.rawCells(); for (int i = 0; i < res1.size(); i++) { if (!ourKVs[i].equals(replicatedKVs[i]) || !CellUtil.matchingValue(ourKVs[i], replicatedKVs[i])) { throw new Exception("This result was different: " + res1.toString() + " compared to " + res2.toString()); } } }
/** * Does a deep comparison of two Results, down to the byte arrays. * @param res1 first result to compare * @param res2 second result to compare * @throws Exception Every difference is throwing an exception */ public static void compareResults(Result res1, Result res2) throws Exception { if (res2 == null) { throw new Exception("There wasn't enough rows, we stopped at " + Bytes.toStringBinary(res1.getRow())); } if (res1.size() != res2.size()) { throw new Exception("This row doesn't have the same number of KVs: " + res1.toString() + " compared to " + res2.toString()); } Cell[] ourKVs = res1.rawCells(); Cell[] replicatedKVs = res2.rawCells(); for (int i = 0; i < res1.size(); i++) { if (!ourKVs[i].equals(replicatedKVs[i]) || !Bytes.equals(CellUtil.cloneValue(ourKVs[i]), CellUtil.cloneValue(replicatedKVs[i]))) { throw new Exception("This result was different: " + res1.toString() + " compared to " + res2.toString()); } } }
/** * Does a deep comparison of two Results, down to the byte arrays. * @param res1 first result to compare * @param res2 second result to compare * @throws Exception Every difference is throwing an exception */ public static void compareResults(Result res1, Result res2) throws Exception { if (res2 == null) { throw new Exception("There wasn't enough rows, we stopped at " + Bytes.toStringBinary(res1.getRow())); } if (res1.size() != res2.size()) { throw new Exception("This row doesn't have the same number of KVs: " + res1.toString() + " compared to " + res2.toString()); } KeyValue[] ourKVs = res1.raw(); KeyValue[] replicatedKVs = res2.raw(); for (int i = 0; i < res1.size(); i++) { if (!ourKVs[i].equals(replicatedKVs[i]) || !Bytes.equals(ourKVs[i].getValue(), replicatedKVs[i].getValue())) { throw new Exception("This result was different: " + res1.toString() + " compared to " + res2.toString()); } } }
private static void assertRowCount(Table t, int expected) throws IOException { try (ResultScanner scanner = t.getScanner(new Scan())) { int i = 0; for (Result r: scanner) { LOG.info(r.toString()); i++; } assertEquals(expected, i); } }
if (c == null) { throw new IllegalArgumentException("Result did not contain the expected column " + QUOTA_POLICY_COLUMN + ", " + result.toString());
LOG.info("Dumping contents of hbase:quota table"); while ((result = scanner.next()) != null) { LOG.info(Bytes.toString(result.getRow()) + " => " + result.toString());
LOG.info("Dumping contents of hbase:quota table"); while ((result = scanner.next()) != null) { LOG.info(Bytes.toString(result.getRow()) + " => " + result.toString());
get.addFamily(f); r = ht.get(get); assertTrue(r.toString(), r.containsColumn(f, f));