use of io.cdap.cdap.data.runtime.StorageModule in project cdap by cdapio.
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);
MockTwillContext mockTwillContext = new MockTwillContext();
return Guice.createInjector(new ConfigModule(cConf), new ZKClientModule(), new InMemoryDiscoveryModule(), new KafkaClientModule(), new LocalLocationModule(), new DistributedLogFrameworkModule(mockTwillContext.getInstanceId(), mockTwillContext.getInstanceCount()), new DataSetsModules().getInMemoryModules(), new TransactionModules().getInMemoryModules(), new TransactionExecutorModule(), new SystemDatasetRuntimeModule().getInMemoryModules(), new NamespaceAdminTestModule(), new AuthorizationTestModule(), new AuthorizationEnforcementModule().getInMemoryModules(), new AuthenticationContextModules().getNoOpModule(), new StorageModule(), 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 io.cdap.cdap.data.runtime.StorageModule in project cdap by cdapio.
the class StorageMain method createStorage.
@VisibleForTesting
void createStorage(CConfiguration cConf) throws IOException {
LOG.info("Creating storages");
CoreSecurityModule coreSecurityModule = CoreSecurityRuntimeModule.getDistributedModule(cConf);
List<Module> modules = new ArrayList<>(Arrays.asList(new ConfigModule(cConf), RemoteAuthenticatorModules.getDefaultModule(), new SystemDatasetRuntimeModule().getStandaloneModules(), // But due to the DataSetsModules, we need to pull in more modules.
new DataSetsModules().getStandaloneModules(), new InMemoryDiscoveryModule(), new StorageModule(), new DFSLocationModule(), new IOModule(), coreSecurityModule, new AuthenticationContextModules().getMasterModule(), new AbstractModule() {
@Override
protected void configure() {
bind(AccessEnforcer.class).to(NoOpAccessController.class);
bind(TransactionSystemClient.class).to(ConstantTransactionSystemClient.class);
// The metrics collection service might not get started at this moment,
// so inject a NoopMetricsCollectionService.
bind(MetricsCollectionService.class).to(NoOpMetricsCollectionService.class).in(Scopes.SINGLETON);
}
}));
if (coreSecurityModule.requiresZKClient()) {
modules.add(new ZKClientModule());
}
Injector injector = Guice.createInjector(modules);
// Create stores definitions
StoreDefinition.createAllTables(injector.getInstance(StructuredTableAdmin.class));
// Create metadata tables
try (MetadataStorage metadataStorage = injector.getInstance(MetadataStorage.class)) {
metadataStorage.createIndex();
}
injector.getInstance(LevelDBTableService.class).close();
LOG.info("Storage creation completed");
}
use of io.cdap.cdap.data.runtime.StorageModule in project cdap by cdapio.
the class RollingLocationLogAppenderTest 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) + "/" + RollingLocationLogAppender.class.getSimpleName();
cConf.set(LoggingConfiguration.LOG_BASE_DIR, logBaseDir);
injector = Guice.createInjector(new ConfigModule(cConf, hConf), new NonCustomLocationUnitTestModule(), new TransactionModules().getInMemoryModules(), new LocalLogAppenderModule(), new DataSetsModules().getInMemoryModules(), new SystemDatasetRuntimeModule().getInMemoryModules(), new AuthorizationTestModule(), new AuthorizationEnforcementModule().getInMemoryModules(), new AuthenticationContextModules().getNoOpModule(), new StorageModule(), new AbstractModule() {
@Override
protected void configure() {
bind(MetricsCollectionService.class).to(NoOpMetricsCollectionService.class);
bind(UGIProvider.class).to(UnsupportedUGIProvider.class);
bind(NamespaceQueryAdmin.class).to(SimpleNamespaceQueryAdmin.class);
bind(OwnerAdmin.class).to(NoOpOwnerAdmin.class);
}
});
txManager = injector.getInstance(TransactionManager.class);
txManager.startAndWait();
}
use of io.cdap.cdap.data.runtime.StorageModule in project cdap by cdapio.
the class FileMetadataTest 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(), new TransactionModules().getInMemoryModules(), new LocalLogAppenderModule(), new DataSetsModules().getInMemoryModules(), new SystemDatasetRuntimeModule().getInMemoryModules(), new AuthorizationTestModule(), new AuthorizationEnforcementModule().getInMemoryModules(), new AuthenticationContextModules().getNoOpModule(), new StorageModule(), 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();
StoreDefinition.LogFileMetaStore.create(injector.getInstance(StructuredTableAdmin.class));
}
Aggregations