Search in sources :

Example 11 with DataSetsModules

use of io.cdap.cdap.data.runtime.DataSetsModules in project cdap by caskdata.

the class AppFabricTestModule method configure.

@Override
protected void configure() {
    install(new DataFabricModules().getInMemoryModules());
    install(new DataSetsModules().getStandaloneModules());
    install(new TransactionExecutorModule());
    install(new DataSetServiceModules().getInMemoryModules());
    install(new ConfigModule(cConf, hConf, sConf));
    install(RemoteAuthenticatorModules.getNoOpModule());
    install(new IOModule());
    install(new InMemoryDiscoveryModule());
    install(new AppFabricServiceRuntimeModule(cConf).getInMemoryModules());
    install(new MonitorHandlerModule(false));
    install(new ProgramRunnerRuntimeModule().getInMemoryModules());
    install(new NonCustomLocationUnitTestModule());
    install(new LocalLogAppenderModule());
    install(new LogReaderRuntimeModules().getInMemoryModules());
    install(new LogQueryRuntimeModule().getInMemoryModules());
    install(new MetricsHandlerModule());
    install(new MetricsClientRuntimeModule().getInMemoryModules());
    install(new ExploreClientModule());
    install(new ConfigStoreModule());
    install(new MetadataServiceModule());
    install(new AuthenticationContextModules().getMasterModule());
    install(new AuthorizationModule());
    install(new AuthorizationEnforcementModule().getStandaloneModules());
    install(new SecureStoreServerModule());
    install(new MetadataReaderWriterModules().getInMemoryModules());
    install(new MessagingServerRuntimeModule().getInMemoryModules());
    install(new MockProvisionerModule());
    // Needed by MonitorHandlerModuler
    bind(TwillRunner.class).to(NoopTwillRunnerService.class);
}
Also used : IOModule(io.cdap.cdap.common.guice.IOModule) DataSetServiceModules(io.cdap.cdap.data.runtime.DataSetServiceModules) InMemoryDiscoveryModule(io.cdap.cdap.common.guice.InMemoryDiscoveryModule) ConfigModule(io.cdap.cdap.common.guice.ConfigModule) TwillRunner(org.apache.twill.api.TwillRunner) MessagingServerRuntimeModule(io.cdap.cdap.messaging.guice.MessagingServerRuntimeModule) MetricsClientRuntimeModule(io.cdap.cdap.metrics.guice.MetricsClientRuntimeModule) MonitorHandlerModule(io.cdap.cdap.app.guice.MonitorHandlerModule) TransactionExecutorModule(io.cdap.cdap.data.runtime.TransactionExecutorModule) MockProvisionerModule(io.cdap.cdap.internal.provision.MockProvisionerModule) ConfigStoreModule(io.cdap.cdap.config.guice.ConfigStoreModule) AuthorizationModule(io.cdap.cdap.app.guice.AuthorizationModule) LogReaderRuntimeModules(io.cdap.cdap.logging.guice.LogReaderRuntimeModules) AuthenticationContextModules(io.cdap.cdap.security.auth.context.AuthenticationContextModules) DataSetsModules(io.cdap.cdap.data.runtime.DataSetsModules) MetadataServiceModule(io.cdap.cdap.metadata.MetadataServiceModule) NonCustomLocationUnitTestModule(io.cdap.cdap.common.guice.NonCustomLocationUnitTestModule) LogQueryRuntimeModule(io.cdap.cdap.logging.guice.LogQueryRuntimeModule) MetadataReaderWriterModules(io.cdap.cdap.metadata.MetadataReaderWriterModules) ProgramRunnerRuntimeModule(io.cdap.cdap.app.guice.ProgramRunnerRuntimeModule) MetricsHandlerModule(io.cdap.cdap.metrics.guice.MetricsHandlerModule) LocalLogAppenderModule(io.cdap.cdap.logging.guice.LocalLogAppenderModule) ExploreClientModule(io.cdap.cdap.explore.guice.ExploreClientModule) DataFabricModules(io.cdap.cdap.data.runtime.DataFabricModules) AppFabricServiceRuntimeModule(io.cdap.cdap.app.guice.AppFabricServiceRuntimeModule) AuthorizationEnforcementModule(io.cdap.cdap.security.authorization.AuthorizationEnforcementModule) SecureStoreServerModule(io.cdap.cdap.security.guice.SecureStoreServerModule)

Example 12 with DataSetsModules

use of io.cdap.cdap.data.runtime.DataSetsModules in project cdap by caskdata.

the class TransactionServiceClientTest method beforeClass.

