use of org.sonar.api.batch.Initializer in project sonarqube by SonarSource.
the class InitializersExecutor method execute.
public void execute() {
Collection<Initializer> initializers = selector.select(Initializer.class, module, true, null);
eventBus.fireEvent(new InitializersPhaseEvent(Lists.newArrayList(initializers), true));
if (LOG.isDebugEnabled()) {
LOG.debug("Initializers : {}", StringUtils.join(initializers, " -> "));
}
Project project = new Project(module.definition());
for (Initializer initializer : initializers) {
eventBus.fireEvent(new InitializerExecutionEvent(initializer, true));
Profiler profiler = Profiler.create(LOG).startInfo("Initializer " + initializer);
initializer.execute(project);
profiler.stopInfo();
eventBus.fireEvent(new InitializerExecutionEvent(initializer, false));
}
eventBus.fireEvent(new InitializersPhaseEvent(Lists.newArrayList(initializers), false));
}
use of org.sonar.api.batch.Initializer in project sonarqube by SonarSource.
the class PhasesSumUpTimeProfilerTest method initializerPhase.
private void initializerPhase(PhasesSumUpTimeProfiler profiler) {
Initializer initializer = new FakeInitializer();
// Start of initializer phase
profiler.onInitializersPhase(initializersEvent(true));
// Start of an initializer
profiler.onInitializerExecution(initializerEvent(initializer, true));
clock.sleep(7);
// End of an initializer
profiler.onInitializerExecution(initializerEvent(initializer, false));
// End of initializer phase
profiler.onInitializersPhase(initializersEvent(false));
}
Aggregations