Search in sources :

Example 16 with BlueprintView

use of com.sequenceiq.cloudbreak.template.views.BlueprintView in project cloudbreak by hortonworks.

the class SqlStreamBuilderAdminDatabaseConfigProviderTest method initTemplatePreparationObject.

private TemplatePreparationObject initTemplatePreparationObject(CmTemplateProcessor cmTemplateProcessor) {
    HostgroupView manager = new HostgroupView("manager", 1, InstanceGroupType.GATEWAY, 1);
    HostgroupView master = new HostgroupView("master", 1, InstanceGroupType.CORE, 2);
    HostgroupView worker = new HostgroupView("worker", 2, InstanceGroupType.CORE, 3);
    BlueprintView blueprintView = new BlueprintView(null, null, null, cmTemplateProcessor);
    RDSConfig rdsConfig = new RDSConfig();
    rdsConfig.setType(DatabaseType.SQL_STREAM_BUILDER_ADMIN.toString());
    rdsConfig.setDatabaseEngine(DatabaseVendor.POSTGRES);
    rdsConfig.setConnectionDriver(DatabaseVendor.POSTGRES.connectionDriver());
    rdsConfig.setConnectionURL("jdbc:postgresql://testhost:5432/eventador_admin");
    rdsConfig.setConnectionUserName("ssb_test_user");
    rdsConfig.setConnectionPassword("ssb_test_pw");
    return TemplatePreparationObject.Builder.builder().withBlueprintView(blueprintView).withHostgroupViews(Set.of(manager, master, worker)).withRdsConfigs(Set.of(rdsConfig)).build();
}
Also used : BlueprintView(com.sequenceiq.cloudbreak.template.views.BlueprintView) RDSConfig(com.sequenceiq.cloudbreak.domain.RDSConfig) HostgroupView(com.sequenceiq.cloudbreak.template.views.HostgroupView)

Example 17 with BlueprintView

use of com.sequenceiq.cloudbreak.template.views.BlueprintView in project cloudbreak by hortonworks.

the class StackV4RequestToTemplatePreparationObjectConverterTest method getBlueprintView.

private BlueprintView getBlueprintView() {
    BlueprintView blueprint = new BlueprintView();
    blueprint.setVersion("7.2.14");
    return blueprint;
}
Also used : BlueprintView(com.sequenceiq.cloudbreak.template.views.BlueprintView)

Example 18 with BlueprintView

use of com.sequenceiq.cloudbreak.template.views.BlueprintView in project cloudbreak by hortonworks.

the class StackV4RequestToTemplatePreparationObjectConverterTest method testConvertWhenProvidingDataThenBlueprintWithExpectedDataShouldBeStored.

@Test
public void testConvertWhenProvidingDataThenBlueprintWithExpectedDataShouldBeStored() {
    String stackVersion = TEST_VERSION;
    String stackType = "HDP";
    when(blueprintStackInfo.getVersion()).thenReturn(stackVersion);
    when(blueprintStackInfo.getType()).thenReturn(stackType);
    BlueprintView expected = mock(BlueprintView.class);
    when(blueprintViewProvider.getBlueprintView(blueprint)).thenReturn(expected);
    TemplatePreparationObject result = underTest.convert(source);
    assertSame(expected, result.getBlueprintView());
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) BlueprintView(com.sequenceiq.cloudbreak.template.views.BlueprintView) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Test(org.junit.Test)

Example 19 with BlueprintView

use of com.sequenceiq.cloudbreak.template.views.BlueprintView in project cloudbreak by hortonworks.

the class BlueprintViewProviderTest method testUsesProcessorFromFactory.

