Search in sources :

Example 21 with LocalLocationModule

use of io.cdap.cdap.common.guice.LocalLocationModule in project cdap by cdapio.

the class DatasetMetadataStorageTest method doSetup.

public static Injector doSetup(Module... additionalModules) throws IOException {
    List<Module> modules = ImmutableList.<Module>builder().add(new ConfigModule(), new LocalLocationModule(), new TransactionInMemoryModule(), new SystemDatasetRuntimeModule().getInMemoryModules(), new NamespaceAdminTestModule(), new AuthorizationTestModule(), new AuthorizationEnforcementModule().getInMemoryModules(), new AuthenticationContextModules().getMasterModule(), new StorageModule(), new AbstractModule() {

        @Override
        protected void configure() {
            bind(MetricsCollectionService.class).to(NoOpMetricsCollectionService.class).in(Scopes.SINGLETON);
        }
    }).add(additionalModules).build();
    Injector injector = Guice.createInjector(modules);
    txManager = injector.getInstance(TransactionManager.class);
    txManager.startAndWait();
    storage = injector.getInstance(DatasetMetadataStorage.class);
    storage.createIndex();
    return injector;
}
Also used : StorageModule(io.cdap.cdap.data.runtime.StorageModule) TransactionInMemoryModule(org.apache.tephra.runtime.TransactionInMemoryModule) NamespaceAdminTestModule(io.cdap.cdap.common.guice.NamespaceAdminTestModule) 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) AuthorizationTestModule(io.cdap.cdap.security.authorization.AuthorizationTestModule) AbstractModule(com.google.inject.AbstractModule) LocalLocationModule(io.cdap.cdap.common.guice.LocalLocationModule) Injector(com.google.inject.Injector) TransactionManager(org.apache.tephra.TransactionManager) SystemDatasetRuntimeModule(io.cdap.cdap.data.runtime.SystemDatasetRuntimeModule) Module(com.google.inject.Module) ConfigModule(io.cdap.cdap.common.guice.ConfigModule) SystemDatasetRuntimeModule(io.cdap.cdap.data.runtime.SystemDatasetRuntimeModule) LocalLocationModule(io.cdap.cdap.common.guice.LocalLocationModule) AuthorizationTestModule(io.cdap.cdap.security.authorization.AuthorizationTestModule) NamespaceAdminTestModule(io.cdap.cdap.common.guice.NamespaceAdminTestModule) AuthorizationEnforcementModule(io.cdap.cdap.security.authorization.AuthorizationEnforcementModule) TransactionInMemoryModule(org.apache.tephra.runtime.TransactionInMemoryModule) StorageModule(io.cdap.cdap.data.runtime.StorageModule) AbstractModule(com.google.inject.AbstractModule) AuthorizationEnforcementModule(io.cdap.cdap.security.authorization.AuthorizationEnforcementModule)

Example 22 with LocalLocationModule

use of io.cdap.cdap.common.guice.LocalLocationModule in project cdap by cdapio.

the class DefaultOwnerStoreTest method setup.

@BeforeClass
public static void setup() throws IOException, TableAlreadyExistsException {
    CConfiguration cConf = CConfiguration.create();
    cConf.set(Constants.CFG_LOCAL_DATA_DIR, TEMP_FOLDER.newFolder().getAbsolutePath());
    Injector injector = Guice.createInjector(new ConfigModule(cConf), new DataSetsModules().getInMemoryModules(), new LocalLocationModule(), new TransactionInMemoryModule(), new SystemDatasetRuntimeModule().getInMemoryModules(), new NamespaceAdminTestModule(), new AuthorizationTestModule(), new AuthorizationEnforcementModule().getInMemoryModules(), new AuthenticationContextModules().getMasterModule(), new StorageModule(), new AbstractModule() {

        @Override
        protected void configure() {
            bind(MetricsCollectionService.class).to(NoOpMetricsCollectionService.class).in(Scopes.SINGLETON);
        }
    });
    injector.getInstance(TransactionManager.class).startAndWait();
    txRunner = injector.getInstance(TransactionRunner.class);
    StoreDefinition.OwnerStore.create(injector.getInstance(StructuredTableAdmin.class));
    ownerStore = new DefaultOwnerStore(txRunner);
}
Also used : StorageModule(io.cdap.cdap.data.runtime.StorageModule) TransactionInMemoryModule(org.apache.tephra.runtime.TransactionInMemoryModule) NamespaceAdminTestModule(io.cdap.cdap.common.guice.NamespaceAdminTestModule) 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) CConfiguration(io.cdap.cdap.common.conf.CConfiguration) AuthorizationTestModule(io.cdap.cdap.security.authorization.AuthorizationTestModule) AbstractModule(com.google.inject.AbstractModule) LocalLocationModule(io.cdap.cdap.common.guice.LocalLocationModule) Injector(com.google.inject.Injector) TransactionManager(org.apache.tephra.TransactionManager) TransactionRunner(io.cdap.cdap.spi.data.transaction.TransactionRunner) SystemDatasetRuntimeModule(io.cdap.cdap.data.runtime.SystemDatasetRuntimeModule) AuthorizationEnforcementModule(io.cdap.cdap.security.authorization.AuthorizationEnforcementModule) BeforeClass(org.junit.BeforeClass)

