Search in sources :

Example 11 with ScannerModel

use of org.apache.hadoop.hbase.rest.model.ScannerModel in project hbase by apache.

the class TestScannerResource method testTableScanWithTableDisable.

// performs table scan during which the underlying table is disabled
// assert that we get 410 (Gone)
@Test
public void testTableScanWithTableDisable() throws IOException {
    ScannerModel model = new ScannerModel();
    model.addColumn(Bytes.toBytes(COLUMN_1));
    model.setCaching(1);
    Response response = client.put("/" + TABLE_TO_BE_DISABLED + "/scanner", Constants.MIMETYPE_PROTOBUF, model.createProtobufOutput());
    assertEquals(response.getCode(), 201);
    String scannerURI = response.getLocation();
    assertNotNull(scannerURI);
    TEST_UTIL.getAdmin().disableTable(TABLE_TO_BE_DISABLED);
    response = client.get(scannerURI, Constants.MIMETYPE_PROTOBUF);
    assertTrue("got " + response.getCode(), response.getCode() == 410);
}
Also used : Response(org.apache.hadoop.hbase.rest.client.Response) ScannerModel(org.apache.hadoop.hbase.rest.model.ScannerModel) Test(org.junit.Test)

Aggregations

ScannerModel (org.apache.hadoop.hbase.rest.model.ScannerModel)11 Response (org.apache.hadoop.hbase.rest.client.Response)10 Test (org.junit.Test)8 StringWriter (java.io.StringWriter)7 CellSetModel (org.apache.hadoop.hbase.rest.model.CellSetModel)6 ByteArrayInputStream (java.io.ByteArrayInputStream)5 RowModel (org.apache.hadoop.hbase.rest.model.RowModel)3 VisibilityLabelsResponse (org.apache.hadoop.hbase.protobuf.generated.VisibilityLabelsProtos.VisibilityLabelsResponse)2 CellModel (org.apache.hadoop.hbase.rest.model.CellModel)2 Header (org.apache.http.Header)1