Search in sources :

Example 6 with ClusterV4Request

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

the class ClusterV4RequestToClusterConverterTest method testConvertWheBlueprintDoesNotExists.

@Test
public void testConvertWheBlueprintDoesNotExists() {
    Mockito.reset(cloudStorageValidationUtil);
    String blueprintName = "bp-name";
    ClusterV4Request source = new ClusterV4Request();
    source.setBlueprintName(blueprintName);
    when(blueprintService.getByNameForWorkspaceAndLoadDefaultsIfNecessary(blueprintName, workspace)).thenReturn(null);
    Exception exception = assertThrows(NotFoundException.class, () -> underTest.convert(source));
    assertEquals("Cluster definition does not exist by name: bp-name", exception.getMessage());
}
Also used : ClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) NotFoundException(com.sequenceiq.cloudbreak.common.exception.NotFoundException) Test(org.junit.jupiter.api.Test)

Example 7 with ClusterV4Request

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

the class AutoTlsFlagPreparatoryTest method testAutoTlsSettingFromPlatformParameterWithoutParent.

@ParameterizedTest
@ValueSource(strings = { "true", "false" })
public void testAutoTlsSettingFromPlatformParameterWithoutParent(String value) {
    ClusterV4Request request = new ClusterV4Request();
    Stack stack = new Stack();
    stack.setPlatformVariant("var");
    stack.setCloudPlatform("magic");
    CloudConnector<Object> connector = mock(CloudConnector.class);
    when(cloudPlatformConnectors.get(Platform.platform("magic"), Variant.variant("var"))).thenReturn(connector);
    PlatformParameters platformParameters = mock(PlatformParameters.class);
    when(connector.parameters()).thenReturn(platformParameters);
    when(platformParameters.isAutoTlsSupported()).thenReturn(Boolean.valueOf(value));
    boolean result = underTest.provideAutoTlsFlag(request, stack, Optional.empty());
    assertEquals(Boolean.valueOf(value), result);
}
Also used : ClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request) PlatformParameters(com.sequenceiq.cloudbreak.cloud.PlatformParameters) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 8 with ClusterV4Request

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

the class AutoTlsFlagPreparatoryTest method testAutoTlsSettingFromRequest.

@ParameterizedTest
@ValueSource(strings = { "true", "false" })
public void testAutoTlsSettingFromRequest(String value) {
    ClusterV4Request request = new ClusterV4Request();
    request.setCm(new ClouderaManagerV4Request());
    request.getCm().setEnableAutoTls(Boolean.valueOf(value));
    boolean result = underTest.provideAutoTlsFlag(request, new Stack(), Optional.empty());
    verifyNoInteractions(cloudPlatformConnectors);
    assertEquals(Boolean.valueOf(value), result);
}
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) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 9 with ClusterV4Request

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

the class ClusterToClusterV4RequestConverterTest method testConvertWhenFileSystemNotNullThenExpectedCloudStorageRequestShouldBePlaced.

@Test
public void testConvertWhenFileSystemNotNullThenExpectedCloudStorageRequestShouldBePlaced() {
    FileSystem fileSystem = new FileSystem();
    CloudStorageRequest expected = new CloudStorageRequest();
    when(cluster.getFileSystem()).thenReturn(fileSystem);
    when(cloudStorageConverter.fileSystemToRequest(fileSystem)).thenReturn(expected);
    ClusterV4Request result = underTest.convert(cluster);
    assertEquals(expected, result.getCloudStorage());
    verify(cloudStorageConverter, times(1)).fileSystemToRequest(fileSystem);
}
Also used : ClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request) CloudStorageRequest(com.sequenceiq.common.api.cloudstorage.CloudStorageRequest) FileSystem(com.sequenceiq.cloudbreak.domain.FileSystem) Test(org.junit.Test)

Example 10 with ClusterV4Request

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

the class ClusterToClusterV4RequestConverterTest method testConvertWhenProxyConfigIsNullThenProxyNameShouldBeNull.

@Test
public void testConvertWhenProxyConfigIsNullThenProxyNameShouldBeNull() {
    when(cluster.getProxyConfigCrn()).thenReturn(null);
    ClusterV4Request result = underTest.convert(cluster);
    assertNull(result.getProxyConfigCrn());
}
Also used : ClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request) Test(org.junit.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