use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.InstanceGroupV4Request in project cloudbreak by hortonworks.
the class StackToStackV4RequestConverter method getInstanceGroups.
private List<InstanceGroupV4Request> getInstanceGroups(Stack stack) {
List<InstanceGroupV4Request> ret = new ArrayList<>();
for (InstanceGroup instanceGroup : stack.getInstanceGroups()) {
InstanceGroupV4Request instanceGroupV4Request = instanceGroupToInstanceGroupV4RequestConverter.convert(instanceGroup);
collectInformationsFromActualHostgroup(stack.getCluster(), instanceGroup, instanceGroupV4Request);
ret.add(instanceGroupV4Request);
}
return ret;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.InstanceGroupV4Request in project cloudbreak by hortonworks.
the class InstanceGroupV4RequestToHostGroupConverterTest method testConvertWhenHostNameUpperCase.
@Test
public void testConvertWhenHostNameUpperCase() {
InstanceGroupV4Request source = new InstanceGroupV4Request();
source.setName("MixEdName");
source.setTemplate(new InstanceTemplateV4Request());
HostGroup actual = underTest.convert(source);
assertEquals(actual.getName(), "mixedname");
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.InstanceGroupV4Request in project cloudbreak by hortonworks.
the class InstanceGroupV4RequestToInstanceGroupConverterTest method testConvertWhenHostNameUpperCase.
@Test
public void testConvertWhenHostNameUpperCase() {
InstanceGroupV4Request source = new InstanceGroupV4Request();
source.setName("MixEdName");
source.setTemplate(new InstanceTemplateV4Request());
when(providerParameterCalculator.get(source)).thenReturn(mock(Mappable.class));
when(instanceTemplateV4RequestToTemplateConverter.convert(any())).thenReturn(new Template());
InstanceGroup actual = underTest.convert(source, "variant");
assertEquals(actual.getGroupName(), "mixedname");
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.InstanceGroupV4Request in project cloudbreak by hortonworks.
the class StackCreatorServiceRecipeValidationTest method getInstanceGroupWithRecipe.
private InstanceGroupV4Request getInstanceGroupWithRecipe(String instanceGroupName, Set<String> recipeNames) {
InstanceGroupV4Request request = new InstanceGroupV4Request();
request.setName(instanceGroupName);
request.setRecipeNames(recipeNames);
return request;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.InstanceGroupV4Request in project cloudbreak by hortonworks.
the class StackCreatorServiceTest method shouldThrowBadRequestWhenRecipeIsMissing.
@Test
public void shouldThrowBadRequestWhenRecipeIsMissing() {
User user = new User();
Workspace workspace = new Workspace();
workspace.setId(WORKSPACE_ID);
StackV4Request stackRequest = new StackV4Request();
InstanceGroupV4Request instanceGroupV4Request = new InstanceGroupV4Request();
instanceGroupV4Request.setName(INSTANCE_GROUP);
instanceGroupV4Request.setRecipeNames(Set.of(RECIPE_NAME));
stackRequest.setInstanceGroups(List.of(instanceGroupV4Request));
doNothing().when(nodeCountLimitValidator).validateProvision(any());
doThrow(new NotFoundException("missing recipe")).when(recipeService).get(NameOrCrn.ofName(RECIPE_NAME), WORKSPACE_ID);
BadRequestException badRequestException = assertThrows(BadRequestException.class, () -> underTest.createStack(user, workspace, stackRequest, false));
assertThat(badRequestException).hasMessage("The given recipe does not exist for the instance group \"INSTANCE_GROUP\": RECIPE_NAME");
}
Aggregations