use of com.sonar.orchestrator.build.MavenBuild in project sonarqube by SonarSource.
the class LinksTest method shouldUseLinkPropertiesOverPomLinksInMaven.
/**
* SONAR-3676
*/
@Test
public void shouldUseLinkPropertiesOverPomLinksInMaven() {
MavenBuild build = MavenBuild.create(ItUtils.projectPom("analysis/links-project")).setCleanPackageSonarGoals().setProperty("sonar.scm.disabled", "true");
orchestrator.executeBuild(build);
verifyLinks();
}
use of com.sonar.orchestrator.build.MavenBuild in project sonarqube by SonarSource.
the class ProjectBuilderTest method shouldDefineProjectFromPlugin.
@Test
public void shouldDefineProjectFromPlugin() {
MavenBuild build = MavenBuild.create(ItUtils.projectPom("analysis/project-builder")).setCleanSonarGoals().setProperty("sonar.enableProjectBuilder", "true").setProperty("sonar.dynamicAnalysis", "false");
orchestrator.executeBuild(build);
checkProject();
checkSubProject("project-builder-module-a");
checkSubProject("project-builder-module-b");
checkFile("project-builder-module-a", "src/HelloA.java");
checkFile("project-builder-module-b", "src/HelloB.java");
assertThat(getComponent(orchestrator, "com.sonarsource.it.projects.batch:project-builder-module-b:src/IgnoredFile.java")).isNull();
}
use of com.sonar.orchestrator.build.MavenBuild in project sonarqube by SonarSource.
the class WebTest method scan_struts.
@BeforeClass
public static void scan_struts() throws Exception {
FileLocation strutsHome = orchestrator.getFileLocationOfShared("it-sonar-performancing/struts-1.3.9/pom.xml");
MavenBuild scan = MavenBuild.create(strutsHome.getFile());
scan.setGoals("sonar:sonar -V");
scan.setEnvironmentVariable("MAVEN_OPTS", "-Xmx512m -server");
scan.setProperty("sonar.scm.disabled", "true");
scan.setProperty("sonar.sourceEncoding", "UTF-8");
orchestrator.executeBuild(scan);
}
use of com.sonar.orchestrator.build.MavenBuild in project sonar-java by SonarSource.
the class JaCoCoControllerTest method test_coverage_per_test.
@Test
public void test_coverage_per_test() throws Exception {
MavenBuild build = MavenBuild.create(TestUtils.projectPom("coverage_error")).setProperty("skipTests", "false").setProperty("javaPluginVersion", javaVersion).setGoals("org.jacoco:jacoco-maven-plugin:prepare-agent clean verify", "sonar:sonar");
BuildResult buildResult = orchestrator.executeBuildQuietly(build);
assertThat(buildResult.isSuccess()).isTrue();
}
use of com.sonar.orchestrator.build.MavenBuild in project sonar-java by SonarSource.
the class JavaTest method java_aware_visitor_rely_on_java_version.
@Test
public void java_aware_visitor_rely_on_java_version() {
String sonarJavaSource = "sonar.java.source";
MavenBuild build = MavenBuild.create(TestUtils.projectPom("java-version-aware-visitor")).setCleanSonarGoals().setProperty("sonar.profile", "java-version-aware-visitor");
// no java version specified. maven scanner gets maven default version : java 5.
orchestrator.executeBuild(build);
assertThat(getMeasureAsInteger("org.example:example", "violations")).isEqualTo(0);
// invalid java version. got issue on java 7 code
build.setProperty(sonarJavaSource, "jdk_1.6");
BuildResult buildResult = orchestrator.executeBuild(build);
// build should not fail
assertThat(buildResult.getLastStatus()).isEqualTo(0);
// build logs should contains warning related to sources
assertThat(buildResult.getLogs()).contains("Invalid java version");
assertThat(getMeasureAsInteger("org.example:example", "violations")).isEqualTo(1);
// upper version. got issue on java 7 code
build.setProperty(sonarJavaSource, "1.8");
orchestrator.executeBuild(build);
assertThat(getMeasureAsInteger("org.example:example", "violations")).isEqualTo(1);
// lower version. no issue on java 7 code
build.setProperty(sonarJavaSource, "1.6");
orchestrator.executeBuild(build);
assertThat(getMeasureAsInteger("org.example:example", "violations")).isEqualTo(0);
SonarScanner scan = SonarScanner.create(TestUtils.projectDir("java-version-aware-visitor")).setProperty("sonar.projectKey", "org.example:example-scanner").setProperty("sonar.projectName", "example").setProperty("sonar.projectVersion", "1.0-SNAPSHOT").setProperty("sonar.profile", "java-version-aware-visitor").setProperty("sonar.sources", "src/main/java");
orchestrator.executeBuild(scan);
// no java version specified, got issue on java 7 code
assertThat(getMeasureAsInteger("org.example:example-scanner", "violations")).isEqualTo(1);
}
Aggregations