Search in sources :

Example 1 with ProductDetailsView

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

the class StackV4RequestToTemplatePreparationObjectConverterTest method testConvertWhenCmAndProductDetailsPresent.

@Test
public void testConvertWhenCmAndProductDetailsPresent() {
    final String cmBaseUrl = "http://cloudera-build-us-west-1.vpc.cloudera.com/s3/build/1677091/cm7/7.0.2/redhat7/yum/";
    final String cmGpgUrl = "http://cloudera-build-us-west-1.vpc.cloudera.com/s3/build/1677091/cm7/7.0.2/redhat7/yum/RPM-GPG-KEY-cloudera";
    final String cmVersion = "7.0.2";
    ClouderaManagerRepositoryV4Request cmRepo = new ClouderaManagerRepositoryV4Request().withBaseUrl(cmBaseUrl).withGpgKeyUrl(cmGpgUrl).withVersion(cmVersion);
    final String smmName = "STREAMS_MESSAGING_MANAGER";
    final String smmVersion = "2.1.0.3.0.0.0-97";
    final String smmParcel = "http://s3.amazonaws.com/dev.hortonworks.com/CSP/centos7/3.x/BUILDS/3.0.0.0-97/tars/parcel/";
    final String smmCsd = "http://s3.amazonaws.com/dev.hortonworks.com/CSP/centos7/3.x/BUILDS/3.0.0.0-97/tars/parcel/STREAMS_MESSAGING_MANAGER-2.1.0.jar";
    ClouderaManagerProductV4Request smm = new ClouderaManagerProductV4Request().withName(smmName).withVersion(smmVersion).withParcel(smmParcel).withCsd(List.of(smmCsd));
    ClouderaManagerV4Request cm = new ClouderaManagerV4Request().withEnableAutoTls(true).withRepository(cmRepo).withProducts(List.of(smm));
    when(cluster.getCm()).thenReturn(cm);
    TemplatePreparationObject result = underTest.convert(source);
    ProductDetailsView products = result.getProductDetailsView();
    assertNotNull(products);
    assertEquals(cmBaseUrl, products.getCm().getBaseUrl());
    assertEquals(cmVersion, products.getCm().getVersion());
    assertEquals(cmGpgUrl, products.getCm().getGpgKeyUrl());
    assertEquals(1, products.getProducts().size());
    ClouderaManagerProduct smmResult = products.getProducts().get(0);
    assertEquals(smmName, smmResult.getName());
    assertEquals(smmVersion, smmResult.getVersion());
    assertEquals(smmParcel, smmResult.getParcel());
    assertEquals(List.of(smmCsd), smmResult.getCsd());
}
Also used : TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) ClouderaManagerProductV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.cm.product.ClouderaManagerProductV4Request) ProductDetailsView(com.sequenceiq.cloudbreak.template.views.ProductDetailsView) ClouderaManagerRepositoryV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.cm.repository.ClouderaManagerRepositoryV4Request) ClouderaManagerProduct(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) ClouderaManagerV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.cm.ClouderaManagerV4Request) Test(org.junit.Test)

Example 2 with ProductDetailsView

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

the class CentralCmTemplateUpdaterTest method setUp.

