aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-engine/src/test/java/org/sonar/batch
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2016-07-04 11:09:39 +0200
committerDuarte Meneses <duarte.meneses@sonarsource.com>2016-07-04 14:14:40 +0200
commit2eedbcc8b76ca3565e30e64c1413f4aeba903b34 (patch)
tree9501d7da2c8764a309de7084585d50a503b19159 /sonar-scanner-engine/src/test/java/org/sonar/batch
parent49cbc42b322e562807add4faaebd649445ee1bce (diff)
downloadsonarqube-2eedbcc8b76ca3565e30e64c1413f4aeba903b34.tar.gz
sonarqube-2eedbcc8b76ca3565e30e64c1413f4aeba903b34.zip
SONAR-7665 Deprecate @BatchSide and introduce @ScannerSide
Diffstat (limited to 'sonar-scanner-engine/src/test/java/org/sonar/batch')
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrap/ExtensionUtilsTest.java37
1 files changed, 28 insertions, 9 deletions
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrap/ExtensionUtilsTest.java b/sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrap/ExtensionUtilsTest.java
index f4b685a57a4..328abd324f3 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrap/ExtensionUtilsTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/batch/bootstrap/ExtensionUtilsTest.java
@@ -23,6 +23,7 @@ import org.junit.Test;
import org.sonar.api.BatchComponent;
import org.sonar.api.batch.BatchSide;
import org.sonar.api.batch.InstantiationStrategy;
+import org.sonar.api.batch.ScannerSide;
import org.sonar.api.ce.ComputeEngineSide;
import org.sonar.api.server.ServerSide;
@@ -38,6 +39,9 @@ public class ExtensionUtilsTest {
assertThat(ExtensionUtils.isInstantiationStrategy(new ProjectService(), InstantiationStrategy.PER_BATCH)).isFalse();
assertThat(ExtensionUtils.isInstantiationStrategy(DefaultService.class, InstantiationStrategy.PER_BATCH)).isFalse();
assertThat(ExtensionUtils.isInstantiationStrategy(new DefaultService(), InstantiationStrategy.PER_BATCH)).isFalse();
+ assertThat(ExtensionUtils.isInstantiationStrategy(DefaultScannerService.class, InstantiationStrategy.PER_BATCH)).isFalse();
+ assertThat(ExtensionUtils.isInstantiationStrategy(new DefaultScannerService(), InstantiationStrategy.PER_BATCH)).isFalse();
+
}
@Test
@@ -48,18 +52,22 @@ public class ExtensionUtilsTest {
assertThat(ExtensionUtils.isInstantiationStrategy(new ProjectService(), InstantiationStrategy.PER_PROJECT)).isTrue();
assertThat(ExtensionUtils.isInstantiationStrategy(DefaultService.class, InstantiationStrategy.PER_PROJECT)).isTrue();
assertThat(ExtensionUtils.isInstantiationStrategy(new DefaultService(), InstantiationStrategy.PER_PROJECT)).isTrue();
+ assertThat(ExtensionUtils.isInstantiationStrategy(DefaultScannerService.class, InstantiationStrategy.PER_PROJECT)).isTrue();
+ assertThat(ExtensionUtils.isInstantiationStrategy(new DefaultScannerService(), InstantiationStrategy.PER_PROJECT)).isTrue();
+
}
@Test
- public void testIsBatchSide() {
- assertThat(ExtensionUtils.isBatchSide(BatchService.class)).isTrue();
- assertThat(ExtensionUtils.isBatchSide(new BatchService())).isTrue();
- assertThat(ExtensionUtils.isBatchSide(DeprecatedBatchService.class)).isTrue();
-
- assertThat(ExtensionUtils.isBatchSide(ServerService.class)).isFalse();
- assertThat(ExtensionUtils.isBatchSide(new ServerService())).isFalse();
- assertThat(ExtensionUtils.isBatchSide(new WebServerService())).isFalse();
- assertThat(ExtensionUtils.isBatchSide(new ComputeEngineService())).isFalse();
+ public void testIsScannerSide() {
+ assertThat(ExtensionUtils.isScannerSide(BatchService.class)).isTrue();
+ assertThat(ExtensionUtils.isScannerSide(ScannerService.class)).isTrue();
+ assertThat(ExtensionUtils.isScannerSide(new BatchService())).isTrue();
+ assertThat(ExtensionUtils.isScannerSide(DeprecatedBatchService.class)).isTrue();
+
+ assertThat(ExtensionUtils.isScannerSide(ServerService.class)).isFalse();
+ assertThat(ExtensionUtils.isScannerSide(new ServerService())).isFalse();
+ assertThat(ExtensionUtils.isScannerSide(new WebServerService())).isFalse();
+ assertThat(ExtensionUtils.isScannerSide(new ComputeEngineService())).isFalse();
}
@BatchSide
@@ -68,6 +76,12 @@ public class ExtensionUtilsTest {
}
+ @ScannerSide
+ @InstantiationStrategy(InstantiationStrategy.PER_BATCH)
+ public static class ScannerService {
+
+ }
+
public static class DeprecatedBatchService implements BatchComponent {
}
@@ -82,6 +96,11 @@ public class ExtensionUtilsTest {
public static class DefaultService {
}
+
+ @ScannerSide
+ public static class DefaultScannerService {
+
+ }
@ServerSide
public static class ServerService {