// changes the issue's component uuid, add a change and set issue as changed to enforce it is persisted to DB
issueUpdater.setIssueMoved(issue, component.getUuid(), IssueChangeContext.createUser(new Date(analysisMetadataHolder.getAnalysisDate()), null));
// other fields (such as module, modulePath, componentKey) are read-only and set/reset for consistency only
- issue.setComponentKey(component.getKey());
+ issue.setComponentKey(component.getPublicKey());
issue.setModuleUuid(null);
issue.setModuleUuidPath(null);
}
issue.setResolution(null);
issue.setStatus(Issue.STATUS_OPEN);
issue.setComponentUuid(component.getUuid());
- issue.setComponentKey(component.getKey());
+ issue.setComponentKey(component.getPublicKey());
issue.setProjectUuid(treeRootHolder.getRoot().getUuid());
- issue.setProjectKey(treeRootHolder.getRoot().getKey());
+ issue.setProjectKey(treeRootHolder.getRoot().getPublicKey());
return issue;
}
private static final FileAttributes DEFAULT_FILE_ATTRIBUTES = new FileAttributes(false, null, 1);
- public static final Component DUMB_PROJECT = builder(Type.PROJECT, 1).setKey("PROJECT_KEY").setUuid("PROJECT_UUID").setName("Project Name").setVersion("1.0-SNAPSHOT").build();
+ public static final Component DUMB_PROJECT = builder(Type.PROJECT, 1)
+ .setKey("PROJECT_KEY")
+ .setPublicKey("PUBLIC_PROJECT_KEY")
+ .setUuid("PROJECT_UUID")
+ .setName("Project Name")
+ .setVersion("1.0-SNAPSHOT")
+ .build();
private final Type type;
private final Status status;
}
public static Builder builder(Type type, int ref) {
- return new Builder(type, ref).setKey("key_" + ref).setUuid("uuid_" + ref);
+ return new Builder(type, ref).setKey("key_" + ref).setPublicKey("public_" + ref).setUuid("uuid_" + ref);
}
public static final class Builder {
public class MovedIssueVisitorTest {
private static final long ANALYSIS_DATE = 894521;
private static final String FILE_UUID = "file uuid";
- private static final Component FILE = ReportComponent.builder(Component.Type.FILE, 1).setUuid(FILE_UUID).build();
+ private static final Component FILE = ReportComponent.builder(Component.Type.FILE, 1)
+ .setKey("key_1")
+ .setPublicKey("public_key_1")
+ .setUuid(FILE_UUID)
+ .build();
@org.junit.Rule
public ExpectedException expectedException = ExpectedException.none();
underTest.onIssue(FILE, issue);
verify(issue).setComponentUuid(FILE.getUuid());
- verify(issue).setComponentKey(FILE.getKey());
+ verify(issue).setComponentKey(FILE.getPublicKey());
verify(issue).setModuleUuid(null);
verify(issue).setModuleUuidPath(null);
verify(issue).setChanged(true);
import org.sonar.scanner.protocol.output.ScannerReport;
import org.sonar.scanner.protocol.output.ScannerReport.TextRange;
import org.sonar.server.computation.task.projectanalysis.batch.BatchReportReaderRule;
-import org.sonar.server.computation.task.projectanalysis.component.TreeRootHolderRule;
import org.sonar.server.computation.task.projectanalysis.component.Component;
import org.sonar.server.computation.task.projectanalysis.component.ReportComponent;
+import org.sonar.server.computation.task.projectanalysis.component.TreeRootHolderRule;
import org.sonar.server.computation.task.projectanalysis.issue.commonrule.CommonRuleEngine;
import org.sonar.server.computation.task.projectanalysis.issue.filter.IssueFilter;
import org.sonar.server.computation.task.projectanalysis.source.SourceLinesRepositoryRule;
public class TrackerRawInputFactoryTest {
- static int FILE_REF = 2;
+ private static int FILE_REF = 2;
- static ReportComponent PROJECT = ReportComponent.builder(Component.Type.PROJECT, 1).setKey("PROJECT_KEY_2").setUuid("PROJECT_UUID_1").build();
- static ReportComponent FILE = ReportComponent.builder(Component.Type.FILE, FILE_REF).setKey("FILE_KEY_2").setUuid("FILE_UUID_2").build();
+ private static ReportComponent PROJECT = ReportComponent.builder(Component.Type.PROJECT, 1).build();
+ private static ReportComponent FILE = ReportComponent.builder(Component.Type.FILE, FILE_REF).build();
@Rule
public TreeRootHolderRule treeRootHolder = new TreeRootHolderRule().setRoot(PROJECT);
}
private void assertInitializedIssue(DefaultIssue issue) {
- assertThat(issue.componentKey()).isEqualTo(FILE.getKey());
+ assertThat(issue.projectKey()).isEqualTo(PROJECT.getPublicKey());
+ assertThat(issue.componentKey()).isEqualTo(FILE.getPublicKey());
assertThat(issue.componentUuid()).isEqualTo(FILE.getUuid());
assertThat(issue.resolution()).isNull();
assertThat(issue.status()).isEqualTo(Issue.STATUS_OPEN);