Search in sources :

Example 11 with ClouderaManagerRepo

use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo in project cloudbreak by hortonworks.

the class ImageToClouderaManagerRepoConverter method convert.

public ClouderaManagerRepo convert(Image image) {
    ClouderaManagerRepo clouderaManagerRepo = new ClouderaManagerRepo();
    clouderaManagerRepo.setPredefined(Boolean.TRUE);
    clouderaManagerRepo.setVersion(image.getPackageVersion(ImagePackageVersion.CM));
    clouderaManagerRepo.setBaseUrl(image.getRepo().get(image.getOsType()));
    clouderaManagerRepo.setBuildNumber(image.getCmBuildNumber());
    return clouderaManagerRepo;
}
Also used : ClouderaManagerRepo(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo)

Example 12 with ClouderaManagerRepo

use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo in project cloudbreak by hortonworks.

the class ClouderaManagerRepositoryV4RequestToClouderaManagerRepoConverterTest method testConvert.

@Test
void testConvert() {
    ClouderaManagerRepositoryV4Request request = new ClouderaManagerRepositoryV4Request();
    ClouderaManagerRepo repo = ClouderaManagerRepositoryV4RequestToClouderaManagerRepoConverter.convert(request);
    assertAll(() -> assertEquals(request.getBaseUrl(), repo.getBaseUrl()), () -> assertEquals(request.getGpgKeyUrl(), repo.getGpgKeyUrl()), () -> assertEquals(request.getVersion(), repo.getVersion()));
}
Also used : ClouderaManagerRepo(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo) ClouderaManagerRepositoryV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.cm.repository.ClouderaManagerRepositoryV4Request) Test(org.junit.jupiter.api.Test)

Example 13 with ClouderaManagerRepo

use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo in project cloudbreak by hortonworks.

the class ClusterHostServiceRunnerTest method testDecoratePillarWithClouderaManagerRepoWithNoJsonLicense.

@Test
void testDecoratePillarWithClouderaManagerRepoWithNoJsonLicense() throws IOException, CloudbreakOrchestratorFailedException {
    String license = FileReaderUtils.readFileFromClasspath("cm-license-nojson.txt");
    when(cmLicenseParser.parseLicense(license)).thenCallRealMethod();
    ClouderaManagerRepo clouderaManagerRepo = new ClouderaManagerRepo();
    clouderaManagerRepo.setVersion("7.2.0");
    clouderaManagerRepo.setBaseUrl("https://archive.cloudera.com/cm/7.2.0/");
    Map<String, SaltPillarProperties> pillar = new HashMap<>();
    underTest.decoratePillarWithClouderaManagerRepo(clouderaManagerRepo, pillar, Optional.of(license));
    SaltPillarProperties resultPillar = pillar.get("cloudera-manager-repo");
    Map<String, Object> properties = resultPillar.getProperties();
    Map<String, Object> values = (Map<String, Object>) properties.get("cloudera-manager");
    assertEquals("7.2.0", ((ClouderaManagerRepo) values.get("repo")).getVersion());
    assertEquals("https://archive.cloudera.com/cm/7.2.0/", ((ClouderaManagerRepo) values.get("repo")).getBaseUrl());
    assertNull(values.get("paywall_username"));
    assertNull(values.get("paywall_password"));
}
Also used : ClouderaManagerRepo(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo) HashMap(java.util.HashMap) Map(java.util.Map) HashMap(java.util.HashMap) ServiceLocationMap(com.sequenceiq.cloudbreak.cluster.model.ServiceLocationMap) SaltPillarProperties(com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties) Test(org.junit.jupiter.api.Test)

Example 14 with ClouderaManagerRepo

use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo in project cloudbreak by hortonworks.

the class ClusterHostServiceRunnerTest method setupMocksForRunClusterServices.

