Search in sources :

Example 1 with TriggerViewRefreshDelegate

use of org.sonar.ce.task.projectanalysis.view.TriggerViewRefreshDelegate in project sonarqube by SonarSource.

the class TriggerViewRefreshStep method execute.

@Override
public void execute(ComputationStep.Context context) {
    for (TriggerViewRefreshDelegate triggerViewRefreshDelegate : this.triggerViewRefreshDelegates) {
        OptionalInt count = triggerViewRefreshDelegate.triggerFrom(analysisMetadata.getProject());
        count.ifPresent(i -> context.getStatistics().add("refreshes" + triggerViewRefreshDelegate.getQualifier(), i));
    }
}
Also used : TriggerViewRefreshDelegate(org.sonar.ce.task.projectanalysis.view.TriggerViewRefreshDelegate) OptionalInt(java.util.OptionalInt)

Example 2 with TriggerViewRefreshDelegate

use of org.sonar.ce.task.projectanalysis.view.TriggerViewRefreshDelegate in project sonarqube by SonarSource.

the class TriggerViewRefreshStepTest method execute_calls_delegate_with_project_from_holder_if_passed_to_constructor.

@Test
public void execute_calls_delegate_with_project_from_holder_if_passed_to_constructor() {
    TriggerViewRefreshDelegate delegate = mock(TriggerViewRefreshDelegate.class);
    Project project = mock(Project.class);
    when(analysisMetadataHolder.getProject()).thenReturn(project);
    TriggerViewRefreshStep underTest = new TriggerViewRefreshStep(analysisMetadataHolder, new TriggerViewRefreshDelegate[] { delegate });
    underTest.execute(new TestComputationStepContext());
    verify(analysisMetadataHolder).getProject();
    verify(delegate).triggerFrom(project);
}
Also used : Project(org.sonar.server.project.Project) TriggerViewRefreshDelegate(org.sonar.ce.task.projectanalysis.view.TriggerViewRefreshDelegate) TestComputationStepContext(org.sonar.ce.task.step.TestComputationStepContext) Test(org.junit.Test)

Aggregations

TriggerViewRefreshDelegate (org.sonar.ce.task.projectanalysis.view.TriggerViewRefreshDelegate)2 OptionalInt (java.util.OptionalInt)1 Test (org.junit.Test)1 TestComputationStepContext (org.sonar.ce.task.step.TestComputationStepContext)1 Project (org.sonar.server.project.Project)1