Search in sources :

Example 1 with MockTwillContext

use of co.cask.cdap.common.test.MockTwillContext 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);
    return Guice.createInjector(new ConfigModule(cConf), new ZKClientModule(), new DiscoveryRuntimeModule().getInMemoryModules(), new KafkaClientModule(), new LocationRuntimeModule().getInMemoryModules(), new DistributedLogFrameworkModule(new MockTwillContext()), new DataSetsModules().getInMemoryModules(), new TransactionModules().getInMemoryModules(), new TransactionExecutorModule(), new SystemDatasetRuntimeModule().getInMemoryModules(), new NamespaceClientRuntimeModule().getInMemoryModules(), new AuthorizationTestModule(), new AuthorizationEnforcementModule().getInMemoryModules(), new AuthenticationContextModules().getNoOpModule(), 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 : NamespaceClientRuntimeModule(co.cask.cdap.common.namespace.guice.NamespaceClientRuntimeModule) MockTwillContext(co.cask.cdap.common.test.MockTwillContext) ConfigModule(co.cask.cdap.common.guice.ConfigModule) AuthenticationContextModules(co.cask.cdap.security.auth.context.AuthenticationContextModules) DataSetsModules(co.cask.cdap.data.runtime.DataSetsModules) LocationRuntimeModule(co.cask.cdap.common.guice.LocationRuntimeModule) NoOpMetricsCollectionService(co.cask.cdap.common.metrics.NoOpMetricsCollectionService) DefaultOwnerAdmin(co.cask.cdap.security.impersonation.DefaultOwnerAdmin) CConfiguration(co.cask.cdap.common.conf.CConfiguration) AuthorizationTestModule(co.cask.cdap.security.authorization.AuthorizationTestModule) AbstractModule(com.google.inject.AbstractModule) TransactionModules(org.apache.tephra.runtime.TransactionModules) ZKClientModule(co.cask.cdap.common.guice.ZKClientModule) TransactionExecutorModule(co.cask.cdap.data.runtime.TransactionExecutorModule) KafkaClientModule(co.cask.cdap.common.guice.KafkaClientModule) DistributedLogFrameworkModule(co.cask.cdap.logging.guice.DistributedLogFrameworkModule) CurrentUGIProvider(co.cask.cdap.security.impersonation.CurrentUGIProvider) SystemDatasetRuntimeModule(co.cask.cdap.data.runtime.SystemDatasetRuntimeModule) DiscoveryRuntimeModule(co.cask.cdap.common.guice.DiscoveryRuntimeModule) AuthorizationEnforcementModule(co.cask.cdap.security.authorization.AuthorizationEnforcementModule)

Aggregations

CConfiguration (co.cask.cdap.common.conf.CConfiguration)1 ConfigModule (co.cask.cdap.common.guice.ConfigModule)1 DiscoveryRuntimeModule (co.cask.cdap.common.guice.DiscoveryRuntimeModule)1 KafkaClientModule (co.cask.cdap.common.guice.KafkaClientModule)1 LocationRuntimeModule (co.cask.cdap.common.guice.LocationRuntimeModule)1 ZKClientModule (co.cask.cdap.common.guice.ZKClientModule)1 NoOpMetricsCollectionService (co.cask.cdap.common.metrics.NoOpMetricsCollectionService)1 NamespaceClientRuntimeModule (co.cask.cdap.common.namespace.guice.NamespaceClientRuntimeModule)1 MockTwillContext (co.cask.cdap.common.test.MockTwillContext)1 DataSetsModules (co.cask.cdap.data.runtime.DataSetsModules)1 SystemDatasetRuntimeModule (co.cask.cdap.data.runtime.SystemDatasetRuntimeModule)1 TransactionExecutorModule (co.cask.cdap.data.runtime.TransactionExecutorModule)1 DistributedLogFrameworkModule (co.cask.cdap.logging.guice.DistributedLogFrameworkModule)1 AuthenticationContextModules (co.cask.cdap.security.auth.context.AuthenticationContextModules)1 AuthorizationEnforcementModule (co.cask.cdap.security.authorization.AuthorizationEnforcementModule)1 AuthorizationTestModule (co.cask.cdap.security.authorization.AuthorizationTestModule)1 CurrentUGIProvider (co.cask.cdap.security.impersonation.CurrentUGIProvider)1 DefaultOwnerAdmin (co.cask.cdap.security.impersonation.DefaultOwnerAdmin)1 AbstractModule (com.google.inject.AbstractModule)1 TransactionModules (org.apache.tephra.runtime.TransactionModules)1