use of org.sonar.scanner.scan.filesystem.InputComponentStore in project sonarqube by SonarSource.
the class CoveragePublisherTest method prepare.
@Before
public void prepare() throws IOException {
String moduleKey = "foo";
inputFile = new TestInputFileBuilder(moduleKey, "src/Foo.php").setLines(5).build();
InputComponentStore componentCache = new InputComponentStore(new PathResolver());
componentCache.put(TestInputFileBuilder.newDefaultInputModule(moduleKey, temp.newFolder()));
componentCache.put(inputFile);
measureCache = mock(MeasureCache.class);
when(measureCache.byMetric(anyString(), anyString())).thenReturn(null);
publisher = new CoveragePublisher(componentCache, measureCache);
}
use of org.sonar.scanner.scan.filesystem.InputComponentStore in project sonarqube by SonarSource.
the class MeasuresPublisherTest method prepare.
@Before
public void prepare() throws IOException {
String moduleKey = "foo";
inputModule = TestInputFileBuilder.newDefaultInputModule(moduleKey, temp.newFolder());
inputFile = new TestInputFileBuilder(moduleKey, "src/Foo.php").setPublish(true).build();
InputComponentStore componentCache = new InputComponentStore(new PathResolver());
componentCache.put(inputModule);
componentCache.put(inputFile);
measureCache = mock(MeasureCache.class);
when(measureCache.byComponentKey(anyString())).thenReturn(Collections.<DefaultMeasure<?>>emptyList());
publisher = new MeasuresPublisher(componentCache, measureCache, mock(TestPlanBuilder.class));
outputDir = temp.newFolder();
writer = new ScannerReportWriter(outputDir);
}
use of org.sonar.scanner.scan.filesystem.InputComponentStore in project sonarqube by SonarSource.
the class JSONReportTest method before.
@Before
public void before() throws Exception {
moduleHierarchy = mock(InputModuleHierarchy.class);
userRepository = mock(UserRepositoryLoader.class);
File projectBaseDir = temp.newFolder();
fs = new DefaultFileSystem(projectBaseDir.toPath());
SIMPLE_DATE_FORMAT.setTimeZone(TimeZone.getTimeZone("GMT+02:00"));
when(server.getVersion()).thenReturn("3.6");
InputComponentStore inputComponentStore = new InputComponentStore(new PathResolver());
DefaultComponentTree inputComponentTree = new DefaultComponentTree();
DefaultInputModule rootModule = new DefaultInputModule(ProjectDefinition.create().setBaseDir(projectBaseDir).setKey("struts"), 1);
inputComponentStore.put(rootModule);
DefaultInputModule moduleA = new DefaultInputModule("struts-core");
inputComponentTree.index(moduleA, rootModule);
DefaultInputModule moduleB = new DefaultInputModule("struts-ui");
inputComponentTree.index(moduleB, rootModule);
DefaultInputDir inputDir = new DefaultInputDir("struts", "src/main/java/org/apache/struts", TestInputFileBuilder.nextBatchId()).setModuleBaseDir(projectBaseDir.toPath());
DefaultInputFile inputFile = new TestInputFileBuilder("struts", "src/main/java/org/apache/struts/Action.java").setModuleBaseDir(projectBaseDir.toPath()).build();
inputFile.setStatus(InputFile.Status.CHANGED);
inputFile.setPublish(true);
inputComponentStore.put(inputFile);
inputComponentStore.put(inputDir);
inputComponentTree.index(inputDir, rootModule);
inputComponentTree.index(inputFile, inputDir);
when(moduleHierarchy.children(rootModule)).thenReturn(Arrays.asList(moduleA, moduleB));
when(moduleHierarchy.parent(moduleA)).thenReturn(rootModule);
when(moduleHierarchy.parent(moduleB)).thenReturn(rootModule);
when(moduleHierarchy.relativePath(moduleA)).thenReturn("core");
when(moduleHierarchy.relativePath(moduleB)).thenReturn("ui");
RulesBuilder builder = new RulesBuilder();
builder.add(RuleKey.of("squid", "AvoidCycles")).setName("Avoid Cycles");
rules = builder.build();
jsonReport = new JSONReport(moduleHierarchy, settings, fs, server, rules, issueCache, rootModule, inputComponentStore, userRepository, inputComponentTree);
}
use of org.sonar.scanner.scan.filesystem.InputComponentStore in project sonarqube by SonarSource.
the class ModuleIndexerTest method createIndexer.
public void createIndexer() {
InputComponentStore componentStore = new InputComponentStore(mock(BranchConfiguration.class), mock(SonarRuntime.class));
moduleHierarchy = mock(DefaultInputModuleHierarchy.class);
indexer = new ModuleIndexer(componentStore, moduleHierarchy);
}
use of org.sonar.scanner.scan.filesystem.InputComponentStore in project sonarqube by SonarSource.
the class SourcePublisherTest method prepare.
@Before
public void prepare() throws IOException {
File baseDir = temp.newFolder();
sourceFile = new File(baseDir, "src/Foo.php");
String moduleKey = "foo";
inputFile = new TestInputFileBuilder(moduleKey, "src/Foo.php").setLines(5).setModuleBaseDir(baseDir.toPath()).setCharset(StandardCharsets.ISO_8859_1).build();
DefaultInputProject rootProject = TestInputFileBuilder.newDefaultInputProject(moduleKey, baseDir);
InputComponentStore componentStore = new InputComponentStore(mock(BranchConfiguration.class), mock(SonarRuntime.class));
componentStore.put(moduleKey, inputFile);
publisher = new SourcePublisher(componentStore);
File outputDir = temp.newFolder();
writer = new ScannerReportWriter(outputDir);
}
Aggregations