Search in sources :

Example 1 with BytesValue

use of org.apache.hbase.thirdparty.com.google.protobuf.BytesValue in project hbase by apache.

the class TestProtobufUtil method testProcedureInfo.

@Test
public void testProcedureInfo() {
    ProcedureProtos.Procedure.Builder builder = createProcedureBuilder(1);
    ByteString stateBytes = ByteString.copyFrom(new byte[] { 65 });
    BytesValue state = BytesValue.newBuilder().setValue(stateBytes).build();
    builder.addStateMessage(Any.pack(state));
    ProcedureProtos.Procedure procedure = builder.build();
    String procJson = ProtobufUtil.toProcedureJson(Lists.newArrayList(procedure));
    assertEquals("[{" + "\"className\":\"java.lang.Object\"," + "\"procId\":\"1\"," + "\"submittedTime\":\"0\"," + "\"state\":\"RUNNABLE\"," + "\"lastUpdate\":\"0\"," + "\"stateMessage\":[{\"value\":\"QQ==\"}]" + "}]", procJson);
}
Also used : ByteString(org.apache.hbase.thirdparty.com.google.protobuf.ByteString) BytesValue(org.apache.hbase.thirdparty.com.google.protobuf.BytesValue) ByteString(org.apache.hbase.thirdparty.com.google.protobuf.ByteString) ProcedureProtos(org.apache.hadoop.hbase.shaded.protobuf.generated.ProcedureProtos) Test(org.junit.Test)

Aggregations

ProcedureProtos (org.apache.hadoop.hbase.shaded.protobuf.generated.ProcedureProtos)1 ByteString (org.apache.hbase.thirdparty.com.google.protobuf.ByteString)1 BytesValue (org.apache.hbase.thirdparty.com.google.protobuf.BytesValue)1 Test (org.junit.Test)1