Search in sources :

Example 1 with IssueFieldsSetter

use of org.sonar.server.issue.IssueFieldsSetter in project sonarqube by SonarSource.

the class ProjectTrackerBaseLazyInputTest method prepare.

@Before
public void prepare() {
    rule = dbTester.rules().insert();
    ruleRepositoryRule.add(rule.getKey());
    rootProjectDto = dbTester.components().insertPublicProject();
    ReportComponent rootProject = ReportComponent.builder(Component.Type.FILE, 1).setKey(rootProjectDto.getDbKey()).setUuid(rootProjectDto.uuid()).build();
    reportModulesPath = mock(ReportModulesPath.class);
    underTest = new ProjectTrackerBaseLazyInput(analysisMetadataHolder, mock(ComponentsWithUnprocessedIssues.class), dbClient, new IssueFieldsSetter(), issuesLoader, reportModulesPath, rootProject);
}
Also used : IssueFieldsSetter(org.sonar.server.issue.IssueFieldsSetter) ReportModulesPath(org.sonar.ce.task.projectanalysis.component.ReportModulesPath) ReportComponent(org.sonar.ce.task.projectanalysis.component.ReportComponent) Before(org.junit.Before)

Example 2 with IssueFieldsSetter

use of org.sonar.server.issue.IssueFieldsSetter in project sonarqube by SonarSource.

the class IntegrateIssuesVisitorTest method setUp.

@Before
public void setUp() throws Exception {
    IssueVisitors issueVisitors = new IssueVisitors(new IssueVisitor[] { issueVisitor });
    defaultIssueCaptor = ArgumentCaptor.forClass(DefaultIssue.class);
    when(movedFilesRepository.getOriginalFile(any(Component.class))).thenReturn(Optional.empty());
    DbClient dbClient = dbTester.getDbClient();
    TrackerRawInputFactory rawInputFactory = new TrackerRawInputFactory(treeRootHolder, reportReader, sourceLinesHash, new CommonRuleEngineImpl(), issueFilter, ruleRepositoryRule, activeRulesHolder);
    TrackerBaseInputFactory baseInputFactory = new TrackerBaseInputFactory(issuesLoader, dbClient, movedFilesRepository, mock(ReportModulesPath.class), analysisMetadataHolder, new IssueFieldsSetter(), mock(ComponentsWithUnprocessedIssues.class));
    TrackerTargetBranchInputFactory targetInputFactory = new TrackerTargetBranchInputFactory(issuesLoader, targetBranchComponentUuids, dbClient);
    TrackerReferenceBranchInputFactory mergeInputFactory = new TrackerReferenceBranchInputFactory(issuesLoader, mergeBranchComponentsUuids, dbClient);
    ClosedIssuesInputFactory closedIssuesInputFactory = new ClosedIssuesInputFactory(issuesLoader, dbClient, movedFilesRepository);
    tracker = new TrackerExecution(baseInputFactory, closedIssuesInputFactory, new Tracker<>(), issuesLoader, analysisMetadataHolder);
    mergeBranchTracker = new ReferenceBranchTrackerExecution(mergeInputFactory, new Tracker<>());
    prBranchTracker = new PullRequestTrackerExecution(baseInputFactory, targetInputFactory, new Tracker<>(), newLinesRepository);
    trackingDelegator = new IssueTrackingDelegator(prBranchTracker, mergeBranchTracker, tracker, analysisMetadataHolder);
    treeRootHolder.setRoot(PROJECT);
    protoIssueCache = new ProtoIssueCache(temp.newFile(), System2.INSTANCE);
    when(issueFilter.accept(any(DefaultIssue.class), eq(FILE))).thenReturn(true);
    when(issueChangeContext.date()).thenReturn(new Date());
    underTest = new IntegrateIssuesVisitor(protoIssueCache, rawInputFactory, issueLifecycle, issueVisitors, trackingDelegator, issueStatusCopier, referenceBranchComponentUuids, mock(PullRequestSourceBranchMerger.class));
}
Also used : Tracker(org.sonar.core.issue.tracking.Tracker) DbClient(org.sonar.db.DbClient) CommonRuleEngineImpl(org.sonar.ce.task.projectanalysis.issue.commonrule.CommonRuleEngineImpl) IssueFieldsSetter(org.sonar.server.issue.IssueFieldsSetter) ReportModulesPath(org.sonar.ce.task.projectanalysis.component.ReportModulesPath) DefaultIssue(org.sonar.core.issue.DefaultIssue) Date(java.util.Date) Component(org.sonar.ce.task.projectanalysis.component.Component) ReportComponent(org.sonar.ce.task.projectanalysis.component.ReportComponent) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)2 ReportComponent (org.sonar.ce.task.projectanalysis.component.ReportComponent)2 ReportModulesPath (org.sonar.ce.task.projectanalysis.component.ReportModulesPath)2 IssueFieldsSetter (org.sonar.server.issue.IssueFieldsSetter)2 Date (java.util.Date)1 Component (org.sonar.ce.task.projectanalysis.component.Component)1 CommonRuleEngineImpl (org.sonar.ce.task.projectanalysis.issue.commonrule.CommonRuleEngineImpl)1 DefaultIssue (org.sonar.core.issue.DefaultIssue)1 Tracker (org.sonar.core.issue.tracking.Tracker)1 DbClient (org.sonar.db.DbClient)1