Search in sources :

Example 16 with Client

use of org.apache.hadoop.hbase.rest.client.Client in project hbase by apache.

the class TestScannersWithLabels method setUpBeforeClass.

@BeforeClass
public static void setUpBeforeClass() throws Exception {
    SUPERUSER = User.createUserForTesting(conf, "admin", new String[] { "supergroup" });
    conf = TEST_UTIL.getConfiguration();
    conf.setClass(VisibilityUtils.VISIBILITY_LABEL_GENERATOR_CLASS, SimpleScanLabelGenerator.class, ScanLabelGenerator.class);
    conf.setInt("hfile.format.version", 3);
    conf.set("hbase.superuser", SUPERUSER.getShortName());
    conf.set("hbase.coprocessor.master.classes", VisibilityController.class.getName());
    conf.set("hbase.coprocessor.region.classes", VisibilityController.class.getName());
    TEST_UTIL.startMiniCluster(1);
    // Wait for the labels table to become available
    TEST_UTIL.waitTableEnabled(VisibilityConstants.LABELS_TABLE_NAME.getName(), 50000);
    createLabels();
    setAuths();
    REST_TEST_UTIL.startServletContainer(conf);
    client = new Client(new Cluster().add("localhost", REST_TEST_UTIL.getServletPort()));
    context = JAXBContext.newInstance(CellModel.class, CellSetModel.class, RowModel.class, ScannerModel.class);
    marshaller = context.createMarshaller();
    unmarshaller = context.createUnmarshaller();
    Admin admin = TEST_UTIL.getAdmin();
    if (admin.tableExists(TABLE)) {
        return;
    }
    HTableDescriptor htd = new HTableDescriptor(TABLE);
    htd.addFamily(new HColumnDescriptor(CFA));
    htd.addFamily(new HColumnDescriptor(CFB));
    admin.createTable(htd);
    insertData(TABLE, COLUMN_1, 1.0);
    insertData(TABLE, COLUMN_2, 0.5);
}
Also used : CellSetModel(org.apache.hadoop.hbase.rest.model.CellSetModel) HColumnDescriptor(org.apache.hadoop.hbase.HColumnDescriptor) Cluster(org.apache.hadoop.hbase.rest.client.Cluster) CellModel(org.apache.hadoop.hbase.rest.model.CellModel) RowModel(org.apache.hadoop.hbase.rest.model.RowModel) VisibilityClient(org.apache.hadoop.hbase.security.visibility.VisibilityClient) Client(org.apache.hadoop.hbase.rest.client.Client) Admin(org.apache.hadoop.hbase.client.Admin) VisibilityController(org.apache.hadoop.hbase.security.visibility.VisibilityController) ScannerModel(org.apache.hadoop.hbase.rest.model.ScannerModel) HTableDescriptor(org.apache.hadoop.hbase.HTableDescriptor) BeforeClass(org.junit.BeforeClass)

Aggregations

Client (org.apache.hadoop.hbase.rest.client.Client)16 Cluster (org.apache.hadoop.hbase.rest.client.Cluster)14 BeforeClass (org.junit.BeforeClass)14 Admin (org.apache.hadoop.hbase.client.Admin)7 HColumnDescriptor (org.apache.hadoop.hbase.HColumnDescriptor)6 HTableDescriptor (org.apache.hadoop.hbase.HTableDescriptor)6 CellModel (org.apache.hadoop.hbase.rest.model.CellModel)5 CellSetModel (org.apache.hadoop.hbase.rest.model.CellSetModel)5 RowModel (org.apache.hadoop.hbase.rest.model.RowModel)5 ScannerModel (org.apache.hadoop.hbase.rest.model.ScannerModel)3 IOException (java.io.IOException)2 Put (org.apache.hadoop.hbase.client.Put)2 Table (org.apache.hadoop.hbase.client.Table)2 RemoteAdmin (org.apache.hadoop.hbase.rest.client.RemoteAdmin)2 TableListModel (org.apache.hadoop.hbase.rest.model.TableListModel)2 BasicHeader (org.apache.http.message.BasicHeader)2 JacksonJaxbJsonProvider (org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider)2 ArrayList (java.util.ArrayList)1 FileStatus (org.apache.hadoop.fs.FileStatus)1 HRegionLocation (org.apache.hadoop.hbase.HRegionLocation)1