コード例 #1
0
  public void testCheckColumn_EnforceVersions() throws IOException {
    ScanWildcardColumnTracker tracker = new ScanWildcardColumnTracker(0, VERSIONS, Long.MIN_VALUE);

    // Create list of qualifiers
    List<byte[]> qualifiers = new ArrayList<byte[]>();
    qualifiers.add(Bytes.toBytes("qualifer1"));
    qualifiers.add(Bytes.toBytes("qualifer1"));
    qualifiers.add(Bytes.toBytes("qualifer1"));
    qualifiers.add(Bytes.toBytes("qualifer2"));

    // Setting up expected result
    List<ScanQueryMatcher.MatchCode> expected = new ArrayList<MatchCode>();
    expected.add(ScanQueryMatcher.MatchCode.INCLUDE);
    expected.add(ScanQueryMatcher.MatchCode.INCLUDE);
    expected.add(ScanQueryMatcher.MatchCode.SEEK_NEXT_COL);
    expected.add(ScanQueryMatcher.MatchCode.INCLUDE);

    List<MatchCode> actual = new ArrayList<ScanQueryMatcher.MatchCode>();

    long timestamp = 0;
    for (byte[] qualifier : qualifiers) {
      MatchCode mc =
          tracker.checkColumn(
              qualifier, 0, qualifier.length, ++timestamp, KeyValue.Type.Put.getCode(), false);
      actual.add(mc);
    }

    // Compare actual with expected
    for (int i = 0; i < expected.size(); i++) {
      assertEquals(expected.get(i), actual.get(i));
    }
  }
コード例 #2
0
  public void DisabledTestCheckColumn_WrongOrder() {
    ScanWildcardColumnTracker tracker = new ScanWildcardColumnTracker(0, VERSIONS, Long.MIN_VALUE);

    // Create list of qualifiers
    List<byte[]> qualifiers = new ArrayList<byte[]>();
    qualifiers.add(Bytes.toBytes("qualifer2"));
    qualifiers.add(Bytes.toBytes("qualifer1"));

    boolean ok = false;

    try {
      for (byte[] qualifier : qualifiers) {
        tracker.checkColumn(qualifier, 0, qualifier.length, 1, KeyValue.Type.Put.getCode(), false);
      }
    } catch (Exception e) {
      ok = true;
    }

    assertEquals(true, ok);
  }