Search in sources :

Example 81 with Response

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

the class TestStatusResource method testGetClusterStatusPB.

@Test
public void testGetClusterStatusPB() throws IOException {
    Response response = client.get("/status/cluster", Constants.MIMETYPE_PROTOBUF);
    assertEquals(response.getCode(), 200);
    assertEquals(Constants.MIMETYPE_PROTOBUF, response.getHeader("content-type"));
    StorageClusterStatusModel model = new StorageClusterStatusModel();
    model.getObjectFromMessage(response.getBody());
    validate(model);
    response = client.get("/status/cluster", Constants.MIMETYPE_PROTOBUF_IETF);
    assertEquals(response.getCode(), 200);
    assertEquals(Constants.MIMETYPE_PROTOBUF_IETF, response.getHeader("content-type"));
    model = new StorageClusterStatusModel();
    model.getObjectFromMessage(response.getBody());
    validate(model);
}
Also used : Response(org.apache.hadoop.hbase.rest.client.Response) StorageClusterStatusModel(org.apache.hadoop.hbase.rest.model.StorageClusterStatusModel) Test(org.junit.Test)

Example 82 with Response

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

the class TestTableResource method testTableListPB.

@Test
public void testTableListPB() throws IOException, JAXBException {
    Response response = client.get("/", Constants.MIMETYPE_PROTOBUF);
    assertEquals(response.getCode(), 200);
    assertEquals(Constants.MIMETYPE_PROTOBUF, response.getHeader("content-type"));
    TableListModel model = new TableListModel();
    model.getObjectFromMessage(response.getBody());
    checkTableList(model);
    response = client.get("/", Constants.MIMETYPE_PROTOBUF_IETF);
    assertEquals(response.getCode(), 200);
    assertEquals(Constants.MIMETYPE_PROTOBUF_IETF, response.getHeader("content-type"));
    model = new TableListModel();
    model.getObjectFromMessage(response.getBody());
    checkTableList(model);
}
Also used : Response(org.apache.hadoop.hbase.rest.client.Response) TableListModel(org.apache.hadoop.hbase.rest.model.TableListModel) Test(org.junit.Test)

Example 83 with Response

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

the class TestTableResource method testTableInfoPB.

@Test
public void testTableInfoPB() throws IOException, JAXBException {
    Response response = client.get("/" + TABLE + "/regions", Constants.MIMETYPE_PROTOBUF);
    assertEquals(response.getCode(), 200);
    assertEquals(Constants.MIMETYPE_PROTOBUF, response.getHeader("content-type"));
    TableInfoModel model = new TableInfoModel();
    model.getObjectFromMessage(response.getBody());
    checkTableInfo(model);
    response = client.get("/" + TABLE + "/regions", Constants.MIMETYPE_PROTOBUF_IETF);
    assertEquals(response.getCode(), 200);
    assertEquals(Constants.MIMETYPE_PROTOBUF_IETF, response.getHeader("content-type"));
    model = new TableInfoModel();
    model.getObjectFromMessage(response.getBody());
    checkTableInfo(model);
}
Also used : Response(org.apache.hadoop.hbase.rest.client.Response) TableInfoModel(org.apache.hadoop.hbase.rest.model.TableInfoModel) Test(org.junit.Test)

Example 84 with Response

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

the class TestTableResource method testTableListXML.

@Test
public void testTableListXML() throws IOException, JAXBException {
    Response response = client.get("/", Constants.MIMETYPE_XML);
    assertEquals(response.getCode(), 200);
    assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
    TableListModel model = (TableListModel) context.createUnmarshaller().unmarshal(new ByteArrayInputStream(response.getBody()));
    checkTableList(model);
}
Also used : Response(org.apache.hadoop.hbase.rest.client.Response) TableListModel(org.apache.hadoop.hbase.rest.model.TableListModel) ByteArrayInputStream(java.io.ByteArrayInputStream) Test(org.junit.Test)

Example 85 with Response

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

the class TestTableResource method testTableListJSON.

@Test
public void testTableListJSON() throws IOException {
    Response response = client.get("/", Constants.MIMETYPE_JSON);
    assertEquals(response.getCode(), 200);
    assertEquals(Constants.MIMETYPE_JSON, response.getHeader("content-type"));
}
Also used : Response(org.apache.hadoop.hbase.rest.client.Response) Test(org.junit.Test)

Aggregations

Response (org.apache.hadoop.hbase.rest.client.Response)91 Test (org.junit.Test)73 CellSetModel (org.apache.hadoop.hbase.rest.model.CellSetModel)39 RowModel (org.apache.hadoop.hbase.rest.model.RowModel)30 CellModel (org.apache.hadoop.hbase.rest.model.CellModel)24 ByteArrayInputStream (java.io.ByteArrayInputStream)16 StringWriter (java.io.StringWriter)16 ScannerModel (org.apache.hadoop.hbase.rest.model.ScannerModel)10 Admin (org.apache.hadoop.hbase.client.Admin)9 JAXBContext (javax.xml.bind.JAXBContext)7 Unmarshaller (javax.xml.bind.Unmarshaller)7 JacksonJaxbJsonProvider (org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider)6 ObjectMapper (org.codehaus.jackson.map.ObjectMapper)6 HashMap (java.util.HashMap)4 NamespaceDescriptor (org.apache.hadoop.hbase.NamespaceDescriptor)4 NamespacesInstanceModel (org.apache.hadoop.hbase.rest.model.NamespacesInstanceModel)4 TestNamespacesInstanceModel (org.apache.hadoop.hbase.rest.model.TestNamespacesInstanceModel)4 Header (org.apache.http.Header)4 StorageClusterVersionModel (org.apache.hadoop.hbase.rest.model.StorageClusterVersionModel)3 TableListModel (org.apache.hadoop.hbase.rest.model.TableListModel)3