use of org.apache.hadoop.ozone.recon.persistence.AbstractReconSqlDBTest in project ozone by apache.
the class ReconTestInjector method setupInjector.
void setupInjector() throws IOException {
List<Module> modules = new ArrayList<>();
modules.add(new AbstractModule() {
@Override
protected void configure() {
try {
bind(OzoneConfiguration.class).toInstance(getTestOzoneConfiguration(temporaryFolder.newFolder()));
if (reconOMMetadataManager != null) {
bind(ReconOMMetadataManager.class).toInstance(reconOMMetadataManager);
}
if (ozoneManagerServiceProvider != null) {
bind(OzoneManagerServiceProvider.class).toInstance(ozoneManagerServiceProvider);
}
if (reconScm != null) {
bind(OzoneStorageContainerManager.class).toInstance(reconScm);
}
if (withContainerDB) {
bind(ReconContainerMetadataManager.class).to(ReconContainerMetadataManagerImpl.class).in(Singleton.class);
bind(ReconNamespaceSummaryManager.class).to(ReconNamespaceSummaryManagerImpl.class).in(Singleton.class);
bind(ReconDBProvider.class).in(Singleton.class);
}
for (Map.Entry<Class, Object> entry : extraInstanceBindings.entrySet()) {
bind(entry.getKey()).toInstance(entry.getValue());
}
for (Map.Entry<Class, Class> entry : extraInheritedBindings.entrySet()) {
bind(entry.getKey()).to(entry.getValue()).in(Singleton.class);
}
for (Class type : extraClassBindings) {
bind(type).in(Singleton.class);
}
} catch (IOException e) {
Assert.fail();
}
}
});
if (CollectionUtils.isNotEmpty(additionalModules)) {
modules.addAll(additionalModules);
}
if (withReconSqlDb) {
reconSqlDB = new AbstractReconSqlDBTest();
modules.addAll(reconSqlDB.getReconSqlDBModules());
}
injector = Guice.createInjector(modules);
if (reconSqlDB != null) {
reconSqlDB.createSchema(injector);
}
}
Aggregations