Search in sources :

Example 6 with TemplatePreparationObject

use of com.sequenceiq.cloudbreak.template.TemplatePreparationObject in project cloudbreak by hortonworks.

the class QueryProcessorConfigProviderTest method isConfigurationNeededFalseWhenNoHueQueryProcessorOnClusterr.

@Test
@SuppressWarnings("unchecked")
public void isConfigurationNeededFalseWhenNoHueQueryProcessorOnClusterr() {
    CmTemplateProcessor mockTemplateProcessor = mock(CmTemplateProcessor.class);
    when(mockTemplateProcessor.isRoleTypePresentInService(QueryStoreRoles.QUERY_PROCESSOR, List.of(QueryStoreRoles.QUERY_PROCESSOR))).thenReturn(false);
    RDSConfig rdsConfig = new RDSConfig();
    rdsConfig.setType(QUERY_PROCESSOR);
    rdsConfig.setConnectionURL(String.format("jdbc:%s://%s:%s/%s", DB_PROVIDER, HOST, PORT, DB_NAME));
    rdsConfig.setConnectionUserName(USER_NAME);
    rdsConfig.setConnectionPassword(PASSWORD);
    TemplatePreparationObject tpo = new Builder().withRdsConfigs(Set.of(rdsConfig)).build();
    boolean result = underTest.isConfigurationNeeded(mockTemplateProcessor, tpo);
    assertThat(result).isFalse();
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) RDSConfig(com.sequenceiq.cloudbreak.domain.RDSConfig) Builder(com.sequenceiq.cloudbreak.template.TemplatePreparationObject.Builder) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) Test(org.junit.jupiter.api.Test)

Example 7 with TemplatePreparationObject

use of com.sequenceiq.cloudbreak.template.TemplatePreparationObject in project cloudbreak by hortonworks.

the class QueryProcessorConfigProviderTest method isConfigurationNeededTrue.

@Test
@SuppressWarnings("unchecked")
public void isConfigurationNeededTrue() {
    CmTemplateProcessor mockTemplateProcessor = mock(CmTemplateProcessor.class);
    when(mockTemplateProcessor.isRoleTypePresentInService(QueryStoreRoles.QUERY_PROCESSOR, List.of(QueryStoreRoles.QUERY_PROCESSOR))).thenReturn(true);
    RDSConfig rdsConfig = new RDSConfig();
    rdsConfig.setType(QUERY_PROCESSOR);
    rdsConfig.setConnectionURL(String.format("jdbc:%s://%s:%s/%s", DB_PROVIDER, HOST, PORT, DB_NAME));
    rdsConfig.setConnectionUserName(USER_NAME);
    rdsConfig.setConnectionPassword(PASSWORD);
    TemplatePreparationObject tpo = new Builder().withRdsConfigs(Set.of(rdsConfig)).build();
    boolean result = underTest.isConfigurationNeeded(mockTemplateProcessor, tpo);
    assertThat(result).isTrue();
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) RDSConfig(com.sequenceiq.cloudbreak.domain.RDSConfig) Builder(com.sequenceiq.cloudbreak.template.TemplatePreparationObject.Builder) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) Test(org.junit.jupiter.api.Test)

Example 8 with TemplatePreparationObject

use of com.sequenceiq.cloudbreak.template.TemplatePreparationObject in project cloudbreak by hortonworks.

the class RangerCloudStorageServiceConfigProviderTest method testGetRangerAws720CloudStorageServiceConfigs.

@Test
public void testGetRangerAws720CloudStorageServiceConfigs() {
    CmTemplateProcessor templateProcessor = mock(CmTemplateProcessor.class);
    TemplatePreparationObject preparationObject = getTemplatePreparationObjectForAws(true, false).withBlueprintView(mock(BlueprintView.class)).withCloudPlatform(CloudPlatform.AWS).withProductDetails(new ClouderaManagerRepo().withVersion("7.2.1"), List.of()).build();
    List<ApiClusterTemplateConfig> serviceConfigs = underTest.getServiceConfigs(templateProcessor, preparationObject);
    assertEquals(1, serviceConfigs.size());
    assertEquals("ranger_plugin_hdfs_audit_url", serviceConfigs.get(0).getName());
    assertEquals("s3a://bucket/ranger/audit", serviceConfigs.get(0).getValue());
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) ClouderaManagerRepo(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) Test(org.junit.jupiter.api.Test)

