use of org.sonar.core.platform.ExtensionContainer in project sonarqube by SonarSource.
the class AbstractExtensionDictionary method completeScannerExtensions.
private static <T> void completeScannerExtensions(ExtensionContainer container, List<T> extensions, Class<T> type) {
extensions.addAll(container.getComponentsByType(type));
ExtensionContainer parentContainer = container.getParent();
if (parentContainer != null) {
completeScannerExtensions(parentContainer, extensions, type);
}
}
use of org.sonar.core.platform.ExtensionContainer in project sonarqube by SonarSource.
the class RequestIdFilterTest method filter_does_not_add_requestId_to_request_passed_on_to_chain_when_there_is_no_RequestIdGenerator_in_container.
@Test
public void filter_does_not_add_requestId_to_request_passed_on_to_chain_when_there_is_no_RequestIdGenerator_in_container() throws IOException, ServletException {
ExtensionContainer container = mock(ExtensionContainer.class);
when(container.getOptionalComponentByType(RequestIdGenerator.class)).thenReturn(Optional.empty());
when(platform.getContainer()).thenReturn(container);
RequestIdFilter underTest = new RequestIdFilter(platform);
underTest.doFilter(servletRequest, servletResponse, filterChain);
verify(servletRequest, times(0)).setAttribute(anyString(), anyString());
}
use of org.sonar.core.platform.ExtensionContainer in project sonarqube by SonarSource.
the class RequestIdFilterTest method filter_does_not_fail_when_there_is_no_RequestIdGenerator_in_container.
@Test
public void filter_does_not_fail_when_there_is_no_RequestIdGenerator_in_container() throws IOException, ServletException {
ExtensionContainer container = mock(ExtensionContainer.class);
when(container.getOptionalComponentByType(RequestIdGenerator.class)).thenReturn(Optional.empty());
when(platform.getContainer()).thenReturn(container);
RequestIdFilter underTest = new RequestIdFilter(platform);
underTest.doFilter(servletRequest, servletResponse, filterChain);
}
use of org.sonar.core.platform.ExtensionContainer in project sonarqube by SonarSource.
the class ModuleSensorExtensionDictionaryTest method newSelector.
private ModuleSensorExtensionDictionary newSelector(Class type, Object... instances) {
ExtensionContainer iocContainer = mock(ExtensionContainer.class);
when(iocContainer.getComponentsByType(type)).thenReturn(Arrays.asList(instances));
return new ModuleSensorExtensionDictionary(iocContainer, mock(ModuleSensorContext.class), sensorOptimizer, fileSystem, branchConfiguration);
}
use of org.sonar.core.platform.ExtensionContainer in project sonarqube by SonarSource.
the class PostJobExtensionDictionaryTest method dependsUponPhaseForPostJob.
@Test
public void dependsUponPhaseForPostJob() {
PrePostJob pre = new PrePostJob();
NormalPostJob normal = new NormalPostJob();
ExtensionContainer iocContainer = mock(ExtensionContainer.class);
when(iocContainer.getComponentsByType(PostJob.class)).thenReturn(List.of(pre, normal));
PostJobExtensionDictionary selector = new PostJobExtensionDictionary(iocContainer, postJobOptimizer, mock(PostJobContext.class));
assertThat(selector.selectPostJobs()).extracting("wrappedPostJob").containsExactly(pre, normal);
}
Aggregations