Search in sources :

Example 1 with SensorStrategy

use of org.sonar.api.batch.fs.internal.SensorStrategy in project sonarqube by SonarSource.

the class DefaultInputFileTest method prepare.

@Before
public void prepare() throws IOException {
    baseDir = temp.newFolder().toPath();
    sensorStrategy = new SensorStrategy();
    indexedFile = new DefaultIndexedFile(baseDir.resolve(PROJECT_RELATIVE_PATH), "ABCDE", PROJECT_RELATIVE_PATH, MODULE_RELATIVE_PATH, InputFile.Type.TEST, "php", 0, sensorStrategy);
}
Also used : DefaultIndexedFile(org.sonar.api.batch.fs.internal.DefaultIndexedFile) SensorStrategy(org.sonar.api.batch.fs.internal.SensorStrategy) Before(org.junit.Before)

Example 2 with SensorStrategy

use of org.sonar.api.batch.fs.internal.SensorStrategy in project sonarqube by SonarSource.

the class ModuleInputComponentStoreTest method should_find_module_components_with_non_global_strategy.

@Test
public void should_find_module_components_with_non_global_strategy() {
    InputComponentStore inputComponentStore = mock(InputComponentStore.class);
    SensorStrategy strategy = new SensorStrategy();
    InputModule module = mock(InputModule.class);
    when(module.key()).thenReturn("foo");
    ModuleInputComponentStore store = new ModuleInputComponentStore(module, inputComponentStore, strategy);
    strategy.setGlobal(false);
    store.inputFiles();
    verify(inputComponentStore).filesByModule("foo");
    String relativePath = "somepath";
    store.inputFile(relativePath);
    verify(inputComponentStore).getFile(any(String.class), eq(relativePath));
    store.languages();
    verify(inputComponentStore).languages(any(String.class));
}
Also used : InputModule(org.sonar.api.batch.fs.InputModule) SensorStrategy(org.sonar.api.batch.fs.internal.SensorStrategy) Test(org.junit.Test)

Example 3 with SensorStrategy

use of org.sonar.api.batch.fs.internal.SensorStrategy in project sonarqube by SonarSource.

the class ModuleInputComponentStoreTest method should_find_all_components_with_global_strategy.

@Test
public void should_find_all_components_with_global_strategy() {
    InputComponentStore inputComponentStore = mock(InputComponentStore.class);
    SensorStrategy strategy = new SensorStrategy();
    ModuleInputComponentStore store = new ModuleInputComponentStore(mock(InputModule.class), inputComponentStore, strategy);
    strategy.setGlobal(true);
    store.inputFiles();
    verify(inputComponentStore).inputFiles();
    String relativePath = "somepath";
    store.inputFile(relativePath);
    verify(inputComponentStore).inputFile(relativePath);
    store.languages();
    verify(inputComponentStore).languages();
}
Also used : InputModule(org.sonar.api.batch.fs.InputModule) SensorStrategy(org.sonar.api.batch.fs.internal.SensorStrategy) Test(org.junit.Test)

Aggregations

SensorStrategy (org.sonar.api.batch.fs.internal.SensorStrategy)3 Test (org.junit.Test)2 InputModule (org.sonar.api.batch.fs.InputModule)2 Before (org.junit.Before)1 DefaultIndexedFile (org.sonar.api.batch.fs.internal.DefaultIndexedFile)1