aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-engine/src/test/java/org/sonar/batch
diff options
context:
space:
mode:
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 {