Search in sources :

Example 26 with BlueprintPreparationObject

use of com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject in project cloudbreak by hortonworks.

the class HadoopConfigurationServiceTest method testConfigure.

@Test
public void testConfigure() throws IOException {
    BlueprintPreparationObject source = Builder.builder().build();
    BlueprintTextProcessor blueprintTextProcessor = mock(BlueprintTextProcessor.class);
    when(configService.getHostGroupConfiguration(blueprintTextProcessor, source.getHostgroupViews())).thenReturn(emptyMap());
    when(configService.getComponentsByHostGroup(blueprintTextProcessor, source.getHostgroupViews())).thenReturn(emptyMap());
    when(blueprintTextProcessor.extendBlueprintHostGroupConfiguration(any(HostgroupConfigurations.class), anyBoolean())).thenReturn(blueprintTextProcessor);
    when(blueprintTextProcessor.extendBlueprintGlobalConfiguration(any(SiteConfigurations.class), anyBoolean())).thenReturn(blueprintTextProcessor);
    BlueprintTextProcessor actual = underTest.customTextManipulation(source, blueprintTextProcessor);
    Assert.assertEquals(blueprintTextProcessor, actual);
}
Also used : HostgroupConfigurations(com.sequenceiq.cloudbreak.blueprint.configuration.HostgroupConfigurations) BlueprintTextProcessor(com.sequenceiq.cloudbreak.blueprint.BlueprintTextProcessor) SiteConfigurations(com.sequenceiq.cloudbreak.blueprint.configuration.SiteConfigurations) BlueprintPreparationObject(com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject) Test(org.junit.Test)

Example 27 with BlueprintPreparationObject

use of com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject in project cloudbreak by hortonworks.

the class HadoopConfigurationServiceTest method testAdditionalCriteriaWhenTrue.

@Test
public void testAdditionalCriteriaWhenTrue() {
    BlueprintPreparationObject source = Builder.builder().withBlueprintView(new BlueprintView("blueprintText", "2.5", "HDP")).build();
    boolean actual = underTest.additionalCriteria(source, "blueprintText");
    Assert.assertTrue(actual);
}
Also used : BlueprintView(com.sequenceiq.cloudbreak.blueprint.template.views.BlueprintView) BlueprintPreparationObject(com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject) Test(org.junit.Test)

Example 28 with BlueprintPreparationObject

use of com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject in project cloudbreak by hortonworks.

the class HbaseConfigProviderTest method testCustomTextManipulationWhenThereAreNoMissingHbaseClients.

@Test
public void testCustomTextManipulationWhenThereAreNoMissingHbaseClients() throws IOException {
    String blueprintText = FileReaderUtils.readFileFromClasspath("blueprints-jackson/bp-kerberized-test.bp");
    BlueprintPreparationObject object = BlueprintPreparationObject.Builder.builder().build();
    Set<String> masters = Sets.newHashSet("master", "slave_1", "slave_2", "compute");
    Set<String> clients = Sets.newHashSet("master", "slave_1", "slave_2", "compute");
    Set<String> missing = Sets.newHashSet();
    when(blueprintProcessor.getHostGroupsWithComponent("HBASE_MASTER")).thenReturn(masters);
    when(blueprintProcessor.getHostGroupsWithComponent("HBASE_CLIENT")).thenReturn(clients);
    when(blueprintProcessor.addComponentToHostgroups("HBASE_CLIENT", missing)).thenReturn(blueprintProcessor);
    when(blueprintProcessor.asText()).thenReturn(blueprintText);
    when(blueprintProcessorFactory.get(anyString())).thenReturn(blueprintProcessor);
    String result = underTest.customTextManipulation(object, blueprintProcessor).asText();
    Assert.assertEquals(blueprintText, result);
    verify(blueprintProcessor, times(1)).getHostGroupsWithComponent("HBASE_MASTER");
    verify(blueprintProcessor, times(1)).getHostGroupsWithComponent("HBASE_CLIENT");
    verify(blueprintProcessor, times(0)).addComponentToHostgroups("HBASE_CLIENT", missing);
}
Also used : BlueprintPreparationObject(com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Aggregations

BlueprintPreparationObject (com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject)28 Test (org.junit.Test)24 Cluster (com.sequenceiq.cloudbreak.domain.Cluster)11 BlueprintView (com.sequenceiq.cloudbreak.blueprint.template.views.BlueprintView)8 BlueprintStackInfo (com.sequenceiq.cloudbreak.blueprint.templates.BlueprintStackInfo)6 BlueprintTextProcessor (com.sequenceiq.cloudbreak.blueprint.BlueprintTextProcessor)5 Matchers.anyString (org.mockito.Matchers.anyString)5 JsonNode (com.fasterxml.jackson.databind.JsonNode)4 GeneralClusterConfigs (com.sequenceiq.cloudbreak.blueprint.templates.GeneralClusterConfigs)4 Blueprint (com.sequenceiq.cloudbreak.domain.Blueprint)4 Stack (com.sequenceiq.cloudbreak.domain.Stack)4 KerberosConfig (com.sequenceiq.cloudbreak.domain.KerberosConfig)2 Json (com.sequenceiq.cloudbreak.domain.json.Json)2 HashMap (java.util.HashMap)2 AmbariClient (com.sequenceiq.ambari.client.AmbariClient)1 GeneratedBlueprintResponse (com.sequenceiq.cloudbreak.api.model.GeneratedBlueprintResponse)1 HostgroupConfigurations (com.sequenceiq.cloudbreak.blueprint.configuration.HostgroupConfigurations)1 SiteConfigurations (com.sequenceiq.cloudbreak.blueprint.configuration.SiteConfigurations)1 HdfConfigs (com.sequenceiq.cloudbreak.blueprint.nifi.HdfConfigs)1 TestFile (com.sequenceiq.cloudbreak.blueprint.testrepeater.TestFile)1