Search in sources :

Example 6 with InputModuleHierarchy

use of org.sonar.scanner.fs.InputModuleHierarchy in project sonarqube by SonarSource.

the class ModuleSensorsExecutorTest method setUp.

@Before
public void setUp() throws IOException {
    when(perModuleSensor.isGlobal()).thenReturn(false);
    when(perModuleSensor.shouldExecute()).thenReturn(true);
    when(perModuleSensor.wrappedSensor()).thenReturn(mock(Sensor.class));
    when(globalSensor.isGlobal()).thenReturn(true);
    when(globalSensor.shouldExecute()).thenReturn(true);
    when(globalSensor.wrappedSensor()).thenReturn(mock(Sensor.class));
    ModuleSensorExtensionDictionary selector = mock(ModuleSensorExtensionDictionary.class);
    when(selector.selectSensors(false)).thenReturn(Collections.singleton(perModuleSensor));
    when(selector.selectSensors(true)).thenReturn(Collections.singleton(globalSensor));
    ProjectDefinition childDef = ProjectDefinition.create().setKey("sub").setBaseDir(temp.newFolder()).setWorkDir(temp.newFolder());
    ProjectDefinition rootDef = ProjectDefinition.create().setKey("root").setBaseDir(temp.newFolder()).setWorkDir(temp.newFolder());
    DefaultInputModule rootModule = TestInputFileBuilder.newDefaultInputModule(rootDef);
    DefaultInputModule subModule = TestInputFileBuilder.newDefaultInputModule(childDef);
    InputModuleHierarchy hierarchy = mock(InputModuleHierarchy.class);
    when(hierarchy.isRoot(rootModule)).thenReturn(true);
    rootModuleExecutor = new ModuleSensorsExecutor(selector, rootModule, hierarchy, strategy, pluginRepository);
    subModuleExecutor = new ModuleSensorsExecutor(selector, subModule, hierarchy, strategy, pluginRepository);
}
Also used : InputModuleHierarchy(org.sonar.scanner.fs.InputModuleHierarchy) ModuleSensorExtensionDictionary(org.sonar.scanner.sensor.ModuleSensorExtensionDictionary) ModuleSensorsExecutor(org.sonar.scanner.sensor.ModuleSensorsExecutor) DefaultInputModule(org.sonar.api.batch.fs.internal.DefaultInputModule) Sensor(org.sonar.api.batch.sensor.Sensor) ProjectDefinition(org.sonar.api.batch.bootstrap.ProjectDefinition) Before(org.junit.Before)

Aggregations

InputModuleHierarchy (org.sonar.scanner.fs.InputModuleHierarchy)6 DefaultInputModule (org.sonar.api.batch.fs.internal.DefaultInputModule)3 HashMap (java.util.HashMap)2 ProjectDefinition (org.sonar.api.batch.bootstrap.ProjectDefinition)2 Sensor (org.sonar.api.batch.sensor.Sensor)2 ScannerProperties (org.sonar.scanner.bootstrap.ScannerProperties)2 CiConfiguration (org.sonar.scanner.ci.CiConfiguration)2 BranchConfiguration (org.sonar.scanner.scan.branch.BranchConfiguration)2 ModuleSensorExtensionDictionary (org.sonar.scanner.sensor.ModuleSensorExtensionDictionary)2 ModuleSensorsExecutor (org.sonar.scanner.sensor.ModuleSensorsExecutor)2 Path (java.nio.file.Path)1 Before (org.junit.Before)1 Test (org.junit.Test)1 GlobalAnalysisMode (org.sonar.scanner.bootstrap.GlobalAnalysisMode)1 CpdExecutor (org.sonar.scanner.cpd.CpdExecutor)1 AnalysisObservers (org.sonar.scanner.mediumtest.AnalysisObservers)1 PostJobsExecutor (org.sonar.scanner.postjob.PostJobsExecutor)1 QualityGateCheck (org.sonar.scanner.qualitygate.QualityGateCheck)1 AnalysisContextReportPublisher (org.sonar.scanner.report.AnalysisContextReportPublisher)1 ReportPublisher (org.sonar.scanner.report.ReportPublisher)1