Search in sources :

Example 16 with FileSystemConfigQueryObject

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

the class CmCloudStorageConfigDetailsTest method testWhenOnlyRangerAdminIsPresentedThenShouldReturnWithOnlyRangerAdminConfigs.

@Test
public void testWhenOnlyRangerAdminIsPresentedThenShouldReturnWithOnlyRangerAdminConfigs() {
    prepareBlueprintProcessorFactoryMock(RANGER_ADMIN, 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(1L, bigCluster.size());
    Set<ConfigQueryEntry> rangerAdmins = serviceEntry(bigCluster, RANGER_ADMIN);
    Assert.assertEquals(1, rangerAdmins.size());
    Assert.assertTrue(rangerAdmins.stream().anyMatch(cqe -> cqe.getDefaultPath().equals("hwx-remote/ranger/audit")));
}
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)

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