private void testUsesProcessorFromFactory(BlueprintTextProcessor processor) {
    when(blueprintTextProcessorFactory.createBlueprintTextProcessor(TEST_BLUEPRINT_TEXT)).thenReturn(processor);
    BlueprintView blueprintView = subject.getBlueprintView(blueprint);
    assertEquals(TEST_BLUEPRINT_TEXT, blueprintView.getBlueprintText());
    assertEquals(TEST_STACK_TYPE, blueprintView.getType());
    assertEquals(TEST_STACK_VERSION, blueprintView.getVersion());
    assertSame(processor, blueprintView.getProcessor());
}
Also used : BlueprintView(com.sequenceiq.cloudbreak.template.views.BlueprintView)

Example 20 with BlueprintView

use of com.sequenceiq.cloudbreak.template.views.BlueprintView in project cloudbreak by hortonworks.

the class HdfsRoleConfigProviderTest method nameNodeHA.

@Test
void nameNodeHA() {
    HostgroupView gateway = new HostgroupView("gateway", 1, InstanceGroupType.GATEWAY, 1);
    HostgroupView master = new HostgroupView("master", 0, InstanceGroupType.CORE, 2);
    HostgroupView quorum = new HostgroupView("quorum", 0, InstanceGroupType.CORE, 3);
    HostgroupView worker = new HostgroupView("worker", 0, InstanceGroupType.CORE, 3);
    String inputJson = FileReaderUtils.readFileFromClasspathQuietly("input/namenode-ha.bp");
    CmTemplateProcessor cmTemplateProcessor = new CmTemplateProcessor(inputJson);
    TemplatePreparationObject preparationObject = TemplatePreparationObject.Builder.builder().withHostgroupViews(Set.of(gateway, master, quorum, worker)).withBlueprintView(new BlueprintView(inputJson, "CDP", "1.0", cmTemplateProcessor)).build();
    Map<String, List<ApiClusterTemplateConfig>> roleConfigs = subject.getRoleConfigs(cmTemplateProcessor, preparationObject);
    List<ApiClusterTemplateConfig> namenodeConfigs = roleConfigs.get("hdfs-NAMENODE-BASE");
    Map<String, ApiClusterTemplateConfig> configMap = cmTemplateProcessor.mapByName(namenodeConfigs);
    assertEquals(NN_HA_PROPERTIES, configMap.keySet());
    assertEquals("true", configMap.get("autofailover_enabled").getValue());
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) BlueprintView(com.sequenceiq.cloudbreak.template.views.BlueprintView) List(java.util.List) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) HostgroupView(com.sequenceiq.cloudbreak.template.views.HostgroupView) Test(org.junit.jupiter.api.Test)

Aggregations

BlueprintView (com.sequenceiq.cloudbreak.template.views.BlueprintView)46 TemplatePreparationObject (com.sequenceiq.cloudbreak.template.TemplatePreparationObject)32 GeneralClusterConfigs (com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs)19 ApiClusterTemplateConfig (com.cloudera.api.swagger.model.ApiClusterTemplateConfig)15 CmTemplateProcessor (com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor)14 HostgroupView (com.sequenceiq.cloudbreak.template.views.HostgroupView)14 Test (org.junit.jupiter.api.Test)14 RDSConfig (com.sequenceiq.cloudbreak.domain.RDSConfig)13 BlueprintTextProcessor (com.sequenceiq.cloudbreak.template.processor.BlueprintTextProcessor)13 Test (org.junit.Test)13 Gateway (com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway)11 ClouderaManagerRepo (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo)9 Builder (com.sequenceiq.cloudbreak.template.TemplatePreparationObject.Builder)9 VirtualGroupRequest (com.sequenceiq.cloudbreak.auth.altus.VirtualGroupRequest)8 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)8 ClouderaManagerProduct (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct)7 HashSet (java.util.HashSet)7 IdBroker (com.sequenceiq.cloudbreak.domain.stack.cluster.IdBroker)6 ApiClusterTemplateVariable (com.cloudera.api.swagger.model.ApiClusterTemplateVariable)5 DatalakeView (com.sequenceiq.cloudbreak.template.views.DatalakeView)5