use of com.github.ambry.config.KMSConfig in project ambry by linkedin.
the class CryptoJobHandlerTest method testDecryptionFailure.
/**
* Tests {@link CryptoJobHandler} for failures during decryption
* @throws InterruptedException
* @throws GeneralSecurityException
*/
@Test
public void testDecryptionFailure() throws InterruptedException, GeneralSecurityException {
cryptoJobHandler.close();
MockCryptoService mockCryptoService = new MockCryptoService(new CryptoServiceConfig(verifiableProperties));
mockCryptoService.exceptionOnDecryption.set(new GeneralSecurityException("Exception to test", new IllegalStateException()));
cryptoJobHandler = new CryptoJobHandler(DEFAULT_THREAD_COUNT);
SecretKeySpec perBlobSecretKey = kms.getRandomKey();
testFailureOnDecryption(perBlobSecretKey, null, false, mockCryptoService, kms);
mockCryptoService.clearStates();
cryptoJobHandler.close();
MockKeyManagementService mockKms = new MockKeyManagementService(new KMSConfig(verifiableProperties), defaultKey);
cryptoJobHandler = new CryptoJobHandler(DEFAULT_THREAD_COUNT);
testFailureOnDecryption(perBlobSecretKey, mockKms, true, cryptoService, mockKms);
}
Aggregations