Search in sources :

Example 11 with FileSystemConfigQueryObject

use of com.sequenceiq.cloudbreak.template.filesystem.FileSystemConfigQueryObject in project cloudbreak by hortonworks.

the class CmCloudStorageConfigDetailsTest method testWhenHiveMetasoreRangerAdminZeppelinRMIsPresentedAndNotAttachedThenShouldReturnWithBothConfigs.

@Test
public void testWhenHiveMetasoreRangerAdminZeppelinRMIsPresentedAndNotAttachedThenShouldReturnWithBothConfigs() {
    prepareBlueprintProcessorFactoryMock(HIVE_METASTORE, RANGER_ADMIN, RESOURCEMANAGER, ZEPPELIN_SERVER, NAMENODE);
    FileSystemConfigQueryObject fileSystemConfigQueryObject = FileSystemConfigQueryObject.Builder.builder().withStorageName(STORAGE_NAME).withClusterName(CLUSTER_NAME).withBlueprintText(BLUEPRINT_TEXT).withAttachedCluster(false).withFileSystemType(FileSystemType.S3.name()).build();
    Set<ConfigQueryEntry> bigCluster = underTest.queryParameters(fileSystemConfigQueryObject);
    Assert.assertEquals(6L, bigCluster.size());
    Set<ConfigQueryEntry> rangerAdmins = serviceEntry(bigCluster, RANGER_ADMIN);
    Set<ConfigQueryEntry> yarnSite = serviceEntry(bigCluster, RESOURCEMANAGER);
    Set<ConfigQueryEntry> zeppelin = serviceEntry(bigCluster, ZEPPELIN_SERVER);
    Set<ConfigQueryEntry> hive = serviceEntry(bigCluster, HIVE_METASTORE);
    Assert.assertEquals(1, rangerAdmins.size());
    Assert.assertTrue(rangerAdmins.stream().anyMatch(cqe -> cqe.getDefaultPath().equals("hwx-remote/ranger/audit")));
    Assert.assertEquals(1, yarnSite.size());
    Assert.assertTrue(yarnSite.stream().anyMatch(cqe -> cqe.getDefaultPath().equals("hwx-remote/bigCluster/oplogs/yarn-app-logs")));
    Assert.assertEquals(1, zeppelin.size());
    Assert.assertTrue(zeppelin.stream().anyMatch(cqe -> cqe.getDefaultPath().equals("hwx-remote/bigCluster/zeppelin/notebook")));
    Assert.assertEquals(3, hive.size());
    Assert.assertTrue(hive.stream().anyMatch(cqe -> cqe.getDefaultPath().equals("hwx-remote/warehouse/tablespace/managed/hive")));
    Assert.assertTrue(hive.stream().anyMatch(cqe -> cqe.getDefaultPath().equals("hwx-remote/warehouse/tablespace/external/hive")));
}
Also used : CloudbreakResourceReaderService(com.sequenceiq.cloudbreak.service.CloudbreakResourceReaderService) Mock(org.mockito.Mock) RunWith(org.junit.runner.RunWith) Set(java.util.Set) ReflectionTestUtils(org.springframework.test.util.ReflectionTestUtils) IOException(java.io.IOException) HashMap(java.util.HashMap) Test(org.junit.Test) Mockito.when(org.mockito.Mockito.when) Collectors(java.util.stream.Collectors) CmTemplateProcessorFactory(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessorFactory) Sets(com.google.common.collect.Sets) Map(java.util.Map) FileSystemType(com.sequenceiq.common.model.FileSystemType) CloudStorageConfigDetails(com.sequenceiq.cloudbreak.template.filesystem.CloudStorageConfigDetails) FileSystemConfigQueryObject(com.sequenceiq.cloudbreak.template.filesystem.FileSystemConfigQueryObject) FileReaderUtils(com.sequenceiq.cloudbreak.util.FileReaderUtils) ConfigQueryEntry(com.sequenceiq.common.api.cloudstorage.query.ConfigQueryEntry) CmTemplateProcessor(com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor) Assert(org.junit.Assert) MockitoJUnitRunner(org.mockito.junit.MockitoJUnitRunner) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) Mockito.mock(org.mockito.Mockito.mock) Before(org.junit.Before) ConfigQueryEntry(com.sequenceiq.common.api.cloudstorage.query.ConfigQueryEntry) FileSystemConfigQueryObject(com.sequenceiq.cloudbreak.template.filesystem.FileSystemConfigQueryObject) Test(org.junit.Test)

Example 12 with FileSystemConfigQueryObject

use of com.sequenceiq.cloudbreak.template.filesystem.FileSystemConfigQueryObject in project cloudbreak by hortonworks.

the class CmCloudStorageConfigDetailsTest method testWhenAttachedClusterAndHiveMetastorePresentedThenShouldReturnWithNothing.

