use of com.sequenceiq.cloudbreak.blueprint.template.views.HostgroupView in project cloudbreak by hortonworks.
the class ConfigServiceTest method testGetHostGroupConfiguration.
@Test
public void testGetHostGroupConfiguration() throws IOException {
init();
HostgroupView hostGroup = new HostgroupView("hostGroup", 10, InstanceGroupType.CORE, 1);
Set<String> components = singleton("component");
BlueprintTextProcessor blueprintTextProcessor = mock(BlueprintTextProcessor.class);
Map<String, Map<String, String>> properties = new HashMap<>();
properties.put("key", singletonMap("propKey", "propValue"));
when(configUtils.isConfigUpdateNeeded(hostGroup)).thenReturn(true);
when(blueprintTextProcessor.getComponentsInHostGroup(hostGroup.getName())).thenReturn(components);
when(configUtils.getProperties(any(ServiceConfig.class), eq(false), eq(10), eq(components))).thenReturn(properties);
Map<String, Map<String, Map<String, String>>> actual = underTest.getHostGroupConfiguration(blueprintTextProcessor, singletonList(hostGroup));
Map<String, Map<String, Map<String, String>>> expected = new HashMap<>();
expected.put("hostGroup", properties);
Assert.assertEquals(actual, expected);
}
use of com.sequenceiq.cloudbreak.blueprint.template.views.HostgroupView in project cloudbreak by hortonworks.
the class ConfigServiceTest method testGetHostGroupConfigurationWhenConfigUpdateIsNotNeed.
@Test
public void testGetHostGroupConfigurationWhenConfigUpdateIsNotNeed() throws IOException {
HostgroupView hostGroup = new HostgroupView("hostGroupName");
BlueprintTextProcessor blueprintTextProcessor = mock(BlueprintTextProcessor.class);
when(configUtils.isConfigUpdateNeeded(hostGroup)).thenReturn(false);
Map<String, Map<String, Map<String, String>>> actual = underTest.getHostGroupConfiguration(blueprintTextProcessor, singletonList(hostGroup));
Assert.assertEquals(actual, emptyMap());
}
use of com.sequenceiq.cloudbreak.blueprint.template.views.HostgroupView in project cloudbreak by hortonworks.
the class ConfigServiceTest method testGetHostGroupConfigurationWhenTemplateIsNull.
@Test
public void testGetHostGroupConfigurationWhenTemplateIsNull() throws IOException {
init();
HostgroupView hostGroup = new HostgroupView("hostGroup");
Set<String> components = singleton("component");
BlueprintTextProcessor blueprintTextProcessor = mock(BlueprintTextProcessor.class);
Map<String, Map<String, String>> properties = new HashMap<>();
properties.put("key", singletonMap("propKey", "propValue"));
when(configUtils.isConfigUpdateNeeded(hostGroup)).thenReturn(true);
when(blueprintTextProcessor.getComponentsInHostGroup(hostGroup.getName())).thenReturn(components);
when(configUtils.getProperties(any(ServiceConfig.class), eq(false), eq(-1), eq(components))).thenReturn(properties);
Map<String, Map<String, Map<String, String>>> actual = underTest.getHostGroupConfiguration(blueprintTextProcessor, singletonList(hostGroup));
Map<String, Map<String, Map<String, String>>> expected = new HashMap<>();
expected.put("hostGroup", properties);
Assert.assertEquals(actual, expected);
}
use of com.sequenceiq.cloudbreak.blueprint.template.views.HostgroupView in project cloudbreak by hortonworks.
the class ConfigServiceTest method testGetHostGroupConfigurationWhenConfigServiceIsEmpty.
@Test
public void testGetHostGroupConfigurationWhenConfigServiceIsEmpty() throws IOException {
ArrayNode rootJsonNode = JsonNodeFactory.instance.arrayNode();
when(configUtils.readConfigJson("hdp/bp-config.json", "sites")).thenReturn(rootJsonNode);
rootJsonNode = JsonNodeFactory.instance.arrayNode();
when(configUtils.readConfigJson("hdp/service-config.json", "services")).thenReturn(rootJsonNode);
underTest.init();
HostgroupView hostGroup = new HostgroupView("hostGroup", 1, InstanceGroupType.CORE, 1);
BlueprintTextProcessor blueprintTextProcessor = mock(BlueprintTextProcessor.class);
Map<String, Map<String, String>> properties = new HashMap<>();
when(configUtils.isConfigUpdateNeeded(hostGroup)).thenReturn(true);
Map<String, Map<String, Map<String, String>>> actual = underTest.getHostGroupConfiguration(blueprintTextProcessor, singletonList(hostGroup));
Map<String, Map<String, Map<String, String>>> expected = new HashMap<>();
expected.put("hostGroup", properties);
Assert.assertEquals(actual, expected);
}
use of com.sequenceiq.cloudbreak.blueprint.template.views.HostgroupView in project cloudbreak by hortonworks.
the class ConfigUtilsTest method testIsConfigNeedFalse.
@Test
public void testIsConfigNeedFalse() {
HostgroupView hostGroup = new HostgroupView("hostGroupName1");
boolean actual = underTest.isConfigUpdateNeeded(hostGroup);
Assert.assertFalse(actual);
}
Aggregations