aboutsummaryrefslogtreecommitdiffstats
path: root/it
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2015-10-05 10:42:44 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2015-10-05 14:27:51 +0200
commitb48ef5a6aaa8f93f768efeac447bbbf365aa4428 (patch)
treed1479c3927136036cbcdd5ed0271a4ae9bc66887 /it
parent2205d5242d2d2ebb579f4a20c7c2dc1a17fbe1a8 (diff)
downloadsonarqube-b48ef5a6aaa8f93f768efeac447bbbf365aa4428.tar.gz
sonarqube-b48ef5a6aaa8f93f768efeac447bbbf365aa4428.zip
Move all batch ITs in the same suite
Diffstat (limited to 'it')
-rw-r--r--it/it-plugins/crash-plugin/pom.xml38
-rw-r--r--it/it-plugins/crash-plugin/src/main/java/CrashPlugin.java12
-rw-r--r--it/it-plugins/crash-plugin/src/main/java/CrashSensor.java31
-rw-r--r--it/it-plugins/pom.xml1
-rw-r--r--it/it-plugins/settings-encryption-plugin/src/main/java/EncryptionVerifier.java12
-rw-r--r--it/it-tests/src/test/java/batch/suite/BatchTest.java (renamed from it/it-tests/src/test/java/batch/BatchTest.java)13
-rw-r--r--it/it-tests/src/test/java/batch/suite/BatchTestSuite.java15
-rw-r--r--it/it-tests/src/test/java/batch/suite/IssuesModeTest.java (renamed from it/it-tests/src/test/java/batch/IssuesModeTest.java)10
-rw-r--r--it/it-tests/src/test/java/batch/suite/SettingsEncryptionTest.java (renamed from it/it-tests/src/test/java/batch/SettingsEncryptionTest.java)15
9 files changed, 25 insertions, 122 deletions
diff --git a/it/it-plugins/crash-plugin/pom.xml b/it/it-plugins/crash-plugin/pom.xml
deleted file mode 100644
index 330344c5fa0..00000000000
--- a/it/it-plugins/crash-plugin/pom.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.sonarsource.it</groupId>
- <artifactId>it-plugins</artifactId>
- <version>5.2-SNAPSHOT</version>
- </parent>
-
- <artifactId>crash-plugin</artifactId>
- <packaging>sonar-plugin</packaging>
- <name>Plugins :: Crash</name>
- <version>1.0-SNAPSHOT</version>
- <description>Crash on demand</description>
-
- <dependencies>
- <dependency>
- <groupId>org.codehaus.sonar</groupId>
- <artifactId>sonar-plugin-api</artifactId>
- <version>${apiVersion}</version>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.sonar</groupId>
- <artifactId>sonar-packaging-maven-plugin</artifactId>
- <version>1.12.1</version>
- <extensions>true</extensions>
- <configuration>
- <pluginClass>CrashPlugin</pluginClass>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/it/it-plugins/crash-plugin/src/main/java/CrashPlugin.java b/it/it-plugins/crash-plugin/src/main/java/CrashPlugin.java
deleted file mode 100644
index dba4fbd4e0a..00000000000
--- a/it/it-plugins/crash-plugin/src/main/java/CrashPlugin.java
+++ /dev/null
@@ -1,12 +0,0 @@
-import org.sonar.api.SonarPlugin;
-
-import java.util.Arrays;
-import java.util.List;
-
-public class CrashPlugin extends SonarPlugin {
-
- public List getExtensions() {
- return Arrays.asList(CrashSensor.class);
- }
-
-}
diff --git a/it/it-plugins/crash-plugin/src/main/java/CrashSensor.java b/it/it-plugins/crash-plugin/src/main/java/CrashSensor.java
deleted file mode 100644
index 7fdd2576120..00000000000
--- a/it/it-plugins/crash-plugin/src/main/java/CrashSensor.java
+++ /dev/null
@@ -1,31 +0,0 @@
-import org.sonar.api.Properties;
-import org.sonar.api.Property;
-import org.sonar.api.batch.Sensor;
-import org.sonar.api.batch.SensorContext;
-import org.sonar.api.config.Settings;
-import org.sonar.api.resources.Project;
-
-@Properties({
- @Property(
- key = "crash",
- name = "Property to decide if it crash or not",
- defaultValue = "false")
-})
-public class CrashSensor implements Sensor {
-
- private Settings settings;
-
- public CrashSensor(Settings settings) {
- this.settings = settings;
- }
-
- public boolean shouldExecuteOnProject(Project project) {
- return true;
- }
-
- public void analyse(Project project, SensorContext sensorContext) {
- if ("true".equals(settings.getString("crash"))) {
- throw new RuntimeException("Crash!");
- }
- }
-}
diff --git a/it/it-plugins/pom.xml b/it/it-plugins/pom.xml
index aa8d2238af2..db917ba0e3c 100644
--- a/it/it-plugins/pom.xml
+++ b/it/it-plugins/pom.xml
@@ -33,7 +33,6 @@
<modules>
<module>access-secured-props-plugin</module>
<module>batch-plugin</module>
- <module>crash-plugin</module>
<module>extension-lifecycle-plugin</module>
<module>global-property-change-plugin</module>
<module>l10n-fr-pack</module>
diff --git a/it/it-plugins/settings-encryption-plugin/src/main/java/EncryptionVerifier.java b/it/it-plugins/settings-encryption-plugin/src/main/java/EncryptionVerifier.java
index c3ea7361c64..a4bafa7b6ae 100644
--- a/it/it-plugins/settings-encryption-plugin/src/main/java/EncryptionVerifier.java
+++ b/it/it-plugins/settings-encryption-plugin/src/main/java/EncryptionVerifier.java
@@ -11,11 +11,13 @@ public class EncryptionVerifier implements BatchExtension {
}
public void start() {
- System.out.println("Start EncryptionVerifier");
-
- String decryptedValue = settings.getString("encryptedProperty");
- if (!"this is a secret".equals(decryptedValue)) {
- throw new IllegalStateException("The property 'encryptedProperty' can not be decrypted");
+ if (settings.hasKey("encryptedProperty")) {
+ System.out.println("Start EncryptionVerifier");
+
+ String decryptedValue = settings.getString("encryptedProperty");
+ if (!"this is a secret".equals(decryptedValue)) {
+ throw new IllegalStateException("The property 'encryptedProperty' can not be decrypted");
+ }
}
}
}
diff --git a/it/it-tests/src/test/java/batch/BatchTest.java b/it/it-tests/src/test/java/batch/suite/BatchTest.java
index f64b9dd8b49..beb8733967b 100644
--- a/it/it-tests/src/test/java/batch/BatchTest.java
+++ b/it/it-tests/src/test/java/batch/suite/BatchTest.java
@@ -3,7 +3,7 @@
* All rights reserved
* mailto:contact AT sonarsource DOT com
*/
-package batch;
+package batch.suite;
import com.sonar.orchestrator.Orchestrator;
import com.sonar.orchestrator.build.BuildFailureException;
@@ -34,16 +34,7 @@ import static org.assertj.core.api.Assertions.assertThat;
public class BatchTest {
@ClassRule
- public static Orchestrator orchestrator = Orchestrator.builderEnv()
- .setSonarVersion("DEV")
- .addPlugin(ItUtils.xooPlugin())
- .setContext("/")
-
- .addPlugin(ItUtils.pluginArtifact("batch-plugin"))
- // Java is only used in convert_library_into_module test
- .setOrchestratorProperty("javaVersion", "LATEST_RELEASE").addPlugin("java")
-
- .build();
+ public static Orchestrator orchestrator = BatchTestSuite.ORCHESTRATOR;
@Rule
public ExpectedException thrown = ExpectedException.none();
diff --git a/it/it-tests/src/test/java/batch/suite/BatchTestSuite.java b/it/it-tests/src/test/java/batch/suite/BatchTestSuite.java
index 0431a2dbd02..7a5aa4028a0 100644
--- a/it/it-tests/src/test/java/batch/suite/BatchTestSuite.java
+++ b/it/it-tests/src/test/java/batch/suite/BatchTestSuite.java
@@ -5,17 +5,17 @@
*/
package batch.suite;
-import util.ItUtils;
-
import com.sonar.orchestrator.Orchestrator;
import org.junit.ClassRule;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
+import util.ItUtils;
@RunWith(Suite.class)
@Suite.SuiteClasses({
ExtensionLifecycleTest.class, LinksTest.class, MavenTest.class, ProjectBuilderTest.class, ProjectExclusionsTest.class,
- TempFolderTest.class, MultiLanguageTest.class, IssueJsonReportTest.class, ProjectProvisioningTest.class
+ TempFolderTest.class, MultiLanguageTest.class, IssueJsonReportTest.class, ProjectProvisioningTest.class, BatchTest.class,
+ IssuesModeTest.class, SettingsEncryptionTest.class
})
public class BatchTestSuite {
@@ -26,6 +26,12 @@ public class BatchTestSuite {
.setOrchestratorProperty("javaVersion", "LATEST_RELEASE").addPlugin("java")
.setContext("/")
+ // Used by SettingsEncryptionTest
+ .addPlugin(ItUtils.pluginArtifact("settings-encryption-plugin"))
+
+ // Used by IssuesModeTest
+ .addPlugin(ItUtils.pluginArtifact("access-secured-props-plugin"))
+
// used by TempFolderTest
.addPlugin(ItUtils.pluginArtifact("batch-plugin"))
@@ -35,8 +41,5 @@ public class BatchTestSuite {
// used by ProjectBuilderTest
.addPlugin(ItUtils.pluginArtifact("project-builder-plugin"))
- // used by SemaphoreTest
- .addPlugin(ItUtils.pluginArtifact("crash-plugin"))
-
.build();
}
diff --git a/it/it-tests/src/test/java/batch/IssuesModeTest.java b/it/it-tests/src/test/java/batch/suite/IssuesModeTest.java
index 7ff66112e3c..6b448214c7b 100644
--- a/it/it-tests/src/test/java/batch/IssuesModeTest.java
+++ b/it/it-tests/src/test/java/batch/suite/IssuesModeTest.java
@@ -3,7 +3,7 @@
* All rights reserved
* mailto:contact AT sonarsource DOT com
*/
-package batch;
+package batch.suite;
import com.google.common.collect.Maps;
import com.sonar.orchestrator.Orchestrator;
@@ -47,13 +47,7 @@ import static org.junit.Assert.fail;
public class IssuesModeTest {
@ClassRule
- public static Orchestrator orchestrator = Orchestrator.builderEnv()
- .setSonarVersion("DEV")
- .addPlugin(ItUtils.xooPlugin())
- .setContext("/")
-
- .addPlugin(ItUtils.pluginArtifact("access-secured-props-plugin"))
- .build();
+ public static Orchestrator orchestrator = BatchTestSuite.ORCHESTRATOR;
@Rule
public ExpectedException thrown = ExpectedException.none();
diff --git a/it/it-tests/src/test/java/batch/SettingsEncryptionTest.java b/it/it-tests/src/test/java/batch/suite/SettingsEncryptionTest.java
index cc375155a6a..9a900fee3eb 100644
--- a/it/it-tests/src/test/java/batch/SettingsEncryptionTest.java
+++ b/it/it-tests/src/test/java/batch/suite/SettingsEncryptionTest.java
@@ -3,28 +3,23 @@
* All rights reserved
* mailto:contact AT sonarsource DOT com
*/
-package batch;
+package batch.suite;
-import util.ItUtils;
import com.sonar.orchestrator.Orchestrator;
import com.sonar.orchestrator.build.BuildFailureException;
import com.sonar.orchestrator.build.BuildResult;
import com.sonar.orchestrator.build.SonarRunner;
-import org.junit.ClassRule;
-import org.junit.Test;
-
import java.io.File;
import java.net.URL;
+import org.junit.ClassRule;
+import org.junit.Test;
+import util.ItUtils;
import static org.assertj.core.api.Assertions.assertThat;
public class SettingsEncryptionTest {
@ClassRule
- public static Orchestrator orchestrator = Orchestrator.builderEnv()
- .setSonarVersion("DEV")
- .addPlugin(ItUtils.pluginArtifact("settings-encryption-plugin"))
- .addPlugin(ItUtils.xooPlugin())
- .build();
+ public static Orchestrator orchestrator = BatchTestSuite.ORCHESTRATOR;
/**
* SONAR-2084