@Test
public void testWhenAttachedClusterAndHiveMetastorePresentedThenShouldReturnWithNothing() {
    prepareBlueprintProcessorFactoryMock(HIVE_METASTORE, NAMENODE);
    FileSystemConfigQueryObject fileSystemConfigQueryObject = FileSystemConfigQueryObject.Builder.builder().withStorageName(STORAGE_NAME).withClusterName(CLUSTER_NAME).withBlueprintText(BLUEPRINT_TEXT).withAttachedCluster(true).withFileSystemType(FileSystemType.S3.name()).build();
    Set<ConfigQueryEntry> bigCluster = underTest.queryParameters(fileSystemConfigQueryObject);
    Assert.assertEquals(0L, bigCluster.size());
}
Also used : ConfigQueryEntry(com.sequenceiq.common.api.cloudstorage.query.ConfigQueryEntry) FileSystemConfigQueryObject(com.sequenceiq.cloudbreak.template.filesystem.FileSystemConfigQueryObject) Test(org.junit.Test)

Example 13 with FileSystemConfigQueryObject

use of com.sequenceiq.cloudbreak.template.filesystem.FileSystemConfigQueryObject in project cloudbreak by hortonworks.

the class CmCloudStorageConfigDetailsTest method testWhenNotAttachedClusterAndOnlyHiveMetastoreIsPresentedThenShouldReturnWithOnlyHiveMetastoreConfigs.

@Test
public void testWhenNotAttachedClusterAndOnlyHiveMetastoreIsPresentedThenShouldReturnWithOnlyHiveMetastoreConfigs() {
    prepareBlueprintProcessorFactoryMock(HIVE_METASTORE, NAMENODE);
    FileSystemConfigQueryObject fileSystemConfigQueryObject = FileSystemConfigQueryObject.Builder.builder().withStorageName(STORAGE_NAME).withClusterName(CLUSTER_NAME).withBlueprintText(BLUEPRINT_TEXT).withAttachedCluster(false).withFileSystemType(FileSystemType.S3.name()).build();
    Set<ConfigQueryEntry> bigCluster = underTest.queryParameters(fileSystemConfigQueryObject);
    Assert.assertEquals(3L, bigCluster.size());
    Set<ConfigQueryEntry> hive = serviceEntry(bigCluster, HIVE_METASTORE);
    Assert.assertEquals(3, hive.size());
    Assert.assertTrue(hive.stream().map(ConfigQueryEntry::getDefaultPath).anyMatch("hwx-remote/warehouse/tablespace/managed/hive"::equals));
    Assert.assertTrue(hive.stream().map(ConfigQueryEntry::getDefaultPath).anyMatch("hwx-remote/warehouse/tablespace/external/hive"::equals));
    Assert.assertTrue(hive.stream().map(ConfigQueryEntry::getDefaultPath).anyMatch("hwx-remote/warehouse/tablespace/external/hive"::equals));
}
Also used : ConfigQueryEntry(com.sequenceiq.common.api.cloudstorage.query.ConfigQueryEntry) FileSystemConfigQueryObject(com.sequenceiq.cloudbreak.template.filesystem.FileSystemConfigQueryObject) Test(org.junit.Test)

Example 14 with FileSystemConfigQueryObject

use of com.sequenceiq.cloudbreak.template.filesystem.FileSystemConfigQueryObject in project cloudbreak by hortonworks.

the class CmCloudStorageConfigDetailsTest method testBasePathWhenNoHDFSServicesWithAttachedCluster.

@Test
public void testBasePathWhenNoHDFSServicesWithAttachedCluster() {
    prepareBlueprintProcessorFactoryMock();
    FileSystemConfigQueryObject fileSystemConfigQueryObject = FileSystemConfigQueryObject.Builder.builder().withStorageName(STORAGE_NAME).withClusterName(CLUSTER_NAME).withBlueprintText(BLUEPRINT_TEXT).withAttachedCluster(true).withFileSystemType(FileSystemType.S3.name()).build();
    Set<ConfigQueryEntry> bigCluster = underTest.queryParameters(fileSystemConfigQueryObject);
    Assert.assertEquals(1L, bigCluster.size());
    Set<ConfigQueryEntry> defaultFS = missingServiceEntry(bigCluster, NAMENODE);
    Assert.assertEquals(1, defaultFS.size());
    Assert.assertTrue(defaultFS.stream().map(ConfigQueryEntry::getDefaultPath).anyMatch("hwx-remote/bigCluster"::equals));
    Assert.assertTrue(defaultFS.stream().map(ConfigQueryEntry::getPropertyName).anyMatch("core_defaultfs"::equals));
}
Also used : ConfigQueryEntry(com.sequenceiq.common.api.cloudstorage.query.ConfigQueryEntry) FileSystemConfigQueryObject(com.sequenceiq.cloudbreak.template.filesystem.FileSystemConfigQueryObject) Test(org.junit.Test)

