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);
}
Aggregations