use of org.sonar.api.resources.Project in project sonarqube by SonarSource.
the class PhasesSumUpTimeProfilerTest method testSimpleProject.
@Test
public void testSimpleProject() throws InterruptedException {
final Project project = mockProject("my:project", true);
fakeAnalysis(profiler, project);
assertThat(profiler.currentModuleProfiling.getProfilingPerPhase(Phase.INIT).getProfilingPerItem(new FakeInitializer()).totalTime()).isEqualTo(7L);
assertThat(profiler.currentModuleProfiling.getProfilingPerPhase(Phase.SENSOR).getProfilingPerItem(new FakeSensor()).totalTime()).isEqualTo(10L);
assertThat(profiler.currentModuleProfiling.getProfilingPerPhase(Phase.POSTJOB).getProfilingPerItem(new FakePostJob()).totalTime()).isEqualTo(30L);
assertThat(profiler.currentModuleProfiling.getProfilingPerBatchStep("Free memory").totalTime()).isEqualTo(9L);
}
use of org.sonar.api.resources.Project in project sonarqube by SonarSource.
the class PhasesSumUpTimeProfilerTest method testMultimoduleProject.
@Test
public void testMultimoduleProject() throws InterruptedException {
final Project project = mockProject("project root", true);
final Project moduleA = mockProject("moduleA", false);
final Project moduleB = mockProject("moduleB", false);
project.definition().addSubProject(moduleA.definition());
project.definition().addSubProject(moduleA.definition());
fakeAnalysis(profiler, moduleA);
fakeAnalysis(profiler, moduleB);
fakeAnalysis(profiler, project);
assertThat(profiler.currentModuleProfiling.getProfilingPerPhase(Phase.INIT).getProfilingPerItem(new FakeInitializer()).totalTime()).isEqualTo(7L);
assertThat(profiler.currentModuleProfiling.getProfilingPerPhase(Phase.SENSOR).getProfilingPerItem(new FakeSensor()).totalTime()).isEqualTo(10L);
assertThat(profiler.currentModuleProfiling.getProfilingPerPhase(Phase.POSTJOB).getProfilingPerItem(new FakePostJob()).totalTime()).isEqualTo(30L);
assertThat(profiler.totalProfiling.getProfilingPerPhase(Phase.INIT).getProfilingPerItem(new FakeInitializer()).totalTime()).isEqualTo(21L);
assertThat(profiler.totalProfiling.getProfilingPerPhase(Phase.SENSOR).getProfilingPerItem(new FakeSensor()).totalTime()).isEqualTo(30L);
assertThat(profiler.totalProfiling.getProfilingPerPhase(Phase.POSTJOB).getProfilingPerItem(new FakePostJob()).totalTime()).isEqualTo(90L);
}
use of org.sonar.api.resources.Project in project sonarlint-core by SonarSource.
the class ScannerExtensionDictionnaryTest method buildStatusCheckersAreExecutedAfterOtherPostJobs.
@Test
public void buildStatusCheckersAreExecutedAfterOtherPostJobs() {
BuildBreaker checker = new BuildBreaker() {
public void executeOn(Project project, SensorContext context) {
}
};
ScannerExtensionDictionnary selector = newSelector(new FakePostJob(), checker, new FakePostJob());
List extensions = Lists.newArrayList(selector.select(PostJob.class, null, true));
assertThat(extensions).hasSize(3);
assertThat(extensions.get(2)).isEqualTo(checker);
}
Aggregations