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;
}
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()));
}
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"));
}
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");
}
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());
}
Aggregations