use of org.apache.hadoop.hbase.rest.client.Client in project hbase by apache.
the class TestResourceFilter method setUpBeforeClass.
@BeforeClass
public static void setUpBeforeClass() throws Exception {
TEST_UTIL.getConfiguration().set(Constants.FILTER_CLASSES, DummyFilter.class.getName());
TEST_UTIL.startMiniCluster();
REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration());
client = new Client(new Cluster().add("localhost", REST_TEST_UTIL.getServletPort()));
}
use of org.apache.hadoop.hbase.rest.client.Client in project hbase by apache.
the class TestSchemaResource method setUpBeforeClass.
@BeforeClass
public static void setUpBeforeClass() throws Exception {
conf = TEST_UTIL.getConfiguration();
conf.setBoolean(RESTServer.REST_CSRF_ENABLED_KEY, csrfEnabled);
extraHdr = new BasicHeader(RESTServer.REST_CSRF_CUSTOM_HEADER_DEFAULT, "");
TEST_UTIL.startMiniCluster();
REST_TEST_UTIL.startServletContainer(conf);
client = new Client(new Cluster().add("localhost", REST_TEST_UTIL.getServletPort()));
testTableSchemaModel = new TestTableSchemaModel();
context = JAXBContext.newInstance(ColumnSchemaModel.class, TableSchemaModel.class);
}
use of org.apache.hadoop.hbase.rest.client.Client in project hbase by apache.
the class TestStatusResource method setUpBeforeClass.
@BeforeClass
public static void setUpBeforeClass() throws Exception {
conf = TEST_UTIL.getConfiguration();
TEST_UTIL.startMiniCluster(1, 1);
TEST_UTIL.createTable(TableName.valueOf("TestStatusResource"), Bytes.toBytes("D"));
TEST_UTIL.createTable(TableName.valueOf("TestStatusResource2"), Bytes.toBytes("D"));
REST_TEST_UTIL.startServletContainer(conf);
Cluster cluster = new Cluster();
cluster.add("localhost", REST_TEST_UTIL.getServletPort());
client = new Client(cluster);
context = JAXBContext.newInstance(StorageClusterStatusModel.class);
TEST_UTIL.waitFor(6000, new Waiter.Predicate<IOException>() {
@Override
public boolean evaluate() throws IOException {
return TEST_UTIL.getMiniHBaseCluster().getClusterStatus().getAverageLoad() > 0;
}
});
}
use of org.apache.hadoop.hbase.rest.client.Client in project hbase by apache.
the class TestTableResource method setUpBeforeClass.
@BeforeClass
public static void setUpBeforeClass() throws Exception {
TEST_UTIL.startMiniCluster(3);
REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration());
client = new Client(new Cluster().add("localhost", REST_TEST_UTIL.getServletPort()));
context = JAXBContext.newInstance(TableModel.class, TableInfoModel.class, TableListModel.class, TableRegionModel.class);
Admin admin = TEST_UTIL.getAdmin();
if (admin.tableExists(TABLE)) {
return;
}
HTableDescriptor htd = new HTableDescriptor(TABLE);
htd.addFamily(new HColumnDescriptor(COLUMN_FAMILY));
admin.createTable(htd);
byte[] k = new byte[3];
byte[][] famAndQf = KeyValue.parseColumn(Bytes.toBytes(COLUMN));
List<Put> puts = new ArrayList<>();
for (byte b1 = 'a'; b1 < 'z'; b1++) {
for (byte b2 = 'a'; b2 < 'z'; b2++) {
for (byte b3 = 'a'; b3 < 'z'; b3++) {
k[0] = b1;
k[1] = b2;
k[2] = b3;
Put put = new Put(k);
put.setDurability(Durability.SKIP_WAL);
put.addColumn(famAndQf[0], famAndQf[1], k);
puts.add(put);
}
}
}
Connection connection = TEST_UTIL.getConnection();
Table table = connection.getTable(TABLE);
table.put(puts);
table.close();
// get the initial layout (should just be one region)
RegionLocator regionLocator = connection.getRegionLocator(TABLE);
List<HRegionLocation> m = regionLocator.getAllRegionLocations();
assertEquals(m.size(), 1);
// tell the master to split the table
admin.split(TABLE);
// give some time for the split to happen
TestEndToEndSplitTransaction.blockUntilRegionSplit(TEST_UTIL.getConfiguration(), 60000, m.get(0).getRegionInfo().getRegionName(), true);
long timeout = System.currentTimeMillis() + (15 * 1000);
while (System.currentTimeMillis() < timeout && m.size() != 2) {
try {
Thread.sleep(250);
} catch (InterruptedException e) {
LOG.warn(StringUtils.stringifyException(e));
}
// check again
m = regionLocator.getAllRegionLocations();
}
// should have two regions now
assertEquals(m.size(), 2);
regionMap = m;
LOG.info("regions: " + regionMap);
regionLocator.close();
}
use of org.apache.hadoop.hbase.rest.client.Client in project hbase by apache.
the class PerformanceEvaluation method runNIsOne.
private void runNIsOne(final Class<? extends Test> cmd) {
Status status = new Status() {
public void setStatus(String msg) throws IOException {
LOG.info(msg);
}
};
RemoteAdmin admin = null;
try {
Client client = new Client(cluster);
admin = new RemoteAdmin(client, getConf());
checkTable(admin);
runOneClient(cmd, 0, this.R, this.R, this.flushCommits, this.writeToWAL, this.useTags, this.noOfTags, this.connection, status);
} catch (Exception e) {
LOG.error("Failed", e);
}
}
Aggregations