private void setupMocksForRunClusterServices() {
    when(umsClient.getAccountDetails(any(), any(), any())).thenReturn(UserManagementProto.Account.getDefaultInstance());
    when(stackService.get(any())).thenReturn(stack);
    when(stack.getCluster()).thenReturn(cluster);
    when(stack.getTunnel()).thenReturn(Tunnel.DIRECT);
    when(stack.getCloudPlatform()).thenReturn(CloudPlatform.AWS.name());
    when(stack.getResourceCrn()).thenReturn(TEST_CLUSTER_CRN);
    when(cluster.getName()).thenReturn("clustername");
    when(cluster.getStack()).thenReturn(stack);
    when(componentLocator.getComponentLocation(any(), any())).thenReturn(new HashMap<>());
    when(exposedServiceCollector.getImpalaService()).thenReturn(mock(ExposedService.class));
    when(environmentConfigProvider.getParentEnvironmentCrn(any())).thenReturn("crn:cdp:iam:us-west-1:accid:user:mockuser@cloudera.com");
    ClouderaManagerRepo clouderaManagerRepo = mock(ClouderaManagerRepo.class);
    when(clouderaManagerRepo.getVersion()).thenReturn("7.2.2");
    GatewayConfig gatewayConfig = mock(GatewayConfig.class);
    when(gatewayConfig.getPrivateAddress()).thenReturn("1.2.3.4");
    when(gatewayConfig.getHostname()).thenReturn("hostname");
    when(gatewayConfigService.getPrimaryGatewayConfig(any())).thenReturn(gatewayConfig);
    when(clusterComponentConfigProvider.getClouderaManagerRepoDetails(any())).thenReturn(clouderaManagerRepo);
    when(exposedServiceCollector.getRangerService()).thenReturn(mock(ExposedService.class));
    ExposedService cmExposedService = mock(ExposedService.class);
    when(cmExposedService.getServiceName()).thenReturn("CM");
    when(exposedServiceCollector.getClouderaManagerService()).thenReturn(cmExposedService);
    Template template = new Template();
    template.setTemporaryStorage(TemporaryStorage.EPHEMERAL_VOLUMES);
    Set<InstanceGroup> instanceGroups = new HashSet<>();
    createInstanceGroup(template, instanceGroups, "fqdn1", null, "1.1.1.1", "1.1.1.2");
    createInstanceGroup(template, instanceGroups, "fqdn2", null, "1.1.2.1", "1.1.2.2");
    InstanceGroup gwIg = createInstanceGroup(template, instanceGroups, "gateway1", "gateway2", "1.1.3.1", "1.1.3.2");
    lenient().when(stack.getNotTerminatedAndNotZombieGatewayInstanceMetadata()).thenReturn(Lists.newArrayList(gwIg.getAllInstanceMetaData()));
    when(stack.getInstanceGroups()).thenReturn(instanceGroups);
    RdsConfigWithoutCluster rdsConfigWithoutCluster = mock(RdsConfigWithoutCluster.class);
    when(rdsConfigWithoutClusterService.findByClusterIdAndType(any(), eq(DatabaseType.CLOUDERA_MANAGER))).thenReturn(rdsConfigWithoutCluster);
    when(rdsConfigWithoutCluster.getType()).thenReturn("asdf");
    when(rdsConfigWithoutCluster.getConnectionURL()).thenReturn("jdbc:postgresql:subname://some-rds.1d3nt1f13r.eu-west-1.rds.amazonaws.com:5432/ranger");
    when(rdsConfigWithoutCluster.getConnectionUserName()).thenReturn(new Secret("username"));
    when(rdsConfigWithoutCluster.getConnectionPassword()).thenReturn(new Secret("password"));
    when(loadBalancerSANProvider.getLoadBalancerSAN(stack)).thenReturn(Optional.empty());
    ClusterPreCreationApi clusterPreCreationApi = mock(ClusterPreCreationApi.class);
    when(clusterApiConnectors.getConnector(cluster)).thenReturn(clusterPreCreationApi);
    ServiceLocationMap serviceLocationMap = new ServiceLocationMap();
    serviceLocationMap.add(new ServiceLocation("serv", "paath"));
    when(clusterPreCreationApi.getServiceLocations()).thenReturn(serviceLocationMap);
    ReflectionTestUtils.setField(underTest, "cmHeartbeatInterval", "1");
    ReflectionTestUtils.setField(underTest, "cmMissedHeartbeatInterval", "1");
}
Also used : ServiceLocationMap(com.sequenceiq.cloudbreak.cluster.model.ServiceLocationMap) ClusterPreCreationApi(com.sequenceiq.cloudbreak.cluster.api.ClusterPreCreationApi) Template(com.sequenceiq.cloudbreak.domain.Template) InstanceGroup(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup) Secret(com.sequenceiq.cloudbreak.service.secret.domain.Secret) ClouderaManagerRepo(com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo) ExposedService(com.sequenceiq.cloudbreak.api.service.ExposedService) ServiceLocation(com.sequenceiq.cloudbreak.cluster.model.ServiceLocation) GatewayConfig(com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig) HashSet(java.util.HashSet) RdsConfigWithoutCluster(com.sequenceiq.cloudbreak.domain.view.RdsConfigWithoutCluster)

Example 15 with ClouderaManagerRepo

use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo 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)

Aggregations

ClouderaManagerRepo (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo)96 TemplatePreparationObject (com.sequenceiq.cloudbreak.template.TemplatePreparationObject)40 Test (org.junit.jupiter.api.Test)38 GeneralClusterConfigs (com.sequenceiq.cloudbreak.template.model.GeneralClusterConfigs)28 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)20 ApiClusterTemplateConfig (com.cloudera.api.swagger.model.ApiClusterTemplateConfig)17 ApiClient (com.cloudera.api.swagger.client.ApiClient)15 ApiClusterTemplateService (com.cloudera.api.swagger.model.ApiClusterTemplateService)15 HostgroupView (com.sequenceiq.cloudbreak.template.views.HostgroupView)15 Test (org.junit.Test)15 ClouderaManagerProduct (com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct)14 DisplayName (org.junit.jupiter.api.DisplayName)14 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)13 MethodSource (org.junit.jupiter.params.provider.MethodSource)13 ArrayList (java.util.ArrayList)12 HashMap (java.util.HashMap)12 Map (java.util.Map)10 CmTemplateProcessor (com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor)9 BigDecimal (java.math.BigDecimal)9 VirtualGroupRequest (com.sequenceiq.cloudbreak.auth.altus.VirtualGroupRequest)8