Search in sources :

Example 6 with HostgroupView

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);
}
Also used : HostgroupView(com.sequenceiq.cloudbreak.blueprint.template.views.HostgroupView) Test(org.junit.Test)

Example 7 with HostgroupView

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);
    }
}
Also used : BlueprintProcessingException(com.sequenceiq.cloudbreak.blueprint.BlueprintProcessingException) GeneralClusterConfigs(com.sequenceiq.cloudbreak.blueprint.templates.GeneralClusterConfigs) RDSConfig(com.sequenceiq.cloudbreak.domain.RDSConfig) Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) BlueprintView(com.sequenceiq.cloudbreak.blueprint.template.views.BlueprintView) CloudbreakServiceException(com.sequenceiq.cloudbreak.service.CloudbreakServiceException) KerberosConfig(com.sequenceiq.cloudbreak.domain.KerberosConfig) IOException(java.io.IOException) IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) LdapConfig(com.sequenceiq.cloudbreak.domain.LdapConfig) BlueprintStackInfo(com.sequenceiq.cloudbreak.blueprint.templates.BlueprintStackInfo) FlexSubscription(com.sequenceiq.cloudbreak.domain.FlexSubscription) FileSystemConfigurationView(com.sequenceiq.cloudbreak.blueprint.template.views.FileSystemConfigurationView) HostgroupView(com.sequenceiq.cloudbreak.blueprint.template.views.HostgroupView)

Example 8 with HostgroupView

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);
}
Also used : HostgroupView(com.sequenceiq.cloudbreak.blueprint.template.views.HostgroupView) Test(org.junit.Test)

Example 9 with HostgroupView

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");
}
Also used : HostgroupView(com.sequenceiq.cloudbreak.blueprint.template.views.HostgroupView) Test(org.junit.Test)

Example 10 with HostgroupView

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;
}
Also used : Set(java.util.Set) HashMap(java.util.HashMap) HostgroupView(com.sequenceiq.cloudbreak.blueprint.template.views.HostgroupView) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

HostgroupView (com.sequenceiq.cloudbreak.blueprint.template.views.HostgroupView)16 Test (org.junit.Test)13 HashMap (java.util.HashMap)10 Map (java.util.Map)10 Collections.emptyMap (java.util.Collections.emptyMap)9 Collections.singletonMap (java.util.Collections.singletonMap)9 Set (java.util.Set)6 Collections.emptySet (java.util.Collections.emptySet)4 JsonIgnoreProperties (com.fasterxml.jackson.annotation.JsonIgnoreProperties)1 JsonPropertyOrder (com.fasterxml.jackson.annotation.JsonPropertyOrder)1 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)1 GATEWAY (com.sequenceiq.cloudbreak.api.model.InstanceGroupType.GATEWAY)1 BlueprintComponentConfigProvider (com.sequenceiq.cloudbreak.blueprint.BlueprintComponentConfigProvider)1 BlueprintConfigurationEntry (com.sequenceiq.cloudbreak.blueprint.BlueprintConfigurationEntry)1 BlueprintPreparationObject (com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject)1 BlueprintProcessingException (com.sequenceiq.cloudbreak.blueprint.BlueprintProcessingException)1 BlueprintProcessorFactory (com.sequenceiq.cloudbreak.blueprint.BlueprintProcessorFactory)1 BlueprintTextProcessor (com.sequenceiq.cloudbreak.blueprint.BlueprintTextProcessor)1 SmartsenseConfigurationLocator (com.sequenceiq.cloudbreak.blueprint.SmartsenseConfigurationLocator)1