hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject svn commit: r1427843 - in /hbase/trunk/hbase-server/src: main/java/org/apache/hadoop/hbase/rest/ main/java/org/apache/hadoop/hbase/rest/provider/consumer/ main/java/org/apache/hadoop/hbase/rest/provider/producer/ test/java/org/apache/hadoop/hbase/rest/
Date Wed, 02 Jan 2013 16:18:31 GMT
Author: apurtell
Date: Wed Jan  2 16:18:30 2013
New Revision: 1427843

URL: http://svn.apache.org/viewvc?rev=1427843&view=rev
Log:
HBASE-7472. [REST] Support MIME type application/protobuf

Modified:
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/Constants.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/ExistsResource.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/MultiRowResource.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RegionsResource.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RootResource.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RowResource.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/ScannerInstanceResource.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/ScannerResource.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/SchemaResource.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/StorageClusterStatusResource.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/VersionResource.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/provider/consumer/ProtobufMessageBodyConsumer.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/provider/producer/ProtobufMessageBodyProducer.java
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestMultiRowResource.java
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestRowResource.java
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestScannerResource.java
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestScannersWithFilters.java
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestSchemaResource.java
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestStatusResource.java
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestTableResource.java
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestVersionResource.java

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/Constants.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/Constants.java?rev=1427843&r1=1427842&r2=1427843&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/Constants.java (original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/Constants.java Wed
Jan  2 16:18:30 2013
@@ -39,6 +39,7 @@ public interface Constants {
   public static final String MIMETYPE_XML = "text/xml";
   public static final String MIMETYPE_BINARY = "application/octet-stream";
   public static final String MIMETYPE_PROTOBUF = "application/x-protobuf";
+  public static final String MIMETYPE_PROTOBUF_IETF = "application/protobuf";
   public static final String MIMETYPE_JSON = "application/json";
 
   public static final String CRLF = "\r\n";

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/ExistsResource.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/ExistsResource.java?rev=1427843&r1=1427842&r2=1427843&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/ExistsResource.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/ExistsResource.java
Wed Jan  2 16:18:30 2013
@@ -55,7 +55,7 @@ public class ExistsResource extends Reso
 
   @GET
   @Produces({MIMETYPE_TEXT, MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF,
-    MIMETYPE_BINARY})
+    MIMETYPE_PROTOBUF_IETF, MIMETYPE_BINARY})
   public Response get(final @Context UriInfo uriInfo) {
     try {
       if (!tableResource.exists()) {

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/MultiRowResource.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/MultiRowResource.java?rev=1427843&r1=1427842&r2=1427843&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/MultiRowResource.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/MultiRowResource.java
Wed Jan  2 16:18:30 2013
@@ -60,7 +60,8 @@ public class MultiRowResource extends Re
   }
 
   @GET
-  @Produces({MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF})
+  @Produces({MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF,
+    MIMETYPE_PROTOBUF_IETF})
   public Response get(final @Context UriInfo uriInfo) {
     MultivaluedMap<String, String> params = uriInfo.getQueryParameters();
 

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RegionsResource.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RegionsResource.java?rev=1427843&r1=1427842&r2=1427843&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RegionsResource.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RegionsResource.java
Wed Jan  2 16:18:30 2013
@@ -66,7 +66,8 @@ public class RegionsResource extends Res
   }
 
   @GET
-  @Produces({MIMETYPE_TEXT, MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF})
+  @Produces({MIMETYPE_TEXT, MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF,
+    MIMETYPE_PROTOBUF_IETF})
   public Response get(final @Context UriInfo uriInfo) {
     if (LOG.isDebugEnabled()) {
       LOG.debug("GET " + uriInfo.getAbsolutePath());

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RootResource.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RootResource.java?rev=1427843&r1=1427842&r2=1427843&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RootResource.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RootResource.java
Wed Jan  2 16:18:30 2013
@@ -69,7 +69,8 @@ public class RootResource extends Resour
   }
 
   @GET
-  @Produces({MIMETYPE_TEXT, MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF})
+  @Produces({MIMETYPE_TEXT, MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF,
+    MIMETYPE_PROTOBUF_IETF})
   public Response get(final @Context UriInfo uriInfo) {
     if (LOG.isDebugEnabled()) {
       LOG.debug("GET " + uriInfo.getAbsolutePath());

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RowResource.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RowResource.java?rev=1427843&r1=1427842&r2=1427843&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RowResource.java (original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/RowResource.java Wed
Jan  2 16:18:30 2013
@@ -80,7 +80,8 @@ public class RowResource extends Resourc
   }
 
   @GET
-  @Produces({MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF})
+  @Produces({MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF,
+    MIMETYPE_PROTOBUF_IETF})
   public Response get(final @Context UriInfo uriInfo) {
     if (LOG.isDebugEnabled()) {
       LOG.debug("GET " + uriInfo.getAbsolutePath());
@@ -306,7 +307,8 @@ public class RowResource extends Resourc
   }
 
   @PUT
-  @Consumes({MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF})
+  @Consumes({MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF,
+    MIMETYPE_PROTOBUF_IETF})
   public Response put(final CellSetModel model,
       final @Context UriInfo uriInfo) {
     if (LOG.isDebugEnabled()) {
@@ -327,7 +329,8 @@ public class RowResource extends Resourc
   }
 
   @POST
-  @Consumes({MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF})
+  @Consumes({MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF,
+    MIMETYPE_PROTOBUF_IETF})
   public Response post(final CellSetModel model,
       final @Context UriInfo uriInfo) {
     if (LOG.isDebugEnabled()) {

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/ScannerInstanceResource.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/ScannerInstanceResource.java?rev=1427843&r1=1427842&r2=1427843&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/ScannerInstanceResource.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/ScannerInstanceResource.java
Wed Jan  2 16:18:30 2013
@@ -68,7 +68,8 @@ public class ScannerInstanceResource ext
   }
 
   @GET
-  @Produces({MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF})
+  @Produces({MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF,
+    MIMETYPE_PROTOBUF_IETF})
   public Response get(final @Context UriInfo uriInfo, 
       @QueryParam("n") int maxRows, final @QueryParam("c") int maxValues) {
     if (LOG.isDebugEnabled()) {

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/ScannerResource.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/ScannerResource.java?rev=1427843&r1=1427842&r2=1427843&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/ScannerResource.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/ScannerResource.java
Wed Jan  2 16:18:30 2013
@@ -120,7 +120,8 @@ public class ScannerResource extends Res
   }
 
   @PUT
-  @Consumes({MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF})
+  @Consumes({MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF,
+    MIMETYPE_PROTOBUF_IETF})
   public Response put(final ScannerModel model, 
       final @Context UriInfo uriInfo) {
     if (LOG.isDebugEnabled()) {
@@ -130,7 +131,8 @@ public class ScannerResource extends Res
   }
 
   @POST
-  @Consumes({MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF})
+  @Consumes({MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF,
+    MIMETYPE_PROTOBUF_IETF})
   public Response post(final ScannerModel model,
       final @Context UriInfo uriInfo) {
     if (LOG.isDebugEnabled()) {

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/SchemaResource.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/SchemaResource.java?rev=1427843&r1=1427842&r2=1427843&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/SchemaResource.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/SchemaResource.java
Wed Jan  2 16:18:30 2013
@@ -86,7 +86,8 @@ public class SchemaResource extends Reso
   }
 
   @GET
-  @Produces({MIMETYPE_TEXT, MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF})
+  @Produces({MIMETYPE_TEXT, MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF,
+    MIMETYPE_PROTOBUF_IETF})
   public Response get(final @Context UriInfo uriInfo) {
     if (LOG.isDebugEnabled()) {
       LOG.debug("GET " + uriInfo.getAbsolutePath());
@@ -209,7 +210,8 @@ public class SchemaResource extends Reso
   }
 
   @PUT
-  @Consumes({MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF})
+  @Consumes({MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF,
+    MIMETYPE_PROTOBUF_IETF})
   public Response put(final TableSchemaModel model, 
       final @Context UriInfo uriInfo) {
     if (LOG.isDebugEnabled()) {
@@ -220,7 +222,8 @@ public class SchemaResource extends Reso
   }
 
   @POST
-  @Consumes({MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF})
+  @Consumes({MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF,
+    MIMETYPE_PROTOBUF_IETF})
   public Response post(final TableSchemaModel model, 
       final @Context UriInfo uriInfo) {
     if (LOG.isDebugEnabled()) {

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/StorageClusterStatusResource.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/StorageClusterStatusResource.java?rev=1427843&r1=1427842&r2=1427843&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/StorageClusterStatusResource.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/StorageClusterStatusResource.java
Wed Jan  2 16:18:30 2013
@@ -60,7 +60,8 @@ public class StorageClusterStatusResourc
   }
 
   @GET
-  @Produces({MIMETYPE_TEXT, MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF})
+  @Produces({MIMETYPE_TEXT, MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF,
+    MIMETYPE_PROTOBUF_IETF})
   public Response get(final @Context UriInfo uriInfo) {
     if (LOG.isDebugEnabled()) {
       LOG.debug("GET " + uriInfo.getAbsolutePath());

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/VersionResource.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/VersionResource.java?rev=1427843&r1=1427842&r2=1427843&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/VersionResource.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/VersionResource.java
Wed Jan  2 16:18:30 2013
@@ -71,7 +71,8 @@ public class VersionResource extends Res
    * @return a response for a version request 
    */
   @GET
-  @Produces({MIMETYPE_TEXT, MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF})
+  @Produces({MIMETYPE_TEXT, MIMETYPE_XML, MIMETYPE_JSON, MIMETYPE_PROTOBUF,
+    MIMETYPE_PROTOBUF_IETF})
   public Response get(final @Context ServletContext context, 
       final @Context UriInfo uriInfo) {
     if (LOG.isDebugEnabled()) {

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/provider/consumer/ProtobufMessageBodyConsumer.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/provider/consumer/ProtobufMessageBodyConsumer.java?rev=1427843&r1=1427842&r2=1427843&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/provider/consumer/ProtobufMessageBodyConsumer.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/provider/consumer/ProtobufMessageBodyConsumer.java
Wed Jan  2 16:18:30 2013
@@ -43,7 +43,7 @@ import org.apache.hadoop.hbase.rest.Prot
  * ProtobufMessageHandler interface capable handlers for decoding protobuf input.
  */
 @Provider
-@Consumes(Constants.MIMETYPE_PROTOBUF)
+@Consumes({Constants.MIMETYPE_PROTOBUF, Constants.MIMETYPE_PROTOBUF_IETF})
 @InterfaceAudience.Private
 public class ProtobufMessageBodyConsumer 
     implements MessageBodyReader<ProtobufMessageHandler> {

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/provider/producer/ProtobufMessageBodyProducer.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/provider/producer/ProtobufMessageBodyProducer.java?rev=1427843&r1=1427842&r2=1427843&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/provider/producer/ProtobufMessageBodyProducer.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/rest/provider/producer/ProtobufMessageBodyProducer.java
Wed Jan  2 16:18:30 2013
@@ -43,7 +43,7 @@ import org.apache.hadoop.hbase.rest.Prot
  * sent, then writeTo to perform the actual I/O.
  */
 @Provider
-@Produces(Constants.MIMETYPE_PROTOBUF)
+@Produces({Constants.MIMETYPE_PROTOBUF, Constants.MIMETYPE_PROTOBUF_IETF})
 @InterfaceAudience.Private
 public class ProtobufMessageBodyProducer
   implements MessageBodyWriter<ProtobufMessageHandler> {

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestMultiRowResource.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestMultiRowResource.java?rev=1427843&r1=1427842&r2=1427843&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestMultiRowResource.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestMultiRowResource.java
Wed Jan  2 16:18:30 2013
@@ -116,6 +116,7 @@ public class TestMultiRowResource {
 
     Response response = client.get(path.toString(), Constants.MIMETYPE_JSON);
     assertEquals(response.getCode(), 200);
+    assertEquals(Constants.MIMETYPE_JSON, response.getHeader("content-type"));
 
     client.delete(row_5_url);
     client.delete(row_6_url);
@@ -142,6 +143,7 @@ public class TestMultiRowResource {
 
     Response response = client.get(path.toString(), Constants.MIMETYPE_XML);
     assertEquals(response.getCode(), 200);
+    assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
 
     client.delete(row_5_url);
     client.delete(row_6_url);

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestRowResource.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestRowResource.java?rev=1427843&r1=1427842&r2=1427843&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestRowResource.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestRowResource.java
Wed Jan  2 16:18:30 2013
@@ -210,6 +210,7 @@ public class TestRowResource {
       String value) throws IOException, JAXBException {
     Response response = getValueXML(table, row, column);
     assertEquals(response.getCode(), 200);
+    assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
     CellSetModel cellSet = (CellSetModel)
       unmarshaller.unmarshal(new ByteArrayInputStream(response.getBody()));
     RowModel rowModel = cellSet.getRows().get(0);
@@ -222,6 +223,7 @@ public class TestRowResource {
       String column, String value) throws IOException, JAXBException {
     Response response = getValueXML(url);
     assertEquals(response.getCode(), 200);
+    assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
     CellSetModel cellSet = (CellSetModel)
       unmarshaller.unmarshal(new ByteArrayInputStream(response.getBody()));
     RowModel rowModel = cellSet.getRows().get(0);
@@ -259,6 +261,7 @@ public class TestRowResource {
       String value) throws IOException {
     Response response = getValuePB(table, row, column);
     assertEquals(response.getCode(), 200);
+    assertEquals(Constants.MIMETYPE_PROTOBUF, response.getHeader("content-type"));
     CellSetModel cellSet = new CellSetModel();
     cellSet.getObjectFromMessage(response.getBody());
     RowModel rowModel = cellSet.getRows().get(0);
@@ -501,6 +504,7 @@ public class TestRowResource {
 
     response = client.get(path, Constants.MIMETYPE_BINARY);
     assertEquals(response.getCode(), 200);
+    assertEquals(Constants.MIMETYPE_BINARY, response.getHeader("content-type"));
     assertTrue(Bytes.equals(response.getBody(), body));
     boolean foundTimestampHeader = false;
     for (Header header: response.getHeaders()) {
@@ -524,6 +528,7 @@ public class TestRowResource {
     Thread.yield();
     response = client.get(path, Constants.MIMETYPE_JSON);
     assertEquals(response.getCode(), 200);
+    assertEquals(Constants.MIMETYPE_JSON, response.getHeader("content-type"));
     response = deleteRow(TABLE, ROW_4);
     assertEquals(response.getCode(), 200);
   }
@@ -537,6 +542,7 @@ public class TestRowResource {
     Thread.yield();
     response = client.get(path, Constants.MIMETYPE_JSON);
     assertEquals(response.getCode(), 200);
+    assertEquals(Constants.MIMETYPE_JSON, response.getHeader("content-type"));
     response = deleteRow(TABLE, ROW_4);
     assertEquals(response.getCode(), 200);
 

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestScannerResource.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestScannerResource.java?rev=1427843&r1=1427842&r2=1427843&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestScannerResource.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestScannerResource.java
Wed Jan  2 16:18:30 2013
@@ -46,6 +46,7 @@ import org.apache.hadoop.hbase.rest.mode
 import org.apache.hadoop.hbase.util.Bytes;
 
 import static org.junit.Assert.*;
+
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -124,6 +125,7 @@ public class TestScannerResource {
       response = client.get(scannerURI, Constants.MIMETYPE_PROTOBUF);
       assertTrue(response.getCode() == 200 || response.getCode() == 204);
       if (response.getCode() == 200) {
+        assertEquals(Constants.MIMETYPE_PROTOBUF, response.getHeader("content-type"));
         CellSetModel cellSet = new CellSetModel();
         cellSet.getObjectFromMessage(response.getBody());
         Iterator<RowModel> rows = cellSet.getRows().iterator();
@@ -207,6 +209,7 @@ public class TestScannerResource {
     // get a cell set
     response = client.get(scannerURI, Constants.MIMETYPE_XML);
     assertEquals(response.getCode(), 200);
+    assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
     CellSetModel cellSet = (CellSetModel)
       unmarshaller.unmarshal(new ByteArrayInputStream(response.getBody()));
     // confirm batch size conformance
@@ -250,6 +253,7 @@ public class TestScannerResource {
     // get a cell set
     response = client.get(scannerURI, Constants.MIMETYPE_PROTOBUF);
     assertEquals(response.getCode(), 200);
+    assertEquals(Constants.MIMETYPE_PROTOBUF, response.getHeader("content-type"));
     CellSetModel cellSet = new CellSetModel();
     cellSet.getObjectFromMessage(response.getBody());
     // confirm batch size conformance
@@ -292,6 +296,7 @@ public class TestScannerResource {
     // get a cell
     response = client.get(scannerURI, Constants.MIMETYPE_BINARY);
     assertEquals(response.getCode(), 200);
+    assertEquals(Constants.MIMETYPE_BINARY, response.getHeader("content-type"));
     // verify that data was returned
     assertTrue(response.getBody().length > 0);
     // verify that the expected X-headers are present

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestScannersWithFilters.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestScannersWithFilters.java?rev=1427843&r1=1427842&r2=1427843&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestScannersWithFilters.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestScannersWithFilters.java
Wed Jan  2 16:18:30 2013
@@ -63,6 +63,7 @@ import org.apache.hadoop.hbase.rest.mode
 import org.apache.hadoop.hbase.util.Bytes;
 
 import static org.junit.Assert.*;
+
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -216,7 +217,7 @@ public class TestScannersWithFilters {
     marshaller.marshal(model, writer);
     LOG.debug(writer.toString());
     byte[] body = Bytes.toBytes(writer.toString());
-    Response response = client.put("/" + TABLE + "/scanner", 
+    Response response = client.put("/" + TABLE + "/scanner",
       Constants.MIMETYPE_XML, body);
     assertEquals(response.getCode(), 201);
     String scannerURI = response.getLocation();
@@ -225,6 +226,7 @@ public class TestScannersWithFilters {
     // get a cell set
     response = client.get(scannerURI, Constants.MIMETYPE_XML);
     assertEquals(response.getCode(), 200);
+    assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
     CellSetModel cells = (CellSetModel)
       unmarshaller.unmarshal(new ByteArrayInputStream(response.getBody()));
 
@@ -250,7 +252,7 @@ public class TestScannersWithFilters {
     marshaller.marshal(model, writer);
     LOG.debug(writer.toString());
     byte[] body = Bytes.toBytes(writer.toString());
-    Response response = client.put("/" + TABLE + "/scanner", 
+    Response response = client.put("/" + TABLE + "/scanner",
       Constants.MIMETYPE_XML, body);
     assertEquals(response.getCode(), 201);
     String scannerURI = response.getLocation();
@@ -259,6 +261,7 @@ public class TestScannersWithFilters {
     // get a cell set
     response = client.get(scannerURI, Constants.MIMETYPE_XML);
     assertEquals(response.getCode(), 200);
+    assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
     CellSetModel cellSet = (CellSetModel)
       unmarshaller.unmarshal(new ByteArrayInputStream(response.getBody()));
 
@@ -312,6 +315,7 @@ public class TestScannersWithFilters {
     // get a cell set
     response = client.get(scannerURI, Constants.MIMETYPE_XML);
     assertEquals(response.getCode(), 200);
+    assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
     CellSetModel cellSet = (CellSetModel)
       unmarshaller.unmarshal(new ByteArrayInputStream(response.getBody()));
 

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestSchemaResource.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestSchemaResource.java?rev=1427843&r1=1427842&r2=1427843&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestSchemaResource.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestSchemaResource.java
Wed Jan  2 16:18:30 2013
@@ -39,6 +39,7 @@ import org.apache.hadoop.hbase.rest.mode
 import org.apache.hadoop.hbase.util.Bytes;
 
 import static org.junit.Assert.*;
+
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -109,6 +110,7 @@ public class TestSchemaResource {
     // retrieve the schema and validate it
     response = client.get(schemaPath, Constants.MIMETYPE_XML);
     assertEquals(response.getCode(), 200);
+    assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
     model = fromXML(response.getBody());
     TestTableSchemaModel.checkModel(model, TABLE1);
 
@@ -147,6 +149,15 @@ public class TestSchemaResource {
     // 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);

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestStatusResource.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestStatusResource.java?rev=1427843&r1=1427842&r2=1427843&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestStatusResource.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestStatusResource.java
Wed Jan  2 16:18:30 2013
@@ -34,6 +34,7 @@ import org.apache.hadoop.hbase.rest.mode
 import org.apache.hadoop.hbase.util.Bytes;
 
 import static org.junit.Assert.*;
+
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -94,6 +95,7 @@ public class TestStatusResource {
   public void testGetClusterStatusXML() throws IOException, JAXBException {
     Response response = client.get("/status/cluster", Constants.MIMETYPE_XML);
     assertEquals(response.getCode(), 200);
+    assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
     StorageClusterStatusModel model = (StorageClusterStatusModel)
       context.createUnmarshaller().unmarshal(
         new ByteArrayInputStream(response.getBody()));
@@ -102,13 +104,17 @@ public class TestStatusResource {
 
   @Test
   public void testGetClusterStatusPB() throws IOException {
-    Response response = client.get("/status/cluster", 
-      Constants.MIMETYPE_PROTOBUF);
+    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);
   }
-
 }
-

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestTableResource.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestTableResource.java?rev=1427843&r1=1427842&r2=1427843&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestTableResource.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestTableResource.java
Wed Jan  2 16:18:30 2013
@@ -45,6 +45,7 @@ import org.apache.hadoop.hbase.util.Byte
 import org.apache.hadoop.util.StringUtils;
 
 import static org.junit.Assert.*;
+
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -178,12 +179,14 @@ public class TestTableResource {
   public void testTableListText() throws IOException {
     Response response = client.get("/", Constants.MIMETYPE_TEXT);
     assertEquals(response.getCode(), 200);
+    assertEquals(Constants.MIMETYPE_TEXT, response.getHeader("content-type"));
   }
 
   @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()));
@@ -194,29 +197,37 @@ public class TestTableResource {
   public void testTableListJSON() throws IOException {
     Response response = client.get("/", Constants.MIMETYPE_JSON);
     assertEquals(response.getCode(), 200);
+    assertEquals(Constants.MIMETYPE_JSON, response.getHeader("content-type"));
   }
 
   @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);
   }
 
   @Test
   public void testTableInfoText() throws IOException {
-    Response response = client.get("/" + TABLE + "/regions",
-      Constants.MIMETYPE_TEXT);
+    Response response = client.get("/" + TABLE + "/regions", Constants.MIMETYPE_TEXT);
     assertEquals(response.getCode(), 200);
+    assertEquals(Constants.MIMETYPE_TEXT, response.getHeader("content-type"));
   }
 
   @Test
   public void testTableInfoXML() throws IOException, JAXBException {
-    Response response = client.get("/" + TABLE + "/regions", 
-      Constants.MIMETYPE_XML);
+    Response response = client.get("/" + TABLE + "/regions",  Constants.MIMETYPE_XML);
     assertEquals(response.getCode(), 200);
+    assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
     TableInfoModel model = (TableInfoModel)
       context.createUnmarshaller()
         .unmarshal(new ByteArrayInputStream(response.getBody()));
@@ -225,19 +236,25 @@ public class TestTableResource {
 
   @Test
   public void testTableInfoJSON() throws IOException {
-    Response response = client.get("/" + TABLE + "/regions", 
-      Constants.MIMETYPE_JSON);
+    Response response = client.get("/" + TABLE + "/regions", Constants.MIMETYPE_JSON);
     assertEquals(response.getCode(), 200);
+    assertEquals(Constants.MIMETYPE_JSON, response.getHeader("content-type"));
   }
 
   @Test
   public void testTableInfoPB() throws IOException, JAXBException {
-    Response response = client.get("/" + TABLE + "/regions",
-      Constants.MIMETYPE_PROTOBUF);
+    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);
   }
 
 }

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestVersionResource.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestVersionResource.java?rev=1427843&r1=1427842&r2=1427843&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestVersionResource.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestVersionResource.java
Wed Jan  2 16:18:30 2013
@@ -37,6 +37,7 @@ import org.apache.hadoop.hbase.rest.mode
 import org.apache.hadoop.hbase.util.Bytes;
 
 import static org.junit.Assert.*;
+
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -96,6 +97,7 @@ public class TestVersionResource {
   public void testGetStargateVersionText() throws IOException {
     Response response = client.get("/version", Constants.MIMETYPE_TEXT);
     assertTrue(response.getCode() == 200);
+    assertEquals(Constants.MIMETYPE_TEXT, response.getHeader("content-type"));
     String body = Bytes.toString(response.getBody());
     assertTrue(body.length() > 0);
     assertTrue(body.contains(RESTServlet.VERSION_STRING));
@@ -113,6 +115,7 @@ public class TestVersionResource {
   public void testGetStargateVersionXML() throws IOException, JAXBException {
     Response response = client.get("/version", Constants.MIMETYPE_XML);
     assertTrue(response.getCode() == 200);
+    assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
     VersionModel model = (VersionModel)
       context.createUnmarshaller().unmarshal(
         new ByteArrayInputStream(response.getBody()));
@@ -124,23 +127,30 @@ public class TestVersionResource {
   public void testGetStargateVersionJSON() throws IOException {
     Response response = client.get("/version", Constants.MIMETYPE_JSON);
     assertTrue(response.getCode() == 200);
+    assertEquals(Constants.MIMETYPE_JSON, response.getHeader("content-type"));
   }
 
   @Test
   public void testGetStargateVersionPB() throws IOException {
     Response response = client.get("/version", Constants.MIMETYPE_PROTOBUF);
     assertTrue(response.getCode() == 200);
+    assertEquals(Constants.MIMETYPE_PROTOBUF, response.getHeader("content-type"));
     VersionModel model = new VersionModel();
     model.getObjectFromMessage(response.getBody());
     validate(model);
-    LOG.info("success retrieving Stargate version as protobuf");
+    response = client.get("/version", Constants.MIMETYPE_PROTOBUF_IETF);
+    assertTrue(response.getCode() == 200);
+    assertEquals(Constants.MIMETYPE_PROTOBUF_IETF, response.getHeader("content-type"));
+    model = new VersionModel();
+    model.getObjectFromMessage(response.getBody());
+    validate(model);
   }
 
   @Test
   public void testGetStorageClusterVersionText() throws IOException {
-    Response response = client.get("/version/cluster", 
-      Constants.MIMETYPE_TEXT);
+    Response response = client.get("/version/cluster", Constants.MIMETYPE_TEXT);
     assertTrue(response.getCode() == 200);
+    assertEquals(Constants.MIMETYPE_TEXT, response.getHeader("content-type"));
   }
 
   @Test
@@ -148,6 +158,7 @@ public class TestVersionResource {
       JAXBException {
     Response response = client.get("/version/cluster",Constants.MIMETYPE_XML);
     assertTrue(response.getCode() == 200);
+    assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
     StorageClusterVersionModel clusterVersionModel = 
       (StorageClusterVersionModel)
         context.createUnmarshaller().unmarshal(
@@ -161,6 +172,7 @@ public class TestVersionResource {
   public void doTestGetStorageClusterVersionJSON() throws IOException {
     Response response = client.get("/version/cluster", Constants.MIMETYPE_JSON);
     assertTrue(response.getCode() == 200);
+    assertEquals(Constants.MIMETYPE_JSON, response.getHeader("content-type"));
   }
 
 }



Mime
View raw message