Search in sources :

Example 6 with AuthorizationEnforcementModule

use of co.cask.cdap.security.authorization.AuthorizationEnforcementModule in project cdap by caskdata.

the class InMemoryQueueTest method init.

@BeforeClass
public static void init() throws Exception {
    injector = Guice.createInjector(new ConfigModule(), new NonCustomLocationUnitTestModule().getModule(), new DiscoveryRuntimeModule().getInMemoryModules(), new SystemDatasetRuntimeModule().getInMemoryModules(), new AuthorizationTestModule(), new AuthorizationEnforcementModule().getInMemoryModules(), new AuthenticationContextModules().getMasterModule(), new DataSetsModules().getInMemoryModules(), new DataFabricModules().getInMemoryModules(), new TransactionMetricsModule(), new ExploreClientModule(), new ViewAdminModules().getInMemoryModules(), Modules.override(new StreamAdminModules().getInMemoryModules()).with(new AbstractModule() {

        @Override
        protected void configure() {
            // The tests are actually testing stream on queue implementation, hence bind it to the queue implementation
            bind(StreamAdmin.class).to(InMemoryStreamAdmin.class);
            bind(StreamAdmin.class).annotatedWith(Names.named(StreamAdminModules.NOAUTH_STREAM_ADMIN)).to(InMemoryStreamAdmin.class);
            bind(StreamMetaStore.class).to(InMemoryStreamMetaStore.class);
        }
    }));
    // transaction manager is a "service" and must be started
    transactionManager = injector.getInstance(TransactionManager.class);
    transactionManager.startAndWait();
    txSystemClient = injector.getInstance(TransactionSystemClient.class);
    queueClientFactory = injector.getInstance(QueueClientFactory.class);
    queueAdmin = injector.getInstance(QueueAdmin.class);
    executorFactory = injector.getInstance(TransactionExecutorFactory.class);
}
Also used : ConfigModule(co.cask.cdap.common.guice.ConfigModule) AuthenticationContextModules(co.cask.cdap.security.auth.context.AuthenticationContextModules) DataSetsModules(co.cask.cdap.data.runtime.DataSetsModules) NonCustomLocationUnitTestModule(co.cask.cdap.common.guice.NonCustomLocationUnitTestModule) AuthorizationTestModule(co.cask.cdap.security.authorization.AuthorizationTestModule) TransactionMetricsModule(co.cask.cdap.data.runtime.TransactionMetricsModule) ViewAdminModules(co.cask.cdap.data.view.ViewAdminModules) AbstractModule(com.google.inject.AbstractModule) TransactionExecutorFactory(org.apache.tephra.TransactionExecutorFactory) StreamAdminModules(co.cask.cdap.data.stream.StreamAdminModules) TransactionSystemClient(org.apache.tephra.TransactionSystemClient) QueueAdmin(co.cask.cdap.data2.transaction.queue.QueueAdmin) StreamAdmin(co.cask.cdap.data2.transaction.stream.StreamAdmin) InMemoryStreamMetaStore(co.cask.cdap.data.stream.service.InMemoryStreamMetaStore) ExploreClientModule(co.cask.cdap.explore.guice.ExploreClientModule) TransactionManager(org.apache.tephra.TransactionManager) QueueClientFactory(co.cask.cdap.data2.queue.QueueClientFactory) SystemDatasetRuntimeModule(co.cask.cdap.data.runtime.SystemDatasetRuntimeModule) DiscoveryRuntimeModule(co.cask.cdap.common.guice.DiscoveryRuntimeModule) DataFabricModules(co.cask.cdap.data.runtime.DataFabricModules) AuthorizationEnforcementModule(co.cask.cdap.security.authorization.AuthorizationEnforcementModule) BeforeClass(org.junit.BeforeClass)

Example 7 with AuthorizationEnforcementModule

use of co.cask.cdap.security.authorization.AuthorizationEnforcementModule in project cdap by caskdata.

the class LevelDBQueueTest method init.