@BeforeClass
public static void beforeClass() throws Exception {
    HBaseTestingUtility hBaseTestingUtility = new HBaseTestingUtility();
    hBaseTestingUtility.startMiniDFSCluster(1);
    Configuration hConf = hBaseTestingUtility.getConfiguration();
    hConf.setBoolean("fs.hdfs.impl.disable.cache", true);
    zkServer = InMemoryZKServer.builder().build();
    zkServer.startAndWait();
    CConfiguration cConf = CConfiguration.create();
    // tests should use the current user for HDFS
    cConf.set(Constants.CFG_HDFS_USER, System.getProperty("user.name"));
    cConf.set(Constants.Zookeeper.QUORUM, zkServer.getConnectionStr());
    cConf.set(Constants.CFG_LOCAL_DATA_DIR, tmpFolder.newFolder().getAbsolutePath());
    cConf.setBoolean(TxConstants.TransactionPruning.PRUNE_ENABLE, false);
    // we want persisting for this test
    cConf.setBoolean(TxConstants.Manager.CFG_DO_PERSIST, true);
    // getCommonConfiguration() sets up an hConf with tx service configuration.
    // however, createTxService() will override these with defaults from the CConf.
    // hence, we must pass in these settings when creating the tx service.
    Configuration extraCConf = new Configuration();
    extraCConf.clear();
    extraCConf = getCommonConfiguration(extraCConf);
    for (Map.Entry<String, String> entry : extraCConf) {
        cConf.set(entry.getKey(), entry.getValue());
    }
    server = TransactionServiceTest.createTxService(zkServer.getConnectionStr(), Networks.getRandomPort(), hConf, tmpFolder.newFolder(), cConf);
    server.startAndWait();
    injector = Guice.createInjector(new ConfigModule(cConf, hConf), RemoteAuthenticatorModules.getNoOpModule(), new ZKClientModule(), new ZKDiscoveryModule(), new NonCustomLocationUnitTestModule(), new TransactionMetricsModule(), new DataFabricModules().getDistributedModules(), new AbstractModule() {

        @Override
        protected void configure() {
            bind(NamespaceQueryAdmin.class).to(SimpleNamespaceQueryAdmin.class);
            bind(UGIProvider.class).to(UnsupportedUGIProvider.class);
            bind(OwnerAdmin.class).to(DefaultOwnerAdmin.class);
        }
    }, Modules.override(new DataSetsModules().getDistributedModules()).with(new AbstractModule() {

        @Override
        protected void configure() {
            bind(MetadataStorage.class).to(NoopMetadataStorage.class);
        }
    }), new AuthorizationTestModule(), new AuthorizationEnforcementModule().getInMemoryModules(), new AuthenticationContextModules().getNoOpModule());
    zkClient = injector.getInstance(ZKClientService.class);
    zkClient.startAndWait();
    txStateStorage = injector.getInstance(TransactionStateStorage.class);
    txStateStorage.startAndWait();
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) CConfiguration(io.cdap.cdap.common.conf.CConfiguration) ZKDiscoveryModule(io.cdap.cdap.common.guice.ZKDiscoveryModule) ConfigModule(io.cdap.cdap.common.guice.ConfigModule) AuthenticationContextModules(io.cdap.cdap.security.auth.context.AuthenticationContextModules) 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) DataSetsModules(io.cdap.cdap.data.runtime.DataSetsModules) NonCustomLocationUnitTestModule(io.cdap.cdap.common.guice.NonCustomLocationUnitTestModule) CConfiguration(io.cdap.cdap.common.conf.CConfiguration) AuthorizationTestModule(io.cdap.cdap.security.authorization.AuthorizationTestModule) TransactionMetricsModule(io.cdap.cdap.data.runtime.TransactionMetricsModule) AbstractModule(com.google.inject.AbstractModule) ZKClientModule(io.cdap.cdap.common.guice.ZKClientModule) NoopMetadataStorage(io.cdap.cdap.spi.metadata.noop.NoopMetadataStorage) ZKClientService(org.apache.twill.zookeeper.ZKClientService) HBaseTestingUtility(org.apache.hadoop.hbase.HBaseTestingUtility) NamespaceQueryAdmin(io.cdap.cdap.common.namespace.NamespaceQueryAdmin) SimpleNamespaceQueryAdmin(io.cdap.cdap.common.namespace.SimpleNamespaceQueryAdmin) TransactionStateStorage(org.apache.tephra.persist.TransactionStateStorage) Map(java.util.Map) DataFabricModules(io.cdap.cdap.data.runtime.DataFabricModules) AuthorizationEnforcementModule(io.cdap.cdap.security.authorization.AuthorizationEnforcementModule) BeforeClass(org.junit.BeforeClass)

Example 13 with DataSetsModules

use of io.cdap.cdap.data.runtime.DataSetsModules in project cdap by caskdata.

the class FileMetadataTest 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 AuthorizationEnforcementModule().getInMemoryModules(), new AuthenticationContextModules().getNoOpModule(), new StorageModule(), 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) CDAPLogAppender(io.cdap.cdap.logging.appender.system.CDAPLogAppender) 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 14 with DataSetsModules

use of io.cdap.cdap.data.runtime.DataSetsModules 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 15 with DataSetsModules

