use of co.cask.cdap.common.guice.ConfigModule in project cdap by caskdata.
the class MessagingHttpServiceTest method init.
@BeforeClass
public static void init() throws IOException {
cConf = CConfiguration.create();
cConf.set(Constants.CFG_LOCAL_DATA_DIR, TEMP_FOLDER.newFolder().getAbsolutePath());
cConf.setInt(Constants.MessagingSystem.HTTP_SERVER_CONSUME_CHUNK_SIZE, 128);
// Set max life time to a high value so that dummy tx ids that we create in the tests still work
cConf.setLong(TxConstants.Manager.CFG_TX_MAX_LIFETIME, 10000000000L);
Injector injector = Guice.createInjector(new ConfigModule(cConf), new DiscoveryRuntimeModule().getInMemoryModules(), new MessagingServerRuntimeModule().getInMemoryModules(), new AbstractModule() {
@Override
protected void configure() {
bind(MetricsCollectionService.class).toInstance(new NoOpMetricsCollectionService());
}
});
httpService = injector.getInstance(MessagingHttpService.class);
httpService.startAndWait();
client = new ClientMessagingService(injector.getInstance(DiscoveryServiceClient.class));
}
use of co.cask.cdap.common.guice.ConfigModule 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);
}
});
}
use of co.cask.cdap.common.guice.ConfigModule in project cdap by caskdata.
the class MetricsTestBase method getModules.
private List<Module> getModules() {
List<Module> modules = new ArrayList<>();
modules.add(new ConfigModule(cConf));
modules.add(new DiscoveryRuntimeModule().getInMemoryModules());
modules.add(new MessagingServerRuntimeModule().getInMemoryModules());
modules.add(new AbstractModule() {
@Override
protected void configure() {
bind(MetricsCollectionService.class).toInstance(new NoOpMetricsCollectionService());
}
});
modules.addAll(getAdditionalModules());
return modules;
}
use of co.cask.cdap.common.guice.ConfigModule in project cdap by caskdata.
the class ConfigurationCheckTest method runConfigurationCheck.
private void runConfigurationCheck(String param, String invalidValue) {
CConfiguration cConf = CConfiguration.create();
cConf.set(param, invalidValue);
Injector injector = Guice.createInjector(new ConfigModule(cConf));
ConfigurationCheck configurationCheck = injector.getInstance(ConfigurationCheck.class);
configurationCheck.run();
}
use of co.cask.cdap.common.guice.ConfigModule in project cdap by caskdata.
the class CDAPLogAppenderTest 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().getModule(), new TransactionModules().getInMemoryModules(), new LoggingModules().getInMemoryModules(), new DataSetsModules().getInMemoryModules(), new SystemDatasetRuntimeModule().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(UnsupportedUGIProvider.class);
bind(OwnerAdmin.class).to(DefaultOwnerAdmin.class);
bind(NamespaceQueryAdmin.class).to(SimpleNamespaceQueryAdmin.class);
}
});
txManager = injector.getInstance(TransactionManager.class);
txManager.startAndWait();
}
Aggregations