Search in sources :

Example 61 with TemplatePreparationObject

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

the class KafkaDatahubConfigProviderTest method isConfigurationNeeded.

@ParameterizedTest
@EnumSource(StackType.class)
void isConfigurationNeeded(StackType stackType) {
    TemplatePreparationObject tpo = templatePreparationObject(stackType, null);
    boolean expectedIsNeeded = stackType == StackType.WORKLOAD;
    assertThat(configProviderUnderTest.isConfigurationNeeded(null, tpo)).as("Configuration should %sbe needed for stack type %s", expectedIsNeeded ? "" : "NOT ", stackType).isEqualTo(expectedIsNeeded);
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) EnumSource(org.junit.jupiter.params.provider.EnumSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 62 with TemplatePreparationObject

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

the class KafkaDelegationTokenConfigProviderTest method testIsConfigurationNeededShouldReturnTrueWhenKafkaBrokerRoleTypeAndKafkaServiceAreAvailableAndKerberosIsEnabled.

@Test
void testIsConfigurationNeededShouldReturnTrueWhenKafkaBrokerRoleTypeAndKafkaServiceAreAvailableAndKerberosIsEnabled() {
    KerberosConfig kerberosConfig = KerberosConfig.KerberosConfigBuilder.aKerberosConfig().build();
    TemplatePreparationObject templatePreparationObject = TemplatePreparationObject.Builder.builder().withKerberosConfig(kerberosConfig).build();
    when(cmTemplateProcessor.isRoleTypePresentInService(underTest.getServiceType(), underTest.getRoleTypes())).thenReturn(Boolean.TRUE);
    boolean result = underTest.isConfigurationNeeded(cmTemplateProcessor, templatePreparationObject);
    Assertions.assertTrue(result);
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) KerberosConfig(com.sequenceiq.cloudbreak.dto.KerberosConfig) Test(org.junit.jupiter.api.Test)

Example 63 with TemplatePreparationObject

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

the class KafkaDelegationTokenConfigProviderTest method testIsConfigurationNeededWhenKerberosIsNotEnabled.

@Test
void testIsConfigurationNeededWhenKerberosIsNotEnabled() {
    TemplatePreparationObject templatePreparationObject = TemplatePreparationObject.Builder.builder().build();
    boolean result = underTest.isConfigurationNeeded(null, templatePreparationObject);
    Assertions.assertFalse(result);
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) Test(org.junit.jupiter.api.Test)

Example 64 with TemplatePreparationObject

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

the class KafkaDelegationTokenConfigProviderTest method testIsConfigurationNeededWhenNoKafkaBrokerRoleType.

@Test
void testIsConfigurationNeededWhenNoKafkaBrokerRoleType() {
    KerberosConfig kerberosConfig = KerberosConfig.KerberosConfigBuilder.aKerberosConfig().build();
    TemplatePreparationObject templatePreparationObject = TemplatePreparationObject.Builder.builder().withKerberosConfig(kerberosConfig).build();
    when(cmTemplateProcessor.isRoleTypePresentInService(underTest.getServiceType(), underTest.getRoleTypes())).thenReturn(Boolean.FALSE);
    boolean result = underTest.isConfigurationNeeded(cmTemplateProcessor, templatePreparationObject);
    Assertions.assertFalse(result);
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) KerberosConfig(com.sequenceiq.cloudbreak.dto.KerberosConfig) Test(org.junit.jupiter.api.Test)

Example 65 with TemplatePreparationObject

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

the class KafkaMultiAzConfigProviderTest method getRoleConfigs.

@ParameterizedTest
@MethodSource("testArgsForGetRoleConfigs")
void getRoleConfigs(String cdhMainVersion, String cdhParcelVersion, Collection<ApiClusterTemplateConfig> expectedConfigs) {
    when(blueprintView.getProcessor()).thenReturn(cmTemplateProcessor);
    when(cmTemplateProcessor.getStackVersion()).thenReturn(cdhMainVersion);
    TemplatePreparationObject tpo = templatePreparationObject(StackType.DATALAKE, cdhParcelVersion);
    List<ApiClusterTemplateConfig> serviceConfigs = configProviderUnderTest.getRoleConfigs(KafkaRoles.KAFKA_BROKER, tpo);
    assertThat(serviceConfigs).as("Expected configs for cdh version: %s / %s", cdhMainVersion, cdhParcelVersion).hasSameElementsAs(expectedConfigs);
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) ApiClusterTemplateConfig(com.cloudera.api.swagger.model.ApiClusterTemplateConfig) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

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