@BeforeClass
public static void init() throws Exception {
    CConfiguration conf = CConfiguration.create();
    conf.set(Constants.CFG_LOCAL_DATA_DIR, tmpFolder.newFolder().getAbsolutePath());
    conf.set(Constants.Dataset.TABLE_PREFIX, "test");
    Injector injector = Guice.createInjector(new ConfigModule(conf), new NonCustomLocationUnitTestModule().getModule(), new DiscoveryRuntimeModule().getStandaloneModules(), new AuthorizationTestModule(), new AuthorizationEnforcementModule().getInMemoryModules(), new AuthenticationContextModules().getMasterModule(), new DataSetsModules().getStandaloneModules(), new DataFabricLevelDBModule(), new TransactionMetricsModule());
    // transaction manager is a "service" and must be started
    transactionManager = injector.getInstance(TransactionManager.class);
    transactionManager.startAndWait();
    txSystemClient = injector.getInstance(TransactionSystemClient.class);
    queueClientFactory = injector.getInstance(QueueClientFactory.class);
    queueAdmin = injector.getInstance(QueueAdmin.class);
    executorFactory = injector.getInstance(TransactionExecutorFactory.class);
    LevelDBTableService.getInstance().clearTables();
}
Also used : ConfigModule(co.cask.cdap.common.guice.ConfigModule) AuthenticationContextModules(co.cask.cdap.security.auth.context.AuthenticationContextModules) DataSetsModules(co.cask.cdap.data.runtime.DataSetsModules) NonCustomLocationUnitTestModule(co.cask.cdap.common.guice.NonCustomLocationUnitTestModule) CConfiguration(co.cask.cdap.common.conf.CConfiguration) AuthorizationTestModule(co.cask.cdap.security.authorization.AuthorizationTestModule) DataFabricLevelDBModule(co.cask.cdap.data.runtime.DataFabricLevelDBModule) TransactionMetricsModule(co.cask.cdap.data.runtime.TransactionMetricsModule) TransactionExecutorFactory(org.apache.tephra.TransactionExecutorFactory) TransactionSystemClient(org.apache.tephra.TransactionSystemClient) QueueAdmin(co.cask.cdap.data2.transaction.queue.QueueAdmin) Injector(com.google.inject.Injector) TransactionManager(org.apache.tephra.TransactionManager) QueueClientFactory(co.cask.cdap.data2.queue.QueueClientFactory) DiscoveryRuntimeModule(co.cask.cdap.common.guice.DiscoveryRuntimeModule) AuthorizationEnforcementModule(co.cask.cdap.security.authorization.AuthorizationEnforcementModule) BeforeClass(org.junit.BeforeClass)

Example 8 with AuthorizationEnforcementModule

use of co.cask.cdap.security.authorization.AuthorizationEnforcementModule in project cdap by caskdata.

the class LevelDBMetricsTableTest method setup.

@BeforeClass
public static void setup() throws Exception {
    CConfiguration conf = CConfiguration.create();
    conf.set(Constants.CFG_LOCAL_DATA_DIR, tmpFolder.newFolder().getAbsolutePath());
    Injector injector = Guice.createInjector(new ConfigModule(conf), new NonCustomLocationUnitTestModule().getModule(), new AuthorizationTestModule(), new AuthorizationEnforcementModule().getInMemoryModules(), new AuthenticationContextModules().getMasterModule(), new DiscoveryRuntimeModule().getStandaloneModules(), new SystemDatasetRuntimeModule().getInMemoryModules(), new DataSetsModules().getInMemoryModules(), new DataFabricLevelDBModule(), new TransactionMetricsModule());
    dsFramework = injector.getInstance(DatasetFramework.class);
}
Also used : ConfigModule(co.cask.cdap.common.guice.ConfigModule) AuthenticationContextModules(co.cask.cdap.security.auth.context.AuthenticationContextModules) DataSetsModules(co.cask.cdap.data.runtime.DataSetsModules) NonCustomLocationUnitTestModule(co.cask.cdap.common.guice.NonCustomLocationUnitTestModule) CConfiguration(co.cask.cdap.common.conf.CConfiguration) AuthorizationTestModule(co.cask.cdap.security.authorization.AuthorizationTestModule) DataFabricLevelDBModule(co.cask.cdap.data.runtime.DataFabricLevelDBModule) TransactionMetricsModule(co.cask.cdap.data.runtime.TransactionMetricsModule) DatasetFramework(co.cask.cdap.data2.dataset2.DatasetFramework) Injector(com.google.inject.Injector) SystemDatasetRuntimeModule(co.cask.cdap.data.runtime.SystemDatasetRuntimeModule) DiscoveryRuntimeModule(co.cask.cdap.common.guice.DiscoveryRuntimeModule) AuthorizationEnforcementModule(co.cask.cdap.security.authorization.AuthorizationEnforcementModule) BeforeClass(org.junit.BeforeClass)

Example 9 with AuthorizationEnforcementModule

