Search in sources :

Example 16 with AuthorizationTestModule

use of io.cdap.cdap.security.authorization.AuthorizationTestModule in project cdap by caskdata.

the class LogFileManagerTest method setUpContext.

@BeforeClass
public static void setUpContext() throws Exception {
    Configuration hConf = HBaseConfiguration.create();
    final CConfiguration cConf = CConfiguration.create();
    cConf.set(Constants.CFG_LOCAL_DATA_DIR, TMP_FOLDER.newFolder().getAbsolutePath());
    String logBaseDir = cConf.get(LoggingConfiguration.LOG_BASE_DIR) + "/" + CDAPLogAppender.class.getSimpleName();
    cConf.set(LoggingConfiguration.LOG_BASE_DIR, logBaseDir);
    injector = Guice.createInjector(new ConfigModule(cConf, hConf), new NonCustomLocationUnitTestModule(), new TransactionModules().getInMemoryModules(), new LocalLogAppenderModule(), new DataSetsModules().getInMemoryModules(), new SystemDatasetRuntimeModule().getInMemoryModules(), new AuthorizationTestModule(), new StorageModule(), new AuthorizationEnforcementModule().getInMemoryModules(), new AuthenticationContextModules().getNoOpModule(), new AbstractModule() {

        @Override
        protected void configure() {
            bind(MetricsCollectionService.class).to(NoOpMetricsCollectionService.class);
            bind(UGIProvider.class).to(UnsupportedUGIProvider.class);
            bind(OwnerAdmin.class).to(DefaultOwnerAdmin.class);
            bind(NamespaceQueryAdmin.class).to(SimpleNamespaceQueryAdmin.class);
        }
    });
    txManager = injector.getInstance(TransactionManager.class);
    txManager.startAndWait();
    StoreDefinition.LogFileMetaStore.create(injector.getInstance(StructuredTableAdmin.class));
}
Also used : StorageModule(io.cdap.cdap.data.runtime.StorageModule) Configuration(org.apache.hadoop.conf.Configuration) LoggingConfiguration(io.cdap.cdap.logging.LoggingConfiguration) CConfiguration(io.cdap.cdap.common.conf.CConfiguration) HBaseConfiguration(org.apache.hadoop.hbase.HBaseConfiguration) NoOpMetricsCollectionService(io.cdap.cdap.common.metrics.NoOpMetricsCollectionService) MetricsCollectionService(io.cdap.cdap.api.metrics.MetricsCollectionService) ConfigModule(io.cdap.cdap.common.guice.ConfigModule) AuthenticationContextModules(io.cdap.cdap.security.auth.context.AuthenticationContextModules) StructuredTableAdmin(io.cdap.cdap.spi.data.StructuredTableAdmin) DataSetsModules(io.cdap.cdap.data.runtime.DataSetsModules) UGIProvider(io.cdap.cdap.security.impersonation.UGIProvider) UnsupportedUGIProvider(io.cdap.cdap.security.impersonation.UnsupportedUGIProvider) DefaultOwnerAdmin(io.cdap.cdap.security.impersonation.DefaultOwnerAdmin) OwnerAdmin(io.cdap.cdap.security.impersonation.OwnerAdmin) NonCustomLocationUnitTestModule(io.cdap.cdap.common.guice.NonCustomLocationUnitTestModule) CConfiguration(io.cdap.cdap.common.conf.CConfiguration) AuthorizationTestModule(io.cdap.cdap.security.authorization.AuthorizationTestModule) AbstractModule(com.google.inject.AbstractModule) TransactionModules(org.apache.tephra.runtime.TransactionModules) LocalLogAppenderModule(io.cdap.cdap.logging.guice.LocalLogAppenderModule) TransactionManager(org.apache.tephra.TransactionManager) NamespaceQueryAdmin(io.cdap.cdap.common.namespace.NamespaceQueryAdmin) SimpleNamespaceQueryAdmin(io.cdap.cdap.common.namespace.SimpleNamespaceQueryAdmin) SystemDatasetRuntimeModule(io.cdap.cdap.data.runtime.SystemDatasetRuntimeModule) AuthorizationEnforcementModule(io.cdap.cdap.security.authorization.AuthorizationEnforcementModule) BeforeClass(org.junit.BeforeClass)

Example 17 with AuthorizationTestModule

use of io.cdap.cdap.security.authorization.AuthorizationTestModule in project cdap by caskdata.

the class HBaseMetricsTableTest method setup.

