Search in sources :

Example 6 with LocalLocationModule

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

the class TetheringRuntimeJobManagerTest method setUp.

@BeforeClass
public static void setUp() throws IOException, TopicAlreadyExistsException {
    CConfiguration cConf = CConfiguration.create();
    cConf.set(Constants.Tethering.TOPIC_PREFIX, "prefix-");
    cConf.set(Constants.CFG_LOCAL_DATA_DIR, TEMP_FOLDER.newFolder().getAbsolutePath());
    Injector injector = Guice.createInjector(new ConfigModule(cConf), new InMemoryDiscoveryModule(), new LocalLocationModule(), new MessagingServerRuntimeModule().getInMemoryModules(), new AbstractModule() {

        @Override
        protected void configure() {
            bind(MetricsCollectionService.class).to(NoOpMetricsCollectionService.class).in(Scopes.SINGLETON);
        }
    });
    messagingService = injector.getInstance(MessagingService.class);
    if (messagingService instanceof Service) {
        ((Service) messagingService).startAndWait();
    }
    TetheringConf conf = TetheringConf.fromProperties(PROPERTIES);
    topicId = new TopicId(NamespaceId.SYSTEM.getNamespace(), cConf.get(Constants.Tethering.TOPIC_PREFIX) + TETHERED_INSTANCE_NAME);
    messagingService.createTopic(new TopicMetadata(topicId, Collections.emptyMap()));
    messageFetcher = new MultiThreadMessagingContext(messagingService).getMessageFetcher();
    runtimeJobManager = new TetheringRuntimeJobManager(conf, cConf, messagingService);
}
Also used : InMemoryDiscoveryModule(io.cdap.cdap.common.guice.InMemoryDiscoveryModule) NoOpMetricsCollectionService(io.cdap.cdap.common.metrics.NoOpMetricsCollectionService) MetricsCollectionService(io.cdap.cdap.api.metrics.MetricsCollectionService) ConfigModule(io.cdap.cdap.common.guice.ConfigModule) 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) MultiThreadMessagingContext(io.cdap.cdap.messaging.context.MultiThreadMessagingContext) CConfiguration(io.cdap.cdap.common.conf.CConfiguration) AbstractModule(com.google.inject.AbstractModule) MessagingService(io.cdap.cdap.messaging.MessagingService) TopicMetadata(io.cdap.cdap.messaging.TopicMetadata) LocalLocationModule(io.cdap.cdap.common.guice.LocalLocationModule) TetheringConf(io.cdap.cdap.internal.tethering.runtime.spi.provisioner.TetheringConf) Injector(com.google.inject.Injector) TopicId(io.cdap.cdap.proto.id.TopicId) BeforeClass(org.junit.BeforeClass)

Example 7 with LocalLocationModule

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

the class SqlDefaultSecretStoreTest 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);
        }
    });
    store = new DefaultSecretStore(injector.getInstance(TransactionRunner.class));
    StoreDefinition.SecretStore.create(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) DefaultSecretStore(io.cdap.cdap.data.security.DefaultSecretStore) Injector(com.google.inject.Injector) ConfigModule(io.cdap.cdap.common.guice.ConfigModule) 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 8 with LocalLocationModule

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

the class SqlProgramHeartBeatTableTest 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 9 with LocalLocationModule

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

the class FileFetcherHttpHandlerInternalTest method setup.

@BeforeClass
public static void setup() throws Exception {
    CConfiguration cConf = CConfiguration.create();
    cConf.set(Constants.CFG_LOCAL_DATA_DIR, TEMP_FOLDER.newFolder().getAbsolutePath());
    Injector injector = Guice.createInjector(new ConfigModule(cConf), new LocalLocationModule());
    FileFetcherHttpHandlerInternal handler = injector.getInstance(FileFetcherHttpHandlerInternal.class);
    httpService = NettyHttpService.builder("FileFetcherHttpHandlerInternalTest").setHttpHandlers(handler).setExceptionHandler(new HttpExceptionHandler()).build();
    httpService.start();
    InetSocketAddress addr = httpService.getBindAddress();
    baseURL = new URL(String.format("http://%s:%d", addr.getHostName(), addr.getPort()));
}
Also used : LocalLocationModule(io.cdap.cdap.common.guice.LocalLocationModule) Injector(com.google.inject.Injector) ConfigModule(io.cdap.cdap.common.guice.ConfigModule) InetSocketAddress(java.net.InetSocketAddress) HttpExceptionHandler(io.cdap.cdap.common.HttpExceptionHandler) CConfiguration(io.cdap.cdap.common.conf.CConfiguration) URL(java.net.URL) FileFetcherHttpHandlerInternal(io.cdap.cdap.gateway.handlers.FileFetcherHttpHandlerInternal) BeforeClass(org.junit.BeforeClass)

Example 10 with LocalLocationModule

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

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)

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