Search in sources :

Example 1 with TaskContainer

use of org.sonar.server.computation.task.container.TaskContainer in project sonarqube by SonarSource.

the class ReportTaskProcessor method process.

@Override
public CeTaskResult process(CeTask task) {
    TaskContainer ceContainer = containerFactory.create(serverContainer, task, componentProviders);
    try {
        ceContainer.getComponentByType(ComputationStepExecutor.class).execute();
        return ceContainer.getComponentByType(TaskResultHolder.class).getResult();
    } finally {
        ensureThreadLocalIsClean(ceContainer);
        ceContainer.cleanup();
    }
}
Also used : TaskContainer(org.sonar.server.computation.task.container.TaskContainer) TaskResultHolder(org.sonar.server.computation.taskprocessor.TaskResultHolder) ComputationStepExecutor(org.sonar.server.computation.task.step.ComputationStepExecutor)

Example 2 with TaskContainer

use of org.sonar.server.computation.task.container.TaskContainer in project sonarqube by SonarSource.

the class ReportComputationStepsTest method instances_throws_ISE_if_container_does_not_have_second_step.

@Test
public void instances_throws_ISE_if_container_does_not_have_second_step() throws Exception {
    expectedException.expect(IllegalStateException.class);
    expectedException.expectMessage("Component not found: class org.sonar.server.computation.task.projectanalysis.step.PersistScannerContextStep");
    final ExtractReportStep reportExtractionStep = mock(ExtractReportStep.class);
    ComponentContainer componentContainer = new ComponentContainer() {

        {
            addSingleton(reportExtractionStep);
        }
    };
    TaskContainerImpl computeEngineContainer = new TaskContainerImpl(componentContainer, new ContainerPopulator<TaskContainer>() {

        @Override
        public void populateContainer(TaskContainer container) {
        // do nothing
        }
    });
    Lists.newArrayList(new ReportComputationSteps(computeEngineContainer).instances());
}
Also used : TaskContainerImpl(org.sonar.server.computation.task.container.TaskContainerImpl) TaskContainer(org.sonar.server.computation.task.container.TaskContainer) ComponentContainer(org.sonar.core.platform.ComponentContainer) Test(org.junit.Test)

Example 3 with TaskContainer

use of org.sonar.server.computation.task.container.TaskContainer in project sonarqube by SonarSource.

the class ReportComputationStepsTest method instances_throws_ISE_if_container_does_not_have_any_step.

@Test
public void instances_throws_ISE_if_container_does_not_have_any_step() throws Exception {
    expectedException.expect(IllegalStateException.class);
    expectedException.expectMessage("Component not found: " + ExtractReportStep.class);
    TaskContainerImpl computeEngineContainer = new TaskContainerImpl(new ComponentContainer(), new ContainerPopulator<TaskContainer>() {

        @Override
        public void populateContainer(TaskContainer container) {
        // do nothing
        }
    });
    Lists.newArrayList(new ReportComputationSteps(computeEngineContainer).instances());
}
Also used : TaskContainerImpl(org.sonar.server.computation.task.container.TaskContainerImpl) TaskContainer(org.sonar.server.computation.task.container.TaskContainer) ComponentContainer(org.sonar.core.platform.ComponentContainer) Test(org.junit.Test)

Aggregations

TaskContainer (org.sonar.server.computation.task.container.TaskContainer)3 Test (org.junit.Test)2 ComponentContainer (org.sonar.core.platform.ComponentContainer)2 TaskContainerImpl (org.sonar.server.computation.task.container.TaskContainerImpl)2 ComputationStepExecutor (org.sonar.server.computation.task.step.ComputationStepExecutor)1 TaskResultHolder (org.sonar.server.computation.taskprocessor.TaskResultHolder)1