Search in sources :

Example 11 with ClusterV4Request

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

the class ClusterToClusterV4RequestConverterTest method testConvertWhenClouderaManagerConversionSuccessfulThenExpectedClouderaManagerV4RequestShouldPlacedIn.

@Test
public void testConvertWhenClouderaManagerConversionSuccessfulThenExpectedClouderaManagerV4RequestShouldPlacedIn() {
    ClouderaManagerV4Request expected = mock(ClouderaManagerV4Request.class);
    when(clouderaManagerV4RequestConverter.convert(cluster)).thenReturn(expected);
    ClusterV4Request result = underTest.convert(cluster);
    assertEquals(expected, result.getCm());
}
Also used : ClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request) ClouderaManagerV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.cm.ClouderaManagerV4Request) Test(org.junit.Test)

Example 12 with ClusterV4Request

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

the class ClusterToClusterV4RequestConverterTest method testConvertWhenThereIsNoFileSystemThenCloudStorageIsNull.

@Test
public void testConvertWhenThereIsNoFileSystemThenCloudStorageIsNull() {
    when(cluster.getFileSystem()).thenReturn(null);
    ClusterV4Request result = underTest.convert(cluster);
    assertNull(result.getCloudStorage());
}
Also used : ClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request) Test(org.junit.Test)

Example 13 with ClusterV4Request

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

the class ClusterToClusterV4RequestConverterTest method testConvertWhenRdsConfigsContainsElementsThenUserManagedOnesNameShouldBeStored.

@Test
public void testConvertWhenRdsConfigsContainsElementsThenUserManagedOnesNameShouldBeStored() {
    RDSConfig notUserManaged = new RDSConfig();
    notUserManaged.setId(0L);
    notUserManaged.setStatus(DEFAULT);
    RDSConfig userManaged = new RDSConfig();
    notUserManaged.setId(1L);
    userManaged.setStatus(USER_MANAGED);
    Set<RDSConfig> rdsConfigs = new LinkedHashSet<>(2);
    rdsConfigs.add(notUserManaged);
    rdsConfigs.add(userManaged);
    when(cluster.getRdsConfigs()).thenReturn(rdsConfigs);
    ClusterV4Request result = underTest.convert(cluster);
    assertEquals(1L, result.getDatabases().size());
}
Also used : LinkedHashSet(java.util.LinkedHashSet) ClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request) RDSConfig(com.sequenceiq.cloudbreak.domain.RDSConfig) Test(org.junit.Test)

Example 14 with ClusterV4Request

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

the class ClusterToClusterV4RequestConverterTest method testConvertWhenRdsConfigIsNotNullButItsEmptyThenRdsConfigNamesShouldBeEmpty.

@Test
public void testConvertWhenRdsConfigIsNotNullButItsEmptyThenRdsConfigNamesShouldBeEmpty() {
    when(cluster.getRdsConfigs()).thenReturn(Collections.emptySet());
    ClusterV4Request result = underTest.convert(cluster);
    assertTrue(result.getDatabases().isEmpty());
}
Also used : ClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request) Test(org.junit.Test)

Example 15 with ClusterV4Request

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

the class StackCreatorServiceTest method testShouldUseBaseCMImageWithProductsAndCmRepoAndPlatformIsNotYarn.

@Test
public void testShouldUseBaseCMImageWithProductsAndCmRepoAndPlatformIsNotYarn() {
    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, 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) 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)

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