use of org.sonar.scanner.scan.filesystem.InputComponentStore in project sonarqube by SonarSource.
the class ComponentsPublisherTest method publish_project_with_links.
@Test
public void publish_project_with_links() throws Exception {
ProjectInfo projectInfo = mock(ProjectInfo.class);
when(projectInfo.getAnalysisDate()).thenReturn(DateUtils.parseDate("2012-12-12"));
ProjectDefinition rootDef = ProjectDefinition.create().setKey("foo").setProperty(CoreProperties.PROJECT_VERSION_PROPERTY, "1.0").setName("Root project").setProperty(CoreProperties.LINKS_HOME_PAGE, "http://home").setProperty(CoreProperties.LINKS_CI, "http://ci").setDescription("Root description").setBaseDir(temp.newFolder()).setWorkDir(temp.newFolder());
DefaultInputProject project = new DefaultInputProject(rootDef, 1);
InputComponentStore store = new InputComponentStore(branchConfiguration, sonarRuntime);
ComponentsPublisher publisher = new ComponentsPublisher(project, store);
publisher.publish(writer);
ScannerReportReader reader = new ScannerReportReader(outputDir);
Component rootProtobuf = reader.readComponent(1);
assertThat(rootProtobuf.getLinkCount()).isEqualTo(2);
assertThat(rootProtobuf.getLink(0).getType()).isEqualTo(ComponentLinkType.HOME);
assertThat(rootProtobuf.getLink(0).getHref()).isEqualTo("http://home");
assertThat(rootProtobuf.getLink(1).getType()).isEqualTo(ComponentLinkType.CI);
assertThat(rootProtobuf.getLink(1).getHref()).isEqualTo("http://ci");
}
use of org.sonar.scanner.scan.filesystem.InputComponentStore in project sonarqube by SonarSource.
the class QProfileVerifierTest method before.
@Before
public void before() {
store = new InputComponentStore(mock(BranchConfiguration.class), mock(SonarRuntime.class));
profiles = mock(QualityProfiles.class);
QProfile javaProfile = new QProfile("p1", "My Java profile", "java", null);
when(profiles.findByLanguage("java")).thenReturn(javaProfile);
QProfile cobolProfile = new QProfile("p2", "My Cobol profile", "cobol", null);
when(profiles.findByLanguage("cobol")).thenReturn(cobolProfile);
}
use of org.sonar.scanner.scan.filesystem.InputComponentStore in project sonarqube by SonarSource.
the class CpdExecutorTest method setUp.
@Before
public void setUp() throws IOException {
File outputDir = temp.newFolder();
baseDir = temp.newFolder();
when(publisher.getWriter()).thenReturn(new ScannerReportWriter(outputDir));
DefaultInputProject project = TestInputFileBuilder.newDefaultInputProject("foo", baseDir);
componentStore = new InputComponentStore(mock(BranchConfiguration.class), sonarRuntime);
executor = new CpdExecutor(settings, index, publisher, componentStore, executorService);
reader = new ScannerReportReader(outputDir);
batchComponent1 = createComponent("src/Foo.php", 5);
batchComponent2 = createComponent("src/Foo2.php", 5);
batchComponent3 = createComponent("src/Foo3.php", 5);
}
Aggregations