jojochuang commented on code in PR #3581:
URL: https://github.com/apache/ozone/pull/3581#discussion_r924982711
##########
hadoop-ozone/client/src/test/java/org/apache/hadoop/ozone/client/checksum/TestReplicatedBlockChecksumComputer.java:
##########
@@ -35,34 +41,60 @@
public class TestReplicatedBlockChecksumComputer {
@Test
public void testComputeMd5Crc() throws IOException {
- final int lenOfZeroBytes = 32;
- byte[] emptyChunkChecksum = new byte[lenOfZeroBytes];
- MD5Hash emptyBlockMD5 = MD5Hash.digest(emptyChunkChecksum);
+ final int lenOfBytes = 32;
+ byte[] randomChunkChecksum = new byte[lenOfBytes];
+ Random r = new Random();
+ r.nextBytes(randomChunkChecksum);
+ MD5Hash emptyBlockMD5 = MD5Hash.digest(randomChunkChecksum);
byte[] emptyBlockMD5Hash = emptyBlockMD5.getDigest();
+ AbstractBlockChecksumComputer computer =
+ buildBlockChecksumComputer(randomChunkChecksum,
+ lenOfBytes, ContainerProtos.ChecksumType.CRC32);
+ computer.compute(MD5MD5CRC);
+ ByteBuffer output = computer.getOutByteBuffer();
+ assertArrayEquals(emptyBlockMD5Hash, output.array());
+ }
+
+ @Test
+ public void testComputeCompositeCrc() throws IOException {
+ final int lenOfBytes = 32;
+ byte[] randomChunkChecksum = new byte[lenOfBytes];
+ Random r = new Random();
+ r.nextBytes(randomChunkChecksum);
+
+ CrcComposer crcComposer =
+ CrcComposer.newCrcComposer(DataChecksum.Type.CRC32C, 4);
Review Comment:
TODO add CRC32 later.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]