use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo in project cloudbreak by hortonworks.
the class RangerCloudStorageServiceConfigProviderTest method testGetRangerAzure720CloudStorageServiceConfigs.
@Test
public void testGetRangerAzure720CloudStorageServiceConfigs() {
CmTemplateProcessor templateProcessor = mock(CmTemplateProcessor.class);
TemplatePreparationObject preparationObject = getTemplatePreparationObjectForAzure(false).withBlueprintView(mock(BlueprintView.class)).withCloudPlatform(CloudPlatform.AZURE).withProductDetails(new ClouderaManagerRepo().withVersion("7.2.0"), 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("abfs://data@your-san.dfs.core.windows.net/ranger/audit", serviceConfigs.get(0).getValue());
}
use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo in project cloudbreak by hortonworks.
the class RangerCloudStorageServiceConfigProviderTest method defaultRangerHdfsAuditUrlWithNamenodeHA.
@Test
public void defaultRangerHdfsAuditUrlWithNamenodeHA() {
CmTemplateProcessor templateProcessor = mock(CmTemplateProcessor.class);
BlueprintView blueprintView = mock(BlueprintView.class);
when(blueprintView.getProcessor()).thenReturn(templateProcessor);
when(templateProcessor.getHostGroupsWithComponent(HdfsRoles.NAMENODE)).thenReturn(Set.of("master"));
when(templateProcessor.getRoleConfig(HdfsRoles.HDFS, HdfsRoles.NAMENODE, "dfs_federation_namenode_nameservice")).thenReturn(Optional.of(config("dfs_federation_namenode_nameservice", "ns")));
TemplatePreparationObject preparationObject = getTemplatePreparationObjectForAws(false, false).withBlueprintView(blueprintView).withProductDetails(new ClouderaManagerRepo().withVersion("7.2.0"), 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("hdfs://ns", serviceConfigs.get(0).getValue());
}
use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo in project cloudbreak by hortonworks.
the class RangerCloudStorageServiceConfigProviderTest method testGetRangerAzureCloudStorageServiceConfigs.
@Test
public void testGetRangerAzureCloudStorageServiceConfigs() {
CmTemplateProcessor templateProcessor = mock(CmTemplateProcessor.class);
TemplatePreparationObject preparationObject = getTemplatePreparationObjectForAzure(true).withBlueprintView(mock(BlueprintView.class)).withCloudPlatform(CloudPlatform.AZURE).withProductDetails(new ClouderaManagerRepo().withVersion("7.2.2"), List.of()).build();
List<ApiClusterTemplateConfig> serviceConfigs = underTest.getServiceConfigs(templateProcessor, preparationObject);
assertEquals(2, serviceConfigs.size());
assertEquals("ranger_plugin_hdfs_audit_url", serviceConfigs.get(0).getName());
assertEquals("abfs://data@your-san.dfs.core.windows.net/ranger/audit", serviceConfigs.get(0).getValue());
assertEquals("cloud_storage_paths", serviceConfigs.get(1).getName());
assertEquals("HIVE_METASTORE_WAREHOUSE=abfs://data@your-san.dfs.core.windows.net/warehouse/tablespace/managed/hive," + "HIVE_REPLICA_WAREHOUSE=abfs://data@your-san.dfs.core.windows.net/hive_replica_functions_dir," + "HIVE_METASTORE_EXTERNAL_WAREHOUSE=abfs://data@your-san.dfs.core.windows.net/warehouse/tablespace/external/hive," + "RANGER_AUDIT=abfs://data@your-san.dfs.core.windows.net/ranger/audit," + "HBASE_ROOT=abfs://data@your-san.dfs.core.windows.net/hbase", serviceConfigs.get(1).getValue());
}
use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo in project cloudbreak by hortonworks.
the class KnoxGatewayConfigProviderTest method roleConfigsWithGatewayWithLdapConfig.
@Test
public void roleConfigsWithGatewayWithLdapConfig() {
Gateway gateway = new Gateway();
gateway.setKnoxMasterSecret("admin");
gateway.setPath("/a/b/c");
IdBroker idBroker = new IdBroker();
idBroker.setMasterSecret("supersecret");
BlueprintTextProcessor blueprintTextProcessor = mock(BlueprintTextProcessor.class);
LdapView ldapConfig = LdapViewBuilder.aLdapView().build();
BlueprintView blueprintView = new BlueprintView("text", "7.2.11", "CDH", blueprintTextProcessor);
GeneralClusterConfigs generalClusterConfigs = new GeneralClusterConfigs();
generalClusterConfigs.setAccountId(Optional.of("1234"));
TemplatePreparationObject source = Builder.builder().withGateway(gateway, "key", new HashSet<>()).withLdapConfig(ldapConfig).withGeneralClusterConfigs(generalClusterConfigs).withBlueprintView(blueprintView).withVirtualGroupView(new VirtualGroupRequest(TestConstants.CRN, "")).withProductDetails(new ClouderaManagerRepo().withVersion("7.4.2"), List.of(new ClouderaManagerProduct().withVersion("7.2.10").withName("CDH"))).withIdBroker(idBroker).build();
when(virtualGroupService.createOrGetVirtualGroup(source.getVirtualGroupRequest(), UmsVirtualGroupRight.KNOX_ADMIN)).thenReturn("knox_admins");
when(entitlementService.isOjdbcTokenDhOneHour(anyString())).thenReturn(true);
assertEquals(List.of(config("idbroker_master_secret", "supersecret"), config("idbroker_gateway_knox_admin_groups", "knox_admins"), config("idbroker_gateway_signing_keystore_name", "signing.jks"), config("idbroker_gateway_signing_keystore_type", "JKS"), config("idbroker_gateway_signing_key_alias", "signing-identity")), underTest.getRoleConfigs(KnoxRoles.IDBROKER, source));
assertEquals(List.of(config("gateway_master_secret", gateway.getKnoxMasterSecret()), config("gateway_default_topology_name", "cdp-proxy"), config("gateway_knox_admin_groups", "knox_admins"), config("gateway_auto_discovery_enabled", "false"), config("gateway_path", gateway.getPath()), config("gateway_signing_keystore_name", "signing.jks"), config("gateway_signing_keystore_type", "JKS"), config("gateway_signing_key_alias", "signing-identity"), config("gateway_dispatch_whitelist", "^*.*$"), config("gateway_service_tokenstate_impl", "org.apache.knox.gateway.services.token.impl.JDBCTokenStateService")), ThreadBasedUserCrnProvider.doAs(TEST_USER_CRN, () -> underTest.getRoleConfigs(KnoxRoles.KNOX_GATEWAY, source)));
assertEquals(List.of(), underTest.getRoleConfigs("NAMENODE", source));
}
use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerRepo in project cloudbreak by hortonworks.
the class KnoxGatewayConfigProviderTest method roleConfigsWithGateway.
@Test
public void roleConfigsWithGateway() {
GatewayTopology topology = new GatewayTopology();
topology.setTopologyName("my-topology");
topology.setExposedServices(Json.silent(new ExposedServices()));
Gateway gateway = new Gateway();
gateway.setKnoxMasterSecret("admin");
gateway.setPath("/a/b/c");
gateway.setTopologies(Set.of(topology));
GeneralClusterConfigs generalClusterConfigs = new GeneralClusterConfigs();
generalClusterConfigs.setAccountId(Optional.of("1234"));
IdBroker idBroker = new IdBroker();
idBroker.setMasterSecret("supersecret");
BlueprintTextProcessor blueprintTextProcessor = mock(BlueprintTextProcessor.class);
BlueprintView blueprintView = new BlueprintView("text", "7.2.11", "CDH", blueprintTextProcessor);
TemplatePreparationObject source = Builder.builder().withGateway(gateway, "key", new HashSet<>()).withGeneralClusterConfigs(generalClusterConfigs).withBlueprintView(blueprintView).withVirtualGroupView(new VirtualGroupRequest(TestConstants.CRN, "")).withProductDetails(new ClouderaManagerRepo().withVersion("7.4.2"), List.of(new ClouderaManagerProduct().withVersion("7.2.10").withName("CDH"))).withIdBroker(idBroker).build();
when(virtualGroupService.createOrGetVirtualGroup(source.getVirtualGroupRequest(), UmsVirtualGroupRight.KNOX_ADMIN)).thenReturn("");
when(entitlementService.isOjdbcTokenDhOneHour(anyString())).thenReturn(true);
assertEquals(List.of(config("idbroker_master_secret", "supersecret"), config("idbroker_gateway_knox_admin_groups", ""), config("idbroker_gateway_signing_keystore_name", "signing.jks"), config("idbroker_gateway_signing_keystore_type", "JKS"), config("idbroker_gateway_signing_key_alias", "signing-identity")), underTest.getRoleConfigs(KnoxRoles.IDBROKER, source));
assertEquals(List.of(config("gateway_master_secret", gateway.getKnoxMasterSecret()), config("gateway_default_topology_name", gateway.getTopologies().iterator().next().getTopologyName()), config("gateway_knox_admin_groups", ""), config("gateway_auto_discovery_enabled", "false"), config("gateway_path", gateway.getPath()), config("gateway_signing_keystore_name", "signing.jks"), config("gateway_signing_keystore_type", "JKS"), config("gateway_signing_key_alias", "signing-identity"), config("gateway_dispatch_whitelist", "^*.*$"), config("gateway_service_tokenstate_impl", "org.apache.knox.gateway.services.token.impl.JDBCTokenStateService")), ThreadBasedUserCrnProvider.doAs(TEST_USER_CRN, () -> underTest.getRoleConfigs(KnoxRoles.KNOX_GATEWAY, source)));
assertEquals(List.of(), underTest.getRoleConfigs("NAMENODE", source));
}
Aggregations