Package org.apache.hadoop.hbase.security.visibility

Examples of org.apache.hadoop.hbase.security.visibility.Authorizations


   * @param proto
   * @return the converted client Authorizations
   */
  public static Authorizations toAuthorizations(ClientProtos.Authorizations proto) {
    if (proto == null) return null;
    return new Authorizations(proto.getLabelList());
  }
View Full Code Here


  }

  @Test
  public void testSetAuthorizations() {
    Scan scan = new Scan();
    scan.setAuthorizations(new Authorizations("A", "B", "0123", "A0", "1A1", "_a"));
    try {
      scan.setAuthorizations(new Authorizations("A|B"));
      fail("Should have failed for A|B.");
    } catch (IllegalArgumentException e) {
    }
    try {
      scan.setAuthorizations(new Authorizations("A&B"));
      fail("Should have failed for A&B.");
    } catch (IllegalArgumentException e) {
    }
    try {
      scan.setAuthorizations(new Authorizations("!B"));
      fail("Should have failed for !B.");
    } catch (IllegalArgumentException e) {
    }
    try {
      scan.setAuthorizations(new Authorizations("A", "(A)"));
      fail("Should have failed for (A).");
    } catch (IllegalArgumentException e) {
    }
    try {
      scan.setAuthorizations(new Authorizations("A", "{A"));
      fail("Should have failed for {A.");
    } catch (IllegalArgumentException e) {
    }
    try {
      scan.setAuthorizations(new Authorizations(" "));
      fail("Should have failed for empty");
    } catch (IllegalArgumentException e) {
    }
    try {
      scan.setAuthorizations(new Authorizations(":B"));
    } catch (IllegalArgumentException e) {
      fail("Should not have failed for :B");
    }
    try {
      scan.setAuthorizations(new Authorizations("-B"));
    } catch (IllegalArgumentException e) {
      fail("Should not have failed for -B");
    }
    try {
      scan.setAuthorizations(new Authorizations(".B"));
    } catch (IllegalArgumentException e) {
      fail("Should not have failed for .B");
    }
    try {
      scan.setAuthorizations(new Authorizations("/B"));
    } catch (IllegalArgumentException e) {
      fail("Should not have failed for /B");
    }
  }
View Full Code Here

    Job job = new Job(conf);
    job.setJarByClass(this.getClass());
    job.setJobName(TEST_NAME + " Verification for " + htd.getTableName());
    setJobScannerConf(job);
    Scan scan = new Scan();
    scan.setAuthorizations(new Authorizations(auths));
    TableMapReduceUtil.initTableMapperJob(htd.getTableName().getNameAsString(), scan,
        VerifyMapper.class, NullWritable.class, NullWritable.class, job);
    TableMapReduceUtil.addDependencyJars(job.getConfiguration(), AbstractHBaseTool.class);
    int scannerCaching = conf.getInt("verify.scannercaching", SCANNER_CACHING);
    TableMapReduceUtil.setScannerCaching(job, scannerCaching);
View Full Code Here

    Job job = new Job(conf);
    job.setJarByClass(this.getClass());
    job.setJobName(TEST_NAME + " Verification for " + htd.getTableName());
    setJobScannerConf(job);
    Scan scan = new Scan();
    scan.setAuthorizations(new Authorizations(auths));
    TableMapReduceUtil.initTableMapperJob(htd.getTableName().getNameAsString(), scan,
        VerifyMapper.class, NullWritable.class, NullWritable.class, job);
    TableMapReduceUtil.addDependencyJars(job.getConfiguration(), AbstractHBaseTool.class);
    int scannerCaching = conf.getInt("verify.scannercaching", SCANNER_CACHING);
    TableMapReduceUtil.setScannerCaching(job, scannerCaching);
View Full Code Here

        table.delete(d);

        Scan scan = new Scan();
        // Scan entire family.
        scan.addFamily(Bytes.toBytes(FAMILY));
        scan.setAuthorizations(new Authorizations("secret", "private"));
        ResultScanner resScanner = table.getScanner(scan);
        Result[] next = resScanner.next(5);
        assertEquals(0, next.length);
        verified = true;
        break;
View Full Code Here

    for (int i = 0; i < numRetries; i++) {
      try {
        Scan scan = new Scan();
        // Scan entire family.
        scan.addFamily(Bytes.toBytes(family));
        scan.setAuthorizations(new Authorizations("secret","private"));
        ResultScanner resScanner = table.getScanner(scan);
        Result[] next = resScanner.next(5);
        assertEquals(1, next.length);
        for (Result res : resScanner) {
          LOG.debug("Getting results " + res.size());
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.security.visibility.Authorizations

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.