Search in sources :

Example 81 with TemplatePreparationObject

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

the class StackV4RequestToTemplatePreparationObjectConverterTest method testConvertWhenClusterHasNoCloudStorageThenFileSystemConfigurationViewShouldBeEmpty.

@Test
public void testConvertWhenClusterHasNoCloudStorageThenFileSystemConfigurationViewShouldBeEmpty() {
    when(cluster.getCloudStorage()).thenReturn(null);
    when(cloudStorageValidationUtil.isCloudStorageConfigured(null)).thenReturn(false);
    TemplatePreparationObject result = underTest.convert(source);
    assertFalse(result.getFileSystemConfigurationView().isPresent());
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) Test(org.junit.Test)

Example 82 with TemplatePreparationObject

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

the class StackV4RequestToTemplatePreparationObjectConverterTest method testConvertWhenGatewayExistsInStack.

@Test
public void testConvertWhenGatewayExistsInStack() {
    when(stackV4RequestToGatewayConverter.convert(source)).thenReturn(new Gateway());
    when(cluster.getGateway()).thenReturn(new GatewayV4Request());
    TemplatePreparationObject result = underTest.convert(source);
    assertNotNull(result.getGatewayView());
}
Also used : GatewayV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.gateway.GatewayV4Request) TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) Gateway(com.sequenceiq.cloudbreak.domain.stack.cluster.gateway.Gateway) Test(org.junit.Test)

Example 83 with TemplatePreparationObject

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

the class StackV4RequestToTemplatePreparationObjectConverterTest method testMockAccountMappings.

@Test
public void testMockAccountMappings() {
    TemplatePreparationObject result = underTest.convert(source);
    AccountMappingView accountMappingView = result.getAccountMappingView();
    assertNotNull(accountMappingView);
    assertEquals(MOCK_GROUP_MAPPINGS, accountMappingView.getGroupMappings());
    assertEquals(MOCK_USER_MAPPINGS, accountMappingView.getUserMappings());
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) AccountMappingView(com.sequenceiq.cloudbreak.template.views.AccountMappingView) Test(org.junit.Test)

Example 84 with TemplatePreparationObject

use of com.sequenceiq.cloudbreak.template.TemplatePreparationObject 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 85 with TemplatePreparationObject

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

the class StackV4RequestToTemplatePreparationObjectConverterTest method testStackPlacement.

@Test
public void testStackPlacement() {
    TemplatePreparationObject result = underTest.convert(source);
    assertTrue(result.getPlacementView().isPresent());
    assertEquals(REGION, result.getPlacementView().get().getRegion());
    assertEquals(REGION, result.getPlacementView().get().getAvailabilityZone());
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) Test(org.junit.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