aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ExtensionInstallerTest.java
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2021-06-09 16:26:56 -0500
committersonartech <sonartech@sonarsource.com>2021-06-17 20:03:08 +0000
commit2754feca4e5fa8fdd804c827783250f48676296c (patch)
tree1ed9522bbc9eff9444fae6bf0a951d976da2b859 /sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ExtensionInstallerTest.java
parent97f2c01fdd4ae863134d4aa1bf32b7dcd512b10c (diff)
downloadsonarqube-2754feca4e5fa8fdd804c827783250f48676296c.tar.gz
sonarqube-2754feca4e5fa8fdd804c827783250f48676296c.zip
SONAR-14925 Remove code deprecated before 7.0 in the Plugin API
Diffstat (limited to 'sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ExtensionInstallerTest.java')
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ExtensionInstallerTest.java60
1 files changed, 1 insertions, 59 deletions
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ExtensionInstallerTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ExtensionInstallerTest.java
index e60676ce65f..364567e4633 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ExtensionInstallerTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/bootstrap/ExtensionInstallerTest.java
@@ -22,7 +22,6 @@ package org.sonar.scanner.bootstrap;
import java.util.Arrays;
import org.apache.commons.lang.ClassUtils;
import org.junit.Test;
-import org.sonar.api.ExtensionProvider;
import org.sonar.api.Plugin;
import org.sonar.api.SonarRuntime;
import org.sonar.api.batch.ScannerSide;
@@ -56,41 +55,9 @@ public class ExtensionInstallerTest {
assertThat(container.getComponentByType(Bar.class)).isNull();
}
- @Test
- public void should_execute_extension_provider() {
- when(pluginRepository.getPluginInfos()).thenReturn(Arrays.asList(new PluginInfo("foo")));
- when(pluginRepository.getPluginInstance("foo")).thenReturn(newPluginInstance(new FooProvider(), new BarProvider()));
- ComponentContainer container = new ComponentContainer();
- ExtensionInstaller installer = new ExtensionInstaller(mock(SonarRuntime.class), pluginRepository, settings.asConfig());
-
- installer.install(container, new FooMatcher());
-
- assertThat(container.getComponentByType(Foo.class)).isNotNull();
- assertThat(container.getComponentByType(Bar.class)).isNull();
- }
-
- @Test
- public void should_provide_list_of_extensions() {
- when(pluginRepository.getPluginInfos()).thenReturn(Arrays.asList(new PluginInfo("foo")));
- when(pluginRepository.getPluginInstance("foo")).thenReturn(newPluginInstance(new FooBarProvider()));
- ComponentContainer container = new ComponentContainer();
- ExtensionInstaller installer = new ExtensionInstaller(mock(SonarRuntime.class), pluginRepository, settings.asConfig());
-
- installer.install(container, new TrueMatcher());
-
- assertThat(container.getComponentByType(Foo.class)).isNotNull();
- assertThat(container.getComponentByType(Bar.class)).isNotNull();
- }
-
private static class FooMatcher implements ExtensionMatcher {
public boolean accept(Object extension) {
- return extension.equals(Foo.class) || ClassUtils.isAssignable(Foo.class, extension.getClass()) || ClassUtils.isAssignable(FooProvider.class, extension.getClass());
- }
- }
-
- private static class TrueMatcher implements ExtensionMatcher {
- public boolean accept(Object extension) {
- return true;
+ return extension.equals(Foo.class) || ClassUtils.isAssignable(Foo.class, extension.getClass());
}
}
@@ -103,29 +70,4 @@ public class ExtensionInstallerTest {
public static class Bar {
}
-
- @ScannerSide
- public static class FooProvider extends ExtensionProvider {
- @Override
- public Object provide() {
- return new Foo();
- }
- }
-
- @ScannerSide
- public static class BarProvider extends ExtensionProvider {
- @Override
- public Object provide() {
- return new Bar();
- }
- }
-
- @ScannerSide
- public static class FooBarProvider extends ExtensionProvider {
- @Override
- public Object provide() {
- return Arrays.asList(new Foo(), new Bar());
- }
- }
-
}