@BeforeClass
public static void setup() throws Exception {
    CConfiguration cConf = CConfiguration.create();
    cConf.set(Constants.CFG_HDFS_USER, System.getProperty("user.name"));
    Injector injector = Guice.createInjector(new DataFabricModules().getDistributedModules(), new ConfigModule(cConf, TEST_HBASE.getConfiguration()), new ZKClientModule(), new ZKDiscoveryModule(), new TransactionMetricsModule(), new DFSLocationModule(), new NamespaceAdminTestModule(), new SystemDatasetRuntimeModule().getDistributedModules(), new DataSetsModules().getInMemoryModules(), new AuthorizationTestModule(), new AuthorizationEnforcementModule().getInMemoryModules(), new AuthenticationContextModules().getNoOpModule(), new AbstractModule() {

        @Override
        protected void configure() {
            bind(UGIProvider.class).to(UnsupportedUGIProvider.class);
            bind(OwnerAdmin.class).to(DefaultOwnerAdmin.class);
        }
    });
    dsFramework = injector.getInstance(DatasetFramework.class);
    tableUtil = injector.getInstance(HBaseTableUtil.class);
    ddlExecutor = new HBaseDDLExecutorFactory(cConf, TEST_HBASE.getHBaseAdmin().getConfiguration()).get();
    ddlExecutor.createNamespaceIfNotExists(tableUtil.getHBaseNamespace(NamespaceId.SYSTEM));
}
Also used : UnsupportedUGIProvider(io.cdap.cdap.security.impersonation.UnsupportedUGIProvider) ZKDiscoveryModule(io.cdap.cdap.common.guice.ZKDiscoveryModule) NamespaceAdminTestModule(io.cdap.cdap.common.guice.NamespaceAdminTestModule) ConfigModule(io.cdap.cdap.common.guice.ConfigModule) AuthenticationContextModules(io.cdap.cdap.security.auth.context.AuthenticationContextModules) DataSetsModules(io.cdap.cdap.data.runtime.DataSetsModules) DefaultOwnerAdmin(io.cdap.cdap.security.impersonation.DefaultOwnerAdmin) CConfiguration(io.cdap.cdap.common.conf.CConfiguration) AuthorizationTestModule(io.cdap.cdap.security.authorization.AuthorizationTestModule) HBaseTableUtil(io.cdap.cdap.data2.util.hbase.HBaseTableUtil) TransactionMetricsModule(io.cdap.cdap.data.runtime.TransactionMetricsModule) AbstractModule(com.google.inject.AbstractModule) DatasetFramework(io.cdap.cdap.data2.dataset2.DatasetFramework) ZKClientModule(io.cdap.cdap.common.guice.ZKClientModule) DFSLocationModule(io.cdap.cdap.common.guice.DFSLocationModule) Injector(com.google.inject.Injector) HBaseDDLExecutorFactory(io.cdap.cdap.data2.util.hbase.HBaseDDLExecutorFactory) SystemDatasetRuntimeModule(io.cdap.cdap.data.runtime.SystemDatasetRuntimeModule) DataFabricModules(io.cdap.cdap.data.runtime.DataFabricModules) AuthorizationEnforcementModule(io.cdap.cdap.security.authorization.AuthorizationEnforcementModule) BeforeClass(org.junit.BeforeClass)

Example 18 with AuthorizationTestModule

use of io.cdap.cdap.security.authorization.AuthorizationTestModule in project cdap by caskdata.

the class LevelDBTableCoreTest method init.

@BeforeClass
public static void init() throws Exception {
    CConfiguration conf = CConfiguration.create();
    conf.set(Constants.CFG_LOCAL_DATA_DIR, tmpFolder.newFolder().getAbsolutePath());
    injector = Guice.createInjector(new ConfigModule(conf), new NonCustomLocationUnitTestModule(), new InMemoryDiscoveryModule(), new DataFabricLevelDBModule(), new TransactionMetricsModule(), new AuthorizationTestModule(), new AuthorizationEnforcementModule().getStandaloneModules(), new AuthenticationContextModules().getMasterModule());
    service = injector.getInstance(LevelDBTableService.class);
}
Also used : InMemoryDiscoveryModule(io.cdap.cdap.common.guice.InMemoryDiscoveryModule) ConfigModule(io.cdap.cdap.common.guice.ConfigModule) AuthenticationContextModules(io.cdap.cdap.security.auth.context.AuthenticationContextModules) NonCustomLocationUnitTestModule(io.cdap.cdap.common.guice.NonCustomLocationUnitTestModule) CConfiguration(io.cdap.cdap.common.conf.CConfiguration) AuthorizationTestModule(io.cdap.cdap.security.authorization.AuthorizationTestModule) DataFabricLevelDBModule(io.cdap.cdap.data.runtime.DataFabricLevelDBModule) TransactionMetricsModule(io.cdap.cdap.data.runtime.TransactionMetricsModule) AuthorizationEnforcementModule(io.cdap.cdap.security.authorization.AuthorizationEnforcementModule) BeforeClass(org.junit.BeforeClass)

Example 19 with AuthorizationTestModule

use of io.cdap.cdap.security.authorization.AuthorizationTestModule in project cdap by caskdata.

the class LevelDBTableTest method init.

