예제 #1
0
  static void runTest(Connector c, MiniAccumuloClusterImpl cluster)
      throws AccumuloException, AccumuloSecurityException, TableExistsException,
          TableNotFoundException, MutationsRejectedException, IOException, InterruptedException,
          NoSuchAlgorithmException {
    c.tableOperations().create(tablename);
    BatchWriter bw = c.createBatchWriter(tablename, new BatchWriterConfig());
    for (int i = 0; i < 10; i++) {
      Mutation m = new Mutation("" + i);
      m.put(input_cf, input_cq, "row" + i);
      bw.addMutation(m);
    }
    bw.close();
    Process hash =
        cluster.exec(
            RowHash.class,
            Collections.singletonList(hadoopTmpDirArg),
            "-i",
            c.getInstance().getInstanceName(),
            "-z",
            c.getInstance().getZooKeepers(),
            "-u",
            "root",
            "-p",
            ROOT_PASSWORD,
            "-t",
            tablename,
            "--column",
            input_cfcq);
    assertEquals(0, hash.waitFor());

    Scanner s = c.createScanner(tablename, Authorizations.EMPTY);
    s.fetchColumn(new Text(input_cf), new Text(output_cq));
    int i = 0;
    for (Entry<Key, Value> entry : s) {
      MessageDigest md = MessageDigest.getInstance("MD5");
      byte[] check = Base64.encodeBase64(md.digest(("row" + i).getBytes()));
      assertEquals(entry.getValue().toString(), new String(check));
      i++;
    }
  }
예제 #2
0
 public static void deleteTest(Connector c, MiniAccumuloClusterImpl cluster) throws Exception {
   VerifyIngest.Opts vopts = new VerifyIngest.Opts();
   TestIngest.Opts opts = new TestIngest.Opts();
   vopts.rows = opts.rows = 1000;
   vopts.cols = opts.cols = 1;
   vopts.random = opts.random = 56;
   TestIngest.ingest(c, opts, BWOPTS);
   assertEquals(
       0,
       cluster
           .exec(
               TestRandomDeletes.class,
               "-u",
               "root",
               "-p",
               ROOT_PASSWORD,
               "-i",
               cluster.getInstanceName(),
               "-z",
               cluster.getZooKeepers())
           .waitFor());
   TestIngest.ingest(c, opts, BWOPTS);
   VerifyIngest.verifyIngest(c, vopts, new ScannerOpts());
 }