Search in sources :

Example 51 with StorageModule

use of io.cdap.cdap.data.runtime.StorageModule in project cdap by cdapio.

the class NoSqlJobQueueTableTest method beforeClass.

@BeforeClass
public static void beforeClass() throws IOException, TableAlreadyExistsException {
    cConf = CConfiguration.create();
    cConf.set(Constants.CFG_LOCAL_DATA_DIR, TEMP_FOLDER.newFolder().getAbsolutePath());
    cConf.set(Constants.Dataset.DATA_STORAGE_IMPLEMENTATION, Constants.Dataset.DATA_STORAGE_NOSQL);
    txManager = new TransactionManager(new Configuration());
    txManager.startAndWait();
    Injector injector = Guice.createInjector(new ConfigModule(cConf), new LocalLocationModule(), new SystemDatasetRuntimeModule().getInMemoryModules(), new StorageModule(), new AbstractModule() {

        @Override
        protected void configure() {
            bind(DatasetDefinitionRegistryFactory.class).to(DefaultDatasetDefinitionRegistryFactory.class).in(Scopes.SINGLETON);
            bind(DatasetFramework.class).to(InMemoryDatasetFramework.class);
            bind(NamespaceQueryAdmin.class).to(InMemoryNamespaceAdmin.class).in(Scopes.SINGLETON);
            bind(TransactionSystemClient.class).toInstance(new InMemoryTxSystemClient(txManager));
            bind(MetricsCollectionService.class).to(NoOpMetricsCollectionService.class).in(Scopes.SINGLETON);
        }
    });
    StructuredTableAdmin tableAdmin = injector.getInstance(StructuredTableAdmin.class);
    transactionRunner = injector.getInstance(TransactionRunner.class);
    StoreDefinition.JobQueueStore.create(tableAdmin);
    StoreDefinition.AppMetadataStore.create(tableAdmin);
}
Also used : StorageModule(io.cdap.cdap.data.runtime.StorageModule) Configuration(org.apache.hadoop.conf.Configuration) CConfiguration(io.cdap.cdap.common.conf.CConfiguration) NoOpMetricsCollectionService(io.cdap.cdap.common.metrics.NoOpMetricsCollectionService) MetricsCollectionService(io.cdap.cdap.api.metrics.MetricsCollectionService) ConfigModule(io.cdap.cdap.common.guice.ConfigModule) StructuredTableAdmin(io.cdap.cdap.spi.data.StructuredTableAdmin) InMemoryTxSystemClient(org.apache.tephra.inmemory.InMemoryTxSystemClient) AbstractModule(com.google.inject.AbstractModule) LocalLocationModule(io.cdap.cdap.common.guice.LocalLocationModule) DatasetDefinitionRegistryFactory(io.cdap.cdap.data2.dataset2.DatasetDefinitionRegistryFactory) DefaultDatasetDefinitionRegistryFactory(io.cdap.cdap.data2.dataset2.DefaultDatasetDefinitionRegistryFactory) TransactionManager(org.apache.tephra.TransactionManager) Injector(com.google.inject.Injector) TransactionRunner(io.cdap.cdap.spi.data.transaction.TransactionRunner) NamespaceQueryAdmin(io.cdap.cdap.common.namespace.NamespaceQueryAdmin) SystemDatasetRuntimeModule(io.cdap.cdap.data.runtime.SystemDatasetRuntimeModule) InMemoryDatasetFramework(io.cdap.cdap.data2.dataset2.InMemoryDatasetFramework) BeforeClass(org.junit.BeforeClass)

Example 52 with StorageModule

use of io.cdap.cdap.data.runtime.StorageModule in project cdap by cdapio.

the class DirectRuntimeRequestValidatorTest method setup.

