use of io.cdap.cdap.data.runtime.StorageModule in project cdap by cdapio.
the class NoSqlJobQueueTableTest method beforeClass.
@BeforeClass
public static void beforeClass() throws IOException, TableAlreadyExistsException {
cConf = CConfiguration.create();
cConf.set(Constants.CFG_LOCAL_DATA_DIR, TEMP_FOLDER.newFolder().getAbsolutePath());
cConf.set(Constants.Dataset.DATA_STORAGE_IMPLEMENTATION, Constants.Dataset.DATA_STORAGE_NOSQL);
txManager = new TransactionManager(new Configuration());
txManager.startAndWait();
Injector injector = Guice.createInjector(new ConfigModule(cConf), new LocalLocationModule(), new SystemDatasetRuntimeModule().getInMemoryModules(), new StorageModule(), new AbstractModule() {
@Override
protected void configure() {
bind(DatasetDefinitionRegistryFactory.class).to(DefaultDatasetDefinitionRegistryFactory.class).in(Scopes.SINGLETON);
bind(DatasetFramework.class).to(InMemoryDatasetFramework.class);
bind(NamespaceQueryAdmin.class).to(InMemoryNamespaceAdmin.class).in(Scopes.SINGLETON);
bind(TransactionSystemClient.class).toInstance(new InMemoryTxSystemClient(txManager));
bind(MetricsCollectionService.class).to(NoOpMetricsCollectionService.class).in(Scopes.SINGLETON);
}
});
StructuredTableAdmin tableAdmin = injector.getInstance(StructuredTableAdmin.class);
transactionRunner = injector.getInstance(TransactionRunner.class);
StoreDefinition.JobQueueStore.create(tableAdmin);
StoreDefinition.AppMetadataStore.create(tableAdmin);
}
use of io.cdap.cdap.data.runtime.StorageModule in project cdap by cdapio.
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 cdapio.
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);
}
use of io.cdap.cdap.data.runtime.StorageModule in project cdap by cdapio.
the class TetheringClientHandlerTest method setup.
@BeforeClass
public static void setup() throws Exception {
cConf = CConfiguration.create();
injector = Guice.createInjector(new ConfigModule(cConf), RemoteAuthenticatorModules.getNoOpModule(), new SystemDatasetRuntimeModule().getInMemoryModules(), new TransactionModules().getInMemoryModules(), new TransactionExecutorModule(), new InMemoryDiscoveryModule(), new MessagingServerRuntimeModule().getInMemoryModules(), new StorageModule(), new AuthorizationTestModule(), new AuthorizationEnforcementModule().getInMemoryModules(), new AuthenticationContextModules().getMasterModule(), new PrivateModule() {
@Override
protected void configure() {
bind(MetricsCollectionService.class).to(NoOpMetricsCollectionService.class).in(Scopes.SINGLETON);
expose(MetricsCollectionService.class);
}
});
tetheringStore = new TetheringStore(injector.getInstance(TransactionRunner.class));
txManager = injector.getInstance(TransactionManager.class);
txManager.startAndWait();
}
use of io.cdap.cdap.data.runtime.StorageModule in project cdap by cdapio.
the class TetheringServerHandlerTest method setup.
@BeforeClass
public static void setup() throws IOException {
cConf = CConfiguration.create();
cConf.set(Constants.CFG_LOCAL_DATA_DIR, TEMP_FOLDER.newFolder().getAbsolutePath());
topicPrefix = cConf.get(Constants.Tethering.TOPIC_PREFIX);
injector = Guice.createInjector(new ConfigModule(cConf), new SystemDatasetRuntimeModule().getInMemoryModules(), new TransactionModules().getInMemoryModules(), new TransactionExecutorModule(), new InMemoryDiscoveryModule(), new LocalLocationModule(), new MessagingServerRuntimeModule().getInMemoryModules(), new StorageModule(), new AuthorizationTestModule(), new AuthorizationEnforcementModule().getInMemoryModules(), new AuthenticationContextModules().getMasterModule(), new PrivateModule() {
@Override
protected void configure() {
bind(MetricsCollectionService.class).to(NoOpMetricsCollectionService.class).in(Scopes.SINGLETON);
expose(MetricsCollectionService.class);
}
});
tetheringStore = new TetheringStore(injector.getInstance(TransactionRunner.class));
messagingService = injector.getInstance(MessagingService.class);
if (messagingService instanceof Service) {
((Service) messagingService).startAndWait();
}
txManager = injector.getInstance(TransactionManager.class);
txManager.startAndWait();
}
Aggregations