use of org.sonar.api.batch.bootstrap.ProjectDefinition in project sonarqube by SonarSource.
the class TestInputFileBuilder method newDefaultInputModule.
public static DefaultInputModule newDefaultInputModule(String moduleKey, File baseDir) {
ProjectDefinition definition = ProjectDefinition.create().setKey(moduleKey);
definition.setBaseDir(baseDir);
return new DefaultInputModule(definition, TestInputFileBuilder.nextBatchId());
}
use of org.sonar.api.batch.bootstrap.ProjectDefinition in project sonarqube by SonarSource.
the class ProjectTest method effectiveKeyShouldEqualKeyWithBranch.
@Test
public void effectiveKeyShouldEqualKeyWithBranch() {
ProjectDefinition definition = ProjectDefinition.create().setKey("mykey").setProperty(CoreProperties.PROJECT_BRANCH_PROPERTY, "branch");
assertThat(new Project(definition).getEffectiveKey()).isEqualTo("mykey:branch");
assertThat(new Project(definition).getKey()).isEqualTo("mykey");
}
use of org.sonar.api.batch.bootstrap.ProjectDefinition in project sonarqube by SonarSource.
the class ProjectTest method setNameWithBranch.
@Test
public void setNameWithBranch() {
ProjectDefinition definition = ProjectDefinition.create().setProperty(CoreProperties.PROJECT_BRANCH_PROPERTY, "branch").setKey("key").setName("name");
Project project = new Project(definition);
assertThat(project.getName()).isEqualTo("name branch");
assertThat(project.getOriginalName()).isEqualTo("name branch");
}
use of org.sonar.api.batch.bootstrap.ProjectDefinition in project sonarqube by SonarSource.
the class QualifiersTest method testProject.
@Test
public void testProject() {
ProjectDefinition rootDef = ProjectDefinition.create();
ProjectDefinition moduleDef = ProjectDefinition.create();
rootDef.addSubProject(moduleDef);
Resource root = new Project(rootDef);
assertThat(Qualifiers.isView(root, true)).isFalse();
assertThat(Qualifiers.isView(root, false)).isFalse();
assertThat(Qualifiers.isProject(root, true)).isTrue();
assertThat(Qualifiers.isProject(root, false)).isTrue();
}
use of org.sonar.api.batch.bootstrap.ProjectDefinition in project sonarqube by SonarSource.
the class ComponentsPublisher method writeLinks.
private static void writeLinks(InputComponent c, ScannerReport.Component.Builder builder) {
if (c instanceof InputModule) {
DefaultInputModule inputModule = (DefaultInputModule) c;
ProjectDefinition def = inputModule.definition();
ComponentLink.Builder linkBuilder = ComponentLink.newBuilder();
writeProjectLink(builder, def, linkBuilder, CoreProperties.LINKS_HOME_PAGE, ComponentLinkType.HOME);
writeProjectLink(builder, def, linkBuilder, CoreProperties.LINKS_CI, ComponentLinkType.CI);
writeProjectLink(builder, def, linkBuilder, CoreProperties.LINKS_ISSUE_TRACKER, ComponentLinkType.ISSUE);
writeProjectLink(builder, def, linkBuilder, CoreProperties.LINKS_SOURCES, ComponentLinkType.SCM);
writeProjectLink(builder, def, linkBuilder, CoreProperties.LINKS_SOURCES_DEV, ComponentLinkType.SCM_DEV);
}
}
Aggregations