@Before
public void setup() throws IOException, TableAlreadyExistsException {
    cConf = CConfiguration.create();
    cConf.set(Constants.CFG_LOCAL_DATA_DIR, TEMP_FOLDER.newFolder().toString());
    // This will effectively turn off the cache in the validator with a TTL of 0.
    cConf.setLong(Constants.RuntimeMonitor.POLL_TIME_MS, 0L);
    Injector injector = Guice.createInjector(new ConfigModule(cConf), new SystemDatasetRuntimeModule().getInMemoryModules(), new DataSetsModules().getInMemoryModules(), new NamespaceAdminTestModule(), new StorageModule(), new AuthenticationContextModules().getNoOpModule(), new AbstractModule() {

        @Override
        protected void configure() {
            bind(MetricsCollectionService.class).to(NoOpMetricsCollectionService.class);
            bind(AccessEnforcer.class).to(NoOpAccessController.class);
            bind(TransactionSystemClient.class).to(ConstantTransactionSystemClient.class);
            bind(Store.class).to(DefaultStore.class);
        }
    });
    // Create store definition
    StoreDefinition.AppMetadataStore.create(injector.getInstance(StructuredTableAdmin.class));
    txRunner = injector.getInstance(TransactionRunner.class);
}
Also used : DefaultStore(io.cdap.cdap.internal.app.store.DefaultStore) 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) StructuredTableAdmin(io.cdap.cdap.spi.data.StructuredTableAdmin) DataSetsModules(io.cdap.cdap.data.runtime.DataSetsModules) NoOpMetricsCollectionService(io.cdap.cdap.common.metrics.NoOpMetricsCollectionService) ConstantTransactionSystemClient(io.cdap.cdap.data.runtime.ConstantTransactionSystemClient) AbstractModule(com.google.inject.AbstractModule) Injector(com.google.inject.Injector) TransactionRunner(io.cdap.cdap.spi.data.transaction.TransactionRunner) SystemDatasetRuntimeModule(io.cdap.cdap.data.runtime.SystemDatasetRuntimeModule) NoOpAccessController(io.cdap.cdap.security.spi.authorization.NoOpAccessController) Before(org.junit.Before)

Example 53 with StorageModule

use of io.cdap.cdap.data.runtime.StorageModule in project cdap by cdapio.

the class SqlUserConfigStoreTest method setup.

@BeforeClass
public static void setup() throws Exception {
    CConfiguration cConf = CConfiguration.create();
    // any plugin which requires transaction will be excluded
    cConf.set(Constants.REQUIREMENTS_DATASET_TYPE_EXCLUDE, Joiner.on(",").join(Table.TYPE, KeyValueTable.TYPE));
    pg = PostgresInstantiator.createAndStart(cConf, TEMP_FOLDER.newFolder());
    Injector injector = Guice.createInjector(new ConfigModule(cConf), new LocalLocationModule(), new SystemDatasetRuntimeModule().getInMemoryModules(), new StorageModule(), new AbstractModule() {

        @Override
        protected void configure() {
            bind(MetricsCollectionService.class).to(NoOpMetricsCollectionService.class).in(Scopes.SINGLETON);
        }
    });
    admin = injector.getInstance(StructuredTableAdmin.class);
    TransactionRunner transactionRunner = injector.getInstance(TransactionRunner.class);
    configStore = new DefaultConfigStore(transactionRunner);
}
Also used : StorageModule(io.cdap.cdap.data.runtime.StorageModule) LocalLocationModule(io.cdap.cdap.common.guice.LocalLocationModule) MetricsCollectionService(io.cdap.cdap.api.metrics.MetricsCollectionService) NoOpMetricsCollectionService(io.cdap.cdap.common.metrics.NoOpMetricsCollectionService) Injector(com.google.inject.Injector) ConfigModule(io.cdap.cdap.common.guice.ConfigModule) StructuredTableAdmin(io.cdap.cdap.spi.data.StructuredTableAdmin) TransactionRunner(io.cdap.cdap.spi.data.transaction.TransactionRunner) SystemDatasetRuntimeModule(io.cdap.cdap.data.runtime.SystemDatasetRuntimeModule) CConfiguration(io.cdap.cdap.common.conf.CConfiguration) AbstractModule(com.google.inject.AbstractModule) BeforeClass(org.junit.BeforeClass)

