use of com.sequenceiq.distrox.api.v1.distrox.model.instancegroup.template.InstanceTemplateV1Request in project cloudbreak by hortonworks.
the class InstanceTemplateV1ToInstanceTemplateV4ConverterTest method convertTestInstanceTemplateV1RequestToInstanceTemplateV4RequestWhenAzure.
@Test
void convertTestInstanceTemplateV1RequestToInstanceTemplateV4RequestWhenAzure() {
InstanceTemplateV1Request source = new InstanceTemplateV1Request();
RootVolumeV1Request rootVolumeV1Request = new RootVolumeV1Request();
source.setRootVolume(rootVolumeV1Request);
AzureInstanceTemplateV1Parameters azureInstanceTemplateV1Parameters = new AzureInstanceTemplateV1Parameters();
source.setAzure(azureInstanceTemplateV1Parameters);
source.setInstanceType(INSTANCE_TYPE);
RootVolumeV4Request rootVolumeV4Request = new RootVolumeV4Request();
when(volumeConverter.convert(rootVolumeV1Request)).thenReturn(rootVolumeV4Request);
AzureInstanceTemplateV4Parameters azureInstanceTemplateV4Parameters = new AzureInstanceTemplateV4Parameters();
when(instanceTemplateParameterConverter.convert(azureInstanceTemplateV1Parameters, environment)).thenReturn(azureInstanceTemplateV4Parameters);
InstanceTemplateV4Request instanceTemplateV4Request = underTest.convert(source, environment);
assertThat(instanceTemplateV4Request).isNotNull();
assertThat(instanceTemplateV4Request.getRootVolume()).isSameAs(rootVolumeV4Request);
assertThat(instanceTemplateV4Request.getAzure()).isSameAs(azureInstanceTemplateV4Parameters);
assertThat(instanceTemplateV4Request.getCloudPlatform()).isEqualTo(CloudPlatform.AZURE);
assertThat(instanceTemplateV4Request.getInstanceType()).isEqualTo(INSTANCE_TYPE);
}
use of com.sequenceiq.distrox.api.v1.distrox.model.instancegroup.template.InstanceTemplateV1Request in project cloudbreak by hortonworks.
the class InstanceTemplateV1ToInstanceTemplateV4ConverterTest method convertTestInstanceTemplateV4RequestToInstanceTemplateV1RequestWhenAzure.
@Test
void convertTestInstanceTemplateV4RequestToInstanceTemplateV1RequestWhenAzure() {
InstanceTemplateV4Request source = new InstanceTemplateV4Request();
RootVolumeV4Request rootVolumeV4Request = new RootVolumeV4Request();
source.setRootVolume(rootVolumeV4Request);
AzureInstanceTemplateV4Parameters azureInstanceTemplateV4Parameters = new AzureInstanceTemplateV4Parameters();
source.setAzure(azureInstanceTemplateV4Parameters);
source.setInstanceType(INSTANCE_TYPE);
RootVolumeV1Request rootVolumeV1Request = new RootVolumeV1Request();
when(volumeConverter.convert(rootVolumeV4Request)).thenReturn(rootVolumeV1Request);
AzureInstanceTemplateV1Parameters azureInstanceTemplateV1Parameters = new AzureInstanceTemplateV1Parameters();
when(instanceTemplateParameterConverter.convert(azureInstanceTemplateV4Parameters)).thenReturn(azureInstanceTemplateV1Parameters);
InstanceTemplateV1Request instanceTemplateV1Request = underTest.convert(source, environment);
assertThat(instanceTemplateV1Request).isNotNull();
assertThat(instanceTemplateV1Request.getRootVolume()).isSameAs(rootVolumeV1Request);
assertThat(instanceTemplateV1Request.getAzure()).isSameAs(azureInstanceTemplateV1Parameters);
assertThat(instanceTemplateV1Request.getCloudPlatform()).isEqualTo(CloudPlatform.AZURE);
assertThat(instanceTemplateV1Request.getInstanceType()).isEqualTo(INSTANCE_TYPE);
}
use of com.sequenceiq.distrox.api.v1.distrox.model.instancegroup.template.InstanceTemplateV1Request in project cloudbreak by hortonworks.
the class AwsCloudProvider method setInstanceTemplateV1Parameters.
@Override
public void setInstanceTemplateV1Parameters(InstanceTemplateV1Request instanceTemplateV1Request) {
AwsInstanceTemplateV1Parameters awsInstanceTemplateV1Parameters = new AwsInstanceTemplateV1Parameters();
AwsEncryptionV1Parameters awsEncryptionV1Parameters = new AwsEncryptionV1Parameters();
awsEncryptionV1Parameters.setType(EncryptionType.DEFAULT);
awsInstanceTemplateV1Parameters.setEncryption(awsEncryptionV1Parameters);
awsInstanceTemplateV1Parameters.setSpot(getAwsInstanceTemplateV1SpotParameters());
instanceTemplateV1Request.setAws(awsInstanceTemplateV1Parameters);
}
use of com.sequenceiq.distrox.api.v1.distrox.model.instancegroup.template.InstanceTemplateV1Request in project cloudbreak by hortonworks.
the class DistroXTemplateTestDto method withInstanceGroups.
private DistroXTemplateTestDto withInstanceGroups(InstanceGroupV4Request instanceGroupTestDto) {
InstanceGroupV1Request instanceGroup = new InstanceGroupV1Request();
InstanceTemplateV1Request template = new InstanceTemplateV1Request();
RootVolumeV1Request rootVolume = new RootVolumeV1Request();
rootVolume.setSize(instanceGroupTestDto.getTemplate().getRootVolume().getSize());
template.setRootVolume(rootVolume);
instanceGroup.setTemplate(template);
instanceGroup.setName(instanceGroupTestDto.getName());
instanceGroup.setNodeCount(instanceGroupTestDto.getNodeCount());
getRequest().setInstanceGroups(Set.of(instanceGroup));
return this;
}
use of com.sequenceiq.distrox.api.v1.distrox.model.instancegroup.template.InstanceTemplateV1Request in project cloudbreak by hortonworks.
the class RootVolumeSizeValidatorTest method tesIsValidWhenRootVolumeIsNull.
@Test
public void tesIsValidWhenRootVolumeIsNull() {
InstanceTemplateV1Request templateV1Request = new InstanceTemplateV1Request();
InstanceGroupV1Request value = new InstanceGroupV1Request();
value.setTemplate(templateV1Request);
boolean actual = underTest.isValid(value, null);
Assertions.assertTrue(actual);
verify(rootVolumeSizeProvider, never()).getForPlatform(any());
}
Aggregations