diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2011-09-13 19:18:29 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2011-09-13 19:18:29 +0200 |
commit | 38ff19caeffef6048056ea26cb7bdaacd0c8cf52 (patch) | |
tree | 440db095908a238273e87ea1429e8d2bbd56624d /sonar-server/src/test | |
parent | 70586c16196d5025a7917fbe39cb124d0bdc4812 (diff) | |
download | sonarqube-38ff19caeffef6048056ea26cb7bdaacd0c8cf52.tar.gz sonarqube-38ff19caeffef6048056ea26cb7bdaacd0c8cf52.zip |
Log a warning if an ExtensionProvider includes other providers
Diffstat (limited to 'sonar-server/src/test')
-rw-r--r-- | sonar-server/src/test/java/org/sonar/server/plugins/DefaultServerPluginRepositoryTest.java | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/sonar-server/src/test/java/org/sonar/server/plugins/DefaultServerPluginRepositoryTest.java b/sonar-server/src/test/java/org/sonar/server/plugins/DefaultServerPluginRepositoryTest.java index 7624e422b07..afe742b1887 100644 --- a/sonar-server/src/test/java/org/sonar/server/plugins/DefaultServerPluginRepositoryTest.java +++ b/sonar-server/src/test/java/org/sonar/server/plugins/DefaultServerPluginRepositoryTest.java @@ -26,6 +26,7 @@ import org.junit.Test; import org.picocontainer.containers.TransientPicoContainer; import org.sonar.api.*; import org.sonar.api.platform.PluginMetadata; +import org.sonar.batch.Batch; import org.sonar.core.plugins.DefaultPluginMetadata; import java.io.File; @@ -86,7 +87,7 @@ public class DefaultServerPluginRepositoryTest { } @Test - public void shouldInvokeServerExtensionProviderss() { + public void shouldInvokeServerExtensionProviders() { DefaultServerPluginRepository repository = new DefaultServerPluginRepository(mock(PluginDeployer.class)); TransientPicoContainer container = new TransientPicoContainer(); @@ -98,6 +99,17 @@ public class DefaultServerPluginRepositoryTest { } @Test + public void shouldNotSupportProvidersOfProviders() { + DefaultServerPluginRepository repository = new DefaultServerPluginRepository(mock(PluginDeployer.class)); + + TransientPicoContainer container = new TransientPicoContainer(); + repository.registerExtensions(container, Arrays.<Plugin>asList(new FakePlugin(Arrays.<Class>asList(SuperExtensionProvider.class)))); + + assertThat(container.getComponents(FakeBatchExtension.class).size(), is(0)); + assertThat(container.getComponents(FakeServerExtension.class).size(), is(0)); + } + + @Test public void shouldDisablePlugin() { DefaultServerPluginRepository repository = new DefaultServerPluginRepository(mock(PluginDeployer.class)); repository.disable("checkstyle"); @@ -175,4 +187,12 @@ public class DefaultServerPluginRepositoryTest { return Arrays.asList(FakeBatchExtension.class, FakeServerExtension.class); } } + + public static class SuperExtensionProvider extends ExtensionProvider implements ServerExtension { + + @Override + public Object provide() { + return FakeExtensionProvider.class; + } + } } |