Examples of ComponentContainer


Examples of org.sonar.api.platform.ComponentContainer

  /**
   * Start level 1 only
   */
  private void startLevel1Container() {
    level1Container = new ComponentContainer();
    level1Container.addSingletons(serverComponents.level1Components());
    level1Container.startComponents();
    currentContainer = level1Container;
  }
View Full Code Here

Examples of org.sonar.api.platform.ComponentContainer

  private ComputationStepRegistry sut;

  @Before
  public void before() {
    ComponentContainer pico = new ComponentContainer();

    pico.addSingleton(mock(SynchronizeProjectPermissionsStep.class));
    pico.addSingleton(mock(IndexProjectIssuesStep.class));
    pico.addSingleton(mock(SwitchSnapshotStep.class));
    pico.addSingleton(mock(DataCleanerStep.class));
    pico.addSingleton(mock(InvalidatePreviewCacheStep.class));
    pico.addSingleton(mock(ComponentIndexationInDatabaseStep.class));

    sut = new ComputationStepRegistry(pico);
  }
View Full Code Here

Examples of org.sonar.api.platform.ComponentContainer

  @Test
  public void should_filter_extensions_to_install() {
    BatchPluginRepository pluginRepository = mock(BatchPluginRepository.class);
    when(pluginRepository.getPluginsByMetadata()).thenReturn(newPlugin(Foo.class, Bar.class));
    ComponentContainer container = new ComponentContainer();
    ExtensionInstaller installer = new ExtensionInstaller(pluginRepository, new EnvironmentInformation("ant", "1.7"), mode);
    installer.install(container, new FooMatcher());

    assertThat(container.getComponentByType(Foo.class)).isNotNull();
    assertThat(container.getComponentByType(Bar.class)).isNull();
  }
View Full Code Here

Examples of org.sonar.api.platform.ComponentContainer

  @Test
  public void should_execute_extension_provider() {
    BatchPluginRepository pluginRepository = mock(BatchPluginRepository.class);
    when(pluginRepository.getPluginsByMetadata()).thenReturn(newPlugin(new FooProvider(), new BarProvider()));
    ComponentContainer container = new ComponentContainer();
    ExtensionInstaller installer = new ExtensionInstaller(pluginRepository, new EnvironmentInformation("ant", "1.7"), mode);

    installer.install(container, new FooMatcher());

    assertThat(container.getComponentByType(Foo.class)).isNotNull();
    assertThat(container.getComponentByType(Bar.class)).isNull();
  }
View Full Code Here

Examples of org.sonar.api.platform.ComponentContainer

  @Test
  public void should_provide_list_of_extensions() {
    BatchPluginRepository pluginRepository = mock(BatchPluginRepository.class);
    when(pluginRepository.getPluginsByMetadata()).thenReturn(newPlugin(new FooBarProvider()));
    ComponentContainer container = new ComponentContainer();
    ExtensionInstaller installer = new ExtensionInstaller(pluginRepository, new EnvironmentInformation("ant", "1.7"), mode);

    installer.install(container, new TrueMatcher());

    assertThat(container.getComponentByType(Foo.class)).isNotNull();
    assertThat(container.getComponentByType(Bar.class)).isNotNull();
  }
View Full Code Here

Examples of org.sonar.api.platform.ComponentContainer

  @Test
  public void should_not_install_on_unsupported_environment() {
    BatchPluginRepository pluginRepository = mock(BatchPluginRepository.class);
    when(pluginRepository.getPluginsByMetadata()).thenReturn(newPlugin(Foo.class, MavenExtension.class, AntExtension.class, new BarProvider()));

    ComponentContainer container = new ComponentContainer();
    ExtensionInstaller installer = new ExtensionInstaller(pluginRepository, new EnvironmentInformation("ant", "1.7"), mode);

    installer.install(container, new TrueMatcher());

    assertThat(container.getComponentByType(MavenExtension.class)).isNull();
    assertThat(container.getComponentByType(AntExtension.class)).isNotNull();
    assertThat(container.getComponentByType(Foo.class)).isNotNull();
    assertThat(container.getComponentByType(Bar.class)).isNotNull();
  }
View Full Code Here

Examples of org.sonar.api.platform.ComponentContainer

import static org.mockito.Mockito.mock;

public class BatchExtensionDictionnaryTest {

  private BatchExtensionDictionnary newSelector(BatchExtension... extensions) {
    ComponentContainer iocContainer = new ComponentContainer();
    for (BatchExtension extension : extensions) {
      iocContainer.addSingleton(extension);
    }
    return new BatchExtensionDictionnary(iocContainer, mock(SensorContext.class), mock(AnalyzerOptimizer.class));
  }
View Full Code Here

Examples of org.sonar.api.platform.ComponentContainer

    assertThat(formulaDecorator.dependsUponDecorators()).hasSize(1);
    assertThat(Iterables.get(formulaDecorator.dependsUponDecorators(), 0)).isEqualTo(firstDecorator);
  }

  private BatchExtensionDictionnary newBatchDictionnary(Object... extensions) {
    ComponentContainer ioc = new ComponentContainer();
    for (Object extension : extensions) {
      ioc.addSingleton(extension);
    }
    return new BatchExtensionDictionnary(ioc);
  }
View Full Code Here

Examples of org.sonar.api.platform.ComponentContainer

import static org.mockito.Mockito.mock;

public class BatchExtensionDictionnaryTest {

  private BatchExtensionDictionnary newSelector(BatchExtension... extensions) {
    ComponentContainer iocContainer = new ComponentContainer();
    for (BatchExtension extension : extensions) {
      iocContainer.addSingleton(extension);
    }
    return new BatchExtensionDictionnary(iocContainer);
  }
View Full Code Here

Examples of org.sonar.api.platform.ComponentContainer

  public void shouldSearchInParentContainers() {
    BatchExtension a = new FakeSensor();
    BatchExtension b = new FakeSensor();
    BatchExtension c = new FakeSensor();

    ComponentContainer grandParent = new ComponentContainer();
    grandParent.addSingleton(a);

    ComponentContainer parent = grandParent.createChild();
    parent.addSingleton(b);

    ComponentContainer child = parent.createChild();
    child.addSingleton(c);

    BatchExtensionDictionnary dictionnary = new BatchExtensionDictionnary(child);
    assertThat(dictionnary.select(BatchExtension.class)).containsOnly(a, b, c);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.