Search in sources :

Example 81 with ClusterV4Request

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

the class StackCreatorServiceTest method testShouldUseBaseCMImageShouldReturnTrueWhenCmRequestIsNotPresentAndPlatformIsYarn.

@Test
public void testShouldUseBaseCMImageShouldReturnTrueWhenCmRequestIsNotPresentAndPlatformIsYarn() {
    ClusterV4Request clusterV4Request = new ClusterV4Request();
    boolean actual = underTest.shouldUseBaseCMImage(clusterV4Request, YARN_PLATFORM);
    assertTrue(actual);
}
Also used : ClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 82 with ClusterV4Request

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

the class StackCreatorServiceTest method testShouldUseBaseCMImageWithProductsAndPlatformIsNotYarn.

@Test
public void testShouldUseBaseCMImageWithProductsAndPlatformIsNotYarn() {
    ClusterV4Request clusterV4Request = new ClusterV4Request();
    ClouderaManagerV4Request cmRequest = new ClouderaManagerV4Request();
    ClouderaManagerProductV4Request cdpRequest = new ClouderaManagerProductV4Request();
    cdpRequest.setName("CDP");
    cdpRequest.setParcel("parcel");
    cdpRequest.setVersion("version");
    cdpRequest.setCsd(List.of("csd"));
    cmRequest.setProducts(List.of(cdpRequest));
    clusterV4Request.setCm(cmRequest);
    boolean base = underTest.shouldUseBaseCMImage(clusterV4Request, AWS_PLATFORM);
    assertTrue(base);
}
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) ClouderaManagerV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.cm.ClouderaManagerV4Request) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 83 with ClusterV4Request

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

the class StackCreatorServiceTest method testShouldUseBaseCMImageWithProductsAndCmRepoAndPlatformIsYarn.

@Test
public void testShouldUseBaseCMImageWithProductsAndCmRepoAndPlatformIsYarn() {
    ClusterV4Request clusterV4Request = new ClusterV4Request();
    ClouderaManagerV4Request cmRequest = new ClouderaManagerV4Request();
    ClouderaManagerProductV4Request cdpRequest = new ClouderaManagerProductV4Request();
    cdpRequest.setName("CDP");
    cdpRequest.setParcel("parcel");
    cdpRequest.setVersion("version");
    cdpRequest.setCsd(List.of("csd"));
    cmRequest.setProducts(List.of(cdpRequest));
    ClouderaManagerRepositoryV4Request cmRepoRequest = new ClouderaManagerRepositoryV4Request();
    cmRequest.setRepository(cmRepoRequest);
    clusterV4Request.setCm(cmRequest);
    boolean base = underTest.shouldUseBaseCMImage(clusterV4Request, YARN_PLATFORM);
    assertTrue(base);
}
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) 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) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 84 with ClusterV4Request

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

the class ClusterCreationEnvironmentValidatorTest method testAutoTlsConfigurations.

// CHECKSTYLE:ON
// @formatter:on
@ParameterizedTest(name = "{0}")
@MethodSource("autoTlsConfigurations")
@MockitoSettings(strictness = Strictness.LENIENT)
void testAutoTlsConfigurations(String testName, boolean cmAutoTls, boolean providerAutoTls, boolean expectedHasErrors) {
    // GIVEN
    Stack stack = getStack();
    ClusterV4Request clusterRequest = new ClusterV4Request();
    ClouderaManagerV4Request cmRequest = new ClouderaManagerV4Request();
    cmRequest.setEnableAutoTls(cmAutoTls);
    clusterRequest.setCm(cmRequest);
    DetailedEnvironmentResponse environment = getEnvironmentResponse();
    when(platformParameters.isAutoTlsSupported()).thenReturn(providerAutoTls);
    when(sdxClientService.getByEnvironmentCrn(any())).thenReturn(Arrays.asList(new SdxClusterResponse()));
    ValidationResult.ValidationResultBuilder validationBuilder = ValidationResult.builder();
    // WHEN
    underTest.validateAutoTls(clusterRequest, stack, validationBuilder, environment.getParentEnvironmentCloudPlatform());
    // THEN
    ValidationResult actualResult = validationBuilder.build();
    assertEquals(expectedHasErrors, actualResult.hasError());
    if (expectedHasErrors) {
        assertEquals(1, actualResult.getErrors().size());
        assertTrue(actualResult.getErrors().contains("AutoTLS is not supported by 'aws' platform!"));
    }
}
Also used : ClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) ValidationResult(com.sequenceiq.cloudbreak.validation.ValidationResult) SdxClusterResponse(com.sequenceiq.sdx.api.model.SdxClusterResponse) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) ClouderaManagerV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.cm.ClouderaManagerV4Request) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource) MockitoSettings(org.mockito.junit.jupiter.MockitoSettings)

Example 85 with ClusterV4Request

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

the class RdsConfigValidatorTest method requestWithDatabases.

private ClusterV4Request requestWithDatabases(DatabaseType... databaseTypes) {
    List<RDSConfig> rdsConfigs = Arrays.stream(databaseTypes).map(TestUtil::rdsConfig).collect(toList());
    rdsConfigs.forEach(each -> when(rdsConfigService.getByNameForWorkspace(each.getName(), workspace)).thenReturn(each));
    ClusterV4Request request = new ClusterV4Request();
    request.setDatabases(rdsConfigs.stream().map(RDSConfig::getName).collect(toSet()));
    return request;
}
Also used : ClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request) RDSConfig(com.sequenceiq.cloudbreak.domain.RDSConfig)

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