Daemon: add testSysModules using the standard ModuleOverloader

Allow the testing of the module override in the sysInjector
by adding the testSysModule provided by the test to the standard
override behaviour.

Make possible the writing of integration test scenarios for all
libModules, including the ones that rely on the overriding of
existing modules.

Enable the replacement of the AuditModule in tests, by adding
the extra createAuditModule() method which is intended to be
overridden by tests. Then, the test-case is based on a default
audit module annotated with @ModuleImpl which is subsequently
overridden by a libModule, annotated with @ModuleImpl as well and
a matching name.

Bug: Issue 13393
Change-Id: I68306905c0db5cecb92a7a504fa8d4adc8305103
This commit is contained in:
Luca Milanesio
2020-09-10 21:31:33 +01:00
parent 1e20974c92
commit dceb7efcf5
5 changed files with 85 additions and 11 deletions

View File

@@ -491,12 +491,13 @@ public class Daemon extends SiteProgram {
modules.add(new AccountDeactivator.Module());
modules.add(new ChangeCleanupRunner.Module());
}
modules.addAll(testSysModules);
modules.add(new LocalMergeSuperSetComputation.Module());
modules.add(new DefaultProjectNameLockManager.Module());
return cfgInjector.createChildInjector(
ModuleOverloader.override(
modules, LibModuleLoader.loadModules(cfgInjector, LibModuleType.SYS_MODULE)));
List<Module> libModules = LibModuleLoader.loadModules(cfgInjector, LibModuleType.SYS_MODULE);
libModules.addAll(testSysModules);
return cfgInjector.createChildInjector(ModuleOverloader.override(modules, libModules));
}
private Module createIndexModule() {