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());
}
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);
}
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);
}
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);
}
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());
}
Aggregations