use of co.cask.cdap.security.authorization.AuthorizationEnforcementModule 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().getModule(), new DiscoveryRuntimeModule().getStandaloneModules(), new DataSetsModules().getStandaloneModules(), new DataFabricLevelDBModule(), new TransactionMetricsModule(), new AuthorizationTestModule(), new AuthorizationEnforcementModule().getStandaloneModules(), new AuthenticationContextModules().getMasterModule());
    service = injector.getInstance(LevelDBTableService.class);
}
Also used : ConfigModule(co.cask.cdap.common.guice.ConfigModule) AuthenticationContextModules(co.cask.cdap.security.auth.context.AuthenticationContextModules) DataSetsModules(co.cask.cdap.data.runtime.DataSetsModules) NonCustomLocationUnitTestModule(co.cask.cdap.common.guice.NonCustomLocationUnitTestModule) CConfiguration(co.cask.cdap.common.conf.CConfiguration) DiscoveryRuntimeModule(co.cask.cdap.common.guice.DiscoveryRuntimeModule) AuthorizationTestModule(co.cask.cdap.security.authorization.AuthorizationTestModule) DataFabricLevelDBModule(co.cask.cdap.data.runtime.DataFabricLevelDBModule) TransactionMetricsModule(co.cask.cdap.data.runtime.TransactionMetricsModule) AuthorizationEnforcementModule(co.cask.cdap.security.authorization.AuthorizationEnforcementModule) BeforeClass(org.junit.BeforeClass)

Example 10 with AuthorizationEnforcementModule

use of co.cask.cdap.security.authorization.AuthorizationEnforcementModule in project cdap by caskdata.

the class DefaultOwnerStoreTest method createInjector.

@BeforeClass
public static void createInjector() {
    Injector injector = Guice.createInjector(new ConfigModule(), new DataSetsModules().getInMemoryModules(), new LocationRuntimeModule().getInMemoryModules(), new TransactionInMemoryModule(), new SystemDatasetRuntimeModule().getInMemoryModules(), new NamespaceClientRuntimeModule().getInMemoryModules(), new AuthorizationTestModule(), new AuthorizationEnforcementModule().getInMemoryModules(), new AuthenticationContextModules().getMasterModule());
    TransactionManager txManager = injector.getInstance(TransactionManager.class);
    txManager.startAndWait();
    ownerStore = injector.getInstance(OwnerStore.class);
}
Also used : NamespaceClientRuntimeModule(co.cask.cdap.common.namespace.guice.NamespaceClientRuntimeModule) TransactionInMemoryModule(org.apache.tephra.runtime.TransactionInMemoryModule) Injector(com.google.inject.Injector) ConfigModule(co.cask.cdap.common.guice.ConfigModule) AuthenticationContextModules(co.cask.cdap.security.auth.context.AuthenticationContextModules) TransactionManager(org.apache.tephra.TransactionManager) DataSetsModules(co.cask.cdap.data.runtime.DataSetsModules) LocationRuntimeModule(co.cask.cdap.common.guice.LocationRuntimeModule) SystemDatasetRuntimeModule(co.cask.cdap.data.runtime.SystemDatasetRuntimeModule) AuthorizationTestModule(co.cask.cdap.security.authorization.AuthorizationTestModule) AuthorizationEnforcementModule(co.cask.cdap.security.authorization.AuthorizationEnforcementModule) OwnerStore(co.cask.cdap.security.impersonation.OwnerStore) BeforeClass(org.junit.BeforeClass)

Aggregations

AuthorizationEnforcementModule (co.cask.cdap.security.authorization.AuthorizationEnforcementModule)59 ConfigModule (co.cask.cdap.common.guice.ConfigModule)58 DataSetsModules (co.cask.cdap.data.runtime.DataSetsModules)56 AuthenticationContextModules (co.cask.cdap.security.auth.context.AuthenticationContextModules)52 AuthorizationTestModule (co.cask.cdap.security.authorization.AuthorizationTestModule)50 AbstractModule (com.google.inject.AbstractModule)50 DiscoveryRuntimeModule (co.cask.cdap.common.guice.DiscoveryRuntimeModule)46 NonCustomLocationUnitTestModule (co.cask.cdap.common.guice.NonCustomLocationUnitTestModule)40 UnsupportedUGIProvider (co.cask.cdap.security.impersonation.UnsupportedUGIProvider)37 BeforeClass (org.junit.BeforeClass)37 DataFabricModules (co.cask.cdap.data.runtime.DataFabricModules)35 DefaultOwnerAdmin (co.cask.cdap.security.impersonation.DefaultOwnerAdmin)35 CConfiguration (co.cask.cdap.common.conf.CConfiguration)34 ExploreClientModule (co.cask.cdap.explore.guice.ExploreClientModule)32 Injector (com.google.inject.Injector)32 SystemDatasetRuntimeModule (co.cask.cdap.data.runtime.SystemDatasetRuntimeModule)29 TransactionManager (org.apache.tephra.TransactionManager)27 TransactionMetricsModule (co.cask.cdap.data.runtime.TransactionMetricsModule)25 ViewAdminModules (co.cask.cdap.data.view.ViewAdminModules)25 OwnerAdmin (co.cask.cdap.security.impersonation.OwnerAdmin)24