use of com.sequenceiq.cloudbreak.common.json.Json in project cloudbreak by hortonworks.
the class InstanceTemplateV4RequestToTemplateConverterTest method convertWithAwsEncryption.
@Test
public void convertWithAwsEncryption() {
InstanceTemplateV4Request source = getSampleAwsRequest();
Template result = ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> underTest.convert(source));
assertAwsEncryptionConvertResult(source, result);
assertThat(new Json(result.getSecretAttributes()).getMap().get(InstanceTemplate.VOLUME_ENCRYPTION_KEY_ID)).isEqualTo("myKey");
}
use of com.sequenceiq.cloudbreak.common.json.Json in project cloudbreak by hortonworks.
the class InstanceTemplateV4RequestToTemplateConverterTest method convertWithGcpEncryptionWithNullKey.
@Test
public void convertWithGcpEncryptionWithNullKey() {
InstanceTemplateV4Request source = getSampleGcpRequest();
source.getGcp().getEncryption().setKey(null);
Template result = underTest.convert(source);
assertGcpEncryptionConvertResult(source, result);
assertThat(new Json(result.getSecretAttributes()).getMap().get(InstanceTemplate.VOLUME_ENCRYPTION_KEY_ID)).isNull();
}
use of com.sequenceiq.cloudbreak.common.json.Json in project cloudbreak by hortonworks.
the class InstanceTemplateV4RequestToTemplateConverterTest method convertWithGcpEncryption.
@Test
public void convertWithGcpEncryption() {
InstanceTemplateV4Request source = getSampleGcpRequest();
Template result = underTest.convert(source);
assertGcpEncryptionConvertResult(source, result);
assertThat(new Json(result.getSecretAttributes()).getMap().get(InstanceTemplate.VOLUME_ENCRYPTION_KEY_ID)).isEqualTo("myKey");
}
use of com.sequenceiq.cloudbreak.common.json.Json in project cloudbreak by hortonworks.
the class InstanceTemplateV4RequestToTemplateConverterTest method convertWithAwsEncryptionWithNullKey.
@Test
public void convertWithAwsEncryptionWithNullKey() {
InstanceTemplateV4Request source = getSampleAwsRequest();
source.getAws().getEncryption().setKey(null);
Template result = ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> underTest.convert(source));
assertAwsEncryptionConvertResult(source, result);
assertThat(new Json(result.getSecretAttributes()).getMap().get(InstanceTemplate.VOLUME_ENCRYPTION_KEY_ID)).isNull();
}
use of com.sequenceiq.cloudbreak.common.json.Json in project cloudbreak by hortonworks.
the class CloudResourceToResourceConverterTest method convert.
@Test
void convert() throws JsonProcessingException {
Map<String, Object> parameters = Map.of("key", "test");
Json attributes = new Json(parameters);
Resource convertedResource = underTest.convert(CloudResource.builder().type(ResourceType.AWS_ENCRYPTED_AMI).status(CommonStatus.REQUESTED).name("ami-01231h231").group("group").instanceId("id").params(Map.of(CloudResource.ATTRIBUTES, Map.of("key", "test"))).reference("ref").build());
assertEquals(ResourceType.AWS_ENCRYPTED_AMI, convertedResource.getResourceType());
assertEquals(CommonStatus.REQUESTED, convertedResource.getResourceStatus());
assertEquals("ami-01231h231", convertedResource.getResourceName());
assertEquals("ref", convertedResource.getResourceReference());
assertEquals("group", convertedResource.getInstanceGroup());
assertEquals("id", convertedResource.getInstanceId());
assertEquals(attributes.getValue(), convertedResource.getAttributes().getValue());
}
Aggregations