use of com.sequenceiq.it.cloudbreak.dto.InstanceGroupTestDto in project cloudbreak by hortonworks.
the class FreeIpaTestDto method withInstanceGroupsEntity.
private FreeIpaTestDto withInstanceGroupsEntity(Collection<InstanceGroupTestDto> instanceGroups, OptionalInt instanceGroupCount, OptionalInt instanceCountByGroup) {
List<InstanceGroupRequest> instanceGroupRequests = instanceGroups.stream().filter(instanceGroupTestDto -> "master".equals(instanceGroupTestDto.getRequest().getName())).limit(1).map(ig -> {
if (getCloudProvider().isMultiAZ()) {
return ig.withNetwork(SubnetId.all());
} else {
return ig;
}
}).map(InstanceGroupTestDto::getRequest).map(mapInstanceGroupRequest(instanceCountByGroup)).collect(Collectors.toList());
if (instanceGroupCount.isPresent() && instanceGroupRequests.size() == 1) {
InstanceGroupRequest reqToCopyDataFrom = instanceGroupRequests.get(0);
instanceGroupRequests.clear();
for (int i = 0; i < instanceGroupCount.getAsInt(); ++i) {
InstanceGroupRequest req = new InstanceGroupRequest();
req.setNodeCount(reqToCopyDataFrom.getNodeCount());
req.setName(reqToCopyDataFrom.getName() + i);
req.setType(reqToCopyDataFrom.getType());
req.setInstanceTemplateRequest(reqToCopyDataFrom.getInstanceTemplate());
req.setSecurityGroup(reqToCopyDataFrom.getSecurityGroup());
req.setNetwork(reqToCopyDataFrom.getNetwork());
instanceGroupRequests.add(req);
}
}
getRequest().setInstanceGroups(instanceGroupRequests);
return this;
}
Aggregations