Search in sources :

Example 6 with SpringComponentContainer

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

the class NodeHealthModuleTest method no_broken_dependencies.

@Test
public void no_broken_dependencies() {
    SpringComponentContainer container = new SpringComponentContainer();
    Server server = mock(Server.class);
    NetworkUtils networkUtils = mock(NetworkUtils.class);
    // settings required by NodeHealthProvider
    mapSettings.setProperty("sonar.cluster.node.name", randomAlphanumeric(3));
    mapSettings.setProperty("sonar.cluster.node.port", valueOf(1 + random.nextInt(10)));
    when(server.getStartedAt()).thenReturn(new Date());
    when(networkUtils.getHostname()).thenReturn(randomAlphanumeric(12));
    // upper level dependencies
    container.add(mock(System2.class), mapSettings.asConfig(), server, networkUtils, mock(HazelcastMember.class));
    // HealthAction dependencies
    container.add(mock(HealthChecker.class));
    underTest.configure(container);
    container.startComponents();
}
Also used : SpringComponentContainer(org.sonar.core.platform.SpringComponentContainer) Server(org.sonar.api.platform.Server) NetworkUtils(org.sonar.process.NetworkUtils) System2(org.sonar.api.utils.System2) HazelcastMember(org.sonar.process.cluster.hz.HazelcastMember) Date(java.util.Date) Test(org.junit.Test)

Example 7 with SpringComponentContainer

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

the class PlatformLevel4 method start.

@Override
public PlatformLevel start() {
    SpringComponentContainer container = getContainer();
    CoreExtensionsInstaller coreExtensionsInstaller = parent.get(WebCoreExtensionsInstaller.class);
    coreExtensionsInstaller.install(container, hasPlatformLevel4OrNone(), noAdditionalSideFilter());
    ServerExtensionInstaller extensionInstaller = parent.get(ServerExtensionInstaller.class);
    extensionInstaller.installExtensions(container);
    super.start();
    return this;
}
Also used : SpringComponentContainer(org.sonar.core.platform.SpringComponentContainer) WebCoreExtensionsInstaller(org.sonar.server.platform.WebCoreExtensionsInstaller) CoreExtensionsInstaller(org.sonar.core.extension.CoreExtensionsInstaller) ServerExtensionInstaller(org.sonar.server.plugins.ServerExtensionInstaller)

Example 8 with SpringComponentContainer

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

the class ProjectExportComputationStepsTest method instances_throws_ISE_if_container_does_not_have_second_step.

@Test
public void instances_throws_ISE_if_container_does_not_have_second_step() {
    ComplexityMeasuresStep reportExtractionStep = mock(ComplexityMeasuresStep.class);
    SpringComponentContainer componentContainer = new SpringComponentContainer() {

        {
            add(reportExtractionStep);
        }
    }.startComponents();
    TaskContainerImpl computeEngineContainer = new TaskContainerImpl(componentContainer, container -> {
    // do nothing
    });
    computeEngineContainer.startComponents();
    Iterable<ComputationStep> instances = new ProjectExportComputationSteps(computeEngineContainer).instances();
    assertThatThrownBy(() -> Lists.newArrayList(instances)).isInstanceOf(IllegalStateException.class).hasMessageContaining("class org.sonar.ce.task.projectexport.steps.LoadProjectStep");
}
Also used : SpringComponentContainer(org.sonar.core.platform.SpringComponentContainer) TaskContainerImpl(org.sonar.ce.task.container.TaskContainerImpl) ComputationStep(org.sonar.ce.task.step.ComputationStep) ComplexityMeasuresStep(org.sonar.ce.task.projectanalysis.step.ComplexityMeasuresStep) Test(org.junit.Test)

Example 9 with SpringComponentContainer

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

the class ComputeEngineContainerImpl method start.

@Override
public ComputeEngineContainer start(Props props) {
    this.level1 = new SpringComponentContainer();
    populateLevel1(this.level1, props, requireNonNull(computeEngineStatus));
    startLevel1(this.level1);
    SpringComponentContainer level2 = this.level1.createChild();
    populateLevel2(level2);
    startLevel2(level2);
    SpringComponentContainer level3 = level2.createChild();
    populateLevel3(level3);
    startLevel3(level3);
    this.level4 = level3.createChild();
    populateLevel4(this.level4, props);
    startLevel4(this.level4);
    startupTasks();
    return this;
}
Also used : SpringComponentContainer(org.sonar.core.platform.SpringComponentContainer)

Example 10 with SpringComponentContainer

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

the class PlatformLevel3 method start.

@Override
public PlatformLevel start() {
    SpringComponentContainer container = getContainer();
    CoreExtensionsInstaller coreExtensionsInstaller = parent.get(WebCoreExtensionsInstaller.class);
    coreExtensionsInstaller.install(container, hasPlatformLevel(3), noAdditionalSideFilter());
    return super.start();
}
Also used : SpringComponentContainer(org.sonar.core.platform.SpringComponentContainer) CoreExtensionsInstaller(org.sonar.core.extension.CoreExtensionsInstaller) WebCoreExtensionsInstaller(org.sonar.server.platform.WebCoreExtensionsInstaller)

Aggregations

SpringComponentContainer (org.sonar.core.platform.SpringComponentContainer)11 Test (org.junit.Test)5 TaskContainerImpl (org.sonar.ce.task.container.TaskContainerImpl)3 ComputationStep (org.sonar.ce.task.step.ComputationStep)3 CoreExtensionsInstaller (org.sonar.core.extension.CoreExtensionsInstaller)3 WebCoreExtensionsInstaller (org.sonar.server.platform.WebCoreExtensionsInstaller)3 Date (java.util.Date)1 Server (org.sonar.api.platform.Server)1 System2 (org.sonar.api.utils.System2)1 ComplexityMeasuresStep (org.sonar.ce.task.projectanalysis.step.ComplexityMeasuresStep)1 NetworkUtils (org.sonar.process.NetworkUtils)1 HazelcastMember (org.sonar.process.cluster.hz.HazelcastMember)1 ServerLifecycleNotifier (org.sonar.server.platform.ServerLifecycleNotifier)1 MigrationConfigurationModule (org.sonar.server.platform.db.migration.MigrationConfigurationModule)1 MigrationContainer (org.sonar.server.platform.db.migration.engine.MigrationContainer)1 MigrationContainerImpl (org.sonar.server.platform.db.migration.engine.MigrationContainerImpl)1 MigrationSteps (org.sonar.server.platform.db.migration.step.MigrationSteps)1 MigrationStepsExecutor (org.sonar.server.platform.db.migration.step.MigrationStepsExecutor)1 ServerExtensionInstaller (org.sonar.server.plugins.ServerExtensionInstaller)1