use of io.cdap.cdap.internal.provision.ProvisionerModule in project cdap by cdapio.
the class TetheringProvisionerTest method testGuiceInjector.
@Test
public void testGuiceInjector() throws Exception {
CConfiguration cConf = CConfiguration.create();
cConf.set(Constants.CFG_LOCAL_DATA_DIR, TEMP_FOLDER.newFolder().getAbsolutePath());
Injector injector = Guice.createInjector(new ConfigModule(cConf), new LocalLocationModule(), new InMemoryDiscoveryModule(), new StorageModule(), new ProvisionerModule(), new MessagingServerRuntimeModule().getInMemoryModules(), new AbstractModule() {
@Override
protected void configure() {
bind(MetricsCollectionService.class).to(NoOpMetricsCollectionService.class);
bind(SecureStore.class).toInstance(FakeSecureStore.builder().build());
bind(ProgramStateWriter.class).to(NoOpProgramStateWriter.class);
}
});
ProvisionerProvider provisionerProvider = injector.getInstance(ProvisionerProvider.class);
Map<String, Provisioner> provisioners = provisionerProvider.loadProvisioners();
Assert.assertNotNull(provisioners.get(TetheringProvisioner.TETHERING_NAME));
ProvisionerConfigProvider configProvider = injector.getInstance(ProvisionerConfigProvider.class);
Map<String, ProvisionerConfig> configs = configProvider.loadProvisionerConfigs(provisioners.values());
Assert.assertNotNull(configs.get(TetheringProvisioner.TETHERING_NAME));
}
use of io.cdap.cdap.internal.provision.ProvisionerModule in project cdap by caskdata.
the class TetheringProvisionerTest method testGuiceInjector.
@Test
public void testGuiceInjector() throws Exception {
CConfiguration cConf = CConfiguration.create();
cConf.set(Constants.CFG_LOCAL_DATA_DIR, TEMP_FOLDER.newFolder().getAbsolutePath());
Injector injector = Guice.createInjector(new ConfigModule(cConf), new LocalLocationModule(), new InMemoryDiscoveryModule(), new StorageModule(), new ProvisionerModule(), new MessagingServerRuntimeModule().getInMemoryModules(), new AbstractModule() {
@Override
protected void configure() {
bind(MetricsCollectionService.class).to(NoOpMetricsCollectionService.class);
bind(SecureStore.class).toInstance(FakeSecureStore.builder().build());
bind(ProgramStateWriter.class).to(NoOpProgramStateWriter.class);
}
});
ProvisionerProvider provisionerProvider = injector.getInstance(ProvisionerProvider.class);
Map<String, Provisioner> provisioners = provisionerProvider.loadProvisioners();
Assert.assertNotNull(provisioners.get(TetheringProvisioner.TETHERING_NAME));
ProvisionerConfigProvider configProvider = injector.getInstance(ProvisionerConfigProvider.class);
Map<String, ProvisionerConfig> configs = configProvider.loadProvisionerConfigs(provisioners.values());
Assert.assertNotNull(configs.get(TetheringProvisioner.TETHERING_NAME));
}
Aggregations