use of com.sequenceiq.cloudbreak.blueprint.template.views.HostgroupView in project cloudbreak by hortonworks.
the class HadoopConfigurationUtilsTests method testFindHostGroupForNode.
@Test
public void testFindHostGroupForNode() {
HostgroupView hostGroup = new HostgroupView("hostGroupName", 1, InstanceGroupType.CORE, 1);
Collection<HostgroupView> hostGroups = singletonList(hostGroup);
HostgroupView actual = underTest.findHostGroupForNode(hostGroups, "hostGroupName");
Assert.assertEquals(actual, hostGroup);
}
use of com.sequenceiq.cloudbreak.blueprint.template.views.HostgroupView in project cloudbreak by hortonworks.
the class StackRequestToBlueprintPreparationObjectConverter method convert.
@Override
public BlueprintPreparationObject convert(StackV2Request source) {
try {
IdentityUser identityUser = userDetailsService.getDetails(source.getOwner(), UserFilterField.USERID);
FlexSubscription flexSubscription = getFlexSubscription(source);
String smartsenseSubscriptionId = getSmartsenseSubscriptionId(source, flexSubscription);
KerberosConfig kerberosConfig = getKerberosConfig(source);
LdapConfig ldapConfig = getLdapConfig(source, identityUser);
FileSystemConfigurationView fileSystemConfigurationView = getFileSystemConfigurationView(source);
Set<RDSConfig> rdsConfigs = getRdsConfigs(source, identityUser);
Blueprint blueprint = getBlueprint(source, identityUser);
BlueprintStackInfo blueprintStackInfo = stackInfoService.blueprintStackInfo(blueprint.getBlueprintText());
Set<HostgroupView> hostgroupViews = getHostgroupViews(source);
BlueprintView blueprintView = new BlueprintView(blueprint.getBlueprintText(), blueprintStackInfo.getVersion(), blueprintStackInfo.getType());
GeneralClusterConfigs generalClusterConfigs = generalClusterConfigsProvider.generalClusterConfigs(source, identityUser);
return BlueprintPreparationObject.Builder.builder().withFlexSubscription(flexSubscription).withRdsConfigs(rdsConfigs).withHostgroupViews(hostgroupViews).withBlueprintView(blueprintView).withStackRepoDetailsHdpVersion(blueprintStackInfo.getVersion()).withFileSystemConfigurationView(fileSystemConfigurationView).withGeneralClusterConfigs(generalClusterConfigs).withSmartSenseSubscriptionId(smartsenseSubscriptionId).withLdapConfig(ldapConfig).withKerberosConfig(kerberosConfig).build();
} catch (BlueprintProcessingException e) {
throw new CloudbreakServiceException(e.getMessage(), e);
} catch (IOException e) {
throw new CloudbreakServiceException(e.getMessage(), e);
}
}
use of com.sequenceiq.cloudbreak.blueprint.template.views.HostgroupView in project cloudbreak by hortonworks.
the class ConfigUtilsTest method testIsConfigNeedTrue.
@Test
public void testIsConfigNeedTrue() {
HostgroupView hostGroup = new HostgroupView("hostGroupName1", 1, InstanceGroupType.CORE, 1);
boolean actual = underTest.isConfigUpdateNeeded(hostGroup);
Assert.assertTrue(actual);
}
use of com.sequenceiq.cloudbreak.blueprint.template.views.HostgroupView in project cloudbreak by hortonworks.
the class HadoopConfigurationUtilsTests method testFindHostGroupForNodeWhenNotFound.
@Test
public void testFindHostGroupForNodeWhenNotFound() {
expectedException.expect(BlueprintProcessingException.class);
expectedException.expectMessage("Couldn't find a saved hostgroup for [hostGroupName] hostgroup name in the validation.");
HostgroupView hostGroup = new HostgroupView("hostGroupName1", 1, InstanceGroupType.CORE, 1);
Collection<HostgroupView> hostGroups = singletonList(hostGroup);
underTest.findHostGroupForNode(hostGroups, "hostGroupName");
}
use of com.sequenceiq.cloudbreak.blueprint.template.views.HostgroupView in project cloudbreak by hortonworks.
the class ConfigService method getComponentsByHostGroup.
public Map<String, Map<String, String>> getComponentsByHostGroup(BlueprintTextProcessor blueprintProcessor, Collection<HostgroupView> hostGroups) {
Map<String, Map<String, String>> config = new HashMap<>();
Map<String, Set<String>> componentsByHostGroup = blueprintProcessor.getComponentsByHostGroup();
componentsByHostGroup.forEach((hostGoupName, value) -> {
HostgroupView hostGroup = hadoopConfigurationUtils.findHostGroupForNode(hostGroups, hostGoupName);
int volumeCount = configUtils.isConfigUpdateNeeded(hostGroup) ? 0 : -1;
value.stream().map(componentName -> configUtils.getServiceConfig(componentName, serviceConfigs)).filter(Objects::nonNull).forEach(serviceConfig -> {
Set<String> hostComponents = blueprintProcessor.getComponentsInHostGroup(hostGoupName);
config.putAll(configUtils.getProperties(serviceConfig, true, volumeCount, hostComponents));
});
});
return config;
}
Aggregations