use of com.sequenceiq.cloudbreak.domain.InstanceGroup in project cloudbreak by hortonworks.
the class EmailSenderService method getInstanceTypes.
private String getInstanceTypes(Stack stack) {
StringBuilder instanceTypesStringBuilder = new StringBuilder();
for (InstanceGroup instanceGroup : stack.getInstanceGroups()) {
String instanceType = instanceGroup.getTemplate().getInstanceType();
instanceTypesStringBuilder.append("<br />").append(" - ");
instanceTypesStringBuilder.append(instanceGroup.getGroupName()).append(" (").append(instanceGroup.getNodeCount()).append(") : ");
instanceTypesStringBuilder.append(instanceType);
}
return instanceTypesStringBuilder.toString();
}
use of com.sequenceiq.cloudbreak.domain.InstanceGroup in project cloudbreak by hortonworks.
the class TestUtil method generateOpenStackInstanceGroups.
public static Set<InstanceGroup> generateOpenStackInstanceGroups(int count) {
Set<InstanceGroup> instanceGroups = new HashSet<>();
instanceGroups.add(instanceGroup(1L, InstanceGroupType.GATEWAY, gcpTemplate(1L)));
for (int i = 0; i < count - 1; i++) {
instanceGroups.add(instanceGroup(1L, InstanceGroupType.CORE, gcpTemplate(1L)));
}
return instanceGroups;
}
use of com.sequenceiq.cloudbreak.domain.InstanceGroup in project cloudbreak by hortonworks.
the class TestUtil method hostGroup.
public static HostGroup hostGroup(String name, int count) {
HostGroup hostGroup = new HostGroup();
hostGroup.setId(1L);
hostGroup.setName(name);
hostGroup.setRecipes(recipes(1));
hostGroup.setHostMetadata(hostMetadata(hostGroup, count));
InstanceGroup instanceGroup = instanceGroup(1L, name, InstanceGroupType.CORE, gcpTemplate(1L), count);
Constraint constraint = new Constraint();
constraint.setInstanceGroup(instanceGroup);
constraint.setHostCount(instanceGroup.getNodeCount());
hostGroup.setConstraint(constraint);
hostGroup.setCluster(cluster(blueprint(), stack(), 1L));
hostGroup.setRecoveryMode(RecoveryMode.MANUAL);
return hostGroup;
}
use of com.sequenceiq.cloudbreak.domain.InstanceGroup in project cloudbreak by hortonworks.
the class TestUtil method generateAwsInstanceGroups.
public static Set<InstanceGroup> generateAwsInstanceGroups(int count) {
Set<InstanceGroup> instanceGroups = new HashSet<>();
instanceGroups.add(instanceGroup(1L, InstanceGroupType.GATEWAY, awsTemplate(1L)));
for (int i = 0; i < count - 1; i++) {
instanceGroups.add(instanceGroup(1L, InstanceGroupType.CORE, awsTemplate(1L)));
}
return instanceGroups;
}
use of com.sequenceiq.cloudbreak.domain.InstanceGroup in project cloudbreak by hortonworks.
the class StackRequestToStackConverterTest method testConvertWithNoGateway.
@SuppressFBWarnings(value = "DLS_DEAD_LOCAL_STORE")
@Test
public void testConvertWithNoGateway() throws CloudbreakException {
InstanceGroup instanceGroup = mock(InstanceGroup.class);
when(instanceGroup.getInstanceGroupType()).thenReturn(InstanceGroupType.CORE);
// GIVEN
ReflectionTestUtils.setField(underTest, "defaultRegions", "AWS:eu-west-2");
given(conversionService.convert(any(Object.class), any(TypeDescriptor.class), any(TypeDescriptor.class))).willReturn(new HashSet<>(Collections.singletonList(instanceGroup)));
given(conversionService.convert(any(Object.class), any(TypeDescriptor.class), any(TypeDescriptor.class))).willReturn(new HashSet<>(Collections.singletonList(instanceGroup)));
given(conversionService.convert(any(StackAuthenticationRequest.class), eq(StackAuthentication.class))).willReturn(new StackAuthentication());
given(conversionService.convert(any(FailurePolicyRequest.class), eq(FailurePolicy.class))).willReturn(new FailurePolicy());
given(conversionService.convert(any(InstanceGroupRequest.class), eq(InstanceGroup.class))).willReturn(instanceGroup);
given(conversionService.convert(any(OrchestratorRequest.class), eq(Orchestrator.class))).willReturn(new Orchestrator());
given(orchestratorTypeResolver.resolveType(any(String.class))).willReturn(OrchestratorType.HOST);
// WHEN
try {
Stack stack = underTest.convert(getRequest("stack/stack.json"));
} catch (BadRequestException e) {
// THEN
Assert.assertEquals("Ambari server must be specified", e.getMessage());
}
}
Aggregations