Example 54 with StorageModule

use of io.cdap.cdap.data.runtime.StorageModule in project cdap by cdapio.

the class TetheringClientHandlerTest method setup.

@BeforeClass
public static void setup() throws Exception {
    cConf = CConfiguration.create();
    injector = Guice.createInjector(new ConfigModule(cConf), RemoteAuthenticatorModules.getNoOpModule(), new SystemDatasetRuntimeModule().getInMemoryModules(), new TransactionModules().getInMemoryModules(), new TransactionExecutorModule(), new InMemoryDiscoveryModule(), new MessagingServerRuntimeModule().getInMemoryModules(), new StorageModule(), new AuthorizationTestModule(), new AuthorizationEnforcementModule().getInMemoryModules(), new AuthenticationContextModules().getMasterModule(), new PrivateModule() {

        @Override
        protected void configure() {
            bind(MetricsCollectionService.class).to(NoOpMetricsCollectionService.class).in(Scopes.SINGLETON);
            expose(MetricsCollectionService.class);
        }
    });
    tetheringStore = new TetheringStore(injector.getInstance(TransactionRunner.class));
    txManager = injector.getInstance(TransactionManager.class);
    txManager.startAndWait();
}
Also used : InMemoryDiscoveryModule(io.cdap.cdap.common.guice.InMemoryDiscoveryModule) StorageModule(io.cdap.cdap.data.runtime.StorageModule) ConfigModule(io.cdap.cdap.common.guice.ConfigModule) AuthenticationContextModules(io.cdap.cdap.security.auth.context.AuthenticationContextModules) MessagingServerRuntimeModule(io.cdap.cdap.messaging.guice.MessagingServerRuntimeModule) NoOpMetricsCollectionService(io.cdap.cdap.common.metrics.NoOpMetricsCollectionService) AuthorizationTestModule(io.cdap.cdap.security.authorization.AuthorizationTestModule) TransactionModules(org.apache.tephra.runtime.TransactionModules) TransactionExecutorModule(io.cdap.cdap.data.runtime.TransactionExecutorModule) TransactionManager(org.apache.tephra.TransactionManager) SystemDatasetRuntimeModule(io.cdap.cdap.data.runtime.SystemDatasetRuntimeModule) AuthorizationEnforcementModule(io.cdap.cdap.security.authorization.AuthorizationEnforcementModule) PrivateModule(com.google.inject.PrivateModule) BeforeClass(org.junit.BeforeClass)

Example 55 with StorageModule

use of io.cdap.cdap.data.runtime.StorageModule in project cdap by cdapio.

the class TetheringServerHandlerTest method setup.

