use of org.apache.cassandra.io.util.FileSegmentInputStream in project cassandra by apache.
the class CommitLogDescriptorTest method writeAndReadHeader_WithEncryptionHeader_EncryptionDisabledInYaml.
/**
* Check that even though enabledTdeOptions is disabled in the yaml, we can still read the commit log header as encrypted.
*/
@Test
public void writeAndReadHeader_WithEncryptionHeader_EncryptionDisabledInYaml() throws IOException {
CommitLogDescriptor descriptor = new CommitLogDescriptor(CommitLogDescriptor.current_version, 1, null, enabledEncryption);
ByteBuffer buffer = ByteBuffer.allocate(16 * 1024);
CommitLogDescriptor.writeHeader(buffer, descriptor);
buffer.flip();
FileSegmentInputStream dataInput = new FileSegmentInputStream(buffer, null, 0);
CommitLogDescriptor result = CommitLogDescriptor.readHeader(dataInput, previouslyEnabledEncryption);
Assert.assertNotNull(result);
Assert.assertNull(result.compression);
Assert.assertTrue(result.getEncryptionContext().isEnabled());
Assert.assertArrayEquals(iv, result.getEncryptionContext().getIV());
}
Aggregations