Search in sources :

Example 11 with ExtensionContainer

use of org.sonar.core.platform.ExtensionContainer in project sonarqube by SonarSource.

the class CoreExtensionsInstallerTest method install_installs_extensions_annotated_with_expected_annotation.

@Test
@UseDataProvider("allMethodsToAddExtension")
public void install_installs_extensions_annotated_with_expected_annotation(BiConsumer<CoreExtension.Context, Collection<Object>> extensionAdder) {
    List<Object> extensions = ImmutableList.of(WestSideClass.class, EastSideClass.class, OtherSideClass.class, Latitude.class);
    CoreExtension coreExtension = newCoreExtension(context -> extensionAdder.accept(context, extensions));
    when(coreExtensionRepository.loadedCoreExtensions()).thenReturn(Stream.of(coreExtension));
    ExtensionContainer container = mock(ExtensionContainer.class);
    underTest.install(container, noExtensionFilter(), noAdditionalSideFilter());
    verify(container).addExtension(coreExtension.getName(), WestSideClass.class);
    verify(container).declareExtension(coreExtension.getName(), OtherSideClass.class);
    verify(container).declareExtension(coreExtension.getName(), EastSideClass.class);
    verify(container).addExtension(coreExtension.getName(), Latitude.class);
    verifyNoMoreInteractions(container);
}
Also used : ExtensionContainer(org.sonar.core.platform.ExtensionContainer) Test(org.junit.Test) UseDataProvider(com.tngtech.java.junit.dataprovider.UseDataProvider)

Aggregations

ExtensionContainer (org.sonar.core.platform.ExtensionContainer)11 Test (org.junit.Test)8 UseDataProvider (com.tngtech.java.junit.dataprovider.UseDataProvider)3 ModuleSensorContext (org.sonar.scanner.sensor.ModuleSensorContext)2 ModuleSensorExtensionDictionary (org.sonar.scanner.sensor.ModuleSensorExtensionDictionary)2 Before (org.junit.Before)1 PostJobContext (org.sonar.api.batch.postjob.PostJobContext)1 Sensor (org.sonar.api.batch.sensor.Sensor)1 Configuration (org.sonar.api.config.Configuration)1 PropertyDefinition (org.sonar.api.config.PropertyDefinition)1 MapSettings (org.sonar.api.config.internal.MapSettings)1 ModuleSensorOptimizer (org.sonar.scanner.sensor.ModuleSensorOptimizer)1