Search in sources :

Example 1 with InstanceGroupTestDto

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;
}
Also used : AwsNetworkParameters(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.network.AwsNetworkParameters) ListFreeIpaResponse(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.list.ListFreeIpaResponse) GcpNetworkParameters(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.network.GcpNetworkParameters) InstanceStatus(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceStatus) RunningParameter.key(com.sequenceiq.it.cloudbreak.context.RunningParameter.key) StringUtils(org.apache.commons.lang3.StringUtils) DELETE_COMPLETED(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.Status.DELETE_COMPLETED) AwsInstanceTemplateV4Parameters(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.template.AwsInstanceTemplateV4Parameters) AwsInstanceTemplateV4SpotParameters(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.template.AwsInstanceTemplateV4SpotParameters) Prototype(com.sequenceiq.it.cloudbreak.Prototype) Strings(org.testng.util.Strings) InstanceGroupTestDto(com.sequenceiq.it.cloudbreak.dto.InstanceGroupTestDto) InstanceTemplateRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceTemplateRequest) Map(java.util.Map) StackAuthenticationRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.security.StackAuthenticationRequest) InstanceGroupV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.InstanceGroupV4Request) InstanceGroupRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupRequest) Tunnel(com.sequenceiq.common.api.type.Tunnel) Status(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.Status) FreeIpaClient(com.sequenceiq.it.cloudbreak.FreeIpaClient) FreeIpaServerRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.FreeIpaServerRequest) InstanceGroupNetworkRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupNetworkRequest) AzureNetworkParameters(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.network.AzureNetworkParameters) PlacementSettingsTestDto(com.sequenceiq.it.cloudbreak.dto.PlacementSettingsTestDto) Collection(java.util.Collection) Purgable(com.sequenceiq.it.cloudbreak.context.Purgable) NetworkV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.network.NetworkV4Request) Collectors(java.util.stream.Collectors) InstanceGroupNetworkV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.network.InstanceGroupNetworkV4Request) NetworkV4TestDto(com.sequenceiq.it.cloudbreak.dto.NetworkV4TestDto) NotFoundException(javax.ws.rs.NotFoundException) Objects(java.util.Objects) List(java.util.List) RunningParameter.emptyRunningParameter(com.sequenceiq.it.cloudbreak.context.RunningParameter.emptyRunningParameter) Optional(java.util.Optional) PlacementSettingsV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.environment.placement.PlacementSettingsV4Request) TelemetryTestDto(com.sequenceiq.it.cloudbreak.dto.telemetry.TelemetryTestDto) PlacementRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.region.PlacementRequest) CreateFreeIpaRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.create.CreateFreeIpaRequest) Investigable(com.sequenceiq.it.cloudbreak.context.Investigable) AbstractFreeIpaTestDto(com.sequenceiq.it.cloudbreak.dto.AbstractFreeIpaTestDto) OptionalInt(java.util.OptionalInt) Function(java.util.function.Function) Supplier(java.util.function.Supplier) Inject(javax.inject.Inject) StackAuthenticationTestDto(com.sequenceiq.it.cloudbreak.dto.StackAuthenticationTestDto) Searchable(com.sequenceiq.it.cloudbreak.search.Searchable) MockNetworkParameters(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.network.MockNetworkParameters) InstanceGroupType(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupType) AwsInstanceTemplateParameters(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.aws.AwsInstanceTemplateParameters) ImageSettingsRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.image.ImageSettingsRequest) StackAuthenticationV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.authentication.StackAuthenticationV4Request) TestContext(com.sequenceiq.it.cloudbreak.context.TestContext) CloudbreakTestDto(com.sequenceiq.it.cloudbreak.dto.CloudbreakTestDto) SecurityGroupRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.security.SecurityGroupRequest) FreeIpaInstanceUtil(com.sequenceiq.it.cloudbreak.util.FreeIpaInstanceUtil) NetworkRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.network.NetworkRequest) SecurityRuleRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.security.SecurityRuleRequest) FreeIpaTestClient(com.sequenceiq.it.cloudbreak.client.FreeIpaTestClient) Clue(com.sequenceiq.it.cloudbreak.context.Clue) SubnetId(com.sequenceiq.it.cloudbreak.dto.SubnetId) EnvironmentTestDto(com.sequenceiq.it.cloudbreak.dto.environment.EnvironmentTestDto) VolumeRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.VolumeRequest) DescribeFreeIpaResponse(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.describe.DescribeFreeIpaResponse) RunningParameter(com.sequenceiq.it.cloudbreak.context.RunningParameter) AwsInstanceTemplateSpotParameters(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.aws.AwsInstanceTemplateSpotParameters) InstanceGroupAwsNetworkParameters(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.aws.InstanceGroupAwsNetworkParameters) Collections(java.util.Collections) InstanceGroupRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupRequest) InstanceGroupTestDto(com.sequenceiq.it.cloudbreak.dto.InstanceGroupTestDto)

Aggregations

AwsInstanceTemplateV4Parameters (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.template.AwsInstanceTemplateV4Parameters)1 AwsInstanceTemplateV4SpotParameters (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.parameter.template.AwsInstanceTemplateV4SpotParameters)1 StackAuthenticationV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.authentication.StackAuthenticationV4Request)1 PlacementSettingsV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.environment.placement.PlacementSettingsV4Request)1 InstanceGroupV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.InstanceGroupV4Request)1 InstanceGroupNetworkV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.instancegroup.network.InstanceGroupNetworkV4Request)1 NetworkV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.network.NetworkV4Request)1 Tunnel (com.sequenceiq.common.api.type.Tunnel)1 FreeIpaServerRequest (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.FreeIpaServerRequest)1 Status (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.Status)1 DELETE_COMPLETED (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.Status.DELETE_COMPLETED)1 ImageSettingsRequest (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.image.ImageSettingsRequest)1 InstanceGroupNetworkRequest (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupNetworkRequest)1 InstanceGroupRequest (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupRequest)1 InstanceGroupType (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupType)1 InstanceStatus (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceStatus)1 InstanceTemplateRequest (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceTemplateRequest)1 VolumeRequest (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.VolumeRequest)1 AwsInstanceTemplateParameters (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.aws.AwsInstanceTemplateParameters)1 AwsInstanceTemplateSpotParameters (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.aws.AwsInstanceTemplateSpotParameters)1