use of com.sonar.orchestrator.build.BuildResult in project sonarqube by SonarSource.
the class BootstrappingTest method analyzeProjectWith50NestedModules.
@Test
public void analyzeProjectWith50NestedModules() throws IOException {
SonarScanner scanner = SonarScanner.create().setProperties("sonar.projectKey", "many-nested-modules", "sonar.projectName", "Many Nested Modules", "sonar.projectVersion", "1.0", "sonar.sources", "", "sonar.showProfiling", "true");
scanner.setEnvironmentVariable("SONAR_RUNNER_OPTS", "-Xmx512m -server");
scanner.setProjectDir(manyNestedModulesBaseDir);
BuildResult result = orchestrator.executeBuild(scanner);
// First analysis
perfRule.assertDurationAround(MavenLogs.extractTotalTime(result.getLogs()), 8900L);
result = orchestrator.executeBuild(scanner);
// Second analysis
perfRule.assertDurationAround(MavenLogs.extractTotalTime(result.getLogs()), 9300L);
}
use of com.sonar.orchestrator.build.BuildResult in project sonarqube by SonarSource.
the class HighlightingTest method computeSyntaxHighlightingOnBigFiles.
@Test
public void computeSyntaxHighlightingOnBigFiles() throws IOException {
File baseDir = temp.newFolder();
File srcDir = new File(baseDir, "src");
srcDir.mkdir();
int nbFiles = 100;
int ruleCount = 100000;
int nblines = 1000;
int linesize = ruleCount / nblines;
for (int nb = 1; nb <= nbFiles; nb++) {
File xooFile = new File(srcDir, "sample" + nb + ".xoo");
File xoohighlightingFile = new File(srcDir, "sample" + nb + ".xoo.highlighting");
FileUtils.write(xooFile, StringUtils.repeat(StringUtils.repeat("a", linesize) + "\n", nblines));
StringBuilder sb = new StringBuilder(16 * ruleCount);
for (int i = 0; i < ruleCount; i++) {
sb.append(i).append(":").append(i + 1).append(":s\n");
}
FileUtils.write(xoohighlightingFile, sb.toString());
}
SonarScanner scanner = SonarScanner.create().setProperties("sonar.projectKey", "highlighting", "sonar.projectName", "highlighting", "sonar.projectVersion", "1.0", "sonar.sources", "src", "sonar.showProfiling", "true");
scanner.setEnvironmentVariable("SONAR_RUNNER_OPTS", "-Xmx512m -server").setProjectDir(baseDir);
BuildResult result = orchestrator.executeBuild(scanner);
System.out.println("Total time: " + MavenLogs.extractTotalTime(result.getLogs()));
perfRule.assertDurationAround(MavenLogs.extractTotalTime(result.getLogs()), 25700L);
Properties prof = readProfiling(baseDir, "highlighting");
perfRule.assertDurationAround(Long.valueOf(prof.getProperty("Xoo Highlighting Sensor")), 9700L);
}
use of com.sonar.orchestrator.build.BuildResult in project sonarqube by SonarSource.
the class MemoryTest method analyzeProjectWithManyModulesAndBigProperties.
// Property on root module is duplicated in each module so it may be big
@Test
public void analyzeProjectWithManyModulesAndBigProperties() throws IOException {
File baseDir = temp.newFolder();
prepareModule(baseDir, "moduleA", 1);
prepareModule(baseDir, "moduleB", 1);
prepareModule(baseDir, "moduleC", 1);
FileUtils.write(new File(baseDir, "sonar-project.properties"), "sonar.modules=moduleA,moduleB,moduleC\n", true);
FileUtils.write(new File(baseDir, "sonar-project.properties"), "sonar.myBigProp=" + Strings.repeat("A", 10000), true);
SonarScanner scanner = SonarScanner.create().setProperties("sonar.projectKey", "big-module-tree", "sonar.projectName", "Big Module Tree", "sonar.projectVersion", "1.0", "sonar.sources", "", "sonar.showProfiling", "true");
scanner.setEnvironmentVariable("SONAR_RUNNER_OPTS", "-Xmx512m -server").setProjectDir(baseDir);
BuildResult result = orchestrator.executeBuild(scanner);
perfRule.assertDurationAround(MavenLogs.extractTotalTime(result.getLogs()), 4847L);
// Second execution with a property on server side
orchestrator.getServer().getAdminWsClient().create(new PropertyCreateQuery("sonar.anotherBigProp", Strings.repeat("B", 1000), "big-module-tree"));
result = orchestrator.executeBuild(scanner);
perfRule.assertDurationAround(MavenLogs.extractTotalTime(result.getLogs()), 4620L);
}
Aggregations