use of io.cdap.cdap.data.runtime.DataSetsModules in project cdap by caskdata.

the class DistributedLogFrameworkTest method createInjector.

private Injector createInjector() throws IOException {
    CConfiguration cConf = CConfiguration.copy(KAFKA_TESTER.getCConf());
    cConf.set(Constants.CFG_LOCAL_DATA_DIR, TEMP_FOLDER.newFolder().getAbsolutePath());
    // The event delay cannot be too small, otherwise the events will be out of order, especially on slow machine
    cConf.setLong(Constants.Logging.PIPELINE_EVENT_DELAY_MS, 2000);
    cConf.setLong("log.process.pipeline.checkpoint.interval.ms", 2000);
    MockTwillContext mockTwillContext = new MockTwillContext();
    return Guice.createInjector(new ConfigModule(cConf), new ZKClientModule(), new InMemoryDiscoveryModule(), new KafkaClientModule(), new LocalLocationModule(), new DistributedLogFrameworkModule(mockTwillContext.getInstanceId(), mockTwillContext.getInstanceCount()), new DataSetsModules().getInMemoryModules(), new TransactionModules().getInMemoryModules(), new TransactionExecutorModule(), new SystemDatasetRuntimeModule().getInMemoryModules(), new NamespaceAdminTestModule(), new AuthorizationTestModule(), new AuthorizationEnforcementModule().getInMemoryModules(), new AuthenticationContextModules().getNoOpModule(), new StorageModule(), new AbstractModule() {

        @Override
        protected void configure() {
            bind(MetricsCollectionService.class).to(NoOpMetricsCollectionService.class);
            bind(UGIProvider.class).to(CurrentUGIProvider.class);
            bind(OwnerAdmin.class).to(DefaultOwnerAdmin.class);
        }
    });
}
Also used : MockTwillContext(io.cdap.cdap.common.test.MockTwillContext) InMemoryDiscoveryModule(io.cdap.cdap.common.guice.InMemoryDiscoveryModule) StorageModule(io.cdap.cdap.data.runtime.StorageModule) 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) NoOpMetricsCollectionService(io.cdap.cdap.common.metrics.NoOpMetricsCollectionService) DefaultOwnerAdmin(io.cdap.cdap.security.impersonation.DefaultOwnerAdmin) 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) ZKClientModule(io.cdap.cdap.common.guice.ZKClientModule) TransactionExecutorModule(io.cdap.cdap.data.runtime.TransactionExecutorModule) LocalLocationModule(io.cdap.cdap.common.guice.LocalLocationModule) KafkaClientModule(io.cdap.cdap.common.guice.KafkaClientModule) DistributedLogFrameworkModule(io.cdap.cdap.logging.guice.DistributedLogFrameworkModule) CurrentUGIProvider(io.cdap.cdap.security.impersonation.CurrentUGIProvider) SystemDatasetRuntimeModule(io.cdap.cdap.data.runtime.SystemDatasetRuntimeModule) AuthorizationEnforcementModule(io.cdap.cdap.security.authorization.AuthorizationEnforcementModule)

Aggregations

DataSetsModules (io.cdap.cdap.data.runtime.DataSetsModules)68 ConfigModule (io.cdap.cdap.common.guice.ConfigModule)64 AuthenticationContextModules (io.cdap.cdap.security.auth.context.AuthenticationContextModules)64 AuthorizationEnforcementModule (io.cdap.cdap.security.authorization.AuthorizationEnforcementModule)64 AbstractModule (com.google.inject.AbstractModule)62 AuthorizationTestModule (io.cdap.cdap.security.authorization.AuthorizationTestModule)46 CConfiguration (io.cdap.cdap.common.conf.CConfiguration)44 NonCustomLocationUnitTestModule (io.cdap.cdap.common.guice.NonCustomLocationUnitTestModule)44 UnsupportedUGIProvider (io.cdap.cdap.security.impersonation.UnsupportedUGIProvider)40 DataFabricModules (io.cdap.cdap.data.runtime.DataFabricModules)36 SystemDatasetRuntimeModule (io.cdap.cdap.data.runtime.SystemDatasetRuntimeModule)34 ExploreClientModule (io.cdap.cdap.explore.guice.ExploreClientModule)32 StructuredTableAdmin (io.cdap.cdap.spi.data.StructuredTableAdmin)32 IOModule (io.cdap.cdap.common.guice.IOModule)30 InMemoryDiscoveryModule (io.cdap.cdap.common.guice.InMemoryDiscoveryModule)30 DataSetServiceModules (io.cdap.cdap.data.runtime.DataSetServiceModules)30 DefaultOwnerAdmin (io.cdap.cdap.security.impersonation.DefaultOwnerAdmin)30 TransactionManager (org.apache.tephra.TransactionManager)30 BeforeClass (org.junit.BeforeClass)30 NamespaceAdminTestModule (io.cdap.cdap.common.guice.NamespaceAdminTestModule)26