@BeforeClass
public static void setup() throws IOException {
    cConf = CConfiguration.create();
    cConf.set(Constants.CFG_LOCAL_DATA_DIR, TEMP_FOLDER.newFolder().getAbsolutePath());
    topicPrefix = cConf.get(Constants.Tethering.TOPIC_PREFIX);
    injector = Guice.createInjector(new ConfigModule(cConf), new SystemDatasetRuntimeModule().getInMemoryModules(), new TransactionModules().getInMemoryModules(), new TransactionExecutorModule(), new InMemoryDiscoveryModule(), new LocalLocationModule(), new MessagingServerRuntimeModule().getInMemoryModules(), new StorageModule(), new AuthorizationTestModule(), new AuthorizationEnforcementModule().getInMemoryModules(), new AuthenticationContextModules().getMasterModule(), new PrivateModule() {

        @Override
        protected void configure() {
            bind(MetricsCollectionService.class).to(NoOpMetricsCollectionService.class).in(Scopes.SINGLETON);
            expose(MetricsCollectionService.class);
        }
    });
    tetheringStore = new TetheringStore(injector.getInstance(TransactionRunner.class));
    messagingService = injector.getInstance(MessagingService.class);
    if (messagingService instanceof Service) {
        ((Service) messagingService).startAndWait();
    }
    txManager = injector.getInstance(TransactionManager.class);
    txManager.startAndWait();
}
Also used : InMemoryDiscoveryModule(io.cdap.cdap.common.guice.InMemoryDiscoveryModule) StorageModule(io.cdap.cdap.data.runtime.StorageModule) ConfigModule(io.cdap.cdap.common.guice.ConfigModule) AuthenticationContextModules(io.cdap.cdap.security.auth.context.AuthenticationContextModules) NettyHttpService(io.cdap.http.NettyHttpService) NoOpMetricsCollectionService(io.cdap.cdap.common.metrics.NoOpMetricsCollectionService) MessagingService(io.cdap.cdap.messaging.MessagingService) Service(com.google.common.util.concurrent.Service) MetricsCollectionService(io.cdap.cdap.api.metrics.MetricsCollectionService) MessagingServerRuntimeModule(io.cdap.cdap.messaging.guice.MessagingServerRuntimeModule) NoOpMetricsCollectionService(io.cdap.cdap.common.metrics.NoOpMetricsCollectionService) AuthorizationTestModule(io.cdap.cdap.security.authorization.AuthorizationTestModule) MessagingService(io.cdap.cdap.messaging.MessagingService) TransactionModules(org.apache.tephra.runtime.TransactionModules) TransactionExecutorModule(io.cdap.cdap.data.runtime.TransactionExecutorModule) LocalLocationModule(io.cdap.cdap.common.guice.LocalLocationModule) TransactionManager(org.apache.tephra.TransactionManager) SystemDatasetRuntimeModule(io.cdap.cdap.data.runtime.SystemDatasetRuntimeModule) AuthorizationEnforcementModule(io.cdap.cdap.security.authorization.AuthorizationEnforcementModule) PrivateModule(com.google.inject.PrivateModule) BeforeClass(org.junit.BeforeClass)

Aggregations

StorageModule (io.cdap.cdap.data.runtime.StorageModule)64 ConfigModule (io.cdap.cdap.common.guice.ConfigModule)62 NoOpMetricsCollectionService (io.cdap.cdap.common.metrics.NoOpMetricsCollectionService)62 AbstractModule (com.google.inject.AbstractModule)58 SystemDatasetRuntimeModule (io.cdap.cdap.data.runtime.SystemDatasetRuntimeModule)56 MetricsCollectionService (io.cdap.cdap.api.metrics.MetricsCollectionService)50 StructuredTableAdmin (io.cdap.cdap.spi.data.StructuredTableAdmin)48 BeforeClass (org.junit.BeforeClass)46 CConfiguration (io.cdap.cdap.common.conf.CConfiguration)44 Injector (com.google.inject.Injector)38 LocalLocationModule (io.cdap.cdap.common.guice.LocalLocationModule)32 AuthenticationContextModules (io.cdap.cdap.security.auth.context.AuthenticationContextModules)32 TransactionRunner (io.cdap.cdap.spi.data.transaction.TransactionRunner)32 TransactionManager (org.apache.tephra.TransactionManager)30 AuthorizationEnforcementModule (io.cdap.cdap.security.authorization.AuthorizationEnforcementModule)28 AuthorizationTestModule (io.cdap.cdap.security.authorization.AuthorizationTestModule)28 DataSetsModules (io.cdap.cdap.data.runtime.DataSetsModules)22 TransactionModules (org.apache.tephra.runtime.TransactionModules)22 NamespaceQueryAdmin (io.cdap.cdap.common.namespace.NamespaceQueryAdmin)20 NonCustomLocationUnitTestModule (io.cdap.cdap.common.guice.NonCustomLocationUnitTestModule)18