use of com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs in project cloudbreak by hortonworks.
the class StackToTemplatePreparationObjectConverterTest method testConvertWhenGeneralClusterConfigsProvidedThenThisShouldBeStored.
@Test
public void testConvertWhenGeneralClusterConfigsProvidedThenThisShouldBeStored() {
GeneralClusterConfigs expected = mock(GeneralClusterConfigs.class);
when(generalClusterConfigsProvider.generalClusterConfigs(stackMock, cluster)).thenReturn(expected);
when(blueprintViewProvider.getBlueprintView(any())).thenReturn(getBlueprintView());
TemplatePreparationObject result = underTest.convert(stackMock);
assertThat(result.getGeneralClusterConfigs()).isEqualTo(expected);
}
use of com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs in project cloudbreak by hortonworks.
the class StackV4RequestToTemplatePreparationObjectConverterTest method testConvertWhenObtainingGeneralClusterConfigsFromGeneralClusterConfigsProviderThenItsReturnValueShouldBeStored.
@Test
public void testConvertWhenObtainingGeneralClusterConfigsFromGeneralClusterConfigsProviderThenItsReturnValueShouldBeStored() {
GeneralClusterConfigs expected = new GeneralClusterConfigs();
when(generalClusterConfigsProvider.generalClusterConfigs(eq(source), anyString(), anyString())).thenReturn(expected);
TemplatePreparationObject result = underTest.convert(source);
assertEquals(expected, result.getGeneralClusterConfigs());
}
use of com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs in project cloudbreak by hortonworks.
the class StackV4RequestToTemplatePreparationObjectConverter method convert.
public TemplatePreparationObject convert(StackV4Request source) {
try {
CloudbreakUser cloudbreakUser = restRequestThreadLocalService.getCloudbreakUser();
User user = userService.getOrCreate(cloudbreakUser);
Workspace workspace = workspaceService.get(restRequestThreadLocalService.getRequestedWorkspaceId(), user);
DetailedEnvironmentResponse environment = environmentClientService.getByCrn(source.getEnvironmentCrn());
Credential credential = getCredential(source, environment);
LdapView ldapConfig = getLdapConfig(source, environment);
BaseFileSystemConfigurationsView fileSystemConfigurationView = getFileSystemConfigurationView(source, credential.getAttributes());
Set<RDSConfig> rdsConfigs = getRdsConfigs(source, workspace);
Blueprint blueprint = getBlueprint(source, workspace);
Set<HostgroupView> hostgroupViews = getHostgroupViews(source);
Gateway gateway = source.getCluster().getGateway() == null ? null : stackV4RequestToGatewayConverter.convert(source);
BlueprintView blueprintView = blueprintViewProvider.getBlueprintView(blueprint);
Optional<String> version = Optional.ofNullable(blueprintView.getVersion());
GeneralClusterConfigs generalClusterConfigs = generalClusterConfigsProvider.generalClusterConfigs(source, cloudbreakUser.getEmail(), blueprintService.getBlueprintVariant(blueprint));
String gatewaySignKey = null;
if (gateway != null) {
gatewaySignKey = gateway.getSignKey();
}
String envCrnForVirtualGroups = getEnvironmentCrnForVirtualGroups(environment);
VirtualGroupRequest virtualGroupRequest = new VirtualGroupRequest(envCrnForVirtualGroups, ldapConfig != null ? ldapConfig.getAdminGroup() : "");
Builder builder = Builder.builder().withCloudPlatform(source.getCloudPlatform()).withRdsConfigs(rdsConfigs).withHostgroupViews(hostgroupViews).withGateway(gateway, gatewaySignKey, exposedServiceCollector.getAllKnoxExposed(version)).withBlueprintView(blueprintView).withFileSystemConfigurationView(fileSystemConfigurationView).withGeneralClusterConfigs(generalClusterConfigs).withLdapConfig(ldapConfig).withCustomInputs(source.getInputs()).withKerberosConfig(getKerberosConfig(source, environment)).withStackType(source.getType()).withVirtualGroupView(virtualGroupRequest);
decorateBuilderWithPlacement(source, builder);
decorateBuilderWithAccountMapping(source, environment, credential, builder);
decorateBuilderWithProductDetails(source, builder);
decorateDatalakeView(source, builder);
return builder.build();
} catch (BlueprintProcessingException | IOException e) {
throw new CloudbreakServiceException(e.getMessage(), e);
}
}
use of com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs in project cloudbreak by hortonworks.
the class RangerRazDatahubConfigProviderTest method getAdditionalServicesWhenRazIsEnabledWithCm710.
@ParameterizedTest(name = "{0}")
@MethodSource("razCloudPlatformDataProvider")
@DisplayName("CM 7.1.0 DH is used and Raz is requested, no additional service needs to be added to the template")
void getAdditionalServicesWhenRazIsEnabledWithCm710(String testCaseName, CloudPlatform cloudPlatform) {
ClouderaManagerRepo cmRepo = new ClouderaManagerRepo();
cmRepo.setVersion("7.1.0");
GeneralClusterConfigs generalClusterConfigs = new GeneralClusterConfigs();
HostgroupView master = new HostgroupView("master", 0, InstanceGroupType.GATEWAY, List.of());
HostgroupView worker = new HostgroupView("worker", 0, InstanceGroupType.CORE, List.of());
TemplatePreparationObject preparationObject = Builder.builder().withStackType(StackType.WORKLOAD).withCloudPlatform(cloudPlatform).withProductDetails(cmRepo, List.of()).withDataLakeView(new DatalakeView(true)).withGeneralClusterConfigs(generalClusterConfigs).withHostgroupViews(Set.of(master, worker)).build();
Map<String, ApiClusterTemplateService> additionalServices = configProvider.getAdditionalServices(cmTemplateProcessor, preparationObject);
assertEquals(0, additionalServices.size());
}
use of com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs in project cloudbreak by hortonworks.
the class RangerRazDatahubConfigProviderTest method getAdditionalServicesWhenRazIsEnabledAndDataLake.
@ParameterizedTest(name = "{0}")
@MethodSource("razCloudPlatformDataProvider")
@DisplayName("CM 7.2.0 DH is used and Raz is requested, but Data Lake, no additional service needs to be added to the template")
void getAdditionalServicesWhenRazIsEnabledAndDataLake(String testCaseName, CloudPlatform cloudPlatform) {
ClouderaManagerRepo cmRepo = new ClouderaManagerRepo();
cmRepo.setVersion("7.2.0");
GeneralClusterConfigs generalClusterConfigs = new GeneralClusterConfigs();
generalClusterConfigs.setEnableRangerRaz(true);
HostgroupView master = new HostgroupView("master", 0, InstanceGroupType.GATEWAY, List.of());
HostgroupView idbroker = new HostgroupView("idbroker", 0, InstanceGroupType.CORE, List.of());
TemplatePreparationObject preparationObject = Builder.builder().withStackType(StackType.DATALAKE).withCloudPlatform(cloudPlatform).withProductDetails(cmRepo, List.of()).withGeneralClusterConfigs(generalClusterConfigs).withHostgroupViews(Set.of(master, idbroker)).build();
Map<String, ApiClusterTemplateService> additionalServices = configProvider.getAdditionalServices(cmTemplateProcessor, preparationObject);
assertEquals(0, additionalServices.size());
}
Aggregations