Search in sources :

Example 41 with Template

use of com.sequenceiq.freeipa.entity.Template in project cloudbreak by hortonworks.

the class DefaultInstanceGroupProviderTest method createDefaultTemplateTestDefaultVolumeEncryptionAddedWhenAwsCustomEncryptionKeyIsAbsent.

@Test
void createDefaultTemplateTestDefaultVolumeEncryptionAddedWhenAwsCustomEncryptionKeyIsAbsent() {
    Template result = underTest.createDefaultTemplate(CloudPlatform.AWS, ACCOUNT_ID, null, null, null);
    assertThat(result).isNotNull();
    Json attributes = result.getAttributes();
    assertThat(attributes).isNotNull();
    assertThat(attributes.<Object>getValue(AwsInstanceTemplate.EBS_ENCRYPTION_ENABLED)).isEqualTo(Boolean.TRUE);
    assertThat(attributes.<Object>getValue(InstanceTemplate.VOLUME_ENCRYPTION_KEY_TYPE)).isEqualTo(EncryptionType.DEFAULT.name());
}
Also used : JSONObject(net.sf.json.JSONObject) Json(com.sequenceiq.cloudbreak.common.json.Json) Template(com.sequenceiq.freeipa.entity.Template) InstanceTemplate(com.sequenceiq.cloudbreak.cloud.model.InstanceTemplate) AzureInstanceTemplate(com.sequenceiq.cloudbreak.cloud.model.instance.AzureInstanceTemplate) AwsInstanceTemplate(com.sequenceiq.cloudbreak.cloud.model.instance.AwsInstanceTemplate) Test(org.junit.jupiter.api.Test)

Example 42 with Template

use of com.sequenceiq.freeipa.entity.Template in project cloudbreak by hortonworks.

the class DefaultInstanceGroupProviderTest method createDefaultTemplateTestCustomVolumeEncryptionWhenEncryptionIsPresent.

@Test
void createDefaultTemplateTestCustomVolumeEncryptionWhenEncryptionIsPresent() {
    Template result = underTest.createDefaultTemplate(CloudPlatform.AWS, ACCOUNT_ID, null, null, "dummyAwsEncryptionKey");
    assertThat(result).isNotNull();
    Json attributes = result.getAttributes();
    assertThat(attributes).isNotNull();
    assertThat(attributes.<Object>getValue(AwsInstanceTemplate.EBS_ENCRYPTION_ENABLED)).isEqualTo(Boolean.TRUE);
    assertThat(attributes.<Object>getValue(InstanceTemplate.VOLUME_ENCRYPTION_KEY_TYPE)).isEqualTo(EncryptionType.CUSTOM.name());
}
Also used : JSONObject(net.sf.json.JSONObject) Json(com.sequenceiq.cloudbreak.common.json.Json) Template(com.sequenceiq.freeipa.entity.Template) InstanceTemplate(com.sequenceiq.cloudbreak.cloud.model.InstanceTemplate) AzureInstanceTemplate(com.sequenceiq.cloudbreak.cloud.model.instance.AzureInstanceTemplate) AwsInstanceTemplate(com.sequenceiq.cloudbreak.cloud.model.instance.AwsInstanceTemplate) Test(org.junit.jupiter.api.Test)

Example 43 with Template

use of com.sequenceiq.freeipa.entity.Template in project cloudbreak by hortonworks.

the class DefaultInstanceGroupProviderTest method createDefaultTemplateTestNoVolumeEncryptionWhenAzure.

@Test
void createDefaultTemplateTestNoVolumeEncryptionWhenAzure() {
    Template result = underTest.createDefaultTemplate(CloudPlatform.AZURE, ACCOUNT_ID, null, null, null);
    assertThat(result).isNotNull();
    assertThat(result.getAttributes()).isNull();
}
Also used : Template(com.sequenceiq.freeipa.entity.Template) InstanceTemplate(com.sequenceiq.cloudbreak.cloud.model.InstanceTemplate) AzureInstanceTemplate(com.sequenceiq.cloudbreak.cloud.model.instance.AzureInstanceTemplate) AwsInstanceTemplate(com.sequenceiq.cloudbreak.cloud.model.instance.AwsInstanceTemplate) Test(org.junit.jupiter.api.Test)

Example 44 with Template

use of com.sequenceiq.freeipa.entity.Template in project cloudbreak by hortonworks.

the class DefaultInstanceGroupProviderTest method createDefaultTemplateTestVolumeEncryptionAddedWhenAzure.

@Test
void createDefaultTemplateTestVolumeEncryptionAddedWhenAzure() {
    Template result = underTest.createDefaultTemplate(CloudPlatform.AZURE, ACCOUNT_ID, "dummyDiskEncryptionSet", null, null);
    assertThat(result).isNotNull();
    Json attributes = result.getAttributes();
    assertThat(attributes).isNotNull();
    assertThat(attributes.<Object>getValue(AzureInstanceTemplate.DISK_ENCRYPTION_SET_ID)).isEqualTo("dummyDiskEncryptionSet");
    assertThat(attributes.<Object>getValue(AzureInstanceTemplate.MANAGED_DISK_ENCRYPTION_WITH_CUSTOM_KEY_ENABLED)).isEqualTo(Boolean.TRUE);
}
Also used : JSONObject(net.sf.json.JSONObject) Json(com.sequenceiq.cloudbreak.common.json.Json) Template(com.sequenceiq.freeipa.entity.Template) InstanceTemplate(com.sequenceiq.cloudbreak.cloud.model.InstanceTemplate) AzureInstanceTemplate(com.sequenceiq.cloudbreak.cloud.model.instance.AzureInstanceTemplate) AwsInstanceTemplate(com.sequenceiq.cloudbreak.cloud.model.instance.AwsInstanceTemplate) Test(org.junit.jupiter.api.Test)

Aggregations

Template (com.sequenceiq.freeipa.entity.Template)44 AwsInstanceTemplate (com.sequenceiq.cloudbreak.cloud.model.instance.AwsInstanceTemplate)33 AzureInstanceTemplate (com.sequenceiq.cloudbreak.cloud.model.instance.AzureInstanceTemplate)31 Test (org.junit.jupiter.api.Test)31 Json (com.sequenceiq.cloudbreak.common.json.Json)27 InstanceTemplate (com.sequenceiq.cloudbreak.cloud.model.InstanceTemplate)26 InstanceTemplateRequest (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceTemplateRequest)21 InstanceGroup (com.sequenceiq.freeipa.entity.InstanceGroup)19 GcpInstanceTemplate (com.sequenceiq.cloudbreak.cloud.model.instance.GcpInstanceTemplate)16 Stack (com.sequenceiq.freeipa.entity.Stack)13 FreeIpaServerRequest (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.FreeIpaServerRequest)10 InstanceGroupRequest (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupRequest)10 NetworkRequest (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.network.NetworkRequest)10 DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)8 InstanceMetaData (com.sequenceiq.freeipa.entity.InstanceMetaData)7 HashMap (java.util.HashMap)6 JSONObject (net.sf.json.JSONObject)6 CloudInstance (com.sequenceiq.cloudbreak.cloud.model.CloudInstance)4 ImageEntity (com.sequenceiq.freeipa.entity.ImageEntity)3 InstanceGroupNetwork (com.sequenceiq.freeipa.entity.InstanceGroupNetwork)3