<plugin>
<groupId>org.sonarsource.sonar-packaging-maven-plugin</groupId>
<artifactId>sonar-packaging-maven-plugin</artifactId>
- <version>1.15</version>
<extensions>true</extensions>
<configuration>
<pluginClass>com.sonarsource.BatchPlugin</pluginClass>
return Arrays.asList(
DumpSettingsInitializer.class,
RaiseMessageException.class,
- TempFolderExtension.class
- );
+ TempFolderExtension.class,
+ WaitingSensor.class);
}
}
--- /dev/null
+package com.sonarsource;
+
+import org.sonar.api.batch.Sensor;
+import org.sonar.api.batch.SensorContext;
+import org.sonar.api.config.Settings;
+import org.sonar.api.resources.Project;
+
+public class WaitingSensor implements Sensor {
+ private Settings settings;
+
+ public WaitingSensor(Settings settings) {
+ this.settings = settings;
+ }
+
+ @Override
+ public boolean shouldExecuteOnProject(Project project) {
+ return settings.getBoolean("sonar.it.enableWaitingSensor");
+ }
+
+ @Override
+ public void analyse(Project module, SensorContext context) {
+ try {
+ Thread.sleep(10_000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+}
tasks.add(new Callable<BuildResult>() {
public BuildResult call() throws Exception {
- SonarRunner runner = configureRunnerIssues("shared/xoo-sample", homeDir);
+ SonarRunner runner = configureRunnerIssues("shared/xoo-sample", homeDir, "sonar.it.enableWaitingSensor", "true");
return orchestrator.executeBuild(runner);
}
});
BuildFailureException bfe = (BuildFailureException) e.getCause();
assertThat(bfe.getResult().getLogs()).contains("Another SonarQube analysis is already in progress for this project");
expectedError = true;
+ } else {
+ throw e;
}
}
}
</parent>
<artifactId>it</artifactId>
- <version>5.3-SNAPSHOT</version>
<name>SonarQube Integration Tests</name>
<packaging>pom</packaging>