From 6108a50f766dac17b0bd45258c70ffd346d366c1 Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Mon, 2 Mar 2015 09:54:06 +0100 Subject: [PATCH] SONAR-5945 close issues on deleted components --- .../computation/step/ParseReportStep.java | 15 +- .../computation/step/ParseReportStepTest.java | 16 +- .../org/sonar/batch/protocol/Constants.java | 14 +- .../batch/protocol/input/BatchInput.java | 209 +++-- .../batch/protocol/output/BatchReport.java | 860 ++++++++++++------ .../sonar/server/source/db/FileSourceDb.java | 198 ++-- .../protocol/output/BatchOutputWriter.java | 14 + .../protocol/output/BatchReportReader.java | 10 + .../batch/protocol/output/FileStructure.java | 2 +- .../src/main/protobuf/batch_report.proto | 6 +- .../output/BatchOutputWriterTest.java | 27 + .../output/BatchReportReaderTest.java | 17 +- .../org/sonar/batch/issue/IssueCache.java | 6 + .../batch/report/ComponentsPublisher.java | 10 - .../sonar/batch/report/IssuesPublisher.java | 50 +- .../batch/report/IssuesPublisherTest.java | 166 ++++ 16 files changed, 1126 insertions(+), 494 deletions(-) create mode 100644 sonar-batch/src/test/java/org/sonar/batch/report/IssuesPublisherTest.java diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/ParseReportStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/ParseReportStep.java index 0eff6e32988..a72ec16fce2 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/ParseReportStep.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/ParseReportStep.java @@ -22,6 +22,7 @@ package org.sonar.server.computation.step; import org.sonar.api.resources.Qualifiers; import org.sonar.batch.protocol.output.BatchReport; +import org.sonar.batch.protocol.output.BatchReportReader; import org.sonar.server.computation.ComputationContext; import org.sonar.server.computation.issue.IssueComputation; @@ -42,13 +43,15 @@ public class ParseReportStep implements ComputationStep { public void execute(ComputationContext context) { int rootComponentRef = context.getReportMetadata().getRootComponentRef(); recursivelyProcessComponent(context, rootComponentRef); + processDeletedComponents(context); issueComputation.afterReportProcessing(); } private void recursivelyProcessComponent(ComputationContext context, int componentRef) { - BatchReport.Component component = context.getReportReader().readComponent(componentRef); + BatchReportReader reportReader = context.getReportReader(); + BatchReport.Component component = reportReader.readComponent(componentRef); if (component != null) { - Iterable issues = context.getReportReader().readComponentIssues(componentRef); + Iterable issues = reportReader.readComponentIssues(componentRef); issueComputation.processComponentIssues(context, component.getUuid(), issues); for (Integer childRef : component.getChildRefsList()) { recursivelyProcessComponent(context, childRef); @@ -56,6 +59,14 @@ public class ParseReportStep implements ComputationStep { } } + private void processDeletedComponents(ComputationContext context) { + int deletedComponentsCount = context.getReportMetadata().getDeletedComponentsCount(); + for (int componentRef = 1; componentRef <= deletedComponentsCount; componentRef++) { + BatchReport.Issues issues = context.getReportReader().readDeletedComponentIssues(componentRef); + issueComputation.processComponentIssues(context, issues.getComponentUuid(), issues.getListList()); + } + } + @Override public String getDescription() { return "Digest analysis report"; diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/ParseReportStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/ParseReportStepTest.java index fe354e79ff7..1b0d625148a 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/ParseReportStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/ParseReportStepTest.java @@ -34,7 +34,9 @@ import org.sonar.server.computation.issue.IssueComputation; import java.io.File; import java.io.IOException; +import java.util.Arrays; import java.util.Collections; +import java.util.List; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; @@ -42,6 +44,10 @@ import static org.mockito.Mockito.verify; public class ParseReportStepTest extends BaseStepTest { + private static final List ISSUES_ON_DELETED_COMPONENT = Arrays.asList(BatchReport.Issue.newBuilder() + .setUuid("DELETED_ISSUE_UUID") + .build()); + @Rule public TemporaryFolder temp = new TemporaryFolder(); @@ -58,12 +64,15 @@ public class ParseReportStepTest extends BaseStepTest { ComputationContext context = new ComputationContext(new BatchReportReader(reportDir), mock(ComponentDto.class)); sut.execute(context); + assertThat(context.getReportMetadata().getRootComponentRef()).isEqualTo(1); + assertThat(context.getReportMetadata().getDeletedComponentsCount()).isEqualTo(1); + // verify that all components are processed (currently only for issues) verify(issueComputation).processComponentIssues(context, "PROJECT_UUID", Collections.emptyList()); verify(issueComputation).processComponentIssues(context, "FILE1_UUID", Collections.emptyList()); verify(issueComputation).processComponentIssues(context, "FILE2_UUID", Collections.emptyList()); + verify(issueComputation).processComponentIssues(context, "DELETED_UUID", ISSUES_ON_DELETED_COMPONENT); verify(issueComputation).afterReportProcessing(); - assertThat(context.getReportMetadata().getRootComponentRef()).isEqualTo(1); } private File generateReport() throws IOException { @@ -74,7 +83,9 @@ public class ParseReportStepTest extends BaseStepTest { .setRootComponentRef(1) .setProjectKey("PROJECT_KEY") .setAnalysisDate(150000000L) + .setDeletedComponentsCount(1) .build()); + writer.writeComponent(BatchReport.Component.newBuilder() .setRef(1) .setType(Constants.ComponentType.PROJECT) @@ -92,6 +103,9 @@ public class ParseReportStepTest extends BaseStepTest { .setType(Constants.ComponentType.FILE) .setUuid("FILE2_UUID") .build()); + + // deleted components + writer.writeDeletedComponentIssues(1, "DELETED_UUID", ISSUES_ON_DELETED_COMPONENT); return dir; } diff --git a/sonar-batch-protocol/src/main/gen-java/org/sonar/batch/protocol/Constants.java b/sonar-batch-protocol/src/main/gen-java/org/sonar/batch/protocol/Constants.java index f9cd2f3ea34..bc9d704a4f2 100644 --- a/sonar-batch-protocol/src/main/gen-java/org/sonar/batch/protocol/Constants.java +++ b/sonar-batch-protocol/src/main/gen-java/org/sonar/batch/protocol/Constants.java @@ -252,13 +252,13 @@ public final class Constants { "otocolH\001" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = - new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { - public com.google.protobuf.ExtensionRegistry assignDescriptors( - com.google.protobuf.Descriptors.FileDescriptor root) { - descriptor = root; - return null; - } - }; + new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { + public com.google.protobuf.ExtensionRegistry assignDescriptors( + com.google.protobuf.Descriptors.FileDescriptor root) { + descriptor = root; + return null; + } + }; com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { diff --git a/sonar-batch-protocol/src/main/gen-java/org/sonar/batch/protocol/input/BatchInput.java b/sonar-batch-protocol/src/main/gen-java/org/sonar/batch/protocol/input/BatchInput.java index 464e4d9bb03..6ecbcc83d31 100644 --- a/sonar-batch-protocol/src/main/gen-java/org/sonar/batch/protocol/input/BatchInput.java +++ b/sonar-batch-protocol/src/main/gen-java/org/sonar/batch/protocol/input/BatchInput.java @@ -8,10 +8,10 @@ public final class BatchInput { public static void registerAllExtensions( com.google.protobuf.ExtensionRegistry registry) { } - public interface ServerIssueOrBuilder extends - // @@protoc_insertion_point(interface_extends:ServerIssue) - com.google.protobuf.MessageOrBuilder { + public interface ServerIssueOrBuilder + extends com.google.protobuf.MessageOrBuilder { + // optional string key = 1; /** * optional string key = 1; */ @@ -26,6 +26,7 @@ public final class BatchInput { com.google.protobuf.ByteString getKeyBytes(); + // optional string module_key = 2; /** * optional string module_key = 2; */ @@ -40,6 +41,7 @@ public final class BatchInput { com.google.protobuf.ByteString getModuleKeyBytes(); + // optional string path = 3; /** * optional string path = 3; */ @@ -54,6 +56,7 @@ public final class BatchInput { com.google.protobuf.ByteString getPathBytes(); + // optional string rule_repository = 4; /** * optional string rule_repository = 4; */ @@ -68,6 +71,7 @@ public final class BatchInput { com.google.protobuf.ByteString getRuleRepositoryBytes(); + // optional string rule_key = 5; /** * optional string rule_key = 5; */ @@ -82,6 +86,7 @@ public final class BatchInput { com.google.protobuf.ByteString getRuleKeyBytes(); + // optional int32 line = 6; /** * optional int32 line = 6; */ @@ -91,6 +96,7 @@ public final class BatchInput { */ int getLine(); + // optional string msg = 7; /** * optional string msg = 7; */ @@ -105,6 +111,7 @@ public final class BatchInput { com.google.protobuf.ByteString getMsgBytes(); + // optional .Severity severity = 8; /** * optional .Severity severity = 8; */ @@ -114,6 +121,7 @@ public final class BatchInput { */ org.sonar.batch.protocol.Constants.Severity getSeverity(); + // optional bool manual_severity = 9; /** * optional bool manual_severity = 9; */ @@ -123,6 +131,7 @@ public final class BatchInput { */ boolean getManualSeverity(); + // optional string resolution = 10; /** * optional string resolution = 10; */ @@ -137,6 +146,7 @@ public final class BatchInput { com.google.protobuf.ByteString getResolutionBytes(); + // optional string status = 11; /** * optional string status = 11; */ @@ -151,6 +161,7 @@ public final class BatchInput { com.google.protobuf.ByteString getStatusBytes(); + // optional string checksum = 12; /** * optional string checksum = 12; */ @@ -165,6 +176,7 @@ public final class BatchInput { com.google.protobuf.ByteString getChecksumBytes(); + // optional string assignee_login = 13; /** * optional string assignee_login = 13; */ @@ -179,6 +191,7 @@ public final class BatchInput { com.google.protobuf.ByteString getAssigneeLoginBytes(); + // optional int64 creation_date = 14; /** * optional int64 creation_date = 14; */ @@ -192,9 +205,8 @@ public final class BatchInput { * Protobuf type {@code ServerIssue} */ public static final class ServerIssue extends - com.google.protobuf.GeneratedMessage implements - // @@protoc_insertion_point(message_implements:ServerIssue) - ServerIssueOrBuilder { + com.google.protobuf.GeneratedMessage + implements ServerIssueOrBuilder { // Use ServerIssue.newBuilder() to construct. private ServerIssue(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); @@ -241,33 +253,28 @@ public final class BatchInput { break; } case 10: { - com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000001; - key_ = bs; + key_ = input.readBytes(); break; } case 18: { - com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000002; - moduleKey_ = bs; + moduleKey_ = input.readBytes(); break; } case 26: { - com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000004; - path_ = bs; + path_ = input.readBytes(); break; } case 34: { - com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000008; - ruleRepository_ = bs; + ruleRepository_ = input.readBytes(); break; } case 42: { - com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000010; - ruleKey_ = bs; + ruleKey_ = input.readBytes(); break; } case 48: { @@ -276,9 +283,8 @@ public final class BatchInput { break; } case 58: { - com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000040; - msg_ = bs; + msg_ = input.readBytes(); break; } case 64: { @@ -298,27 +304,23 @@ public final class BatchInput { break; } case 82: { - com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000200; - resolution_ = bs; + resolution_ = input.readBytes(); break; } case 90: { - com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000400; - status_ = bs; + status_ = input.readBytes(); break; } case 98: { - com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000800; - checksum_ = bs; + checksum_ = input.readBytes(); break; } case 106: { - com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00001000; - assigneeLogin_ = bs; + assigneeLogin_ = input.readBytes(); break; } case 112: { @@ -366,6 +368,7 @@ public final class BatchInput { } private int bitField0_; + // optional string key = 1; public static final int KEY_FIELD_NUMBER = 1; private java.lang.Object key_; /** @@ -408,6 +411,7 @@ public final class BatchInput { } } + // optional string module_key = 2; public static final int MODULE_KEY_FIELD_NUMBER = 2; private java.lang.Object moduleKey_; /** @@ -450,6 +454,7 @@ public final class BatchInput { } } + // optional string path = 3; public static final int PATH_FIELD_NUMBER = 3; private java.lang.Object path_; /** @@ -492,6 +497,7 @@ public final class BatchInput { } } + // optional string rule_repository = 4; public static final int RULE_REPOSITORY_FIELD_NUMBER = 4; private java.lang.Object ruleRepository_; /** @@ -534,6 +540,7 @@ public final class BatchInput { } } + // optional string rule_key = 5; public static final int RULE_KEY_FIELD_NUMBER = 5; private java.lang.Object ruleKey_; /** @@ -576,6 +583,7 @@ public final class BatchInput { } } + // optional int32 line = 6; public static final int LINE_FIELD_NUMBER = 6; private int line_; /** @@ -591,6 +599,7 @@ public final class BatchInput { return line_; } + // optional string msg = 7; public static final int MSG_FIELD_NUMBER = 7; private java.lang.Object msg_; /** @@ -633,6 +642,7 @@ public final class BatchInput { } } + // optional .Severity severity = 8; public static final int SEVERITY_FIELD_NUMBER = 8; private org.sonar.batch.protocol.Constants.Severity severity_; /** @@ -648,6 +658,7 @@ public final class BatchInput { return severity_; } + // optional bool manual_severity = 9; public static final int MANUAL_SEVERITY_FIELD_NUMBER = 9; private boolean manualSeverity_; /** @@ -663,6 +674,7 @@ public final class BatchInput { return manualSeverity_; } + // optional string resolution = 10; public static final int RESOLUTION_FIELD_NUMBER = 10; private java.lang.Object resolution_; /** @@ -705,6 +717,7 @@ public final class BatchInput { } } + // optional string status = 11; public static final int STATUS_FIELD_NUMBER = 11; private java.lang.Object status_; /** @@ -747,6 +760,7 @@ public final class BatchInput { } } + // optional string checksum = 12; public static final int CHECKSUM_FIELD_NUMBER = 12; private java.lang.Object checksum_; /** @@ -789,6 +803,7 @@ public final class BatchInput { } } + // optional string assignee_login = 13; public static final int ASSIGNEE_LOGIN_FIELD_NUMBER = 13; private java.lang.Object assigneeLogin_; /** @@ -831,6 +846,7 @@ public final class BatchInput { } } + // optional int64 creation_date = 14; public static final int CREATION_DATE_FIELD_NUMBER = 14; private long creationDate_; /** @@ -865,8 +881,7 @@ public final class BatchInput { private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; + if (isInitialized != -1) return isInitialized == 1; memoizedIsInitialized = 1; return true; @@ -1064,9 +1079,8 @@ public final class BatchInput { * Protobuf type {@code ServerIssue} */ public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder implements - // @@protoc_insertion_point(builder_implements:ServerIssue) - org.sonar.batch.protocol.input.BatchInput.ServerIssueOrBuilder { + com.google.protobuf.GeneratedMessage.Builder + implements org.sonar.batch.protocol.input.BatchInput.ServerIssueOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.sonar.batch.protocol.input.BatchInput.internal_static_ServerIssue_descriptor; @@ -1316,6 +1330,7 @@ public final class BatchInput { } private int bitField0_; + // optional string key = 1; private java.lang.Object key_ = ""; /** * optional string key = 1; @@ -1329,12 +1344,9 @@ public final class BatchInput { public java.lang.String getKey() { java.lang.Object ref = key_; if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - key_ = s; - } + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + key_ = s; return s; } else { return (java.lang.String) ref; @@ -1392,6 +1404,7 @@ public final class BatchInput { return this; } + // optional string module_key = 2; private java.lang.Object moduleKey_ = ""; /** * optional string module_key = 2; @@ -1405,12 +1418,9 @@ public final class BatchInput { public java.lang.String getModuleKey() { java.lang.Object ref = moduleKey_; if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - moduleKey_ = s; - } + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + moduleKey_ = s; return s; } else { return (java.lang.String) ref; @@ -1468,6 +1478,7 @@ public final class BatchInput { return this; } + // optional string path = 3; private java.lang.Object path_ = ""; /** * optional string path = 3; @@ -1481,12 +1492,9 @@ public final class BatchInput { public java.lang.String getPath() { java.lang.Object ref = path_; if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - path_ = s; - } + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + path_ = s; return s; } else { return (java.lang.String) ref; @@ -1544,6 +1552,7 @@ public final class BatchInput { return this; } + // optional string rule_repository = 4; private java.lang.Object ruleRepository_ = ""; /** * optional string rule_repository = 4; @@ -1557,12 +1566,9 @@ public final class BatchInput { public java.lang.String getRuleRepository() { java.lang.Object ref = ruleRepository_; if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - ruleRepository_ = s; - } + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + ruleRepository_ = s; return s; } else { return (java.lang.String) ref; @@ -1620,6 +1626,7 @@ public final class BatchInput { return this; } + // optional string rule_key = 5; private java.lang.Object ruleKey_ = ""; /** * optional string rule_key = 5; @@ -1633,12 +1640,9 @@ public final class BatchInput { public java.lang.String getRuleKey() { java.lang.Object ref = ruleKey_; if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - ruleKey_ = s; - } + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + ruleKey_ = s; return s; } else { return (java.lang.String) ref; @@ -1696,6 +1700,7 @@ public final class BatchInput { return this; } + // optional int32 line = 6; private int line_ ; /** * optional int32 line = 6; @@ -1728,6 +1733,7 @@ public final class BatchInput { return this; } + // optional string msg = 7; private java.lang.Object msg_ = ""; /** * optional string msg = 7; @@ -1741,12 +1747,9 @@ public final class BatchInput { public java.lang.String getMsg() { java.lang.Object ref = msg_; if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - msg_ = s; - } + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + msg_ = s; return s; } else { return (java.lang.String) ref; @@ -1804,6 +1807,7 @@ public final class BatchInput { return this; } + // optional .Severity severity = 8; private org.sonar.batch.protocol.Constants.Severity severity_ = org.sonar.batch.protocol.Constants.Severity.INFO; /** * optional .Severity severity = 8; @@ -1839,6 +1843,7 @@ public final class BatchInput { return this; } + // optional bool manual_severity = 9; private boolean manualSeverity_ ; /** * optional bool manual_severity = 9; @@ -1871,6 +1876,7 @@ public final class BatchInput { return this; } + // optional string resolution = 10; private java.lang.Object resolution_ = ""; /** * optional string resolution = 10; @@ -1884,12 +1890,9 @@ public final class BatchInput { public java.lang.String getResolution() { java.lang.Object ref = resolution_; if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - resolution_ = s; - } + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + resolution_ = s; return s; } else { return (java.lang.String) ref; @@ -1947,6 +1950,7 @@ public final class BatchInput { return this; } + // optional string status = 11; private java.lang.Object status_ = ""; /** * optional string status = 11; @@ -1960,12 +1964,9 @@ public final class BatchInput { public java.lang.String getStatus() { java.lang.Object ref = status_; if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - status_ = s; - } + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + status_ = s; return s; } else { return (java.lang.String) ref; @@ -2023,6 +2024,7 @@ public final class BatchInput { return this; } + // optional string checksum = 12; private java.lang.Object checksum_ = ""; /** * optional string checksum = 12; @@ -2036,12 +2038,9 @@ public final class BatchInput { public java.lang.String getChecksum() { java.lang.Object ref = checksum_; if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - checksum_ = s; - } + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + checksum_ = s; return s; } else { return (java.lang.String) ref; @@ -2099,6 +2098,7 @@ public final class BatchInput { return this; } + // optional string assignee_login = 13; private java.lang.Object assigneeLogin_ = ""; /** * optional string assignee_login = 13; @@ -2112,12 +2112,9 @@ public final class BatchInput { public java.lang.String getAssigneeLogin() { java.lang.Object ref = assigneeLogin_; if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - assigneeLogin_ = s; - } + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + assigneeLogin_ = s; return s; } else { return (java.lang.String) ref; @@ -2175,6 +2172,7 @@ public final class BatchInput { return this; } + // optional int64 creation_date = 14; private long creationDate_ ; /** * optional int64 creation_date = 14; @@ -2218,7 +2216,7 @@ public final class BatchInput { // @@protoc_insertion_point(class_scope:ServerIssue) } - private static final com.google.protobuf.Descriptors.Descriptor + private static com.google.protobuf.Descriptors.Descriptor internal_static_ServerIssue_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable @@ -2243,25 +2241,24 @@ public final class BatchInput { " \001(\003B\"\n\036org.sonar.batch.protocol.inputH\001" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = - new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { - public com.google.protobuf.ExtensionRegistry assignDescriptors( - com.google.protobuf.Descriptors.FileDescriptor root) { - descriptor = root; - return null; - } - }; + new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { + public com.google.protobuf.ExtensionRegistry assignDescriptors( + com.google.protobuf.Descriptors.FileDescriptor root) { + descriptor = root; + internal_static_ServerIssue_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_ServerIssue_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_ServerIssue_descriptor, + new java.lang.String[] { "Key", "ModuleKey", "Path", "RuleRepository", "RuleKey", "Line", "Msg", "Severity", "ManualSeverity", "Resolution", "Status", "Checksum", "AssigneeLogin", "CreationDate", }); + return null; + } + }; com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { org.sonar.batch.protocol.Constants.getDescriptor(), }, assigner); - internal_static_ServerIssue_descriptor = - getDescriptor().getMessageTypes().get(0); - internal_static_ServerIssue_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_ServerIssue_descriptor, - new java.lang.String[] { "Key", "ModuleKey", "Path", "RuleRepository", "RuleKey", "Line", "Msg", "Severity", "ManualSeverity", "Resolution", "Status", "Checksum", "AssigneeLogin", "CreationDate", }); - org.sonar.batch.protocol.Constants.getDescriptor(); } // @@protoc_insertion_point(outer_class_scope) diff --git a/sonar-batch-protocol/src/main/gen-java/org/sonar/batch/protocol/output/BatchReport.java b/sonar-batch-protocol/src/main/gen-java/org/sonar/batch/protocol/output/BatchReport.java index c3d15bf144e..c2d7821b918 100644 --- a/sonar-batch-protocol/src/main/gen-java/org/sonar/batch/protocol/output/BatchReport.java +++ b/sonar-batch-protocol/src/main/gen-java/org/sonar/batch/protocol/output/BatchReport.java @@ -8,10 +8,10 @@ public final class BatchReport { public static void registerAllExtensions( com.google.protobuf.ExtensionRegistry registry) { } - public interface MetadataOrBuilder extends - // @@protoc_insertion_point(interface_extends:Metadata) - com.google.protobuf.MessageOrBuilder { + public interface MetadataOrBuilder + extends com.google.protobuf.MessageOrBuilder { + // optional int64 analysis_date = 1; /** * optional int64 analysis_date = 1; */ @@ -21,6 +21,7 @@ public final class BatchReport { */ long getAnalysisDate(); + // optional string project_key = 2; /** * optional string project_key = 2; */ @@ -35,6 +36,7 @@ public final class BatchReport { com.google.protobuf.ByteString getProjectKeyBytes(); + // optional int32 root_component_ref = 3; /** * optional int32 root_component_ref = 3; */ @@ -44,11 +46,12 @@ public final class BatchReport { */ int getRootComponentRef(); + // optional int64 snapshot_id = 4; /** * optional int64 snapshot_id = 4; * *
-     * temporary field used during development of computation stack
+     * temporary fields used during development of computation stack
      * 
*/ boolean hasSnapshotId(); @@ -56,18 +59,27 @@ public final class BatchReport { * optional int64 snapshot_id = 4; * *
-     * temporary field used during development of computation stack
+     * temporary fields used during development of computation stack
      * 
*/ long getSnapshotId(); + + // optional int32 deleted_components_count = 5; + /** + * optional int32 deleted_components_count = 5; + */ + boolean hasDeletedComponentsCount(); + /** + * optional int32 deleted_components_count = 5; + */ + int getDeletedComponentsCount(); } /** * Protobuf type {@code Metadata} */ public static final class Metadata extends - com.google.protobuf.GeneratedMessage implements - // @@protoc_insertion_point(message_implements:Metadata) - MetadataOrBuilder { + com.google.protobuf.GeneratedMessage + implements MetadataOrBuilder { // Use Metadata.newBuilder() to construct. private Metadata(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); @@ -119,9 +131,8 @@ public final class BatchReport { break; } case 18: { - com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000002; - projectKey_ = bs; + projectKey_ = input.readBytes(); break; } case 24: { @@ -134,6 +145,11 @@ public final class BatchReport { snapshotId_ = input.readInt64(); break; } + case 40: { + bitField0_ |= 0x00000010; + deletedComponentsCount_ = input.readInt32(); + break; + } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { @@ -174,6 +190,7 @@ public final class BatchReport { } private int bitField0_; + // optional int64 analysis_date = 1; public static final int ANALYSIS_DATE_FIELD_NUMBER = 1; private long analysisDate_; /** @@ -189,6 +206,7 @@ public final class BatchReport { return analysisDate_; } + // optional string project_key = 2; public static final int PROJECT_KEY_FIELD_NUMBER = 2; private java.lang.Object projectKey_; /** @@ -231,6 +249,7 @@ public final class BatchReport { } } + // optional int32 root_component_ref = 3; public static final int ROOT_COMPONENT_REF_FIELD_NUMBER = 3; private int rootComponentRef_; /** @@ -246,13 +265,14 @@ public final class BatchReport { return rootComponentRef_; } + // optional int64 snapshot_id = 4; public static final int SNAPSHOT_ID_FIELD_NUMBER = 4; private long snapshotId_; /** * optional int64 snapshot_id = 4; * *
-     * temporary field used during development of computation stack
+     * temporary fields used during development of computation stack
      * 
*/ public boolean hasSnapshotId() { @@ -262,24 +282,40 @@ public final class BatchReport { * optional int64 snapshot_id = 4; * *
-     * temporary field used during development of computation stack
+     * temporary fields used during development of computation stack
      * 
*/ public long getSnapshotId() { return snapshotId_; } + // optional int32 deleted_components_count = 5; + public static final int DELETED_COMPONENTS_COUNT_FIELD_NUMBER = 5; + private int deletedComponentsCount_; + /** + * optional int32 deleted_components_count = 5; + */ + public boolean hasDeletedComponentsCount() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + /** + * optional int32 deleted_components_count = 5; + */ + public int getDeletedComponentsCount() { + return deletedComponentsCount_; + } + private void initFields() { analysisDate_ = 0L; projectKey_ = ""; rootComponentRef_ = 0; snapshotId_ = 0L; + deletedComponentsCount_ = 0; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; + if (isInitialized != -1) return isInitialized == 1; memoizedIsInitialized = 1; return true; @@ -300,6 +336,9 @@ public final class BatchReport { if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeInt64(4, snapshotId_); } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeInt32(5, deletedComponentsCount_); + } getUnknownFields().writeTo(output); } @@ -325,6 +364,10 @@ public final class BatchReport { size += com.google.protobuf.CodedOutputStream .computeInt64Size(4, snapshotId_); } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(5, deletedComponentsCount_); + } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; @@ -407,9 +450,8 @@ public final class BatchReport { * Protobuf type {@code Metadata} */ public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder implements - // @@protoc_insertion_point(builder_implements:Metadata) - org.sonar.batch.protocol.output.BatchReport.MetadataOrBuilder { + com.google.protobuf.GeneratedMessage.Builder + implements org.sonar.batch.protocol.output.BatchReport.MetadataOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.sonar.batch.protocol.output.BatchReport.internal_static_Metadata_descriptor; @@ -450,6 +492,8 @@ public final class BatchReport { bitField0_ = (bitField0_ & ~0x00000004); snapshotId_ = 0L; bitField0_ = (bitField0_ & ~0x00000008); + deletedComponentsCount_ = 0; + bitField0_ = (bitField0_ & ~0x00000010); return this; } @@ -494,6 +538,10 @@ public final class BatchReport { to_bitField0_ |= 0x00000008; } result.snapshotId_ = snapshotId_; + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000010; + } + result.deletedComponentsCount_ = deletedComponentsCount_; result.bitField0_ = to_bitField0_; onBuilt(); return result; @@ -524,6 +572,9 @@ public final class BatchReport { if (other.hasSnapshotId()) { setSnapshotId(other.getSnapshotId()); } + if (other.hasDeletedComponentsCount()) { + setDeletedComponentsCount(other.getDeletedComponentsCount()); + } this.mergeUnknownFields(other.getUnknownFields()); return this; } @@ -551,6 +602,7 @@ public final class BatchReport { } private int bitField0_; + // optional int64 analysis_date = 1; private long analysisDate_ ; /** * optional int64 analysis_date = 1; @@ -583,6 +635,7 @@ public final class BatchReport { return this; } + // optional string project_key = 2; private java.lang.Object projectKey_ = ""; /** * optional string project_key = 2; @@ -596,12 +649,9 @@ public final class BatchReport { public java.lang.String getProjectKey() { java.lang.Object ref = projectKey_; if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - projectKey_ = s; - } + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + projectKey_ = s; return s; } else { return (java.lang.String) ref; @@ -659,6 +709,7 @@ public final class BatchReport { return this; } + // optional int32 root_component_ref = 3; private int rootComponentRef_ ; /** * optional int32 root_component_ref = 3; @@ -691,12 +742,13 @@ public final class BatchReport { return this; } + // optional int64 snapshot_id = 4; private long snapshotId_ ; /** * optional int64 snapshot_id = 4; * *
-       * temporary field used during development of computation stack
+       * temporary fields used during development of computation stack
        * 
*/ public boolean hasSnapshotId() { @@ -706,7 +758,7 @@ public final class BatchReport { * optional int64 snapshot_id = 4; * *
-       * temporary field used during development of computation stack
+       * temporary fields used during development of computation stack
        * 
*/ public long getSnapshotId() { @@ -716,7 +768,7 @@ public final class BatchReport { * optional int64 snapshot_id = 4; * *
-       * temporary field used during development of computation stack
+       * temporary fields used during development of computation stack
        * 
*/ public Builder setSnapshotId(long value) { @@ -729,7 +781,7 @@ public final class BatchReport { * optional int64 snapshot_id = 4; * *
-       * temporary field used during development of computation stack
+       * temporary fields used during development of computation stack
        * 
*/ public Builder clearSnapshotId() { @@ -739,6 +791,39 @@ public final class BatchReport { return this; } + // optional int32 deleted_components_count = 5; + private int deletedComponentsCount_ ; + /** + * optional int32 deleted_components_count = 5; + */ + public boolean hasDeletedComponentsCount() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + /** + * optional int32 deleted_components_count = 5; + */ + public int getDeletedComponentsCount() { + return deletedComponentsCount_; + } + /** + * optional int32 deleted_components_count = 5; + */ + public Builder setDeletedComponentsCount(int value) { + bitField0_ |= 0x00000010; + deletedComponentsCount_ = value; + onChanged(); + return this; + } + /** + * optional int32 deleted_components_count = 5; + */ + public Builder clearDeletedComponentsCount() { + bitField0_ = (bitField0_ & ~0x00000010); + deletedComponentsCount_ = 0; + onChanged(); + return this; + } + // @@protoc_insertion_point(builder_scope:Metadata) } @@ -750,10 +835,10 @@ public final class BatchReport { // @@protoc_insertion_point(class_scope:Metadata) } - public interface ComponentOrBuilder extends - // @@protoc_insertion_point(interface_extends:Component) - com.google.protobuf.MessageOrBuilder { + public interface ComponentOrBuilder + extends com.google.protobuf.MessageOrBuilder { + // optional int32 ref = 1; /** * optional int32 ref = 1; */ @@ -763,6 +848,7 @@ public final class BatchReport { */ int getRef(); + // optional string path = 2; /** * optional string path = 2; */ @@ -777,6 +863,7 @@ public final class BatchReport { com.google.protobuf.ByteString getPathBytes(); + // optional string name = 3; /** * optional string name = 3; */ @@ -791,6 +878,7 @@ public final class BatchReport { com.google.protobuf.ByteString getNameBytes(); + // optional .ComponentType type = 4; /** * optional .ComponentType type = 4; */ @@ -800,6 +888,7 @@ public final class BatchReport { */ org.sonar.batch.protocol.Constants.ComponentType getType(); + // optional bool is_test = 5; /** * optional bool is_test = 5; */ @@ -809,6 +898,7 @@ public final class BatchReport { */ boolean getIsTest(); + // optional string language = 6; /** * optional string language = 6; */ @@ -823,6 +913,7 @@ public final class BatchReport { com.google.protobuf.ByteString getLanguageBytes(); + // repeated int32 child_refs = 7 [packed = true]; /** * repeated int32 child_refs = 7 [packed = true]; */ @@ -836,6 +927,7 @@ public final class BatchReport { */ int getChildRefs(int index); + // optional int32 snapshot_id = 8; /** * optional int32 snapshot_id = 8; * @@ -853,6 +945,7 @@ public final class BatchReport { */ int getSnapshotId(); + // optional string uuid = 9; /** * optional string uuid = 9; */ @@ -871,9 +964,8 @@ public final class BatchReport { * Protobuf type {@code Component} */ public static final class Component extends - com.google.protobuf.GeneratedMessage implements - // @@protoc_insertion_point(message_implements:Component) - ComponentOrBuilder { + com.google.protobuf.GeneratedMessage + implements ComponentOrBuilder { // Use Component.newBuilder() to construct. private Component(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); @@ -925,15 +1017,13 @@ public final class BatchReport { break; } case 18: { - com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000002; - path_ = bs; + path_ = input.readBytes(); break; } case 26: { - com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000004; - name_ = bs; + name_ = input.readBytes(); break; } case 32: { @@ -953,9 +1043,8 @@ public final class BatchReport { break; } case 50: { - com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000020; - language_ = bs; + language_ = input.readBytes(); break; } case 56: { @@ -985,9 +1074,8 @@ public final class BatchReport { break; } case 74: { - com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000080; - uuid_ = bs; + uuid_ = input.readBytes(); break; } } @@ -1033,6 +1121,7 @@ public final class BatchReport { } private int bitField0_; + // optional int32 ref = 1; public static final int REF_FIELD_NUMBER = 1; private int ref_; /** @@ -1048,6 +1137,7 @@ public final class BatchReport { return ref_; } + // optional string path = 2; public static final int PATH_FIELD_NUMBER = 2; private java.lang.Object path_; /** @@ -1090,6 +1180,7 @@ public final class BatchReport { } } + // optional string name = 3; public static final int NAME_FIELD_NUMBER = 3; private java.lang.Object name_; /** @@ -1132,6 +1223,7 @@ public final class BatchReport { } } + // optional .ComponentType type = 4; public static final int TYPE_FIELD_NUMBER = 4; private org.sonar.batch.protocol.Constants.ComponentType type_; /** @@ -1147,6 +1239,7 @@ public final class BatchReport { return type_; } + // optional bool is_test = 5; public static final int IS_TEST_FIELD_NUMBER = 5; private boolean isTest_; /** @@ -1162,6 +1255,7 @@ public final class BatchReport { return isTest_; } + // optional string language = 6; public static final int LANGUAGE_FIELD_NUMBER = 6; private java.lang.Object language_; /** @@ -1204,6 +1298,7 @@ public final class BatchReport { } } + // repeated int32 child_refs = 7 [packed = true]; public static final int CHILD_REFS_FIELD_NUMBER = 7; private java.util.List childRefs_; /** @@ -1227,6 +1322,7 @@ public final class BatchReport { } private int childRefsMemoizedSerializedSize = -1; + // optional int32 snapshot_id = 8; public static final int SNAPSHOT_ID_FIELD_NUMBER = 8; private int snapshotId_; /** @@ -1250,6 +1346,7 @@ public final class BatchReport { return snapshotId_; } + // optional string uuid = 9; public static final int UUID_FIELD_NUMBER = 9; private java.lang.Object uuid_; /** @@ -1306,8 +1403,7 @@ public final class BatchReport { private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; + if (isInitialized != -1) return isInitialized == 1; memoizedIsInitialized = 1; return true; @@ -1484,9 +1580,8 @@ public final class BatchReport { * Protobuf type {@code Component} */ public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder implements - // @@protoc_insertion_point(builder_implements:Component) - org.sonar.batch.protocol.output.BatchReport.ComponentOrBuilder { + com.google.protobuf.GeneratedMessage.Builder + implements org.sonar.batch.protocol.output.BatchReport.ComponentOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.sonar.batch.protocol.output.BatchReport.internal_static_Component_descriptor; @@ -1687,6 +1782,7 @@ public final class BatchReport { } private int bitField0_; + // optional int32 ref = 1; private int ref_ ; /** * optional int32 ref = 1; @@ -1719,6 +1815,7 @@ public final class BatchReport { return this; } + // optional string path = 2; private java.lang.Object path_ = ""; /** * optional string path = 2; @@ -1732,12 +1829,9 @@ public final class BatchReport { public java.lang.String getPath() { java.lang.Object ref = path_; if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - path_ = s; - } + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + path_ = s; return s; } else { return (java.lang.String) ref; @@ -1795,6 +1889,7 @@ public final class BatchReport { return this; } + // optional string name = 3; private java.lang.Object name_ = ""; /** * optional string name = 3; @@ -1808,12 +1903,9 @@ public final class BatchReport { public java.lang.String getName() { java.lang.Object ref = name_; if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - name_ = s; - } + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + name_ = s; return s; } else { return (java.lang.String) ref; @@ -1871,6 +1963,7 @@ public final class BatchReport { return this; } + // optional .ComponentType type = 4; private org.sonar.batch.protocol.Constants.ComponentType type_ = org.sonar.batch.protocol.Constants.ComponentType.PROJECT; /** * optional .ComponentType type = 4; @@ -1906,6 +1999,7 @@ public final class BatchReport { return this; } + // optional bool is_test = 5; private boolean isTest_ ; /** * optional bool is_test = 5; @@ -1938,6 +2032,7 @@ public final class BatchReport { return this; } + // optional string language = 6; private java.lang.Object language_ = ""; /** * optional string language = 6; @@ -1951,12 +2046,9 @@ public final class BatchReport { public java.lang.String getLanguage() { java.lang.Object ref = language_; if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - language_ = s; - } + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + language_ = s; return s; } else { return (java.lang.String) ref; @@ -2014,6 +2106,7 @@ public final class BatchReport { return this; } + // repeated int32 child_refs = 7 [packed = true]; private java.util.List childRefs_ = java.util.Collections.emptyList(); private void ensureChildRefsIsMutable() { if (!((bitField0_ & 0x00000040) == 0x00000040)) { @@ -2065,8 +2158,7 @@ public final class BatchReport { public Builder addAllChildRefs( java.lang.Iterable values) { ensureChildRefsIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, childRefs_); + super.addAll(values, childRefs_); onChanged(); return this; } @@ -2080,6 +2172,7 @@ public final class BatchReport { return this; } + // optional int32 snapshot_id = 8; private int snapshotId_ ; /** * optional int32 snapshot_id = 8; @@ -2128,6 +2221,7 @@ public final class BatchReport { return this; } + // optional string uuid = 9; private java.lang.Object uuid_ = ""; /** * optional string uuid = 9; @@ -2141,12 +2235,9 @@ public final class BatchReport { public java.lang.String getUuid() { java.lang.Object ref = uuid_; if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - uuid_ = s; - } + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + uuid_ = s; return s; } else { return (java.lang.String) ref; @@ -2215,10 +2306,10 @@ public final class BatchReport { // @@protoc_insertion_point(class_scope:Component) } - public interface IssueOrBuilder extends - // @@protoc_insertion_point(interface_extends:Issue) - com.google.protobuf.MessageOrBuilder { + public interface IssueOrBuilder + extends com.google.protobuf.MessageOrBuilder { + // optional string rule_repository = 1; /** * optional string rule_repository = 1; */ @@ -2233,6 +2324,7 @@ public final class BatchReport { com.google.protobuf.ByteString getRuleRepositoryBytes(); + // optional string rule_key = 2; /** * optional string rule_key = 2; */ @@ -2247,6 +2339,7 @@ public final class BatchReport { com.google.protobuf.ByteString getRuleKeyBytes(); + // optional int32 line = 3; /** * optional int32 line = 3; */ @@ -2256,6 +2349,7 @@ public final class BatchReport { */ int getLine(); + // optional string msg = 4; /** * optional string msg = 4; */ @@ -2270,6 +2364,7 @@ public final class BatchReport { com.google.protobuf.ByteString getMsgBytes(); + // optional .Severity severity = 5; /** * optional .Severity severity = 5; */ @@ -2279,11 +2374,12 @@ public final class BatchReport { */ org.sonar.batch.protocol.Constants.Severity getSeverity(); + // repeated string tags = 6; /** * repeated string tags = 6; */ - com.google.protobuf.ProtocolStringList - getTagsList(); + java.util.List + getTagsList(); /** * repeated string tags = 6; */ @@ -2298,6 +2394,7 @@ public final class BatchReport { com.google.protobuf.ByteString getTagsBytes(int index); + // optional double effort_to_fix = 7; /** * optional double effort_to_fix = 7; * @@ -2315,6 +2412,7 @@ public final class BatchReport { */ double getEffortToFix(); + // optional bool is_new = 8; /** * optional bool is_new = 8; */ @@ -2324,6 +2422,7 @@ public final class BatchReport { */ boolean getIsNew(); + // optional string uuid = 9; /** * optional string uuid = 9; */ @@ -2338,6 +2437,7 @@ public final class BatchReport { com.google.protobuf.ByteString getUuidBytes(); + // optional int64 debt_in_minutes = 10; /** * optional int64 debt_in_minutes = 10; */ @@ -2347,6 +2447,7 @@ public final class BatchReport { */ long getDebtInMinutes(); + // optional string resolution = 11; /** * optional string resolution = 11; */ @@ -2361,6 +2462,7 @@ public final class BatchReport { com.google.protobuf.ByteString getResolutionBytes(); + // optional string status = 12; /** * optional string status = 12; */ @@ -2375,6 +2477,7 @@ public final class BatchReport { com.google.protobuf.ByteString getStatusBytes(); + // optional string checksum = 13; /** * optional string checksum = 13; */ @@ -2389,6 +2492,7 @@ public final class BatchReport { com.google.protobuf.ByteString getChecksumBytes(); + // optional bool manual_severity = 14; /** * optional bool manual_severity = 14; */ @@ -2398,6 +2502,7 @@ public final class BatchReport { */ boolean getManualSeverity(); + // optional string reporter = 15; /** * optional string reporter = 15; */ @@ -2412,6 +2517,7 @@ public final class BatchReport { com.google.protobuf.ByteString getReporterBytes(); + // optional string assignee = 16; /** * optional string assignee = 16; */ @@ -2426,6 +2532,7 @@ public final class BatchReport { com.google.protobuf.ByteString getAssigneeBytes(); + // optional string action_plan_key = 17; /** * optional string action_plan_key = 17; */ @@ -2440,6 +2547,7 @@ public final class BatchReport { com.google.protobuf.ByteString getActionPlanKeyBytes(); + // optional string attributes = 18; /** * optional string attributes = 18; */ @@ -2454,6 +2562,7 @@ public final class BatchReport { com.google.protobuf.ByteString getAttributesBytes(); + // optional string author_login = 19; /** * optional string author_login = 19; */ @@ -2468,6 +2577,7 @@ public final class BatchReport { com.google.protobuf.ByteString getAuthorLoginBytes(); + // optional int64 creation_date = 20; /** * optional int64 creation_date = 20; */ @@ -2477,6 +2587,7 @@ public final class BatchReport { */ long getCreationDate(); + // optional int64 close_date = 21; /** * optional int64 close_date = 21; */ @@ -2486,6 +2597,7 @@ public final class BatchReport { */ long getCloseDate(); + // optional int64 update_date = 22; /** * optional int64 update_date = 22; */ @@ -2495,6 +2607,7 @@ public final class BatchReport { */ long getUpdateDate(); + // optional int64 selected_at = 23; /** * optional int64 selected_at = 23; */ @@ -2504,6 +2617,7 @@ public final class BatchReport { */ long getSelectedAt(); + // optional string diff_fields = 24; /** * optional string diff_fields = 24; */ @@ -2518,6 +2632,7 @@ public final class BatchReport { com.google.protobuf.ByteString getDiffFieldsBytes(); + // optional bool is_changed = 25; /** * optional bool is_changed = 25; */ @@ -2527,6 +2642,7 @@ public final class BatchReport { */ boolean getIsChanged(); + // optional bool must_send_notification = 26; /** * optional bool must_send_notification = 26; */ @@ -2540,9 +2656,8 @@ public final class BatchReport { * Protobuf type {@code Issue} */ public static final class Issue extends - com.google.protobuf.GeneratedMessage implements - // @@protoc_insertion_point(message_implements:Issue) - IssueOrBuilder { + com.google.protobuf.GeneratedMessage + implements IssueOrBuilder { // Use Issue.newBuilder() to construct. private Issue(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); @@ -2589,15 +2704,13 @@ public final class BatchReport { break; } case 10: { - com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000001; - ruleRepository_ = bs; + ruleRepository_ = input.readBytes(); break; } case 18: { - com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000002; - ruleKey_ = bs; + ruleKey_ = input.readBytes(); break; } case 24: { @@ -2606,9 +2719,8 @@ public final class BatchReport { break; } case 34: { - com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000008; - msg_ = bs; + msg_ = input.readBytes(); break; } case 40: { @@ -2623,12 +2735,11 @@ public final class BatchReport { break; } case 50: { - com.google.protobuf.ByteString bs = input.readBytes(); if (!((mutable_bitField0_ & 0x00000020) == 0x00000020)) { tags_ = new com.google.protobuf.LazyStringArrayList(); mutable_bitField0_ |= 0x00000020; } - tags_.add(bs); + tags_.add(input.readBytes()); break; } case 57: { @@ -2642,9 +2753,8 @@ public final class BatchReport { break; } case 74: { - com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000080; - uuid_ = bs; + uuid_ = input.readBytes(); break; } case 80: { @@ -2653,21 +2763,18 @@ public final class BatchReport { break; } case 90: { - com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000200; - resolution_ = bs; + resolution_ = input.readBytes(); break; } case 98: { - com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000400; - status_ = bs; + status_ = input.readBytes(); break; } case 106: { - com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000800; - checksum_ = bs; + checksum_ = input.readBytes(); break; } case 112: { @@ -2676,33 +2783,28 @@ public final class BatchReport { break; } case 122: { - com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00002000; - reporter_ = bs; + reporter_ = input.readBytes(); break; } case 130: { - com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00004000; - assignee_ = bs; + assignee_ = input.readBytes(); break; } case 138: { - com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00008000; - actionPlanKey_ = bs; + actionPlanKey_ = input.readBytes(); break; } case 146: { - com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00010000; - attributes_ = bs; + attributes_ = input.readBytes(); break; } case 154: { - com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00020000; - authorLogin_ = bs; + authorLogin_ = input.readBytes(); break; } case 160: { @@ -2726,9 +2828,8 @@ public final class BatchReport { break; } case 194: { - com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00400000; - diffFields_ = bs; + diffFields_ = input.readBytes(); break; } case 200: { @@ -2750,7 +2851,7 @@ public final class BatchReport { e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000020) == 0x00000020)) { - tags_ = tags_.getUnmodifiableView(); + tags_ = new com.google.protobuf.UnmodifiableLazyStringList(tags_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); @@ -2784,6 +2885,7 @@ public final class BatchReport { } private int bitField0_; + // optional string rule_repository = 1; public static final int RULE_REPOSITORY_FIELD_NUMBER = 1; private java.lang.Object ruleRepository_; /** @@ -2826,6 +2928,7 @@ public final class BatchReport { } } + // optional string rule_key = 2; public static final int RULE_KEY_FIELD_NUMBER = 2; private java.lang.Object ruleKey_; /** @@ -2868,6 +2971,7 @@ public final class BatchReport { } } + // optional int32 line = 3; public static final int LINE_FIELD_NUMBER = 3; private int line_; /** @@ -2883,6 +2987,7 @@ public final class BatchReport { return line_; } + // optional string msg = 4; public static final int MSG_FIELD_NUMBER = 4; private java.lang.Object msg_; /** @@ -2925,6 +3030,7 @@ public final class BatchReport { } } + // optional .Severity severity = 5; public static final int SEVERITY_FIELD_NUMBER = 5; private org.sonar.batch.protocol.Constants.Severity severity_; /** @@ -2940,12 +3046,13 @@ public final class BatchReport { return severity_; } + // repeated string tags = 6; public static final int TAGS_FIELD_NUMBER = 6; private com.google.protobuf.LazyStringList tags_; /** * repeated string tags = 6; */ - public com.google.protobuf.ProtocolStringList + public java.util.List getTagsList() { return tags_; } @@ -2969,6 +3076,7 @@ public final class BatchReport { return tags_.getByteString(index); } + // optional double effort_to_fix = 7; public static final int EFFORT_TO_FIX_FIELD_NUMBER = 7; private double effortToFix_; /** @@ -2992,6 +3100,7 @@ public final class BatchReport { return effortToFix_; } + // optional bool is_new = 8; public static final int IS_NEW_FIELD_NUMBER = 8; private boolean isNew_; /** @@ -3007,6 +3116,7 @@ public final class BatchReport { return isNew_; } + // optional string uuid = 9; public static final int UUID_FIELD_NUMBER = 9; private java.lang.Object uuid_; /** @@ -3049,6 +3159,7 @@ public final class BatchReport { } } + // optional int64 debt_in_minutes = 10; public static final int DEBT_IN_MINUTES_FIELD_NUMBER = 10; private long debtInMinutes_; /** @@ -3064,6 +3175,7 @@ public final class BatchReport { return debtInMinutes_; } + // optional string resolution = 11; public static final int RESOLUTION_FIELD_NUMBER = 11; private java.lang.Object resolution_; /** @@ -3106,6 +3218,7 @@ public final class BatchReport { } } + // optional string status = 12; public static final int STATUS_FIELD_NUMBER = 12; private java.lang.Object status_; /** @@ -3148,6 +3261,7 @@ public final class BatchReport { } } + // optional string checksum = 13; public static final int CHECKSUM_FIELD_NUMBER = 13; private java.lang.Object checksum_; /** @@ -3190,6 +3304,7 @@ public final class BatchReport { } } + // optional bool manual_severity = 14; public static final int MANUAL_SEVERITY_FIELD_NUMBER = 14; private boolean manualSeverity_; /** @@ -3205,6 +3320,7 @@ public final class BatchReport { return manualSeverity_; } + // optional string reporter = 15; public static final int REPORTER_FIELD_NUMBER = 15; private java.lang.Object reporter_; /** @@ -3247,6 +3363,7 @@ public final class BatchReport { } } + // optional string assignee = 16; public static final int ASSIGNEE_FIELD_NUMBER = 16; private java.lang.Object assignee_; /** @@ -3289,6 +3406,7 @@ public final class BatchReport { } } + // optional string action_plan_key = 17; public static final int ACTION_PLAN_KEY_FIELD_NUMBER = 17; private java.lang.Object actionPlanKey_; /** @@ -3331,6 +3449,7 @@ public final class BatchReport { } } + // optional string attributes = 18; public static final int ATTRIBUTES_FIELD_NUMBER = 18; private java.lang.Object attributes_; /** @@ -3373,6 +3492,7 @@ public final class BatchReport { } } + // optional string author_login = 19; public static final int AUTHOR_LOGIN_FIELD_NUMBER = 19; private java.lang.Object authorLogin_; /** @@ -3415,6 +3535,7 @@ public final class BatchReport { } } + // optional int64 creation_date = 20; public static final int CREATION_DATE_FIELD_NUMBER = 20; private long creationDate_; /** @@ -3430,6 +3551,7 @@ public final class BatchReport { return creationDate_; } + // optional int64 close_date = 21; public static final int CLOSE_DATE_FIELD_NUMBER = 21; private long closeDate_; /** @@ -3445,6 +3567,7 @@ public final class BatchReport { return closeDate_; } + // optional int64 update_date = 22; public static final int UPDATE_DATE_FIELD_NUMBER = 22; private long updateDate_; /** @@ -3460,6 +3583,7 @@ public final class BatchReport { return updateDate_; } + // optional int64 selected_at = 23; public static final int SELECTED_AT_FIELD_NUMBER = 23; private long selectedAt_; /** @@ -3475,6 +3599,7 @@ public final class BatchReport { return selectedAt_; } + // optional string diff_fields = 24; public static final int DIFF_FIELDS_FIELD_NUMBER = 24; private java.lang.Object diffFields_; /** @@ -3517,6 +3642,7 @@ public final class BatchReport { } } + // optional bool is_changed = 25; public static final int IS_CHANGED_FIELD_NUMBER = 25; private boolean isChanged_; /** @@ -3532,6 +3658,7 @@ public final class BatchReport { return isChanged_; } + // optional bool must_send_notification = 26; public static final int MUST_SEND_NOTIFICATION_FIELD_NUMBER = 26; private boolean mustSendNotification_; /** @@ -3578,8 +3705,7 @@ public final class BatchReport { private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; + if (isInitialized != -1) return isInitialized == 1; memoizedIsInitialized = 1; return true; @@ -3866,9 +3992,8 @@ public final class BatchReport { * Protobuf type {@code Issue} */ public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder implements - // @@protoc_insertion_point(builder_implements:Issue) - org.sonar.batch.protocol.output.BatchReport.IssueOrBuilder { + com.google.protobuf.GeneratedMessage.Builder + implements org.sonar.batch.protocol.output.BatchReport.IssueOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.sonar.batch.protocol.output.BatchReport.internal_static_Issue_descriptor; @@ -4002,7 +4127,8 @@ public final class BatchReport { } result.severity_ = severity_; if (((bitField0_ & 0x00000020) == 0x00000020)) { - tags_ = tags_.getUnmodifiableView(); + tags_ = new com.google.protobuf.UnmodifiableLazyStringList( + tags_); bitField0_ = (bitField0_ & ~0x00000020); } result.tags_ = tags_; @@ -4240,6 +4366,7 @@ public final class BatchReport { } private int bitField0_; + // optional string rule_repository = 1; private java.lang.Object ruleRepository_ = ""; /** * optional string rule_repository = 1; @@ -4253,12 +4380,9 @@ public final class BatchReport { public java.lang.String getRuleRepository() { java.lang.Object ref = ruleRepository_; if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - ruleRepository_ = s; - } + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + ruleRepository_ = s; return s; } else { return (java.lang.String) ref; @@ -4316,6 +4440,7 @@ public final class BatchReport { return this; } + // optional string rule_key = 2; private java.lang.Object ruleKey_ = ""; /** * optional string rule_key = 2; @@ -4329,12 +4454,9 @@ public final class BatchReport { public java.lang.String getRuleKey() { java.lang.Object ref = ruleKey_; if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - ruleKey_ = s; - } + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + ruleKey_ = s; return s; } else { return (java.lang.String) ref; @@ -4392,6 +4514,7 @@ public final class BatchReport { return this; } + // optional int32 line = 3; private int line_ ; /** * optional int32 line = 3; @@ -4424,6 +4547,7 @@ public final class BatchReport { return this; } + // optional string msg = 4; private java.lang.Object msg_ = ""; /** * optional string msg = 4; @@ -4437,12 +4561,9 @@ public final class BatchReport { public java.lang.String getMsg() { java.lang.Object ref = msg_; if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - msg_ = s; - } + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + msg_ = s; return s; } else { return (java.lang.String) ref; @@ -4500,6 +4621,7 @@ public final class BatchReport { return this; } + // optional .Severity severity = 5; private org.sonar.batch.protocol.Constants.Severity severity_ = org.sonar.batch.protocol.Constants.Severity.INFO; /** * optional .Severity severity = 5; @@ -4535,6 +4657,7 @@ public final class BatchReport { return this; } + // repeated string tags = 6; private com.google.protobuf.LazyStringList tags_ = com.google.protobuf.LazyStringArrayList.EMPTY; private void ensureTagsIsMutable() { if (!((bitField0_ & 0x00000020) == 0x00000020)) { @@ -4545,9 +4668,9 @@ public final class BatchReport { /** * repeated string tags = 6; */ - public com.google.protobuf.ProtocolStringList + public java.util.List getTagsList() { - return tags_.getUnmodifiableView(); + return java.util.Collections.unmodifiableList(tags_); } /** * repeated string tags = 6; @@ -4600,8 +4723,7 @@ public final class BatchReport { public Builder addAllTags( java.lang.Iterable values) { ensureTagsIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, tags_); + super.addAll(values, tags_); onChanged(); return this; } @@ -4628,6 +4750,7 @@ public final class BatchReport { return this; } + // optional double effort_to_fix = 7; private double effortToFix_ ; /** * optional double effort_to_fix = 7; @@ -4676,6 +4799,7 @@ public final class BatchReport { return this; } + // optional bool is_new = 8; private boolean isNew_ ; /** * optional bool is_new = 8; @@ -4708,6 +4832,7 @@ public final class BatchReport { return this; } + // optional string uuid = 9; private java.lang.Object uuid_ = ""; /** * optional string uuid = 9; @@ -4721,12 +4846,9 @@ public final class BatchReport { public java.lang.String getUuid() { java.lang.Object ref = uuid_; if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - uuid_ = s; - } + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + uuid_ = s; return s; } else { return (java.lang.String) ref; @@ -4784,6 +4906,7 @@ public final class BatchReport { return this; } + // optional int64 debt_in_minutes = 10; private long debtInMinutes_ ; /** * optional int64 debt_in_minutes = 10; @@ -4816,6 +4939,7 @@ public final class BatchReport { return this; } + // optional string resolution = 11; private java.lang.Object resolution_ = ""; /** * optional string resolution = 11; @@ -4829,12 +4953,9 @@ public final class BatchReport { public java.lang.String getResolution() { java.lang.Object ref = resolution_; if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - resolution_ = s; - } + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + resolution_ = s; return s; } else { return (java.lang.String) ref; @@ -4892,6 +5013,7 @@ public final class BatchReport { return this; } + // optional string status = 12; private java.lang.Object status_ = ""; /** * optional string status = 12; @@ -4905,12 +5027,9 @@ public final class BatchReport { public java.lang.String getStatus() { java.lang.Object ref = status_; if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - status_ = s; - } + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + status_ = s; return s; } else { return (java.lang.String) ref; @@ -4968,6 +5087,7 @@ public final class BatchReport { return this; } + // optional string checksum = 13; private java.lang.Object checksum_ = ""; /** * optional string checksum = 13; @@ -4981,12 +5101,9 @@ public final class BatchReport { public java.lang.String getChecksum() { java.lang.Object ref = checksum_; if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - checksum_ = s; - } + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + checksum_ = s; return s; } else { return (java.lang.String) ref; @@ -5044,6 +5161,7 @@ public final class BatchReport { return this; } + // optional bool manual_severity = 14; private boolean manualSeverity_ ; /** * optional bool manual_severity = 14; @@ -5076,6 +5194,7 @@ public final class BatchReport { return this; } + // optional string reporter = 15; private java.lang.Object reporter_ = ""; /** * optional string reporter = 15; @@ -5089,12 +5208,9 @@ public final class BatchReport { public java.lang.String getReporter() { java.lang.Object ref = reporter_; if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - reporter_ = s; - } + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + reporter_ = s; return s; } else { return (java.lang.String) ref; @@ -5152,6 +5268,7 @@ public final class BatchReport { return this; } + // optional string assignee = 16; private java.lang.Object assignee_ = ""; /** * optional string assignee = 16; @@ -5165,12 +5282,9 @@ public final class BatchReport { public java.lang.String getAssignee() { java.lang.Object ref = assignee_; if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - assignee_ = s; - } + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + assignee_ = s; return s; } else { return (java.lang.String) ref; @@ -5228,6 +5342,7 @@ public final class BatchReport { return this; } + // optional string action_plan_key = 17; private java.lang.Object actionPlanKey_ = ""; /** * optional string action_plan_key = 17; @@ -5241,12 +5356,9 @@ public final class BatchReport { public java.lang.String getActionPlanKey() { java.lang.Object ref = actionPlanKey_; if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - actionPlanKey_ = s; - } + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + actionPlanKey_ = s; return s; } else { return (java.lang.String) ref; @@ -5304,6 +5416,7 @@ public final class BatchReport { return this; } + // optional string attributes = 18; private java.lang.Object attributes_ = ""; /** * optional string attributes = 18; @@ -5317,12 +5430,9 @@ public final class BatchReport { public java.lang.String getAttributes() { java.lang.Object ref = attributes_; if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - attributes_ = s; - } + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + attributes_ = s; return s; } else { return (java.lang.String) ref; @@ -5380,6 +5490,7 @@ public final class BatchReport { return this; } + // optional string author_login = 19; private java.lang.Object authorLogin_ = ""; /** * optional string author_login = 19; @@ -5393,12 +5504,9 @@ public final class BatchReport { public java.lang.String getAuthorLogin() { java.lang.Object ref = authorLogin_; if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - authorLogin_ = s; - } + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + authorLogin_ = s; return s; } else { return (java.lang.String) ref; @@ -5456,6 +5564,7 @@ public final class BatchReport { return this; } + // optional int64 creation_date = 20; private long creationDate_ ; /** * optional int64 creation_date = 20; @@ -5488,6 +5597,7 @@ public final class BatchReport { return this; } + // optional int64 close_date = 21; private long closeDate_ ; /** * optional int64 close_date = 21; @@ -5520,6 +5630,7 @@ public final class BatchReport { return this; } + // optional int64 update_date = 22; private long updateDate_ ; /** * optional int64 update_date = 22; @@ -5552,6 +5663,7 @@ public final class BatchReport { return this; } + // optional int64 selected_at = 23; private long selectedAt_ ; /** * optional int64 selected_at = 23; @@ -5584,6 +5696,7 @@ public final class BatchReport { return this; } + // optional string diff_fields = 24; private java.lang.Object diffFields_ = ""; /** * optional string diff_fields = 24; @@ -5597,12 +5710,9 @@ public final class BatchReport { public java.lang.String getDiffFields() { java.lang.Object ref = diffFields_; if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - diffFields_ = s; - } + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + diffFields_ = s; return s; } else { return (java.lang.String) ref; @@ -5660,6 +5770,7 @@ public final class BatchReport { return this; } + // optional bool is_changed = 25; private boolean isChanged_ ; /** * optional bool is_changed = 25; @@ -5692,6 +5803,7 @@ public final class BatchReport { return this; } + // optional bool must_send_notification = 26; private boolean mustSendNotification_ ; /** * optional bool must_send_notification = 26; @@ -5735,10 +5847,10 @@ public final class BatchReport { // @@protoc_insertion_point(class_scope:Issue) } - public interface IssuesOrBuilder extends - // @@protoc_insertion_point(interface_extends:Issues) - com.google.protobuf.MessageOrBuilder { + public interface IssuesOrBuilder + extends com.google.protobuf.MessageOrBuilder { + // optional int32 component_ref = 1; /** * optional int32 component_ref = 1; */ @@ -5748,6 +5860,7 @@ public final class BatchReport { */ int getComponentRef(); + // repeated .Issue list = 2; /** * repeated .Issue list = 2; */ @@ -5771,14 +5884,40 @@ public final class BatchReport { */ org.sonar.batch.protocol.output.BatchReport.IssueOrBuilder getListOrBuilder( int index); + + // optional string component_uuid = 3; + /** + * optional string component_uuid = 3; + * + *
+     * Temporary field for issues on deleted components
+     * 
+ */ + boolean hasComponentUuid(); + /** + * optional string component_uuid = 3; + * + *
+     * Temporary field for issues on deleted components
+     * 
+ */ + java.lang.String getComponentUuid(); + /** + * optional string component_uuid = 3; + * + *
+     * Temporary field for issues on deleted components
+     * 
+ */ + com.google.protobuf.ByteString + getComponentUuidBytes(); } /** * Protobuf type {@code Issues} */ public static final class Issues extends - com.google.protobuf.GeneratedMessage implements - // @@protoc_insertion_point(message_implements:Issues) - IssuesOrBuilder { + com.google.protobuf.GeneratedMessage + implements IssuesOrBuilder { // Use Issues.newBuilder() to construct. private Issues(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); @@ -5837,6 +5976,11 @@ public final class BatchReport { list_.add(input.readMessage(org.sonar.batch.protocol.output.BatchReport.Issue.PARSER, extensionRegistry)); break; } + case 26: { + bitField0_ |= 0x00000002; + componentUuid_ = input.readBytes(); + break; + } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { @@ -5880,6 +6024,7 @@ public final class BatchReport { } private int bitField0_; + // optional int32 component_ref = 1; public static final int COMPONENT_REF_FIELD_NUMBER = 1; private int componentRef_; /** @@ -5895,6 +6040,7 @@ public final class BatchReport { return componentRef_; } + // repeated .Issue list = 2; public static final int LIST_FIELD_NUMBER = 2; private java.util.List list_; /** @@ -5930,15 +6076,70 @@ public final class BatchReport { return list_.get(index); } + // optional string component_uuid = 3; + public static final int COMPONENT_UUID_FIELD_NUMBER = 3; + private java.lang.Object componentUuid_; + /** + * optional string component_uuid = 3; + * + *
+     * Temporary field for issues on deleted components
+     * 
+ */ + public boolean hasComponentUuid() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + /** + * optional string component_uuid = 3; + * + *
+     * Temporary field for issues on deleted components
+     * 
+ */ + public java.lang.String getComponentUuid() { + java.lang.Object ref = componentUuid_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + if (bs.isValidUtf8()) { + componentUuid_ = s; + } + return s; + } + } + /** + * optional string component_uuid = 3; + * + *
+     * Temporary field for issues on deleted components
+     * 
+ */ + public com.google.protobuf.ByteString + getComponentUuidBytes() { + java.lang.Object ref = componentUuid_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + componentUuid_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + private void initFields() { componentRef_ = 0; list_ = java.util.Collections.emptyList(); + componentUuid_ = ""; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; + if (isInitialized != -1) return isInitialized == 1; memoizedIsInitialized = 1; return true; @@ -5953,6 +6154,9 @@ public final class BatchReport { for (int i = 0; i < list_.size(); i++) { output.writeMessage(2, list_.get(i)); } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(3, getComponentUuidBytes()); + } getUnknownFields().writeTo(output); } @@ -5970,6 +6174,10 @@ public final class BatchReport { size += com.google.protobuf.CodedOutputStream .computeMessageSize(2, list_.get(i)); } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, getComponentUuidBytes()); + } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; @@ -6052,9 +6260,8 @@ public final class BatchReport { * Protobuf type {@code Issues} */ public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder implements - // @@protoc_insertion_point(builder_implements:Issues) - org.sonar.batch.protocol.output.BatchReport.IssuesOrBuilder { + com.google.protobuf.GeneratedMessage.Builder + implements org.sonar.batch.protocol.output.BatchReport.IssuesOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.sonar.batch.protocol.output.BatchReport.internal_static_Issues_descriptor; @@ -6096,6 +6303,8 @@ public final class BatchReport { } else { listBuilder_.clear(); } + componentUuid_ = ""; + bitField0_ = (bitField0_ & ~0x00000004); return this; } @@ -6137,6 +6346,10 @@ public final class BatchReport { } else { result.list_ = listBuilder_.build(); } + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000002; + } + result.componentUuid_ = componentUuid_; result.bitField0_ = to_bitField0_; onBuilt(); return result; @@ -6182,6 +6395,11 @@ public final class BatchReport { } } } + if (other.hasComponentUuid()) { + bitField0_ |= 0x00000004; + componentUuid_ = other.componentUuid_; + onChanged(); + } this.mergeUnknownFields(other.getUnknownFields()); return this; } @@ -6209,6 +6427,7 @@ public final class BatchReport { } private int bitField0_; + // optional int32 component_ref = 1; private int componentRef_ ; /** * optional int32 component_ref = 1; @@ -6241,6 +6460,7 @@ public final class BatchReport { return this; } + // repeated .Issue list = 2; private java.util.List list_ = java.util.Collections.emptyList(); private void ensureListIsMutable() { @@ -6382,8 +6602,7 @@ public final class BatchReport { java.lang.Iterable values) { if (listBuilder_ == null) { ensureListIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, list_); + super.addAll(values, list_); onChanged(); } else { listBuilder_.addAllMessages(values); @@ -6481,6 +6700,104 @@ public final class BatchReport { return listBuilder_; } + // optional string component_uuid = 3; + private java.lang.Object componentUuid_ = ""; + /** + * optional string component_uuid = 3; + * + *
+       * Temporary field for issues on deleted components
+       * 
+ */ + public boolean hasComponentUuid() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * optional string component_uuid = 3; + * + *
+       * Temporary field for issues on deleted components
+       * 
+ */ + public java.lang.String getComponentUuid() { + java.lang.Object ref = componentUuid_; + if (!(ref instanceof java.lang.String)) { + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + componentUuid_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * optional string component_uuid = 3; + * + *
+       * Temporary field for issues on deleted components
+       * 
+ */ + public com.google.protobuf.ByteString + getComponentUuidBytes() { + java.lang.Object ref = componentUuid_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + componentUuid_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * optional string component_uuid = 3; + * + *
+       * Temporary field for issues on deleted components
+       * 
+ */ + public Builder setComponentUuid( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + componentUuid_ = value; + onChanged(); + return this; + } + /** + * optional string component_uuid = 3; + * + *
+       * Temporary field for issues on deleted components
+       * 
+ */ + public Builder clearComponentUuid() { + bitField0_ = (bitField0_ & ~0x00000004); + componentUuid_ = getDefaultInstance().getComponentUuid(); + onChanged(); + return this; + } + /** + * optional string component_uuid = 3; + * + *
+       * Temporary field for issues on deleted components
+       * 
+ */ + public Builder setComponentUuidBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + componentUuid_ = value; + onChanged(); + return this; + } + // @@protoc_insertion_point(builder_scope:Issues) } @@ -6492,22 +6809,22 @@ public final class BatchReport { // @@protoc_insertion_point(class_scope:Issues) } - private static final com.google.protobuf.Descriptors.Descriptor + private static com.google.protobuf.Descriptors.Descriptor internal_static_Metadata_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_Metadata_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor + private static com.google.protobuf.Descriptors.Descriptor internal_static_Component_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_Component_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor + private static com.google.protobuf.Descriptors.Descriptor internal_static_Issue_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_Issue_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor + private static com.google.protobuf.Descriptors.Descriptor internal_static_Issues_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable @@ -6521,69 +6838,70 @@ public final class BatchReport { descriptor; static { java.lang.String[] descriptorData = { - "\n\022batch_report.proto\032\017constants.proto\"g\n" + - "\010Metadata\022\025\n\ranalysis_date\030\001 \001(\003\022\023\n\013proj" + - "ect_key\030\002 \001(\t\022\032\n\022root_component_ref\030\003 \001(" + - "\005\022\023\n\013snapshot_id\030\004 \001(\003\"\260\001\n\tComponent\022\013\n\003" + - "ref\030\001 \001(\005\022\014\n\004path\030\002 \001(\t\022\014\n\004name\030\003 \001(\t\022\034\n" + - "\004type\030\004 \001(\0162\016.ComponentType\022\017\n\007is_test\030\005" + - " \001(\010\022\020\n\010language\030\006 \001(\t\022\026\n\nchild_refs\030\007 \003" + - "(\005B\002\020\001\022\023\n\013snapshot_id\030\010 \001(\005\022\014\n\004uuid\030\t \001(" + - "\t\"\232\004\n\005Issue\022\027\n\017rule_repository\030\001 \001(\t\022\020\n\010" + - "rule_key\030\002 \001(\t\022\014\n\004line\030\003 \001(\005\022\013\n\003msg\030\004 \001(", - "\t\022\033\n\010severity\030\005 \001(\0162\t.Severity\022\014\n\004tags\030\006" + - " \003(\t\022\025\n\reffort_to_fix\030\007 \001(\001\022\016\n\006is_new\030\010 " + - "\001(\010\022\014\n\004uuid\030\t \001(\t\022\027\n\017debt_in_minutes\030\n \001" + - "(\003\022\022\n\nresolution\030\013 \001(\t\022\016\n\006status\030\014 \001(\t\022\020" + - "\n\010checksum\030\r \001(\t\022\027\n\017manual_severity\030\016 \001(" + - "\010\022\020\n\010reporter\030\017 \001(\t\022\020\n\010assignee\030\020 \001(\t\022\027\n" + - "\017action_plan_key\030\021 \001(\t\022\022\n\nattributes\030\022 \001" + - "(\t\022\024\n\014author_login\030\023 \001(\t\022\025\n\rcreation_dat" + - "e\030\024 \001(\003\022\022\n\nclose_date\030\025 \001(\003\022\023\n\013update_da" + - "te\030\026 \001(\003\022\023\n\013selected_at\030\027 \001(\003\022\023\n\013diff_fi", - "elds\030\030 \001(\t\022\022\n\nis_changed\030\031 \001(\010\022\036\n\026must_s" + - "end_notification\030\032 \001(\010\"5\n\006Issues\022\025\n\rcomp" + - "onent_ref\030\001 \001(\005\022\024\n\004list\030\002 \003(\0132\006.IssueB#\n" + - "\037org.sonar.batch.protocol.outputH\001" + "\n\022batch_report.proto\032\017constants.proto\"\211\001" + + "\n\010Metadata\022\025\n\ranalysis_date\030\001 \001(\003\022\023\n\013pro" + + "ject_key\030\002 \001(\t\022\032\n\022root_component_ref\030\003 \001" + + "(\005\022\023\n\013snapshot_id\030\004 \001(\003\022 \n\030deleted_compo" + + "nents_count\030\005 \001(\005\"\260\001\n\tComponent\022\013\n\003ref\030\001" + + " \001(\005\022\014\n\004path\030\002 \001(\t\022\014\n\004name\030\003 \001(\t\022\034\n\004type" + + "\030\004 \001(\0162\016.ComponentType\022\017\n\007is_test\030\005 \001(\010\022" + + "\020\n\010language\030\006 \001(\t\022\026\n\nchild_refs\030\007 \003(\005B\002\020" + + "\001\022\023\n\013snapshot_id\030\010 \001(\005\022\014\n\004uuid\030\t \001(\t\"\232\004\n" + + "\005Issue\022\027\n\017rule_repository\030\001 \001(\t\022\020\n\010rule_", + "key\030\002 \001(\t\022\014\n\004line\030\003 \001(\005\022\013\n\003msg\030\004 \001(\t\022\033\n\010" + + "severity\030\005 \001(\0162\t.Severity\022\014\n\004tags\030\006 \003(\t\022" + + "\025\n\reffort_to_fix\030\007 \001(\001\022\016\n\006is_new\030\010 \001(\010\022\014" + + "\n\004uuid\030\t \001(\t\022\027\n\017debt_in_minutes\030\n \001(\003\022\022\n" + + "\nresolution\030\013 \001(\t\022\016\n\006status\030\014 \001(\t\022\020\n\010che" + + "cksum\030\r \001(\t\022\027\n\017manual_severity\030\016 \001(\010\022\020\n\010" + + "reporter\030\017 \001(\t\022\020\n\010assignee\030\020 \001(\t\022\027\n\017acti" + + "on_plan_key\030\021 \001(\t\022\022\n\nattributes\030\022 \001(\t\022\024\n" + + "\014author_login\030\023 \001(\t\022\025\n\rcreation_date\030\024 \001" + + "(\003\022\022\n\nclose_date\030\025 \001(\003\022\023\n\013update_date\030\026 ", + "\001(\003\022\023\n\013selected_at\030\027 \001(\003\022\023\n\013diff_fields\030" + + "\030 \001(\t\022\022\n\nis_changed\030\031 \001(\010\022\036\n\026must_send_n" + + "otification\030\032 \001(\010\"M\n\006Issues\022\025\n\rcomponent" + + "_ref\030\001 \001(\005\022\024\n\004list\030\002 \003(\0132\006.Issue\022\026\n\016comp" + + "onent_uuid\030\003 \001(\tB#\n\037org.sonar.batch.prot" + + "ocol.outputH\001" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = - new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { - public com.google.protobuf.ExtensionRegistry assignDescriptors( - com.google.protobuf.Descriptors.FileDescriptor root) { - descriptor = root; - return null; - } - }; + new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { + public com.google.protobuf.ExtensionRegistry assignDescriptors( + com.google.protobuf.Descriptors.FileDescriptor root) { + descriptor = root; + internal_static_Metadata_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_Metadata_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_Metadata_descriptor, + new java.lang.String[] { "AnalysisDate", "ProjectKey", "RootComponentRef", "SnapshotId", "DeletedComponentsCount", }); + internal_static_Component_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_Component_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_Component_descriptor, + new java.lang.String[] { "Ref", "Path", "Name", "Type", "IsTest", "Language", "ChildRefs", "SnapshotId", "Uuid", }); + internal_static_Issue_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_Issue_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_Issue_descriptor, + new java.lang.String[] { "RuleRepository", "RuleKey", "Line", "Msg", "Severity", "Tags", "EffortToFix", "IsNew", "Uuid", "DebtInMinutes", "Resolution", "Status", "Checksum", "ManualSeverity", "Reporter", "Assignee", "ActionPlanKey", "Attributes", "AuthorLogin", "CreationDate", "CloseDate", "UpdateDate", "SelectedAt", "DiffFields", "IsChanged", "MustSendNotification", }); + internal_static_Issues_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_Issues_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_Issues_descriptor, + new java.lang.String[] { "ComponentRef", "List", "ComponentUuid", }); + return null; + } + }; com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { org.sonar.batch.protocol.Constants.getDescriptor(), }, assigner); - internal_static_Metadata_descriptor = - getDescriptor().getMessageTypes().get(0); - internal_static_Metadata_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_Metadata_descriptor, - new java.lang.String[] { "AnalysisDate", "ProjectKey", "RootComponentRef", "SnapshotId", }); - internal_static_Component_descriptor = - getDescriptor().getMessageTypes().get(1); - internal_static_Component_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_Component_descriptor, - new java.lang.String[] { "Ref", "Path", "Name", "Type", "IsTest", "Language", "ChildRefs", "SnapshotId", "Uuid", }); - internal_static_Issue_descriptor = - getDescriptor().getMessageTypes().get(2); - internal_static_Issue_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_Issue_descriptor, - new java.lang.String[] { "RuleRepository", "RuleKey", "Line", "Msg", "Severity", "Tags", "EffortToFix", "IsNew", "Uuid", "DebtInMinutes", "Resolution", "Status", "Checksum", "ManualSeverity", "Reporter", "Assignee", "ActionPlanKey", "Attributes", "AuthorLogin", "CreationDate", "CloseDate", "UpdateDate", "SelectedAt", "DiffFields", "IsChanged", "MustSendNotification", }); - internal_static_Issues_descriptor = - getDescriptor().getMessageTypes().get(3); - internal_static_Issues_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_Issues_descriptor, - new java.lang.String[] { "ComponentRef", "List", }); - org.sonar.batch.protocol.Constants.getDescriptor(); } // @@protoc_insertion_point(outer_class_scope) diff --git a/sonar-batch-protocol/src/main/gen-java/org/sonar/server/source/db/FileSourceDb.java b/sonar-batch-protocol/src/main/gen-java/org/sonar/server/source/db/FileSourceDb.java index a1b40ec8fbf..523344bac28 100644 --- a/sonar-batch-protocol/src/main/gen-java/org/sonar/server/source/db/FileSourceDb.java +++ b/sonar-batch-protocol/src/main/gen-java/org/sonar/server/source/db/FileSourceDb.java @@ -8,10 +8,10 @@ public final class FileSourceDb { public static void registerAllExtensions( com.google.protobuf.ExtensionRegistry registry) { } - public interface LineOrBuilder extends - // @@protoc_insertion_point(interface_extends:org.sonar.server.source.db.Line) - com.google.protobuf.MessageOrBuilder { + public interface LineOrBuilder + extends com.google.protobuf.MessageOrBuilder { + // optional int32 line = 1; /** * optional int32 line = 1; */ @@ -21,6 +21,7 @@ public final class FileSourceDb { */ int getLine(); + // optional string source = 2; /** * optional string source = 2; */ @@ -35,6 +36,7 @@ public final class FileSourceDb { com.google.protobuf.ByteString getSourceBytes(); + // optional string scm_revision = 3; /** * optional string scm_revision = 3; * @@ -61,6 +63,7 @@ public final class FileSourceDb { com.google.protobuf.ByteString getScmRevisionBytes(); + // optional string scm_author = 4; /** * optional string scm_author = 4; */ @@ -75,6 +78,7 @@ public final class FileSourceDb { com.google.protobuf.ByteString getScmAuthorBytes(); + // optional int64 scm_date = 5; /** * optional int64 scm_date = 5; */ @@ -84,6 +88,7 @@ public final class FileSourceDb { */ long getScmDate(); + // optional int32 ut_line_hits = 6; /** * optional int32 ut_line_hits = 6; * @@ -101,6 +106,7 @@ public final class FileSourceDb { */ int getUtLineHits(); + // optional int32 ut_conditions = 7; /** * optional int32 ut_conditions = 7; */ @@ -110,6 +116,7 @@ public final class FileSourceDb { */ int getUtConditions(); + // optional int32 ut_covered_conditions = 8; /** * optional int32 ut_covered_conditions = 8; */ @@ -119,6 +126,7 @@ public final class FileSourceDb { */ int getUtCoveredConditions(); + // optional int32 it_line_hits = 9; /** * optional int32 it_line_hits = 9; * @@ -136,6 +144,7 @@ public final class FileSourceDb { */ int getItLineHits(); + // optional int32 it_conditions = 10; /** * optional int32 it_conditions = 10; */ @@ -145,6 +154,7 @@ public final class FileSourceDb { */ int getItConditions(); + // optional int32 it_covered_conditions = 11; /** * optional int32 it_covered_conditions = 11; */ @@ -154,6 +164,7 @@ public final class FileSourceDb { */ int getItCoveredConditions(); + // optional int32 overall_line_hits = 12; /** * optional int32 overall_line_hits = 12; * @@ -171,6 +182,7 @@ public final class FileSourceDb { */ int getOverallLineHits(); + // optional int32 overall_conditions = 13; /** * optional int32 overall_conditions = 13; */ @@ -180,6 +192,7 @@ public final class FileSourceDb { */ int getOverallConditions(); + // optional int32 overall_covered_conditions = 14; /** * optional int32 overall_covered_conditions = 14; */ @@ -189,6 +202,7 @@ public final class FileSourceDb { */ int getOverallCoveredConditions(); + // optional string highlighting = 15; /** * optional string highlighting = 15; */ @@ -203,6 +217,7 @@ public final class FileSourceDb { com.google.protobuf.ByteString getHighlightingBytes(); + // optional string symbols = 16; /** * optional string symbols = 16; */ @@ -217,6 +232,7 @@ public final class FileSourceDb { com.google.protobuf.ByteString getSymbolsBytes(); + // repeated int32 duplications = 17 [packed = true]; /** * repeated int32 duplications = 17 [packed = true]; */ @@ -234,9 +250,8 @@ public final class FileSourceDb { * Protobuf type {@code org.sonar.server.source.db.Line} */ public static final class Line extends - com.google.protobuf.GeneratedMessage implements - // @@protoc_insertion_point(message_implements:org.sonar.server.source.db.Line) - LineOrBuilder { + com.google.protobuf.GeneratedMessage + implements LineOrBuilder { // Use Line.newBuilder() to construct. private Line(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); @@ -288,21 +303,18 @@ public final class FileSourceDb { break; } case 18: { - com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000002; - source_ = bs; + source_ = input.readBytes(); break; } case 26: { - com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000004; - scmRevision_ = bs; + scmRevision_ = input.readBytes(); break; } case 34: { - com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00000008; - scmAuthor_ = bs; + scmAuthor_ = input.readBytes(); break; } case 40: { @@ -356,15 +368,13 @@ public final class FileSourceDb { break; } case 122: { - com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00004000; - highlighting_ = bs; + highlighting_ = input.readBytes(); break; } case 130: { - com.google.protobuf.ByteString bs = input.readBytes(); bitField0_ |= 0x00008000; - symbols_ = bs; + symbols_ = input.readBytes(); break; } case 136: { @@ -431,6 +441,7 @@ public final class FileSourceDb { } private int bitField0_; + // optional int32 line = 1; public static final int LINE_FIELD_NUMBER = 1; private int line_; /** @@ -446,6 +457,7 @@ public final class FileSourceDb { return line_; } + // optional string source = 2; public static final int SOURCE_FIELD_NUMBER = 2; private java.lang.Object source_; /** @@ -488,6 +500,7 @@ public final class FileSourceDb { } } + // optional string scm_revision = 3; public static final int SCM_REVISION_FIELD_NUMBER = 3; private java.lang.Object scmRevision_; /** @@ -542,6 +555,7 @@ public final class FileSourceDb { } } + // optional string scm_author = 4; public static final int SCM_AUTHOR_FIELD_NUMBER = 4; private java.lang.Object scmAuthor_; /** @@ -584,6 +598,7 @@ public final class FileSourceDb { } } + // optional int64 scm_date = 5; public static final int SCM_DATE_FIELD_NUMBER = 5; private long scmDate_; /** @@ -599,6 +614,7 @@ public final class FileSourceDb { return scmDate_; } + // optional int32 ut_line_hits = 6; public static final int UT_LINE_HITS_FIELD_NUMBER = 6; private int utLineHits_; /** @@ -622,6 +638,7 @@ public final class FileSourceDb { return utLineHits_; } + // optional int32 ut_conditions = 7; public static final int UT_CONDITIONS_FIELD_NUMBER = 7; private int utConditions_; /** @@ -637,6 +654,7 @@ public final class FileSourceDb { return utConditions_; } + // optional int32 ut_covered_conditions = 8; public static final int UT_COVERED_CONDITIONS_FIELD_NUMBER = 8; private int utCoveredConditions_; /** @@ -652,6 +670,7 @@ public final class FileSourceDb { return utCoveredConditions_; } + // optional int32 it_line_hits = 9; public static final int IT_LINE_HITS_FIELD_NUMBER = 9; private int itLineHits_; /** @@ -675,6 +694,7 @@ public final class FileSourceDb { return itLineHits_; } + // optional int32 it_conditions = 10; public static final int IT_CONDITIONS_FIELD_NUMBER = 10; private int itConditions_; /** @@ -690,6 +710,7 @@ public final class FileSourceDb { return itConditions_; } + // optional int32 it_covered_conditions = 11; public static final int IT_COVERED_CONDITIONS_FIELD_NUMBER = 11; private int itCoveredConditions_; /** @@ -705,6 +726,7 @@ public final class FileSourceDb { return itCoveredConditions_; } + // optional int32 overall_line_hits = 12; public static final int OVERALL_LINE_HITS_FIELD_NUMBER = 12; private int overallLineHits_; /** @@ -728,6 +750,7 @@ public final class FileSourceDb { return overallLineHits_; } + // optional int32 overall_conditions = 13; public static final int OVERALL_CONDITIONS_FIELD_NUMBER = 13; private int overallConditions_; /** @@ -743,6 +766,7 @@ public final class FileSourceDb { return overallConditions_; } + // optional int32 overall_covered_conditions = 14; public static final int OVERALL_COVERED_CONDITIONS_FIELD_NUMBER = 14; private int overallCoveredConditions_; /** @@ -758,6 +782,7 @@ public final class FileSourceDb { return overallCoveredConditions_; } + // optional string highlighting = 15; public static final int HIGHLIGHTING_FIELD_NUMBER = 15; private java.lang.Object highlighting_; /** @@ -800,6 +825,7 @@ public final class FileSourceDb { } } + // optional string symbols = 16; public static final int SYMBOLS_FIELD_NUMBER = 16; private java.lang.Object symbols_; /** @@ -842,6 +868,7 @@ public final class FileSourceDb { } } + // repeated int32 duplications = 17 [packed = true]; public static final int DUPLICATIONS_FIELD_NUMBER = 17; private java.util.List duplications_; /** @@ -887,8 +914,7 @@ public final class FileSourceDb { private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; + if (isInitialized != -1) return isInitialized == 1; memoizedIsInitialized = 1; return true; @@ -1121,9 +1147,8 @@ public final class FileSourceDb { * Protobuf type {@code org.sonar.server.source.db.Line} */ public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder implements - // @@protoc_insertion_point(builder_implements:org.sonar.server.source.db.Line) - org.sonar.server.source.db.FileSourceDb.LineOrBuilder { + com.google.protobuf.GeneratedMessage.Builder + implements org.sonar.server.source.db.FileSourceDb.LineOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.sonar.server.source.db.FileSourceDb.internal_static_org_sonar_server_source_db_Line_descriptor; @@ -1398,6 +1423,7 @@ public final class FileSourceDb { } private int bitField0_; + // optional int32 line = 1; private int line_ ; /** * optional int32 line = 1; @@ -1430,6 +1456,7 @@ public final class FileSourceDb { return this; } + // optional string source = 2; private java.lang.Object source_ = ""; /** * optional string source = 2; @@ -1443,12 +1470,9 @@ public final class FileSourceDb { public java.lang.String getSource() { java.lang.Object ref = source_; if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - source_ = s; - } + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + source_ = s; return s; } else { return (java.lang.String) ref; @@ -1506,6 +1530,7 @@ public final class FileSourceDb { return this; } + // optional string scm_revision = 3; private java.lang.Object scmRevision_ = ""; /** * optional string scm_revision = 3; @@ -1527,12 +1552,9 @@ public final class FileSourceDb { public java.lang.String getScmRevision() { java.lang.Object ref = scmRevision_; if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - scmRevision_ = s; - } + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + scmRevision_ = s; return s; } else { return (java.lang.String) ref; @@ -1606,6 +1628,7 @@ public final class FileSourceDb { return this; } + // optional string scm_author = 4; private java.lang.Object scmAuthor_ = ""; /** * optional string scm_author = 4; @@ -1619,12 +1642,9 @@ public final class FileSourceDb { public java.lang.String getScmAuthor() { java.lang.Object ref = scmAuthor_; if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - scmAuthor_ = s; - } + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + scmAuthor_ = s; return s; } else { return (java.lang.String) ref; @@ -1682,6 +1702,7 @@ public final class FileSourceDb { return this; } + // optional int64 scm_date = 5; private long scmDate_ ; /** * optional int64 scm_date = 5; @@ -1714,6 +1735,7 @@ public final class FileSourceDb { return this; } + // optional int32 ut_line_hits = 6; private int utLineHits_ ; /** * optional int32 ut_line_hits = 6; @@ -1762,6 +1784,7 @@ public final class FileSourceDb { return this; } + // optional int32 ut_conditions = 7; private int utConditions_ ; /** * optional int32 ut_conditions = 7; @@ -1794,6 +1817,7 @@ public final class FileSourceDb { return this; } + // optional int32 ut_covered_conditions = 8; private int utCoveredConditions_ ; /** * optional int32 ut_covered_conditions = 8; @@ -1826,6 +1850,7 @@ public final class FileSourceDb { return this; } + // optional int32 it_line_hits = 9; private int itLineHits_ ; /** * optional int32 it_line_hits = 9; @@ -1874,6 +1899,7 @@ public final class FileSourceDb { return this; } + // optional int32 it_conditions = 10; private int itConditions_ ; /** * optional int32 it_conditions = 10; @@ -1906,6 +1932,7 @@ public final class FileSourceDb { return this; } + // optional int32 it_covered_conditions = 11; private int itCoveredConditions_ ; /** * optional int32 it_covered_conditions = 11; @@ -1938,6 +1965,7 @@ public final class FileSourceDb { return this; } + // optional int32 overall_line_hits = 12; private int overallLineHits_ ; /** * optional int32 overall_line_hits = 12; @@ -1986,6 +2014,7 @@ public final class FileSourceDb { return this; } + // optional int32 overall_conditions = 13; private int overallConditions_ ; /** * optional int32 overall_conditions = 13; @@ -2018,6 +2047,7 @@ public final class FileSourceDb { return this; } + // optional int32 overall_covered_conditions = 14; private int overallCoveredConditions_ ; /** * optional int32 overall_covered_conditions = 14; @@ -2050,6 +2080,7 @@ public final class FileSourceDb { return this; } + // optional string highlighting = 15; private java.lang.Object highlighting_ = ""; /** * optional string highlighting = 15; @@ -2063,12 +2094,9 @@ public final class FileSourceDb { public java.lang.String getHighlighting() { java.lang.Object ref = highlighting_; if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - highlighting_ = s; - } + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + highlighting_ = s; return s; } else { return (java.lang.String) ref; @@ -2126,6 +2154,7 @@ public final class FileSourceDb { return this; } + // optional string symbols = 16; private java.lang.Object symbols_ = ""; /** * optional string symbols = 16; @@ -2139,12 +2168,9 @@ public final class FileSourceDb { public java.lang.String getSymbols() { java.lang.Object ref = symbols_; if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = - (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (bs.isValidUtf8()) { - symbols_ = s; - } + java.lang.String s = ((com.google.protobuf.ByteString) ref) + .toStringUtf8(); + symbols_ = s; return s; } else { return (java.lang.String) ref; @@ -2202,6 +2228,7 @@ public final class FileSourceDb { return this; } + // repeated int32 duplications = 17 [packed = true]; private java.util.List duplications_ = java.util.Collections.emptyList(); private void ensureDuplicationsIsMutable() { if (!((bitField0_ & 0x00010000) == 0x00010000)) { @@ -2253,8 +2280,7 @@ public final class FileSourceDb { public Builder addAllDuplications( java.lang.Iterable values) { ensureDuplicationsIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, duplications_); + super.addAll(values, duplications_); onChanged(); return this; } @@ -2279,10 +2305,10 @@ public final class FileSourceDb { // @@protoc_insertion_point(class_scope:org.sonar.server.source.db.Line) } - public interface DataOrBuilder extends - // @@protoc_insertion_point(interface_extends:org.sonar.server.source.db.Data) - com.google.protobuf.MessageOrBuilder { + public interface DataOrBuilder + extends com.google.protobuf.MessageOrBuilder { + // repeated .org.sonar.server.source.db.Line lines = 1; /** * repeated .org.sonar.server.source.db.Line lines = 1; */ @@ -2311,9 +2337,8 @@ public final class FileSourceDb { * Protobuf type {@code org.sonar.server.source.db.Data} */ public static final class Data extends - com.google.protobuf.GeneratedMessage implements - // @@protoc_insertion_point(message_implements:org.sonar.server.source.db.Data) - DataOrBuilder { + com.google.protobuf.GeneratedMessage + implements DataOrBuilder { // Use Data.newBuilder() to construct. private Data(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); @@ -2409,6 +2434,7 @@ public final class FileSourceDb { return PARSER; } + // repeated .org.sonar.server.source.db.Line lines = 1; public static final int LINES_FIELD_NUMBER = 1; private java.util.List lines_; /** @@ -2450,8 +2476,7 @@ public final class FileSourceDb { private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; + if (isInitialized != -1) return isInitialized == 1; memoizedIsInitialized = 1; return true; @@ -2558,9 +2583,8 @@ public final class FileSourceDb { * Protobuf type {@code org.sonar.server.source.db.Data} */ public static final class Builder extends - com.google.protobuf.GeneratedMessage.Builder implements - // @@protoc_insertion_point(builder_implements:org.sonar.server.source.db.Data) - org.sonar.server.source.db.FileSourceDb.DataOrBuilder { + com.google.protobuf.GeneratedMessage.Builder + implements org.sonar.server.source.db.FileSourceDb.DataOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return org.sonar.server.source.db.FileSourceDb.internal_static_org_sonar_server_source_db_Data_descriptor; @@ -2704,6 +2728,7 @@ public final class FileSourceDb { } private int bitField0_; + // repeated .org.sonar.server.source.db.Line lines = 1; private java.util.List lines_ = java.util.Collections.emptyList(); private void ensureLinesIsMutable() { @@ -2845,8 +2870,7 @@ public final class FileSourceDb { java.lang.Iterable values) { if (linesBuilder_ == null) { ensureLinesIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll( - values, lines_); + super.addAll(values, lines_); onChanged(); } else { linesBuilder_.addAllMessages(values); @@ -2955,12 +2979,12 @@ public final class FileSourceDb { // @@protoc_insertion_point(class_scope:org.sonar.server.source.db.Data) } - private static final com.google.protobuf.Descriptors.Descriptor + private static com.google.protobuf.Descriptors.Descriptor internal_static_org_sonar_server_source_db_Line_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_org_sonar_server_source_db_Line_fieldAccessorTable; - private static final com.google.protobuf.Descriptors.Descriptor + private static com.google.protobuf.Descriptors.Descriptor internal_static_org_sonar_server_source_db_Data_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable @@ -2989,29 +3013,29 @@ public final class FileSourceDb { "2 .org.sonar.server.source.db.LineB\002H\001" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = - new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { - public com.google.protobuf.ExtensionRegistry assignDescriptors( - com.google.protobuf.Descriptors.FileDescriptor root) { - descriptor = root; - return null; - } - }; + new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { + public com.google.protobuf.ExtensionRegistry assignDescriptors( + com.google.protobuf.Descriptors.FileDescriptor root) { + descriptor = root; + internal_static_org_sonar_server_source_db_Line_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_org_sonar_server_source_db_Line_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_org_sonar_server_source_db_Line_descriptor, + new java.lang.String[] { "Line", "Source", "ScmRevision", "ScmAuthor", "ScmDate", "UtLineHits", "UtConditions", "UtCoveredConditions", "ItLineHits", "ItConditions", "ItCoveredConditions", "OverallLineHits", "OverallConditions", "OverallCoveredConditions", "Highlighting", "Symbols", "Duplications", }); + internal_static_org_sonar_server_source_db_Data_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_org_sonar_server_source_db_Data_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_org_sonar_server_source_db_Data_descriptor, + new java.lang.String[] { "Lines", }); + return null; + } + }; com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { }, assigner); - internal_static_org_sonar_server_source_db_Line_descriptor = - getDescriptor().getMessageTypes().get(0); - internal_static_org_sonar_server_source_db_Line_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_org_sonar_server_source_db_Line_descriptor, - new java.lang.String[] { "Line", "Source", "ScmRevision", "ScmAuthor", "ScmDate", "UtLineHits", "UtConditions", "UtCoveredConditions", "ItLineHits", "ItConditions", "ItCoveredConditions", "OverallLineHits", "OverallConditions", "OverallCoveredConditions", "Highlighting", "Symbols", "Duplications", }); - internal_static_org_sonar_server_source_db_Data_descriptor = - getDescriptor().getMessageTypes().get(1); - internal_static_org_sonar_server_source_db_Data_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_org_sonar_server_source_db_Data_descriptor, - new java.lang.String[] { "Lines", }); } // @@protoc_insertion_point(outer_class_scope) diff --git a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/BatchOutputWriter.java b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/BatchOutputWriter.java index 2e12a297e1e..ce1ce341d6f 100644 --- a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/BatchOutputWriter.java +++ b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/BatchOutputWriter.java @@ -62,4 +62,18 @@ public class BatchOutputWriter { File file = fileStructure.fileFor(FileStructure.Domain.ISSUES, componentRef); ProtobufUtil.writeToFile(issuesBuilder.build(), file); } + + /** + * Issues on components which have been deleted are stored in another location. + * Temporary hack, waiting for computation stack + */ + public void writeDeletedComponentIssues(int componentRef, String componentUuid, Iterable issues) { + BatchReport.Issues.Builder issuesBuilder = BatchReport.Issues.newBuilder(); + issuesBuilder.setComponentRef(componentRef); + issuesBuilder.setComponentUuid(componentUuid); + issuesBuilder.addAllList(issues); + File file = fileStructure.fileFor(FileStructure.Domain.ISSUES_ON_DELETED, componentRef); + ProtobufUtil.writeToFile(issuesBuilder.build(), file); + } + } diff --git a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/BatchReportReader.java b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/BatchReportReader.java index 872aa277e5d..e1695c1bd07 100644 --- a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/BatchReportReader.java +++ b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/BatchReportReader.java @@ -20,6 +20,7 @@ package org.sonar.batch.protocol.output; import org.sonar.batch.protocol.ProtobufUtil; +import org.sonar.batch.protocol.output.BatchReport.Issues; import javax.annotation.CheckForNull; @@ -60,4 +61,13 @@ public class BatchReportReader { } return Collections.emptyList(); } + + public Issues readDeletedComponentIssues(int deletedComponentRef) { + File file = fileStructure.fileFor(FileStructure.Domain.ISSUES_ON_DELETED, deletedComponentRef); + if (!file.exists() || !file.isFile()) { + throw new IllegalStateException("Unable to find report for deleted component #" + deletedComponentRef); + } + // all the issues are loaded in memory + return ProtobufUtil.readFile(file, Issues.PARSER); + } } diff --git a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/FileStructure.java b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/FileStructure.java index 5e2d51b26ce..4f9529d2c3b 100644 --- a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/FileStructure.java +++ b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/output/FileStructure.java @@ -27,7 +27,7 @@ import java.io.File; public class FileStructure { public static enum Domain { - ISSUES("issues-"), COMPONENT("component-"); + ISSUES("issues-"), ISSUES_ON_DELETED("issues-deleted-"), COMPONENT("component-"); private final String filePrefix; diff --git a/sonar-batch-protocol/src/main/protobuf/batch_report.proto b/sonar-batch-protocol/src/main/protobuf/batch_report.proto index af3f2dc1f37..546f33f86fb 100644 --- a/sonar-batch-protocol/src/main/protobuf/batch_report.proto +++ b/sonar-batch-protocol/src/main/protobuf/batch_report.proto @@ -43,8 +43,9 @@ message Metadata { optional string project_key = 2; optional int32 root_component_ref = 3; - // temporary field used during development of computation stack + // temporary fields used during development of computation stack optional int64 snapshot_id = 4; + optional int32 deleted_components_count = 5; } message Component { @@ -95,4 +96,7 @@ message Issue { message Issues { optional int32 component_ref = 1; repeated Issue list = 2; + + // Temporary field for issues on deleted components + optional string component_uuid = 3; } diff --git a/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/output/BatchOutputWriterTest.java b/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/output/BatchOutputWriterTest.java index ed1d4362048..c64d1a0cf07 100644 --- a/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/output/BatchOutputWriterTest.java +++ b/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/output/BatchOutputWriterTest.java @@ -115,6 +115,33 @@ public class BatchOutputWriterTest { assertThat(file).exists().isFile(); BatchReport.Issues read = ProtobufUtil.readFile(file, BatchReport.Issues.PARSER); assertThat(read.getComponentRef()).isEqualTo(1); + assertThat(read.hasComponentUuid()).isFalse(); + assertThat(read.getListCount()).isEqualTo(1); + } + + @Test + public void write_issues_of_deleted_component() throws Exception { + File dir = temp.newFolder(); + BatchOutputWriter writer = new BatchOutputWriter(dir); + + // no data yet + assertThat(writer.hasComponentData(FileStructure.Domain.ISSUES_ON_DELETED, 1)).isFalse(); + + // write data + BatchReport.Issue issue = BatchReport.Issue.newBuilder() + .setUuid("ISSUE_A") + .setLine(50) + .setMsg("the message") + .build(); + + writer.writeDeletedComponentIssues(1, "componentUuid", Arrays.asList(issue)); + + assertThat(writer.hasComponentData(FileStructure.Domain.ISSUES_ON_DELETED, 1)).isTrue(); + File file = writer.getFileStructure().fileFor(FileStructure.Domain.ISSUES_ON_DELETED, 1); + assertThat(file).exists().isFile(); + BatchReport.Issues read = ProtobufUtil.readFile(file, BatchReport.Issues.PARSER); + assertThat(read.getComponentRef()).isEqualTo(1); + assertThat(read.getComponentUuid()).isEqualTo("componentUuid"); assertThat(read.getListCount()).isEqualTo(1); } } diff --git a/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/output/BatchReportReaderTest.java b/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/output/BatchReportReaderTest.java index 0be09049e68..8dd814247eb 100644 --- a/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/output/BatchReportReaderTest.java +++ b/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/output/BatchReportReaderTest.java @@ -22,6 +22,8 @@ package org.sonar.batch.protocol.output; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; +import org.sonar.batch.protocol.output.BatchReport.Issues; +import org.sonar.batch.protocol.output.BatchReport.Metadata; import java.io.File; import java.util.Arrays; @@ -40,11 +42,16 @@ public class BatchReportReaderTest { initFiles(dir); BatchReportReader reader = new BatchReportReader(dir); - assertThat(reader.readMetadata().getAnalysisDate()).isEqualTo(15000000L); + Metadata readMetadata = reader.readMetadata(); + assertThat(readMetadata.getAnalysisDate()).isEqualTo(15000000L); + assertThat(readMetadata.getDeletedComponentsCount()).isEqualTo(1); assertThat(reader.readComponentIssues(1)).hasSize(1); assertThat(reader.readComponentIssues(200)).isEmpty(); assertThat(reader.readComponent(1).getUuid()).isEqualTo("UUID_A"); assertThat(reader.readComponent(200)).isNull(); + Issues deletedComponentIssues = reader.readDeletedComponentIssues(1); + assertThat(deletedComponentIssues.getComponentUuid()).isEqualTo("compUuid"); + assertThat(deletedComponentIssues.getListList()).hasSize(1); } @@ -54,7 +61,8 @@ public class BatchReportReaderTest { BatchReport.Metadata.Builder metadata = BatchReport.Metadata.newBuilder() .setAnalysisDate(15000000L) .setProjectKey("PROJECT_A") - .setRootComponentRef(1); + .setRootComponentRef(1) + .setDeletedComponentsCount(1); writer.writeMetadata(metadata.build()); BatchReport.Component.Builder component = BatchReport.Component.newBuilder() @@ -68,10 +76,7 @@ public class BatchReportReaderTest { .build(); writer.writeComponentIssues(1, Arrays.asList(issue)); - } - - @Test - public void readMetadata() throws Exception { + writer.writeDeletedComponentIssues(1, "compUuid", Arrays.asList(issue)); } } diff --git a/sonar-batch/src/main/java/org/sonar/batch/issue/IssueCache.java b/sonar-batch/src/main/java/org/sonar/batch/issue/IssueCache.java index f804fc62efd..f0c1cfb1fbd 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/issue/IssueCache.java +++ b/sonar-batch/src/main/java/org/sonar/batch/issue/IssueCache.java @@ -24,6 +24,8 @@ import org.sonar.api.issue.internal.DefaultIssue; import org.sonar.batch.index.Cache; import org.sonar.batch.index.Caches; +import java.util.Collection; + /** * Shared issues among all project modules */ @@ -44,6 +46,10 @@ public class IssueCache implements BatchComponent { return cache.values(); } + public Collection componentKeys() { + return cache.keySet(); + } + public IssueCache put(DefaultIssue issue) { cache.put(issue.componentKey(), issue.key(), issue); return this; diff --git a/sonar-batch/src/main/java/org/sonar/batch/report/ComponentsPublisher.java b/sonar-batch/src/main/java/org/sonar/batch/report/ComponentsPublisher.java index 0a7d97d9ad6..7850f6e2db4 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/report/ComponentsPublisher.java +++ b/sonar-batch/src/main/java/org/sonar/batch/report/ComponentsPublisher.java @@ -21,7 +21,6 @@ package org.sonar.batch.report; import org.sonar.api.batch.bootstrap.ProjectReactor; import org.sonar.api.resources.Language; -import org.sonar.api.resources.Project; import org.sonar.api.resources.Resource; import org.sonar.api.resources.ResourceUtils; import org.sonar.batch.index.BatchResource; @@ -48,15 +47,6 @@ public class ComponentsPublisher implements ReportPublisher { @Override public void publish(BatchOutputWriter writer) { BatchResource rootProject = resourceCache.get(reactor.getRoot().getKeyWithBranch()); - BatchReport.Metadata.Builder builder = BatchReport.Metadata.newBuilder() - .setAnalysisDate(((Project) rootProject.resource()).getAnalysisDate().getTime()) - .setProjectKey(((Project) rootProject.resource()).key()) - .setRootComponentRef(rootProject.batchId()); - Integer sid = rootProject.snapshotId(); - if (sid != null) { - builder.setSnapshotId(sid); - } - writer.writeMetadata(builder.build()); recursiveWriteComponent(rootProject, writer); } diff --git a/sonar-batch/src/main/java/org/sonar/batch/report/IssuesPublisher.java b/sonar-batch/src/main/java/org/sonar/batch/report/IssuesPublisher.java index 8be01240274..fd7bd13b814 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/report/IssuesPublisher.java +++ b/sonar-batch/src/main/java/org/sonar/batch/report/IssuesPublisher.java @@ -21,8 +21,10 @@ package org.sonar.batch.report; import com.google.common.base.Function; import com.google.common.collect.Iterables; +import org.sonar.api.batch.bootstrap.ProjectReactor; import org.sonar.api.issue.internal.DefaultIssue; import org.sonar.api.issue.internal.FieldDiffs; +import org.sonar.api.resources.Project; import org.sonar.api.utils.KeyValueFormat; import org.sonar.batch.index.BatchResource; import org.sonar.batch.index.ResourceCache; @@ -33,29 +35,73 @@ import org.sonar.batch.protocol.output.BatchReport; import javax.annotation.Nullable; +import java.util.Collection; import java.util.Date; +import java.util.Iterator; public class IssuesPublisher implements ReportPublisher { private final ResourceCache resourceCache; private final IssueCache issueCache; + private final ProjectReactor reactor; - public IssuesPublisher(ResourceCache resourceCache, IssueCache issueCache) { + public IssuesPublisher(ProjectReactor reactor, ResourceCache resourceCache, IssueCache issueCache) { + this.reactor = reactor; this.resourceCache = resourceCache; this.issueCache = issueCache; } @Override public void publish(BatchOutputWriter writer) { + Collection deletedComponentKeys = issueCache.componentKeys(); for (BatchResource resource : resourceCache.all()) { - Iterable issues = issueCache.byComponent(resource.resource().getEffectiveKey()); + String componentKey = resource.resource().getEffectiveKey(); + Iterable issues = issueCache.byComponent(componentKey); writer.writeComponentIssues(resource.batchId(), Iterables.transform(issues, new Function() { @Override public BatchReport.Issue apply(DefaultIssue input) { return toReportIssue(input); } })); + deletedComponentKeys.remove(componentKey); } + + int count = exportIssuesOfDeletedComponents(deletedComponentKeys, writer); + + exportMetadata(writer, count); + } + + private void exportMetadata(BatchOutputWriter writer, int count) { + BatchResource rootProject = resourceCache.get(reactor.getRoot().getKeyWithBranch()); + BatchReport.Metadata.Builder builder = BatchReport.Metadata.newBuilder() + .setAnalysisDate(((Project) rootProject.resource()).getAnalysisDate().getTime()) + .setProjectKey(((Project) rootProject.resource()).key()) + .setRootComponentRef(rootProject.batchId()) + .setDeletedComponentsCount(count); + Integer sid = rootProject.snapshotId(); + if (sid != null) { + builder.setSnapshotId(sid); + } + writer.writeMetadata(builder.build()); + } + + private int exportIssuesOfDeletedComponents(Collection deletedComponentKeys, BatchOutputWriter writer) { + int deletedComponentCount = 0; + for (Object componentKey : deletedComponentKeys) { + deletedComponentCount++; + Iterable issues = issueCache.byComponent(componentKey.toString()); + Iterator iterator = issues.iterator(); + if (iterator.hasNext()) { + String componentUuid = iterator.next().componentUuid(); + writer.writeDeletedComponentIssues(deletedComponentCount, componentUuid, Iterables.transform(issues, new Function() { + @Override + public BatchReport.Issue apply(DefaultIssue input) { + return toReportIssue(input); + } + })); + } + } + return deletedComponentCount; } private BatchReport.Issue toReportIssue(DefaultIssue issue) { diff --git a/sonar-batch/src/test/java/org/sonar/batch/report/IssuesPublisherTest.java b/sonar-batch/src/test/java/org/sonar/batch/report/IssuesPublisherTest.java new file mode 100644 index 00000000000..2674e1ddc78 --- /dev/null +++ b/sonar-batch/src/test/java/org/sonar/batch/report/IssuesPublisherTest.java @@ -0,0 +1,166 @@ +/* + * SonarQube, open source software quality management tool. + * Copyright (C) 2008-2014 SonarSource + * mailto:contact AT sonarsource DOT com + * + * SonarQube is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * SonarQube is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.batch.report; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TemporaryFolder; +import org.sonar.api.batch.bootstrap.ProjectDefinition; +import org.sonar.api.batch.bootstrap.ProjectReactor; +import org.sonar.api.database.model.Snapshot; +import org.sonar.api.issue.internal.DefaultIssue; +import org.sonar.api.issue.internal.FieldDiffs; +import org.sonar.api.resources.Project; +import org.sonar.api.rule.RuleKey; +import org.sonar.api.utils.Duration; +import org.sonar.batch.index.ResourceCache; +import org.sonar.batch.issue.IssueCache; +import org.sonar.batch.protocol.output.BatchOutputWriter; +import org.sonar.batch.protocol.output.BatchReport.Metadata; +import org.sonar.batch.protocol.output.BatchReportReader; + +import java.io.File; +import java.util.Arrays; +import java.util.Collections; +import java.util.Date; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +public class IssuesPublisherTest { + + @Rule + public TemporaryFolder temp = new TemporaryFolder(); + + private IssueCache issueCache; + private IssuesPublisher publisher; + + @Before + public void prepare() { + ProjectDefinition root = ProjectDefinition.create().setKey("foo"); + Project p = new Project("foo").setAnalysisDate(new Date(1234567L)); + ResourceCache resourceCache = new ResourceCache(); + org.sonar.api.resources.Resource sampleFile = org.sonar.api.resources.File.create("src/Foo.php").setEffectiveKey("foo:src/Foo.php"); + resourceCache.add(p, null).setSnapshot(new Snapshot().setId(2)); + resourceCache.add(sampleFile, null); + issueCache = mock(IssueCache.class); + when(issueCache.byComponent(anyString())).thenReturn(Collections.emptyList()); + publisher = new IssuesPublisher(new ProjectReactor(root), resourceCache, issueCache); + } + + @Test + public void publishIssuesAndMetadata() throws Exception { + + DefaultIssue issue1 = new DefaultIssue(); + issue1.setKey("uuid"); + issue1.setSeverity("MAJOR"); + issue1.setRuleKey(RuleKey.of("repo", "rule")); + DefaultIssue issue2 = new DefaultIssue(); + issue2.setKey("uuid2"); + issue2.setSeverity("MAJOR"); + issue2.setRuleKey(RuleKey.of("repo", "rule")); + issue2.setLine(2); + issue2.setMessage("msg"); + issue2.setEffortToFix(2d); + issue2.setDebt(Duration.create(2)); + issue2.setResolution("FIXED"); + issue2.setStatus("RESOLVED"); + issue2.setChecksum("checksum"); + issue2.setReporter("reporter"); + issue2.setAssignee("assignee"); + issue2.setActionPlanKey("action"); + issue2.setAuthorLogin("author"); + issue2.setCurrentChange(new FieldDiffs().setUserLogin("foo")); + issue2.setCreationDate(new Date()); + issue2.setUpdateDate(new Date()); + issue2.setCloseDate(new Date()); + issue2.setSelectedAt(1234L); + when(issueCache.byComponent("foo:src/Foo.php")).thenReturn(Arrays.asList(issue1, issue2)); + + File outputDir = temp.newFolder(); + BatchOutputWriter writer = new BatchOutputWriter(outputDir); + + publisher.publish(writer); + + BatchReportReader reader = new BatchReportReader(outputDir); + Metadata metadata = reader.readMetadata(); + assertThat(metadata.getAnalysisDate()).isEqualTo(1234567L); + assertThat(metadata.getProjectKey()).isEqualTo("foo"); + assertThat(metadata.getDeletedComponentsCount()).isEqualTo(0); + assertThat(metadata.getSnapshotId()).isEqualTo(2); + + assertThat(reader.readComponentIssues(1)).hasSize(0); + assertThat(reader.readComponentIssues(2)).hasSize(2); + + } + + @Test + public void publishIssuesOfDeletedComponents() throws Exception { + + DefaultIssue issue1 = new DefaultIssue(); + issue1.setKey("uuid"); + issue1.setComponentUuid("deletedUuid"); + issue1.setSeverity("MAJOR"); + issue1.setRuleKey(RuleKey.of("repo", "rule")); + DefaultIssue issue2 = new DefaultIssue(); + issue2.setKey("uuid2"); + issue2.setComponentUuid("deletedUuid"); + issue2.setSeverity("MAJOR"); + issue2.setRuleKey(RuleKey.of("repo", "rule")); + issue2.setLine(2); + issue2.setMessage("msg"); + issue2.setEffortToFix(2d); + issue2.setDebt(Duration.create(2)); + issue2.setResolution("FIXED"); + issue2.setStatus("RESOLVED"); + issue2.setChecksum("checksum"); + issue2.setReporter("reporter"); + issue2.setAssignee("assignee"); + issue2.setActionPlanKey("action"); + issue2.setAuthorLogin("author"); + issue2.setCurrentChange(new FieldDiffs().setUserLogin("foo")); + issue2.setCreationDate(new Date()); + issue2.setUpdateDate(new Date()); + issue2.setCloseDate(new Date()); + issue2.setSelectedAt(1234L); + + when(issueCache.byComponent("foo:deleted.php")).thenReturn(Arrays.asList(issue1, issue2)); + + when(issueCache.componentKeys()).thenReturn(Arrays.asList("foo:deleted.php")); + + File outputDir = temp.newFolder(); + BatchOutputWriter writer = new BatchOutputWriter(outputDir); + + publisher.publish(writer); + + BatchReportReader reader = new BatchReportReader(outputDir); + Metadata metadata = reader.readMetadata(); + assertThat(metadata.getDeletedComponentsCount()).isEqualTo(1); + + assertThat(reader.readComponentIssues(1)).hasSize(0); + assertThat(reader.readComponentIssues(2)).hasSize(0); + assertThat(reader.readDeletedComponentIssues(1).getComponentUuid()).isEqualTo("deletedUuid"); + assertThat(reader.readDeletedComponentIssues(1).getListList()).hasSize(2); + + } +} -- 2.39.5