use of com.sequenceiq.freeipa.entity.Template in project cloudbreak by hortonworks.
the class InstanceTemplateRequestToTemplateConverterTest method shouldSetEncryptionKeyAndEncryptionMethodPropertyWhenCustomAwsEncryptionKeyPresent.
@Test
void shouldSetEncryptionKeyAndEncryptionMethodPropertyWhenCustomAwsEncryptionKeyPresent() {
InstanceTemplateRequest source = new InstanceTemplateRequest();
source.setInstanceType(INSTANCE_TYPE);
Template result = underTest.convert(source, CloudPlatform.AWS, ACCOUNT_ID, null, null, "dummyAwsEncryptionKeyArn");
Json attributes = result.getAttributes();
assertThat(attributes).isNotNull();
assertThat(attributes.<Object>getValue(GcpInstanceTemplate.VOLUME_ENCRYPTION_KEY_ID)).isEqualTo("dummyAwsEncryptionKeyArn");
assertThat(attributes.<Object>getValue(InstanceTemplate.VOLUME_ENCRYPTION_KEY_TYPE)).isEqualTo(EncryptionType.CUSTOM.name());
}
use of com.sequenceiq.freeipa.entity.Template in project cloudbreak by hortonworks.
the class InstanceTemplateRequestToTemplateConverterTest method shouldSetSpotPercentagePropertyWhenProvided.
@Test
void shouldSetSpotPercentagePropertyWhenProvided() {
InstanceTemplateRequest source = new InstanceTemplateRequest();
source.setInstanceType(INSTANCE_TYPE);
source.setAws(createAwsInstanceTemplateParameters(SPOT_PERCENTAGE, SPOT_MAX_PRICE));
Template result = underTest.convert(source, CLOUD_PLATFORM, ACCOUNT_ID, null, null, null);
Json attributes = result.getAttributes();
assertThat(attributes).isNotNull();
assertThat(attributes.<Object>getValue(AwsInstanceTemplate.EC2_SPOT_PERCENTAGE)).isEqualTo(SPOT_PERCENTAGE);
assertThat(attributes.<Object>getValue(AwsInstanceTemplate.EC2_SPOT_MAX_PRICE)).isEqualTo(SPOT_MAX_PRICE);
}
use of com.sequenceiq.freeipa.entity.Template in project cloudbreak by hortonworks.
the class InstanceTemplateRequestToTemplateConverterTest method shouldNotSetVolumeEncryptionWhenAzure.
@Test
void shouldNotSetVolumeEncryptionWhenAzure() {
InstanceTemplateRequest source = new InstanceTemplateRequest();
source.setInstanceType(INSTANCE_TYPE);
Template result = underTest.convert(source, CloudPlatform.AZURE, ACCOUNT_ID, null, null, null);
Json attributes = result.getAttributes();
assertThat(attributes).isNotNull();
assertThat(attributes.<Object>getValue(AwsInstanceTemplate.EBS_ENCRYPTION_ENABLED)).isNull();
assertThat(attributes.<Object>getValue(InstanceTemplate.VOLUME_ENCRYPTION_KEY_TYPE)).isNull();
}
use of com.sequenceiq.freeipa.entity.Template in project cloudbreak by hortonworks.
the class InstanceTemplateRequestToTemplateConverterTest method shouldSetAccoundIdWhenProvided.
@Test
void shouldSetAccoundIdWhenProvided() {
InstanceTemplateRequest source = new InstanceTemplateRequest();
source.setInstanceType(INSTANCE_TYPE);
Template result = underTest.convert(source, CLOUD_PLATFORM, ACCOUNT_ID, null, null, null);
assertThat(result.getAccountId()).isEqualTo(ACCOUNT_ID);
}
use of com.sequenceiq.freeipa.entity.Template in project cloudbreak by hortonworks.
the class DefaultInstanceGroupProviderTest method createDefaultTemplateTestVolumeEncryptionAddedWhenGcp.
@Test
void createDefaultTemplateTestVolumeEncryptionAddedWhenGcp() {
Template result = underTest.createDefaultTemplate(CloudPlatform.GCP, ACCOUNT_ID, null, "dummyEncryptionKey", null);
assertThat(result).isNotNull();
Json attributes = result.getAttributes();
assertThat(attributes).isNotNull();
assertThat(attributes.<Object>getValue(AzureInstanceTemplate.VOLUME_ENCRYPTION_KEY_ID)).isEqualTo("dummyEncryptionKey");
assertThat(attributes.<Object>getValue("keyEncryptionMethod")).isEqualTo("KMS");
}
Aggregations