}
@Test
public void testTableCreateAndDeletePB() throws IOException, JAXBException {
String schemaPath = "/" + TABLE2 + "/schema";
TableSchemaModel model;
Response response;
HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
assertFalse(admin.tableExists(TABLE2));
// create the table
model = TestTableSchemaModel.buildTestModel(TABLE2);
TestTableSchemaModel.checkModel(model, TABLE2);
response = client.put(schemaPath, Constants.MIMETYPE_PROTOBUF,
model.createProtobufOutput());
assertEquals(response.getCode(), 201);
// recall the same put operation but in read-only mode
conf.set("hbase.rest.readonly", "true");
response = client.put(schemaPath, Constants.MIMETYPE_PROTOBUF,
model.createProtobufOutput());
assertEquals(response.getCode(), 403);
// retrieve the schema and validate it
response = client.get(schemaPath, Constants.MIMETYPE_PROTOBUF);
assertEquals(response.getCode(), 200);
assertEquals(Constants.MIMETYPE_PROTOBUF, response.getHeader("content-type"));
model = new TableSchemaModel();
model.getObjectFromMessage(response.getBody());
TestTableSchemaModel.checkModel(model, TABLE2);
// retrieve the schema and validate it with alternate pbuf type
response = client.get(schemaPath, Constants.MIMETYPE_PROTOBUF_IETF);
assertEquals(response.getCode(), 200);
assertEquals(Constants.MIMETYPE_PROTOBUF_IETF, response.getHeader("content-type"));
model = new TableSchemaModel();
model.getObjectFromMessage(response.getBody());
TestTableSchemaModel.checkModel(model, TABLE2);
// test delete schema operation is forbidden in read-only mode
response = client.delete(schemaPath);
assertEquals(response.getCode(), 403);