Search in sources :

Example 86 with ClusterV4Request

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request in project cloudbreak by hortonworks.

the class RdsConfigValidatorTest method acceptsMultipleDatabasesOfDifferentType.

@Test
public void acceptsMultipleDatabasesOfDifferentType() {
    ClusterV4Request request = requestWithDatabases(DatabaseType.HIVE, DatabaseType.HUE, DatabaseType.RANGER);
    subject.validateRdsConfigs(request, null, workspace);
}
Also used : ClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request) Test(org.junit.Test)

Example 87 with ClusterV4Request

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request in project cloudbreak by hortonworks.

the class RdsConfigValidatorTest method rejectsMultipleDatabasesOfSameType.

@Test
public void rejectsMultipleDatabasesOfSameType() {
    ClusterV4Request request = requestWithDatabases(DatabaseType.HIVE, DatabaseType.HUE, DatabaseType.HIVE, DatabaseType.RANGER, DatabaseType.RANGER);
    BadRequestException exception = assertThrows(BadRequestException.class, () -> subject.validateRdsConfigs(request, null, workspace));
    assertTrue(exception.getMessage().contains("HIVE"));
    assertFalse(exception.getMessage().contains("HUE"));
    assertTrue(exception.getMessage().contains("RANGER"));
}
Also used : ClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request) BadRequestException(com.sequenceiq.cloudbreak.common.exception.BadRequestException) Test(org.junit.Test)

Example 88 with ClusterV4Request

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request in project cloudbreak by hortonworks.

the class StackRuntimeVersionValidatorTest method createStackRequest.

private StackV4Request createStackRequest(String dataHubVersion) {
    ClouderaManagerRepositoryV4Request clouderaManagerRepositoryV4Request = new ClouderaManagerRepositoryV4Request();
    clouderaManagerRepositoryV4Request.setVersion("do-not-use-this-version");
    ClouderaManagerV4Request clouderaManagerV4Request = new ClouderaManagerV4Request();
    clouderaManagerV4Request.setProducts(List.of(new ClouderaManagerProductV4Request().withName("CDH").withVersion(dataHubVersion)));
    clouderaManagerV4Request.setRepository(clouderaManagerRepositoryV4Request);
    ClusterV4Request clusterV4Request = new ClusterV4Request();
    clusterV4Request.setCm(clouderaManagerV4Request);
    StackV4Request stackV4Request = new StackV4Request();
    stackV4Request.setCluster(clusterV4Request);
    stackV4Request.setEnvironmentCrn(ENVIRONMENT_CRN);
    return stackV4Request;
}
Also used : ClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request) ClouderaManagerProductV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.cm.product.ClouderaManagerProductV4Request) StackV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request) ClouderaManagerRepositoryV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.cm.repository.ClouderaManagerRepositoryV4Request) ClouderaManagerV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.cm.ClouderaManagerV4Request)

Example 89 with ClusterV4Request

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request in project cloudbreak by hortonworks.

the class StackRuntimeVersionValidatorTest method createStackRequestWithoutCm.

private StackV4Request createStackRequestWithoutCm() {
    ClusterV4Request clusterV4Request = new ClusterV4Request();
    StackV4Request stackV4Request = new StackV4Request();
    stackV4Request.setCluster(clusterV4Request);
    stackV4Request.setEnvironmentCrn(ENVIRONMENT_CRN);
    return stackV4Request;
}
Also used : ClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request) StackV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request)

Example 90 with ClusterV4Request

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request in project cloudbreak by hortonworks.

the class DistroXClusterToClusterConverter method convert.

public ClusterV4Request convert(DistroXV1Request request, DetailedEnvironmentResponse environment) {
    DistroXClusterV1Request source = request.getCluster();
    ClusterV4Request response = new ClusterV4Request();
    if (isEmpty(source.getExposedServices())) {
        source.setExposedServices(List.of("ALL"));
    }
    response.setGateway(gatewayConverter.convert(source.getExposedServices()));
    response.setName(null);
    response.setDatabases(source.getDatabases());
    response.setBlueprintName(source.getBlueprintName());
    response.setCustomConfigurationsName(source.getCustomConfigurationsName());
    response.setUserName(source.getUserName());
    response.setPassword(source.getPassword());
    response.setProxyConfigCrn(getIfNotNull(source.getProxy(), proxy -> getProxyCrnByName(ThreadBasedUserCrnProvider.getAccountId(), proxy)));
    response.setCm(getIfNotNull(source.getCm(), cmConverter::convert));
    response.setCloudStorage(cloudStorageDecorator.decorate(source.getBlueprintName(), request.getName(), source.getCloudStorage(), environment));
    response.setValidateBlueprint(source.getValidateBlueprint());
    response.setCustomContainer(null);
    response.setCustomQueue(null);
    return response;
}
Also used : List(java.util.List) Component(org.springframework.stereotype.Component) ThreadBasedUserCrnProvider(com.sequenceiq.cloudbreak.auth.ThreadBasedUserCrnProvider) DistroXClusterV1Request(com.sequenceiq.distrox.api.v1.distrox.model.cluster.DistroXClusterV1Request) NullUtil.getIfNotNull(com.sequenceiq.cloudbreak.util.NullUtil.getIfNotNull) ProxyEndpoint(com.sequenceiq.environment.api.v1.proxy.endpoint.ProxyEndpoint) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) ClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request) CollectionUtils.isEmpty(org.apache.commons.collections4.CollectionUtils.isEmpty) RegionAwareInternalCrnGeneratorFactory(com.sequenceiq.cloudbreak.auth.crn.RegionAwareInternalCrnGeneratorFactory) DistroXV1Request(com.sequenceiq.distrox.api.v1.distrox.model.DistroXV1Request) ClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request) DistroXClusterV1Request(com.sequenceiq.distrox.api.v1.distrox.model.cluster.DistroXClusterV1Request)

Aggregations

ClusterV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request)90 Test (org.junit.jupiter.api.Test)59 ClouderaManagerV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.cm.ClouderaManagerV4Request)16 CloudStorageRequest (com.sequenceiq.common.api.cloudstorage.CloudStorageRequest)14 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)14 Test (org.junit.Test)13 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)13 Cluster (com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster)12 DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)10 SdxClusterRequest (com.sequenceiq.sdx.api.model.SdxClusterRequest)10 StackV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request)9 GatewayV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.GatewayV4Request)9 ClouderaManagerRepositoryV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.cm.repository.ClouderaManagerRepositoryV4Request)8 Blueprint (com.sequenceiq.cloudbreak.domain.Blueprint)8 SdxCloudStorageRequest (com.sequenceiq.sdx.api.model.SdxCloudStorageRequest)8 ClouderaManagerProductV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.cm.product.ClouderaManagerProductV4Request)7 ThreadBasedUserCrnProvider (com.sequenceiq.cloudbreak.auth.ThreadBasedUserCrnProvider)7 StorageLocationBase (com.sequenceiq.common.api.cloudstorage.StorageLocationBase)7 List (java.util.List)7 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)6