use of org.sonar.api.batch.PostJob in project sonarqube by SonarSource.
the class PostJobsExecutor method execute.
private void execute(SensorContext context, Collection<PostJob> postJobs) {
logPostJobs(postJobs);
Project project = new Project(module.definition());
for (PostJob postJob : postJobs) {
LOG.info("Executing post-job {}", ScannerUtils.describe(postJob));
eventBus.fireEvent(new PostJobExecutionEvent(postJob, true));
postJob.executeOn(project, context);
eventBus.fireEvent(new PostJobExecutionEvent(postJob, false));
}
}
use of org.sonar.api.batch.PostJob in project sonarqube by SonarSource.
the class PhasesSumUpTimeProfilerTest method postJobPhase.
private void postJobPhase(PhasesSumUpTimeProfiler profiler) {
PostJob postJob = new FakePostJob();
// Start of sensor phase
profiler.onPostJobsPhase(postJobsEvent(true));
// Start of a Sensor
profiler.onPostJobExecution(postJobEvent(postJob, true));
clock.sleep(30);
// End of a Sensor
profiler.onPostJobExecution(postJobEvent(postJob, false));
// End of sensor phase
profiler.onPostJobsPhase(postJobsEvent(false));
}