Search in sources :

Example 1 with ByteStringConversion

use of org.apache.hadoop.hdds.scm.ByteStringConversion in project ozone by apache.

the class TestContainerUtils method redactsDataBuffers.

@Test
public void redactsDataBuffers() {
    // GIVEN
    ContainerCommandRequestProto req = getDummyCommandRequestProto(ReadChunk);
    ChunkBuffer data = ChunkBuffer.wrap(ByteBuffer.wrap("junk".getBytes(UTF_8)));
    ContainerCommandResponseProto resp = getReadChunkResponse(req, data, ByteStringConversion::safeWrap);
    // WHEN
    ContainerCommandResponseProto processed = processForDebug(resp);
    // THEN
    ContainerProtos.DataBuffers dataBuffers = processed.getReadChunk().getDataBuffers();
    assertEquals(1, dataBuffers.getBuffersCount());
    assertEquals("<redacted>", dataBuffers.getBuffers(0).toString(UTF_8));
}
Also used : ContainerProtos(org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos) ByteStringConversion(org.apache.hadoop.hdds.scm.ByteStringConversion) ContainerCommandRequestProto(org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.ContainerCommandRequestProto) ChunkBuffer(org.apache.hadoop.ozone.common.ChunkBuffer) ContainerCommandResponseProto(org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.ContainerCommandResponseProto) Test(org.junit.Test)

Aggregations

ContainerProtos (org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos)1 ContainerCommandRequestProto (org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.ContainerCommandRequestProto)1 ContainerCommandResponseProto (org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.ContainerCommandResponseProto)1 ByteStringConversion (org.apache.hadoop.hdds.scm.ByteStringConversion)1 ChunkBuffer (org.apache.hadoop.ozone.common.ChunkBuffer)1 Test (org.junit.Test)1