Search in sources :

Example 36 with ClusterV4Request

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

the class ClusterRequestToClusterConverterTest method testConvert.

@Test
public void testConvert() {
    // GIVEN
    ClusterV4Request request = getRequest("cluster.json");
    Blueprint blueprint = new Blueprint();
    blueprint.setStackType(StackType.HDP.name());
    given(blueprintService.getByNameForWorkspaceAndLoadDefaultsIfNecessary(eq("my-blueprint"), any())).willReturn(blueprint);
    given(gatewayV4RequestToGatewayConverter.convert(request.getGateway())).willReturn(new Gateway());
    // WHEN
    Cluster result = underTest.convert(request);
    // THEN
    assertAllFieldsNotNull(result, Arrays.asList("stack", "blueprint", "creationStarted", "creationFinished", "upSince", "statusReason", "clusterManagerIp", "fileSystem", "additionalFileSystem", "rdsConfigs", "attributes", "uptime", "ambariSecurityMasterKey", "proxyConfigCrn", "configStrategy", "extendedBlueprintText", "environmentCrn", "variant", "description", "databaseServerCrn", "fqdn", "customConfigurations"));
}
Also used : ClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request) Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) Gateway(com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) AbstractJsonConverterTest(com.sequenceiq.cloudbreak.converter.AbstractJsonConverterTest) Test(org.junit.jupiter.api.Test)

Example 37 with ClusterV4Request

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

the class ClusterRequestToClusterConverterTest method testNoGateway.

@Test
public void testNoGateway() {
    // GIVEN
    Blueprint blueprint = new Blueprint();
    blueprint.setStackType(StackType.HDP.name());
    given(blueprintService.getByNameForWorkspaceAndLoadDefaultsIfNecessary(eq("my-blueprint"), any())).willReturn(blueprint);
    // WHEN
    ClusterV4Request clusterRequest = getRequest("cluster-no-gateway.json");
    Cluster result = underTest.convert(clusterRequest);
    // THEN
    assertAllFieldsNotNull(result, Arrays.asList("stack", "blueprint", "creationStarted", "creationFinished", "upSince", "statusReason", "clusterManagerIp", "fileSystem", "additionalFileSystem", "rdsConfigs", "attributes", "uptime", "ambariSecurityMasterKey", "proxyConfigCrn", "configStrategy", "extendedBlueprintText", "gateway", "environmentCrn", "variant", "description", "databaseServerCrn", "fqdn", "customConfigurations"));
    assertNull(result.getGateway());
}
Also used : ClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request) Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) AbstractJsonConverterTest(com.sequenceiq.cloudbreak.converter.AbstractJsonConverterTest) Test(org.junit.jupiter.api.Test)

Example 38 with ClusterV4Request

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

the class ClusterRequestToClusterConverterTest method testConvertWithCloudStorageDetails.

@Test
public void testConvertWithCloudStorageDetails() {
    // GIVEN
    ClusterV4Request request = getRequest("cluster-with-cloud-storage.json");
    given(gatewayV4RequestToGatewayConverter.convert(request.getGateway())).willReturn(new Gateway());
    given(cloudStorageConverter.requestToFileSystem(request.getCloudStorage())).willReturn(new FileSystem());
    given(cloudStorageValidationUtil.isCloudStorageConfigured(request.getCloudStorage())).willReturn(true);
    Blueprint blueprint = new Blueprint();
    blueprint.setStackType(StackType.HDP.name());
    given(blueprintService.getByNameForWorkspaceAndLoadDefaultsIfNecessary(eq("my-blueprint"), any())).willReturn(blueprint);
    // WHEN
    Cluster result = ThreadBasedUserCrnProvider.doAs(TEST_USER_CRN, () -> underTest.convert(request));
    // THEN
    assertAllFieldsNotNull(result, Arrays.asList("stack", "blueprint", "creationStarted", "creationFinished", "upSince", "statusReason", "clusterManagerIp", "additionalFileSystem", "rdsConfigs", "attributes", "uptime", "ambariSecurityMasterKey", "proxyConfigCrn", "extendedBlueprintText", "environmentCrn", "variant", "description", "databaseServerCrn", "fqdn", "configStrategy", "customConfigurations"));
}
Also used : ClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request) Gateway(com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway) Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) FileSystem(com.sequenceiq.cloudbreak.domain.FileSystem) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) AbstractJsonConverterTest(com.sequenceiq.cloudbreak.converter.AbstractJsonConverterTest) Test(org.junit.jupiter.api.Test)

Example 39 with ClusterV4Request

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

the class SdxServiceTest method testCreateInternalSdxClusterWithCustomInstanceGroupShouldFail.

@Test
void testCreateInternalSdxClusterWithCustomInstanceGroupShouldFail() {
    when(sdxClusterRepository.findByAccountIdAndEnvNameAndDeletedIsNullAndDetachedIsFalse(anyString(), anyString())).thenReturn(new ArrayList<>());
    StackV4Request stackV4Request = new StackV4Request();
    ClusterV4Request clusterV4Request = new ClusterV4Request();
    stackV4Request.setCluster(clusterV4Request);
    SdxClusterRequest sdxClusterRequest = createSdxClusterRequest("7.2.12", CUSTOM);
    withCustomInstanceGroups(sdxClusterRequest);
    mockEnvironmentCall(sdxClusterRequest, CloudPlatform.AWS, null);
    BadRequestException badRequestException = assertThrows(BadRequestException.class, () -> underTest.createSdx(USER_CRN, CLUSTER_NAME, sdxClusterRequest, stackV4Request));
    assertEquals("Custom instance group is not accepted on SDX Internal API.", badRequestException.getMessage());
}
Also used : ClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request) StackV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request) SdxClusterRequest(com.sequenceiq.sdx.api.model.SdxClusterRequest) BadRequestException(com.sequenceiq.cloudbreak.common.exception.BadRequestException) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) Test(org.junit.jupiter.api.Test)

Example 40 with ClusterV4Request

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

the class GatewayManifesterTest method prepareGatewayWhenRequestedHasValueForGatewayShouldReturnWithoutModifications.

@Test
void prepareGatewayWhenRequestedHasValueForGatewayShouldReturnWithoutModifications() {
    GatewayV4Request gatewayV4Request = getGatewayV4Request();
    StackV4Request stackV4Request = new StackV4Request();
    stackV4Request.setCluster(new ClusterV4Request());
    stackV4Request.getCluster().setGateway(gatewayV4Request);
    underTest.configureGatewayForSdxCluster(stackV4Request);
    isTrue(stackV4Request.getCluster().getGateway().equals(gatewayV4Request));
}
Also used : GatewayV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.GatewayV4Request) ClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request) StackV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.StackV4Request) Test(org.junit.jupiter.api.Test)

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