Example 9 with TemplatePreparationObject

use of com.sequenceiq.cloudbreak.template.TemplatePreparationObject in project cloudbreak by hortonworks.

the class RangerCloudStorageServiceConfigProviderTest method testGetRangerAzure720CloudStorageServiceConfigs.

@Test
public void testGetRangerAzure720CloudStorageServiceConfigs() {
    CmTemplateProcessor templateProcessor = mock(CmTemplateProcessor.class);
    TemplatePreparationObject preparationObject = getTemplatePreparationObjectForAzure(false).withBlueprintView(mock(BlueprintView.class)).withCloudPlatform(CloudPlatform.AZURE).withProductDetails(new ClouderaManagerRepo().withVersion("7.2.0"), List.of()).build();
    List<ApiClusterTemplateConfig> serviceConfigs = underTest.getServiceConfigs(templateProcessor, preparationObject);
    assertEquals(1, serviceConfigs.size());
    assertEquals("ranger_plugin_hdfs_audit_url", serviceConfigs.get(0).getName());
    assertEquals("abfs://data@your-san.dfs.core.windows.net/ranger/audit", serviceConfigs.get(0).getValue());
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) ClouderaManagerRepo(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) Test(org.junit.jupiter.api.Test)

Example 10 with TemplatePreparationObject

use of com.sequenceiq.cloudbreak.template.TemplatePreparationObject in project cloudbreak by hortonworks.

the class RangerCloudStorageServiceConfigProviderTest method defaultRangerHdfsAuditUrlWithNamenodeHA.

@Test
public void defaultRangerHdfsAuditUrlWithNamenodeHA() {
    CmTemplateProcessor templateProcessor = mock(CmTemplateProcessor.class);
    BlueprintView blueprintView = mock(BlueprintView.class);
    when(blueprintView.getProcessor()).thenReturn(templateProcessor);
    when(templateProcessor.getHostGroupsWithComponent(HdfsRoles.NAMENODE)).thenReturn(Set.of("master"));
    when(templateProcessor.getRoleConfig(HdfsRoles.HDFS, HdfsRoles.NAMENODE, "dfs_federation_namenode_nameservice")).thenReturn(Optional.of(config("dfs_federation_namenode_nameservice", "ns")));
    TemplatePreparationObject preparationObject = getTemplatePreparationObjectForAws(false, false).withBlueprintView(blueprintView).withProductDetails(new ClouderaManagerRepo().withVersion("7.2.0"), List.of()).build();
    List<ApiClusterTemplateConfig> serviceConfigs = underTest.getServiceConfigs(templateProcessor, preparationObject);
    assertEquals(1, serviceConfigs.size());
    assertEquals("ranger_plugin_hdfs_audit_url", serviceConfigs.get(0).getName());
    assertEquals("hdfs://ns", serviceConfigs.get(0).getValue());
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) ClouderaManagerRepo(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo) BlueprintView(com.sequenceiq.cloudbreak.template.views.BlueprintView) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) Test(org.junit.jupiter.api.Test)

Aggregations

TemplatePreparationObject (com.sequenceiq.cloudbreak.template.TemplatePreparationObject)266 Test (org.junit.Test)133 ApiClusterTemplateConfig (com.cloudera.api.swagger.model.ApiClusterTemplateConfig)127 CmTemplateProcessor (com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor)116 Test (org.junit.jupiter.api.Test)87 GeneralClusterConfigs (com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs)53 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)48 List (java.util.List)45 ClouderaManagerRepo (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo)40 HostgroupView (com.sequenceiq.cloudbreak.template.views.HostgroupView)38 Builder (com.sequenceiq.cloudbreak.template.TemplatePreparationObject.Builder)36 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)35 ArrayList (java.util.ArrayList)34 BlueprintView (com.sequenceiq.cloudbreak.template.views.BlueprintView)32 ApiClusterTemplateService (com.cloudera.api.swagger.model.ApiClusterTemplateService)27 MethodSource (org.junit.jupiter.params.provider.MethodSource)23 BaseFileSystemConfigurationsView (com.sequenceiq.cloudbreak.template.filesystem.BaseFileSystemConfigurationsView)20 AccountMappingView (com.sequenceiq.cloudbreak.template.views.AccountMappingView)17 RDSConfig (com.sequenceiq.cloudbreak.domain.RDSConfig)16 DisplayName (org.junit.jupiter.api.DisplayName)16