@BeforeClass
public static void init() throws Exception {
    cConf = CConfiguration.create();
    cConf.set(Constants.CFG_LOCAL_DATA_DIR, tmpFolder.newFolder().getAbsolutePath());
    Injector injector = Guice.createInjector(new ConfigModule(cConf), new NonCustomLocationUnitTestModule(), new InMemoryDiscoveryModule(), new DataFabricLevelDBModule(), new TransactionMetricsModule(), new AuthorizationTestModule(), new AuthorizationEnforcementModule().getStandaloneModules(), new AuthenticationContextModules().getMasterModule());
    service = injector.getInstance(LevelDBTableService.class);
}
Also used : InMemoryDiscoveryModule(io.cdap.cdap.common.guice.InMemoryDiscoveryModule) Injector(com.google.inject.Injector) ConfigModule(io.cdap.cdap.common.guice.ConfigModule) AuthenticationContextModules(io.cdap.cdap.security.auth.context.AuthenticationContextModules) NonCustomLocationUnitTestModule(io.cdap.cdap.common.guice.NonCustomLocationUnitTestModule) AuthorizationTestModule(io.cdap.cdap.security.authorization.AuthorizationTestModule) DataFabricLevelDBModule(io.cdap.cdap.data.runtime.DataFabricLevelDBModule) TransactionMetricsModule(io.cdap.cdap.data.runtime.TransactionMetricsModule) AuthorizationEnforcementModule(io.cdap.cdap.security.authorization.AuthorizationEnforcementModule) BeforeClass(org.junit.BeforeClass)

Example 20 with AuthorizationTestModule

use of io.cdap.cdap.security.authorization.AuthorizationTestModule in project cdap by caskdata.

the class LevelDBTableServiceTest method init.

@BeforeClass
public static void init() throws Exception {
    CConfiguration conf = CConfiguration.create();
    conf.set(Constants.CFG_LOCAL_DATA_DIR, tmpFolder.newFolder().getAbsolutePath());
    injector = Guice.createInjector(new ConfigModule(conf), new NonCustomLocationUnitTestModule(), new InMemoryDiscoveryModule(), new DataFabricLevelDBModule(), new TransactionMetricsModule(), new AuthorizationTestModule(), new AuthorizationEnforcementModule().getStandaloneModules(), new AuthenticationContextModules().getMasterModule());
    service = injector.getInstance(LevelDBTableService.class);
}
Also used : InMemoryDiscoveryModule(io.cdap.cdap.common.guice.InMemoryDiscoveryModule) ConfigModule(io.cdap.cdap.common.guice.ConfigModule) AuthenticationContextModules(io.cdap.cdap.security.auth.context.AuthenticationContextModules) NonCustomLocationUnitTestModule(io.cdap.cdap.common.guice.NonCustomLocationUnitTestModule) CConfiguration(io.cdap.cdap.common.conf.CConfiguration) AuthorizationTestModule(io.cdap.cdap.security.authorization.AuthorizationTestModule) DataFabricLevelDBModule(io.cdap.cdap.data.runtime.DataFabricLevelDBModule) TransactionMetricsModule(io.cdap.cdap.data.runtime.TransactionMetricsModule) AuthorizationEnforcementModule(io.cdap.cdap.security.authorization.AuthorizationEnforcementModule) BeforeClass(org.junit.BeforeClass)

Aggregations

AuthenticationContextModules (io.cdap.cdap.security.auth.context.AuthenticationContextModules)33 AuthorizationTestModule (io.cdap.cdap.security.authorization.AuthorizationTestModule)33 ConfigModule (io.cdap.cdap.common.guice.ConfigModule)32 AuthorizationEnforcementModule (io.cdap.cdap.security.authorization.AuthorizationEnforcementModule)32 AbstractModule (com.google.inject.AbstractModule)27 NonCustomLocationUnitTestModule (io.cdap.cdap.common.guice.NonCustomLocationUnitTestModule)24 DataSetsModules (io.cdap.cdap.data.runtime.DataSetsModules)23 CConfiguration (io.cdap.cdap.common.conf.CConfiguration)22 BeforeClass (org.junit.BeforeClass)21 UnsupportedUGIProvider (io.cdap.cdap.security.impersonation.UnsupportedUGIProvider)20 TransactionManager (org.apache.tephra.TransactionManager)19 InMemoryDiscoveryModule (io.cdap.cdap.common.guice.InMemoryDiscoveryModule)17 SystemDatasetRuntimeModule (io.cdap.cdap.data.runtime.SystemDatasetRuntimeModule)17 NoOpMetricsCollectionService (io.cdap.cdap.common.metrics.NoOpMetricsCollectionService)16 DefaultOwnerAdmin (io.cdap.cdap.security.impersonation.DefaultOwnerAdmin)16 Injector (com.google.inject.Injector)15 StructuredTableAdmin (io.cdap.cdap.spi.data.StructuredTableAdmin)15 MetricsCollectionService (io.cdap.cdap.api.metrics.MetricsCollectionService)14 NamespaceAdminTestModule (io.cdap.cdap.common.guice.NamespaceAdminTestModule)14 StorageModule (io.cdap.cdap.data.runtime.StorageModule)14