Search in sources :

Example 11 with Client

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

the class TestTableScan method setUpBeforeClass.

@BeforeClass
public static void setUpBeforeClass() throws Exception {
    conf = TEST_UTIL.getConfiguration();
    conf.set(Constants.CUSTOM_FILTERS, "CustomFilter:" + CustomFilter.class.getName());
    TEST_UTIL.startMiniCluster();
    REST_TEST_UTIL.startServletContainer(conf);
    client = new Client(new Cluster().add("localhost", REST_TEST_UTIL.getServletPort()));
    Admin admin = TEST_UTIL.getAdmin();
    if (!admin.tableExists(TABLE)) {
        HTableDescriptor htd = new HTableDescriptor(TABLE);
        htd.addFamily(new HColumnDescriptor(CFA));
        htd.addFamily(new HColumnDescriptor(CFB));
        admin.createTable(htd);
        expectedRows1 = TestScannerResource.insertData(conf, TABLE, COLUMN_1, 1.0);
        expectedRows2 = TestScannerResource.insertData(conf, TABLE, COLUMN_2, 0.5);
    }
}
Also used : HColumnDescriptor(org.apache.hadoop.hbase.HColumnDescriptor) Cluster(org.apache.hadoop.hbase.rest.client.Cluster) Client(org.apache.hadoop.hbase.rest.client.Client) Admin(org.apache.hadoop.hbase.client.Admin) HTableDescriptor(org.apache.hadoop.hbase.HTableDescriptor) BeforeClass(org.junit.BeforeClass)

Example 12 with Client

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

the class TestGzipFilter method setUpBeforeClass.

@BeforeClass
public static void setUpBeforeClass() throws Exception {
    TEST_UTIL.startMiniCluster();
    REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration());
    client = new Client(new Cluster().add("localhost", REST_TEST_UTIL.getServletPort()));
    Admin admin = TEST_UTIL.getAdmin();
    if (admin.tableExists(TABLE)) {
        return;
    }
    HTableDescriptor htd = new HTableDescriptor(TABLE);
    htd.addFamily(new HColumnDescriptor(CFA));
    admin.createTable(htd);
}
Also used : HColumnDescriptor(org.apache.hadoop.hbase.HColumnDescriptor) Cluster(org.apache.hadoop.hbase.rest.client.Cluster) Client(org.apache.hadoop.hbase.rest.client.Client) Admin(org.apache.hadoop.hbase.client.Admin) HTableDescriptor(org.apache.hadoop.hbase.HTableDescriptor) BeforeClass(org.junit.BeforeClass)

Example 13 with Client

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

the class TestScannerResource method setUpBeforeClass.

@BeforeClass
public static void setUpBeforeClass() throws Exception {
    conf = TEST_UTIL.getConfiguration();
    TEST_UTIL.startMiniCluster();
    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);
    expectedRows1 = insertData(TEST_UTIL.getConfiguration(), TABLE, COLUMN_1, 1.0);
    expectedRows2 = insertData(TEST_UTIL.getConfiguration(), TABLE, COLUMN_2, 0.5);
    htd = new HTableDescriptor(TABLE_TO_BE_DISABLED);
    htd.addFamily(new HColumnDescriptor(CFA));
    htd.addFamily(new HColumnDescriptor(CFB));
    admin.createTable(htd);
}
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) Client(org.apache.hadoop.hbase.rest.client.Client) Admin(org.apache.hadoop.hbase.client.Admin) ScannerModel(org.apache.hadoop.hbase.rest.model.ScannerModel) HTableDescriptor(org.apache.hadoop.hbase.HTableDescriptor) BeforeClass(org.junit.BeforeClass)

Example 14 with Client

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

the class RowResourceBase method setUpBeforeClass.

@BeforeClass
public static void setUpBeforeClass() throws Exception {
    conf = TEST_UTIL.getConfiguration();
    TEST_UTIL.startMiniCluster(3);
    REST_TEST_UTIL.startServletContainer(conf);
    context = JAXBContext.newInstance(CellModel.class, CellSetModel.class, RowModel.class);
    xmlMarshaller = context.createMarshaller();
    xmlUnmarshaller = context.createUnmarshaller();
    jsonMapper = new JacksonJaxbJsonProvider().locateMapper(CellSetModel.class, MediaType.APPLICATION_JSON_TYPE);
    client = new Client(new Cluster().add("localhost", REST_TEST_UTIL.getServletPort()));
}
Also used : CellSetModel(org.apache.hadoop.hbase.rest.model.CellSetModel) Cluster(org.apache.hadoop.hbase.rest.client.Cluster) CellModel(org.apache.hadoop.hbase.rest.model.CellModel) RowModel(org.apache.hadoop.hbase.rest.model.RowModel) JacksonJaxbJsonProvider(org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider) Client(org.apache.hadoop.hbase.rest.client.Client) BeforeClass(org.junit.BeforeClass)

Example 15 with Client

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

the class PerformanceEvaluation method runNIsMoreThanOne.

/*
   * We're to run multiple clients concurrently.  Setup a mapreduce job.  Run
   * one map per client.  Then run a single reduce to sum the elapsed times.
   * @param cmd Command to run.
   * @throws IOException
   */
private void runNIsMoreThanOne(final Class<? extends Test> cmd) throws IOException, InterruptedException, ClassNotFoundException {
    RemoteAdmin remoteAdmin = new RemoteAdmin(new Client(cluster), getConf());
    checkTable(remoteAdmin);
    if (nomapred) {
        doMultipleClients(cmd);
    } else {
        doMapReduce(cmd);
    }
}
Also used : RemoteAdmin(org.apache.hadoop.hbase.rest.client.RemoteAdmin) Client(org.apache.hadoop.hbase.rest.client.Client)

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