use of org.sonar.api.resources.Project in project sonarqube by SonarSource.
the class ComponentKeysTest method create_effective_key.
@Test
public void create_effective_key() {
Project project = new Project(ProjectDefinition.create().setKey("my_project"));
assertThat(ComponentKeys.createEffectiveKey("my_project", project)).isEqualTo("my_project");
Directory dir = Directory.create("src/org/foo");
assertThat(ComponentKeys.createEffectiveKey("my_project", dir)).isEqualTo("my_project:src/org/foo");
InputFile file = mock(InputFile.class);
when(file.relativePath()).thenReturn("foo/Bar.php");
assertThat(ComponentKeys.createEffectiveKey("my_project", file)).isEqualTo("my_project:foo/Bar.php");
}
use of org.sonar.api.resources.Project in project sonarqube by SonarSource.
the class InitializerTest method shouldBeExecutedByDefault.
@Test
public void shouldBeExecutedByDefault() {
Project project = mock(Project.class);
assertThat(new FakeInitializer().shouldExecuteOnProject(project)).isTrue();
}
use of org.sonar.api.resources.Project 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.resources.Project in project sonarqube by SonarSource.
the class ModuleScanContainer method addCoreComponents.
private void addCoreComponents() {
add(module.definition(), // still injected by some plugins
new Project(module.definition()), module, ModuleSettings.class);
if (getComponentByType(AnalysisMode.class).isIssues()) {
add(IssuesPhaseExecutor.class, IssuesReports.class);
} else {
add(PublishPhaseExecutor.class);
}
add(EventBus.class, RuleFinderCompatibility.class, PostJobsExecutor.class, SensorsExecutor.class, InitializersExecutor.class, // file system
ModuleInputComponentStore.class, FileExclusions.class, ExclusionFilters.class, new MetadataGeneratorProvider(), FileMetadata.class, StatusDetectionFactory.class, LanguageDetection.class, FileIndexer.class, InputFileBuilder.class, FileSystemLogger.class, DefaultModuleFileSystem.class, ModuleFileSystemInitializer.class, QProfileVerifier.class, SensorOptimizer.class, PostJobOptimizer.class, DefaultPostJobContext.class, DefaultSensorStorage.class, DeprecatedSensorContext.class, ScannerExtensionDictionnary.class, IssueFilters.class, CoverageExclusions.class, SensorStrategy.class, // rules
new RulesProfileProvider(), CheckFactory.class, // issues
IssuableFactory.class, ModuleIssues.class, org.sonar.api.issue.NoSonarFilter.class, // issue exclusions
IssueInclusionPatternInitializer.class, IssueExclusionPatternInitializer.class, IssueExclusionsRegexpScanner.class, IssueExclusionsLoader.class, EnforceIssuesFilter.class, IgnoreIssuesFilter.class, // Perspectives
ScannerPerspectives.class, HighlightableBuilder.class, SymbolizableBuilder.class, DefaultFileLinesContextFactory.class);
}
use of org.sonar.api.resources.Project in project sonarqube by SonarSource.
the class SensorsExecutor method executeSensor.
private void executeSensor(SensorContext context, Sensor sensor) {
eventBus.fireEvent(new SensorExecutionEvent(sensor, true));
sensor.analyse(new Project(module.definition()), context);
eventBus.fireEvent(new SensorExecutionEvent(sensor, false));
}
Aggregations