@Before
public void setUp() {
    when(entitlementService.sdxHbaseCloudStorageEnabled(anyString())).thenReturn(true);
    List<CmTemplateComponentConfigProvider> cmTemplateComponentConfigProviders = List.of(new HiveMetastoreConfigProvider(), coreConfigProvider, hbaseCloudStorageProvider);
    when(cmTemplateProcessorFactory.get(anyString())).thenAnswer(i -> new CmTemplateProcessor(i.getArgument(0)));
    when(templatePreparationObject.getBlueprintView()).thenReturn(blueprintView);
    when(templatePreparationObject.getHostgroupViews()).thenReturn(toHostgroupViews(getHostgroupMappings()));
    when(templatePreparationObject.getGeneralClusterConfigs()).thenReturn(generalClusterConfigs);
    doNothing().when(s3ConfigProvider).getServiceConfigs(any(TemplatePreparationObject.class), any(StringBuilder.class));
    RDSConfig rdsConfig = TestUtil.rdsConfig(DatabaseType.HIVE);
    when(templatePreparationObject.getRdsConfigs()).thenReturn(Set.of(rdsConfig));
    when(templatePreparationObject.getRdsConfig(DatabaseType.HIVE)).thenReturn(rdsConfig);
    when(templatePreparationObject.getCustomConfigurationsView()).thenReturn(Optional.of(customConfigurationsView));
    List<StorageLocationView> locations = new ArrayList<>();
    StorageLocation hbaseRootDir = new StorageLocation();
    hbaseRootDir.setProperty("hbase.rootdir");
    hbaseRootDir.setValue("s3a://bucket/cluster1/hbase");
    locations.add(new StorageLocationView(hbaseRootDir));
    S3FileSystemConfigurationsView fileSystemConfigurationsView = new S3FileSystemConfigurationsView(new S3FileSystem(), locations, false);
    when(templatePreparationObject.getFileSystemConfigurationView()).thenReturn(Optional.of(fileSystemConfigurationsView));
    when(generalClusterConfigs.getClusterName()).thenReturn("testcluster");
    when(generalClusterConfigs.getPassword()).thenReturn("Admin123!");
    when(generalClusterConfigs.getAccountId()).thenReturn(Optional.of("1234"));
    clouderaManagerRepo = new ClouderaManagerRepo();
    clouderaManagerRepo.setVersion("6.1.0");
    ProductDetailsView productDetailsView = new ProductDetailsView(clouderaManagerRepo, List.of());
    when(templatePreparationObject.getProductDetailsView()).thenReturn(productDetailsView);
    ReflectionTestUtils.setField(cmTemplateComponentConfigProviderProcessor, "providers", cmTemplateComponentConfigProviders);
    ReflectionTestUtils.setField(cmTemplateConfigInjectorProcessor, "injectors", List.of());
    ReflectionTestUtils.setField(cmHostGroupRoleConfigProviderProcessor, "providers", List.of());
}
Also used : StorageLocationView(com.sequenceiq.cloudbreak.template.filesystem.StorageLocationView) ProductDetailsView(com.sequenceiq.cloudbreak.template.views.ProductDetailsView) RDSConfig(com.sequenceiq.cloudbreak.domain.RDSConfig) ArrayList(java.util.ArrayList) S3FileSystemConfigurationsView(com.sequenceiq.cloudbreak.template.filesystem.s3.S3FileSystemConfigurationsView) S3FileSystem(com.sequenceiq.common.api.filesystem.S3FileSystem) TemplatePreparationObject(com.sequenceiq.cloudbreak.template.TemplatePreparationObject) ClouderaManagerRepo(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo) HiveMetastoreConfigProvider(com.sequenceiq.cloudbreak.cmtemplate.configproviders.hive.HiveMetastoreConfigProvider) StorageLocation(com.sequenceiq.cloudbreak.domain.StorageLocation) Before(org.junit.Before)

Aggregations

TemplatePreparationObject (com.sequenceiq.cloudbreak.template.TemplatePreparationObject)2 ProductDetailsView (com.sequenceiq.cloudbreak.template.views.ProductDetailsView)2 ClouderaManagerV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.cm.ClouderaManagerV4Request)1 ClouderaManagerProductV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.cm.product.ClouderaManagerProductV4Request)1 ClouderaManagerRepositoryV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.cm.repository.ClouderaManagerRepositoryV4Request)1 ClouderaManagerProduct (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct)1 ClouderaManagerRepo (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo)1 HiveMetastoreConfigProvider (com.sequenceiq.cloudbreak.cmtemplate.configproviders.hive.HiveMetastoreConfigProvider)1 RDSConfig (com.sequenceiq.cloudbreak.domain.RDSConfig)1 StorageLocation (com.sequenceiq.cloudbreak.domain.StorageLocation)1 StorageLocationView (com.sequenceiq.cloudbreak.template.filesystem.StorageLocationView)1 S3FileSystemConfigurationsView (com.sequenceiq.cloudbreak.template.filesystem.s3.S3FileSystemConfigurationsView)1 S3FileSystem (com.sequenceiq.common.api.filesystem.S3FileSystem)1 ArrayList (java.util.ArrayList)1 Before (org.junit.Before)1 Test (org.junit.Test)1 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)1