use of com.microsoft.azure.management.compute.Encryption in project cloudbreak by hortonworks.
the class AzureClient method setupDiskEncryptionWithDesIfNeeded.
@VisibleForTesting
void setupDiskEncryptionWithDesIfNeeded(String diskEncryptionSetId, Disk.DefinitionStages.WithCreate withCreate) {
if (!Strings.isNullOrEmpty(diskEncryptionSetId)) {
// This is nasty. The DES setter is not exposed in WithCreate, so have to rely on the direct tweaking of the underlying DiskInner.
Encryption encryption = new Encryption();
encryption.withDiskEncryptionSetId(diskEncryptionSetId);
// WithCreate is actually a DiskImpl instance, but that type is not visible.
DiskInner inner = (DiskInner) ((IndexableRefreshableWrapperImpl) withCreate).inner();
inner.withEncryption(encryption);
}
}
use of com.microsoft.azure.management.compute.Encryption in project cloudbreak by hortonworks.
the class AzureClientTest method setupDiskEncryptionWithDesIfNeededTestWhenDesGiven.
@Test
void setupDiskEncryptionWithDesIfNeededTestWhenDesGiven() {
when(withCreateIndexableRefreshableWrapperImpl.inner()).thenReturn(diskInner);
underTest.setupDiskEncryptionWithDesIfNeeded(DISK_ENCRYPTION_SET_ID, (Disk.DefinitionStages.WithCreate) withCreateIndexableRefreshableWrapperImpl);
verify(diskInner).withEncryption(encryptionCaptor.capture());
Encryption encryption = encryptionCaptor.getValue();
assertThat(encryption).isNotNull();
assertThat(encryption.diskEncryptionSetId()).isEqualTo(DISK_ENCRYPTION_SET_ID);
}
Aggregations