use of com.sequenceiq.cloudbreak.template.filesystem.StorageLocationView in project cloudbreak by hortonworks.
the class YarnCloudStorageRoleConfigProviderTest method getTemplatePreparationObject.
private TemplatePreparationObject getTemplatePreparationObject(boolean includeLocations) {
HostgroupView master = new HostgroupView("master", 1, InstanceGroupType.GATEWAY, 1);
HostgroupView worker = new HostgroupView("worker", 2, InstanceGroupType.CORE, 2);
List<StorageLocationView> locations = new ArrayList<>();
if (includeLocations) {
locations.add(new StorageLocationView(getYarnRemoteAppLogDir()));
}
S3FileSystemConfigurationsView fileSystemConfigurationsView = new S3FileSystemConfigurationsView(new S3FileSystem(), locations, false);
return Builder.builder().withFileSystemConfigurationView(fileSystemConfigurationsView).withHostgroupViews(Set.of(master, worker)).build();
}
use of com.sequenceiq.cloudbreak.template.filesystem.StorageLocationView in project cloudbreak by hortonworks.
the class StackToTemplatePreparationObjectConverterTest method testConvertWhenEnvironmentBackupLocationDefinedThenBaseFileSystemConfigurationsViewShouldAddIt.
@Test
public void testConvertWhenEnvironmentBackupLocationDefinedThenBaseFileSystemConfigurationsViewShouldAddIt() throws IOException {
String backupLocation = "s3a://test";
FileSystem sourceFileSystem = new FileSystem();
FileSystem clusterServiceFileSystem = new FileSystem();
ConfigQueryEntries configQueryEntries = new ConfigQueryEntries();
BaseFileSystemConfigurationsView expected = mock(BaseFileSystemConfigurationsView.class);
List<StorageLocationView> storageLocationViews = mock(List.class);
BackupResponse backupResponse = new BackupResponse();
backupResponse.setStorageLocation(backupLocation);
DetailedEnvironmentResponse environmentResponse = DetailedEnvironmentResponse.builder().withIdBrokerMappingSource(IdBrokerMappingSource.MOCK).withCredential(new CredentialResponse()).withAdminGroupName(ADMIN_GROUP_NAME).withCrn(TestConstants.CRN).withBackup(backupResponse).build();
StorageLocation storageLocation = new StorageLocation();
storageLocation.setValue(backupLocation);
storageLocation.setProperty(RangerCloudStorageServiceConfigProvider.DEFAULT_BACKUP_DIR);
StorageLocationView backupLocationView = new StorageLocationView(storageLocation);
when(sourceCluster.getFileSystem()).thenReturn(sourceFileSystem);
when(cluster.getFileSystem()).thenReturn(clusterServiceFileSystem);
when(fileSystemConfigurationProvider.fileSystemConfiguration(eq(clusterServiceFileSystem), eq(stackMock), any(), eq(new Json("")), eq(configQueryEntries))).thenReturn(expected);
when(cmCloudStorageConfigProvider.getConfigQueryEntries()).thenReturn(configQueryEntries);
when(environmentClientService.getByCrn(anyString())).thenReturn(environmentResponse);
when(blueprintViewProvider.getBlueprintView(any())).thenReturn(getBlueprintView());
when(expected.getLocations()).thenReturn(storageLocationViews);
TemplatePreparationObject result = underTest.convert(stackMock);
assertThat(result.getFileSystemConfigurationView().isPresent()).isTrue();
assertThat(result.getFileSystemConfigurationView().get()).isEqualTo(expected);
verify(fileSystemConfigurationProvider, times(1)).fileSystemConfiguration(eq(clusterServiceFileSystem), eq(stackMock), any(), eq(new Json("")), eq(configQueryEntries));
verify(expected, times(1)).getLocations();
verify(storageLocationViews, times(1)).add(eq(backupLocationView));
}
use of com.sequenceiq.cloudbreak.template.filesystem.StorageLocationView in project cloudbreak by hortonworks.
the class HiveLLAPServiceConfigProviderTest method getTemplatePreparationObject.
private TemplatePreparationObject getTemplatePreparationObject(boolean includeLocations) {
HostgroupView master = new HostgroupView("master", 1, InstanceGroupType.GATEWAY, 1);
HostgroupView worker = new HostgroupView("worker", 2, InstanceGroupType.CORE, 2);
List<StorageLocationView> locations = new ArrayList<>();
if (includeLocations) {
StorageLocation hmsExternalWarehouseDir = new StorageLocation();
hmsExternalWarehouseDir.setProperty("hive.metastore.warehouse.external.dir");
hmsExternalWarehouseDir.setValue("s3a://bucket/hive/warehouse/external");
locations.add(new StorageLocationView(hmsExternalWarehouseDir));
}
S3FileSystemConfigurationsView fileSystemConfigurationsView = new S3FileSystemConfigurationsView(new S3FileSystem(), locations, false);
return Builder.builder().withFileSystemConfigurationView(fileSystemConfigurationsView).withHostgroupViews(Set.of(master, worker)).build();
}
use of com.sequenceiq.cloudbreak.template.filesystem.StorageLocationView in project cloudbreak by hortonworks.
the class HiveMetastoreCloudStorageServiceConfigProviderTest method getTemplatePreparationObject.
private TemplatePreparationObject getTemplatePreparationObject(boolean includeLocations) {
HostgroupView master = new HostgroupView("master", 1, InstanceGroupType.GATEWAY, 1);
HostgroupView worker = new HostgroupView("worker", 2, InstanceGroupType.CORE, 2);
List<StorageLocationView> locations = new ArrayList<>();
if (includeLocations) {
locations.add(new StorageLocationView(getHiveWarehouseStorageLocation()));
locations.add(new StorageLocationView(getHiveWarehouseExternalStorageLocation()));
locations.add(new StorageLocationView(getHiveWarehouseReplicaStorageLocation()));
}
S3FileSystemConfigurationsView fileSystemConfigurationsView = new S3FileSystemConfigurationsView(new S3FileSystem(), locations, false);
return Builder.builder().withFileSystemConfigurationView(fileSystemConfigurationsView).withHostgroupViews(Set.of(master, worker)).build();
}
use of com.sequenceiq.cloudbreak.template.filesystem.StorageLocationView in project cloudbreak by hortonworks.
the class CoreConfigProviderTest method isConfigurationNeededWhenKafkaPresentedHdfsNotAndStorageConfiguredMustReturnTrue.
@Test
public void isConfigurationNeededWhenKafkaPresentedHdfsNotAndStorageConfiguredMustReturnTrue() {
CmTemplateProcessor mockTemplateProcessor = mock(CmTemplateProcessor.class);
TemplatePreparationObject templatePreparationObject = mock(TemplatePreparationObject.class);
BaseFileSystemConfigurationsView fileSystemConfiguration = mock(BaseFileSystemConfigurationsView.class);
List<StorageLocationView> storageLocationViews = new ArrayList<>();
StorageLocation storageLocation = new StorageLocation();
storageLocation.setConfigFile("core_defaultfs");
storageLocation.setProperty("core_defaultfs");
storageLocation.setValue("s3a://default-bucket/");
storageLocationViews.add(new StorageLocationView(storageLocation));
when(fileSystemConfiguration.getLocations()).thenReturn(storageLocationViews);
Optional<BaseFileSystemConfigurationsView> fileSystemConfigurationView = Optional.of(fileSystemConfiguration);
when(mockTemplateProcessor.isRoleTypePresentInService(KAFKA_SERVICE, List.of(KAFKA_BROKER))).thenReturn(true);
when(mockTemplateProcessor.isRoleTypePresentInService(HDFS, List.of(NAMENODE))).thenReturn(false);
when(templatePreparationObject.getFileSystemConfigurationView()).thenReturn(fileSystemConfigurationView);
Assert.assertTrue(underTest.isConfigurationNeeded(mockTemplateProcessor, templatePreparationObject));
}
Aggregations