use of com.sequenceiq.sdx.api.model.SdxClusterResponse in project cloudbreak by hortonworks.
the class StackV4RequestToTemplatePreparationObjectConverter method decorateDatalakeView.
private void decorateDatalakeView(StackV4Request source, TemplatePreparationObject.Builder builder) {
DatalakeView datalakeView = null;
if (StringUtils.isNotEmpty(source.getEnvironmentCrn()) && StackType.WORKLOAD.equals(source.getType())) {
List<SdxClusterResponse> datalakes = sdxClientService.getByEnvironmentCrn(source.getEnvironmentCrn());
if (!datalakes.isEmpty()) {
datalakeView = new DatalakeView(datalakes.get(0).getRangerRazEnabled());
}
}
builder.withDataLakeView(datalakeView);
}
use of com.sequenceiq.sdx.api.model.SdxClusterResponse in project cloudbreak by hortonworks.
the class ClusterCreationEnvironmentValidatorTest method testValidateShouldWorkWhenStackEnvIsNullButResourcesCouldBeFoundInTheSameWorkspace.
@Test
void testValidateShouldWorkWhenStackEnvIsNullButResourcesCouldBeFoundInTheSameWorkspace() {
// GIVEN
Stack stack = getStack();
stack.setEnvironmentCrn(null);
DetailedEnvironmentResponse environment = getEnvironmentResponse();
when(sdxClientService.getByEnvironmentCrn(any())).thenReturn(Arrays.asList(new SdxClusterResponse()));
ValidationResult.ValidationResultBuilder validationBuilder = ValidationResult.builder();
// WHEN
underTest.validate(stack, environment, true, validationBuilder);
// THEN
ValidationResult actualResult = validationBuilder.build();
assertFalse(actualResult.hasError());
}
use of com.sequenceiq.sdx.api.model.SdxClusterResponse in project cloudbreak by hortonworks.
the class ClusterCreationEnvironmentValidatorTest method testValidateShouldBeSuccessWhenStackRegionIsRegionDisplayNameAndEnvironmentsRegionsAreRegionNames.
@Test
void testValidateShouldBeSuccessWhenStackRegionIsRegionDisplayNameAndEnvironmentsRegionsAreRegionNames() {
// GIVEN
String westUs2RegionName = "westus2";
String westUs2RegionDisplayName = "West US 2";
Stack stack = getStack();
stack.setRegion(westUs2RegionDisplayName);
DetailedEnvironmentResponse environment = getEnvironmentResponse();
CompactRegionResponse regions = new CompactRegionResponse();
regions.getNames().add(westUs2RegionName);
regions.getNames().add("westus");
environment.setRegions(regions);
when(connector.displayNameToRegion(any())).thenReturn(westUs2RegionName);
when(connector.regionToDisplayName(any())).thenReturn(westUs2RegionDisplayName);
when(sdxClientService.getByEnvironmentCrn(any())).thenReturn(Arrays.asList(new SdxClusterResponse()));
ValidationResult.ValidationResultBuilder validationBuilder = ValidationResult.builder();
// WHEN
underTest.validate(stack, environment, true, validationBuilder);
// THEN
ValidationResult actualResult = validationBuilder.build();
assertFalse(actualResult.hasError());
}
use of com.sequenceiq.sdx.api.model.SdxClusterResponse 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!"));
}
}
use of com.sequenceiq.sdx.api.model.SdxClusterResponse in project cloudbreak by hortonworks.
the class ClusterCreationEnvironmentValidatorTest method testValidateShouldBeSuccessWhenStackRegionIsRegionNameAndEnvironmentsRegionsAreDisplayNames.
@Test
void testValidateShouldBeSuccessWhenStackRegionIsRegionNameAndEnvironmentsRegionsAreDisplayNames() {
// GIVEN
String westUs2RegionName = "westus2";
String westUs2RegionDisplayName = "West US 2";
Stack stack = getStack();
stack.setRegion(westUs2RegionName);
DetailedEnvironmentResponse environment = getEnvironmentResponse();
CompactRegionResponse regions = new CompactRegionResponse();
regions.getNames().add(westUs2RegionDisplayName);
regions.getNames().add("West US");
environment.setRegions(regions);
when(connector.displayNameToRegion(any())).thenReturn(westUs2RegionName);
when(connector.regionToDisplayName(any())).thenReturn(westUs2RegionDisplayName);
when(sdxClientService.getByEnvironmentCrn(any())).thenReturn(Arrays.asList(new SdxClusterResponse()));
ValidationResult.ValidationResultBuilder validationBuilder = ValidationResult.builder();
// WHEN
underTest.validate(stack, environment, true, validationBuilder);
// THEN
ValidationResult actualResult = validationBuilder.build();
assertFalse(actualResult.hasError());
}
Aggregations