use of io.cdap.cdap.data.runtime.StorageModule in project cdap by caskdata.
the class SqlJobQueueTableTest method setup.
@BeforeClass
public static void setup() throws Exception {
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(NamespaceQueryAdmin.class).to(InMemoryNamespaceAdmin.class).in(Scopes.SINGLETON);
bind(MetricsCollectionService.class).to(NoOpMetricsCollectionService.class).in(Scopes.SINGLETON);
}
});
StructuredTableAdmin structuredTableAdmin = injector.getInstance(StructuredTableAdmin.class);
transactionRunner = injector.getInstance(TransactionRunner.class);
StoreDefinition.JobQueueStore.create(structuredTableAdmin);
StoreDefinition.AppMetadataStore.create(structuredTableAdmin);
}
use of io.cdap.cdap.data.runtime.StorageModule in project cdap by caskdata.
the class DirectRuntimeRequestValidatorTest method setup.
@Before
public void setup() throws IOException, TableAlreadyExistsException {
cConf = CConfiguration.create();
cConf.set(Constants.CFG_LOCAL_DATA_DIR, TEMP_FOLDER.newFolder().toString());
// This will effectively turn off the cache in the validator with a TTL of 0.
cConf.setLong(Constants.RuntimeMonitor.POLL_TIME_MS, 0L);
Injector injector = Guice.createInjector(new ConfigModule(cConf), new SystemDatasetRuntimeModule().getInMemoryModules(), new DataSetsModules().getInMemoryModules(), new NamespaceAdminTestModule(), new StorageModule(), new AuthenticationContextModules().getNoOpModule(), new AbstractModule() {
@Override
protected void configure() {
bind(MetricsCollectionService.class).to(NoOpMetricsCollectionService.class);
bind(AccessEnforcer.class).to(NoOpAccessController.class);
bind(TransactionSystemClient.class).to(ConstantTransactionSystemClient.class);
bind(Store.class).to(DefaultStore.class);
}
});
// Create store definition
StoreDefinition.AppMetadataStore.create(injector.getInstance(StructuredTableAdmin.class));
txRunner = injector.getInstance(TransactionRunner.class);
}
use of io.cdap.cdap.data.runtime.StorageModule in project cdap by caskdata.
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 SqlAppMetadataStoreTest 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.AppMetadataStore.create(injector.getInstance(StructuredTableAdmin.class));
}
use of io.cdap.cdap.data.runtime.StorageModule in project cdap by cdapio.
the class SqlStructuredTableTest method beforeClass.
@BeforeClass
public static void beforeClass() throws Exception {
CConfiguration cConf = CConfiguration.create();
pg = PostgresInstantiator.createAndStart(cConf, TEMP_FOLDER.newFolder());
Injector injector = Guice.createInjector(new ConfigModule(cConf), new StorageModule(), new AbstractModule() {
@Override
protected void configure() {
bind(MetricsCollectionService.class).to(NoOpMetricsCollectionService.class).in(Scopes.SINGLETON);
}
});
tableAdmin = injector.getInstance(StructuredTableAdmin.class);
transactionRunner = injector.getInstance(TransactionRunner.class);
Assert.assertEquals(PostgreSqlStructuredTableAdmin.class, tableAdmin.getClass());
Assert.assertEquals(RetryingSqlTransactionRunner.class, transactionRunner.getClass());
}
Aggregations