Example 15 with FileSystemConfigQueryObject

use of com.sequenceiq.cloudbreak.template.filesystem.FileSystemConfigQueryObject in project cloudbreak by hortonworks.

the class CmCloudStorageConfigDetailsTest method testProfilerServicesWithAttachedCluster.

@Test
public void testProfilerServicesWithAttachedCluster() {
    prepareBlueprintProcessorFactoryMock(DATA_DISCOVERY_SERVICE_AGENT, PROFILER_ADMIN_AGENT, PROFILER_METRICS_AGENT, PROFILER_SCHEDULER_AGENT, NAMENODE);
    FileSystemConfigQueryObject fileSystemConfigQueryObject = FileSystemConfigQueryObject.Builder.builder().withStorageName(STORAGE_NAME).withClusterName(CLUSTER_NAME).withBlueprintText(BLUEPRINT_TEXT).withAttachedCluster(true).withFileSystemType(FileSystemType.S3.name()).build();
    Set<ConfigQueryEntry> bigCluster = underTest.queryParameters(fileSystemConfigQueryObject);
    Assert.assertEquals(1L, bigCluster.size());
    Set<ConfigQueryEntry> dataDiscoveryService = serviceEntry(bigCluster, DATA_DISCOVERY_SERVICE_AGENT);
    Set<ConfigQueryEntry> profilerAdmin = serviceEntry(bigCluster, PROFILER_ADMIN_AGENT);
    Set<ConfigQueryEntry> profilerMetrics = serviceEntry(bigCluster, PROFILER_METRICS_AGENT);
    Set<ConfigQueryEntry> profilerScheduler = serviceEntry(bigCluster, PROFILER_SCHEDULER_AGENT);
    Assert.assertEquals(1, dataDiscoveryService.size());
    Assert.assertTrue(dataDiscoveryService.stream().map(ConfigQueryEntry::getDefaultPath).anyMatch("hwx-remote/dpprofiler"::equals));
    Assert.assertTrue(dataDiscoveryService.stream().map(ConfigQueryEntry::getPropertyName).anyMatch("file_system_uri"::equals));
    Assert.assertEquals(1, profilerAdmin.size());
    Assert.assertTrue(profilerAdmin.stream().map(ConfigQueryEntry::getDefaultPath).anyMatch("hwx-remote/dpprofiler"::equals));
    Assert.assertTrue(profilerAdmin.stream().map(ConfigQueryEntry::getPropertyName).anyMatch("file_system_uri"::equals));
    Assert.assertEquals(1, profilerMetrics.size());
    Assert.assertTrue(profilerMetrics.stream().map(ConfigQueryEntry::getDefaultPath).anyMatch("hwx-remote/dpprofiler"::equals));
    Assert.assertTrue(profilerMetrics.stream().map(ConfigQueryEntry::getPropertyName).anyMatch("file_system_uri"::equals));
    Assert.assertEquals(1, profilerScheduler.size());
    Assert.assertTrue(profilerScheduler.stream().map(ConfigQueryEntry::getDefaultPath).anyMatch("hwx-remote/dpprofiler"::equals));
    Assert.assertTrue(profilerScheduler.stream().map(ConfigQueryEntry::getPropertyName).anyMatch("file_system_uri"::equals));
}
Also used : ConfigQueryEntry(com.sequenceiq.common.api.cloudstorage.query.ConfigQueryEntry) FileSystemConfigQueryObject(com.sequenceiq.cloudbreak.template.filesystem.FileSystemConfigQueryObject) Test(org.junit.Test)

Aggregations

FileSystemConfigQueryObject (com.sequenceiq.cloudbreak.template.filesystem.FileSystemConfigQueryObject)16 ConfigQueryEntry (com.sequenceiq.common.api.cloudstorage.query.ConfigQueryEntry)15 Test (org.junit.Test)12 Sets (com.google.common.collect.Sets)4 CmTemplateProcessor (com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessor)4 CmTemplateProcessorFactory (com.sequenceiq.cloudbreak.cmtemplate.CmTemplateProcessorFactory)4 Blueprint (com.sequenceiq.cloudbreak.domain.Blueprint)4 CloudbreakResourceReaderService (com.sequenceiq.cloudbreak.service.CloudbreakResourceReaderService)4 CloudStorageConfigDetails (com.sequenceiq.cloudbreak.template.filesystem.CloudStorageConfigDetails)4 FileReaderUtils (com.sequenceiq.cloudbreak.util.FileReaderUtils)4 FileSystemType (com.sequenceiq.common.model.FileSystemType)4 IOException (java.io.IOException)4 HashMap (java.util.HashMap)4 Map (java.util.Map)4 Set (java.util.Set)4 Collectors (java.util.stream.Collectors)4 Assert (org.junit.Assert)4 Before (org.junit.Before)4 RunWith (org.junit.runner.RunWith)4 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)4