use of com.sequenceiq.distrox.api.v1.distrox.model.instancegroup.InstanceGroupV1Request in project cloudbreak by hortonworks.
the class DistroXV1RequestTest method getAllRecipesIfRecipeNamesAreNullTest.
@Test
public void getAllRecipesIfRecipeNamesAreNullTest() {
DistroXV1Request distroXV1Request = new DistroXV1Request();
InstanceGroupV1Request instanceGroupV1Request = new InstanceGroupV1Request();
instanceGroupV1Request.setRecipeNames(null);
distroXV1Request.setInstanceGroups(Collections.singleton(instanceGroupV1Request));
Set<String> allRecipes = distroXV1Request.getAllRecipes();
assertEquals(0, allRecipes.size());
}
use of com.sequenceiq.distrox.api.v1.distrox.model.instancegroup.InstanceGroupV1Request in project cloudbreak by hortonworks.
the class RootVolumeSizeValidatorTest method tesIsValidWhenTemplateIsNull.
@Test
public void tesIsValidWhenTemplateIsNull() {
InstanceGroupV1Request value = new InstanceGroupV1Request();
boolean actual = underTest.isValid(value, null);
Assertions.assertTrue(actual);
verify(rootVolumeSizeProvider, never()).getForPlatform(any());
}
use of com.sequenceiq.distrox.api.v1.distrox.model.instancegroup.InstanceGroupV1Request in project cloudbreak by hortonworks.
the class RootVolumeSizeValidatorTest method tesIsValidWhenSizeIsNull.
@Test
public void tesIsValidWhenSizeIsNull() {
InstanceTemplateV1Request templateV1Request = new InstanceTemplateV1Request();
templateV1Request.setRootVolume(new RootVolumeV1Request());
InstanceGroupV1Request value = new InstanceGroupV1Request();
value.setTemplate(templateV1Request);
boolean actual = underTest.isValid(value, null);
Assertions.assertTrue(actual);
verify(rootVolumeSizeProvider, never()).getForPlatform(any());
}
use of com.sequenceiq.distrox.api.v1.distrox.model.instancegroup.InstanceGroupV1Request in project cloudbreak by hortonworks.
the class RootVolumeSizeValidatorTest method testIsValid.
@ParameterizedTest
@MethodSource("isValidSource")
public void testIsValid(boolean valid, int size) {
InstanceTemplateV1Request templateV1Request = new InstanceTemplateV1Request();
templateV1Request.setAws(new AwsInstanceTemplateV1Parameters());
RootVolumeV1Request rootVolume = new RootVolumeV1Request();
rootVolume.setSize(size);
templateV1Request.setRootVolume(rootVolume);
ConstraintValidatorContext context = mock(ConstraintValidatorContext.class);
ConstraintValidatorContext.ConstraintViolationBuilder builder = mock(ConstraintValidatorContext.ConstraintViolationBuilder.class);
when(rootVolumeSizeProvider.getForPlatform("AWS")).thenReturn(10);
if (!valid) {
when(context.buildConstraintViolationWithTemplate("Group root volume (" + size + "GB) couldn't be less than 10GB")).thenReturn(builder);
}
InstanceGroupV1Request value = new InstanceGroupV1Request();
value.setName("group");
value.setTemplate(templateV1Request);
boolean actual = underTest.isValid(value, context);
Assertions.assertEquals(actual, valid);
int times = valid ? 0 : 1;
verify(context, times(times)).buildConstraintViolationWithTemplate("Group root volume (" + size + "GB) couldn't be less than 10GB");
}
use of com.sequenceiq.distrox.api.v1.distrox.model.instancegroup.InstanceGroupV1Request in project cloudbreak by hortonworks.
the class DistroXTestDto method withRecipe.
public DistroXTestDto withRecipe(String recipeName) {
InstanceGroupV1Request instanceGroupV1Request = getRequest().getInstanceGroups().iterator().next();
instanceGroupV1Request.setRecipeNames(Sets.newHashSet());
instanceGroupV1Request.getRecipeNames().add(recipeName);
return this;
}
Aggregations