singhpk234 commented on code in PR #14751:
URL: https://github.com/apache/iceberg/pull/14751#discussion_r2697233468
##########
aws/src/integration/java/org/apache/iceberg/aws/TestKeyManagementClient.java:
##########
@@ -91,13 +96,48 @@ public void testKeyWrapping() {
try (AwsKeyManagementClient keyManagementClient = new
AwsKeyManagementClient()) {
keyManagementClient.initialize(ImmutableMap.of());
- ByteBuffer key = ByteBuffer.wrap(new
String("super-secret-table-master-key").getBytes());
+ ByteBuffer key =
ByteBuffer.wrap("super-secret-table-master-key".getBytes());
ByteBuffer encryptedKey = keyManagementClient.wrapKey(key, keyId);
assertThat(keyManagementClient.unwrapKey(encryptedKey,
keyId)).isEqualTo(key);
}
}
+ @Test
+ public void testSerialization() throws Exception {
+ try (AwsKeyManagementClient keyManagementClient = new
AwsKeyManagementClient()) {
+ keyManagementClient.initialize(
+ ImmutableMap.of(
+ AwsProperties.KMS_ENCRYPTION_ALGORITHM_SPEC,
+ EncryptionAlgorithmSpec.RSAES_OAEP_SHA_256.toString(),
+ AwsProperties.KMS_DATA_KEY_SPEC,
+ DataKeySpec.AES_128.toString()));
+ assertThat(keyManagementClient.encryptionAlgorithmSpec())
+ .isEqualTo(EncryptionAlgorithmSpec.RSAES_OAEP_SHA_256);
+
assertThat(keyManagementClient.dataKeySpec()).isEqualTo(DataKeySpec.AES_128);
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ try (ObjectOutputStream writer = new ObjectOutputStream(out)) {
+ writer.writeObject(keyManagementClient);
+ }
+
+ AwsKeyManagementClient result;
+ ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
+ try (ObjectInputStream reader = new ObjectInputStream(in)) {
+ result = (AwsKeyManagementClient) reader.readObject();
+ }
Review Comment:
can we use TestHelpers class here and test both kryo and java serialization
https://github.com/apache/iceberg/blob/main/api/src/test/java/org/apache/iceberg/TestHelpers.java#L57
copy to all places.
--
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]