Example 23 with LocalLocationModule

use of io.cdap.cdap.common.guice.LocalLocationModule in project cdap by cdapio.

the class SqlOwnerStoreTest method setup.

@BeforeClass
public static void setup() throws Exception {
    CConfiguration cConf = CConfiguration.create();
    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);
        }
    });
    txRunner = injector.getInstance(TransactionRunner.class);
    StoreDefinition.OwnerStore.create(injector.getInstance(StructuredTableAdmin.class));
    ownerStore = new DefaultOwnerStore(txRunner);
}
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) TransactionRunner(io.cdap.cdap.spi.data.transaction.TransactionRunner) StructuredTableAdmin(io.cdap.cdap.spi.data.StructuredTableAdmin) SystemDatasetRuntimeModule(io.cdap.cdap.data.runtime.SystemDatasetRuntimeModule) CConfiguration(io.cdap.cdap.common.conf.CConfiguration) AbstractModule(com.google.inject.AbstractModule) BeforeClass(org.junit.BeforeClass)

Example 24 with LocalLocationModule

use of io.cdap.cdap.common.guice.LocalLocationModule in project cdap by cdapio.

the class SqlFieldLineageTableTest method beforeClass.

@BeforeClass
public static void beforeClass() throws IOException, TableAlreadyExistsException {
    CConfiguration cConf = CConfiguration.create();
    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);
        }
    });
    transactionRunner = injector.getInstance(TransactionRunner.class);
    StoreDefinition.createAllTables(injector.getInstance(StructuredTableAdmin.class));
}
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) TransactionRunner(io.cdap.cdap.spi.data.transaction.TransactionRunner) StructuredTableAdmin(io.cdap.cdap.spi.data.StructuredTableAdmin) SystemDatasetRuntimeModule(io.cdap.cdap.data.runtime.SystemDatasetRuntimeModule) CConfiguration(io.cdap.cdap.common.conf.CConfiguration) AbstractModule(com.google.inject.AbstractModule) BeforeClass(org.junit.BeforeClass)

Example 25 with LocalLocationModule

use of io.cdap.cdap.common.guice.LocalLocationModule in project cdap by cdapio.

the class SqlUsageTableTest method beforeClass.

@BeforeClass
public static void beforeClass() throws IOException, TableAlreadyExistsException {
    CConfiguration cConf = CConfiguration.create();
    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);
        }
    });
    transactionRunner = injector.getInstance(TransactionRunner.class);
    StoreDefinition.createAllTables(injector.getInstance(StructuredTableAdmin.class));
}
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) TransactionRunner(io.cdap.cdap.spi.data.transaction.TransactionRunner) StructuredTableAdmin(io.cdap.cdap.spi.data.StructuredTableAdmin) SystemDatasetRuntimeModule(io.cdap.cdap.data.runtime.SystemDatasetRuntimeModule) CConfiguration(io.cdap.cdap.common.conf.CConfiguration) AbstractModule(com.google.inject.AbstractModule) BeforeClass(org.junit.BeforeClass)

Aggregations

ConfigModule (io.cdap.cdap.common.guice.ConfigModule)54 LocalLocationModule (io.cdap.cdap.common.guice.LocalLocationModule)54 AbstractModule (com.google.inject.AbstractModule)48 CConfiguration (io.cdap.cdap.common.conf.CConfiguration)40 NoOpMetricsCollectionService (io.cdap.cdap.common.metrics.NoOpMetricsCollectionService)40 Injector (com.google.inject.Injector)38 MetricsCollectionService (io.cdap.cdap.api.metrics.MetricsCollectionService)38 StorageModule (io.cdap.cdap.data.runtime.StorageModule)32 BeforeClass (org.junit.BeforeClass)32 SystemDatasetRuntimeModule (io.cdap.cdap.data.runtime.SystemDatasetRuntimeModule)30 AuthenticationContextModules (io.cdap.cdap.security.auth.context.AuthenticationContextModules)26 StructuredTableAdmin (io.cdap.cdap.spi.data.StructuredTableAdmin)26 TransactionRunner (io.cdap.cdap.spi.data.transaction.TransactionRunner)22 InMemoryDiscoveryModule (io.cdap.cdap.common.guice.InMemoryDiscoveryModule)16 MessagingServerRuntimeModule (io.cdap.cdap.messaging.guice.MessagingServerRuntimeModule)16 Service (com.google.common.util.concurrent.Service)12 MessagingService (io.cdap.cdap.messaging.MessagingService)12 AuthorizationEnforcementModule (io.cdap.cdap.security.authorization.AuthorizationEnforcementModule)12 IOModule (io.cdap.cdap.common.guice.IOModule)10 KafkaClientModule (io.cdap.cdap.common.guice.KafkaClientModule)10