diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2015-01-13 16:26:54 +0100 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2015-01-13 16:32:51 +0100 |
commit | 4bedac2e6c552bee88832ebce94152d01ba20cde (patch) | |
tree | da9112071b7a9afb01f387393c000d27c8b438e7 /sonar-batch-protocol | |
parent | 462a8d985a9c0320e7eb3764a346b92f1ec1b824 (diff) | |
download | sonarqube-4bedac2e6c552bee88832ebce94152d01ba20cde.tar.gz sonarqube-4bedac2e6c552bee88832ebce94152d01ba20cde.zip |
SONAR-5473 Added missing "needBlame" field in project referential
Diffstat (limited to 'sonar-batch-protocol')
-rw-r--r-- | sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/FileData.java | 8 | ||||
-rw-r--r-- | sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/ProjectReferentialsTest.java | 11 |
2 files changed, 13 insertions, 6 deletions
diff --git a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/FileData.java b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/FileData.java index fc7e7beca02..d68bcbd3c61 100644 --- a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/FileData.java +++ b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/FileData.java @@ -25,12 +25,14 @@ import javax.annotation.Nullable; public class FileData { private final String hash; + private final boolean needBlame; private final String scmLastCommitDatetimesByLine; private final String scmRevisionsByLine; private final String scmAuthorsByLine; - public FileData(@Nullable String hash, @Nullable String scmLastCommitDatetimesByLine, @Nullable String scmRevisionsByLine, @Nullable String scmAuthorsByLine) { + public FileData(@Nullable String hash, boolean needBlame, @Nullable String scmLastCommitDatetimesByLine, @Nullable String scmRevisionsByLine, @Nullable String scmAuthorsByLine) { this.hash = hash; + this.needBlame = needBlame; this.scmLastCommitDatetimesByLine = scmLastCommitDatetimesByLine; this.scmRevisionsByLine = scmRevisionsByLine; this.scmAuthorsByLine = scmAuthorsByLine; @@ -41,6 +43,10 @@ public class FileData { return hash; } + public boolean needBlame() { + return needBlame; + } + @CheckForNull public String scmLastCommitDatetimesByLine() { return scmLastCommitDatetimesByLine; diff --git a/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/ProjectReferentialsTest.java b/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/ProjectReferentialsTest.java index 12cdedcb4ce..348fcd8187f 100644 --- a/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/ProjectReferentialsTest.java +++ b/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/ProjectReferentialsTest.java @@ -49,8 +49,8 @@ public class ProjectReferentialsTest { ref.addActiveRule(activeRule); ref.setLastAnalysisDate(new SimpleDateFormat("dd/MM/yyyy").parse("31/10/2014")); ref.setTimestamp(10); - ref.addFileData("foo", "src/main/java/Foo.java", new FileData("xyz", "1=12345,2=3456", "1=345,2=345", "1=henryju,2=gaudin")); - ref.addFileData("foo", "src/main/java/Foo2.java", new FileData("xyz", "1=12345,2=3456", "1=345,2=345", "1=henryju,2=gaudin")); + ref.addFileData("foo", "src/main/java/Foo.java", new FileData("xyz", true, "1=12345,2=3456", "1=345,2=345", "1=henryju,2=gaudin")); + ref.addFileData("foo", "src/main/java/Foo2.java", new FileData("xyz", false, "1=12345,2=3456", "1=345,2=345", "1=henryju,2=gaudin")); JSONAssert .assertEquals( @@ -58,8 +58,8 @@ public class ProjectReferentialsTest { + "qprofilesByLanguage:{java:{key:\"squid-java\",name:Java,language:java,rulesUpdatedAt:\"1984-03-14T00:00:00+0100\"}}," + "activeRules:[{repositoryKey:repo,ruleKey:rule,name:Rule,severity:MAJOR,internalKey:rule,language:java,params:{param1:value1}}]," + "settingsByModule:{foo:{prop1:value1,prop2:value2,prop:value}}," - + "fileDataByModuleAndPath:{foo:{\"src/main/java/Foo.java\":{hash:xyz,scmLastCommitDatetimesByLine:\"1\u003d12345,2\u003d3456\",scmRevisionsByLine:\"1\u003d345,2\u003d345\",scmAuthorsByLine:\"1\u003dhenryju,2\u003dgaudin\"}," - + "\"src/main/java/Foo2.java\":{hash:xyz,scmLastCommitDatetimesByLine:\"1\u003d12345,2\u003d3456\",scmRevisionsByLine:\"1\u003d345,2\u003d345\",scmAuthorsByLine:\"1\u003dhenryju,2\u003dgaudin\"}}}," + + "fileDataByModuleAndPath:{foo:{\"src/main/java/Foo.java\":{hash:xyz,needBlame:true,scmLastCommitDatetimesByLine:\"1\u003d12345,2\u003d3456\",scmRevisionsByLine:\"1\u003d345,2\u003d345\",scmAuthorsByLine:\"1\u003dhenryju,2\u003dgaudin\"}," + + "\"src/main/java/Foo2.java\":{hash:xyz,needBlame:false,scmLastCommitDatetimesByLine:\"1\u003d12345,2\u003d3456\",scmRevisionsByLine:\"1\u003d345,2\u003d345\",scmAuthorsByLine:\"1\u003dhenryju,2\u003dgaudin\"}}}," + "lastAnalysisDate:\"2014-10-31T00:00:00+0100\"}", ref.toJson(), true); } @@ -71,7 +71,7 @@ public class ProjectReferentialsTest { + "qprofilesByLanguage:{java:{key:\"squid-java\",name:Java,language:java,rulesUpdatedAt:\"1984-03-14T00:00:00+0100\"}}," + "activeRules:[{repositoryKey:repo,ruleKey:rule,name:Rule,severity:MAJOR,internalKey:rule1,language:java,params:{param1:value1}}]," + "settingsByModule:{foo:{prop:value}}," - + "fileDataByModuleAndPath:{foo:{\"src/main/java/Foo.java\":{hash:xyz,scmLastCommitDatetimesByLine:\"1\u003d12345,2\u003d3456\",scmRevisionsByLine:\"1\u003d345,2\u003d345\",scmAuthorsByLine:\"1\u003dhenryju,2\u003dgaudin\"}}}," + + "fileDataByModuleAndPath:{foo:{\"src/main/java/Foo.java\":{hash:xyz,needBlame:true,scmLastCommitDatetimesByLine:\"1\u003d12345,2\u003d3456\",scmRevisionsByLine:\"1\u003d345,2\u003d345\",scmAuthorsByLine:\"1\u003dhenryju,2\u003dgaudin\"}}}," + "lastAnalysisDate:\"2014-10-31T00:00:00+0100\"}"); assertThat(ref.timestamp()).isEqualTo(1); @@ -94,6 +94,7 @@ public class ProjectReferentialsTest { assertThat(ref.fileData("foo2", "src/main/java/Foo3.java")).isNull(); assertThat(ref.fileData("foo", "src/main/java/Foo.java").hash()).isEqualTo("xyz"); + assertThat(ref.fileData("foo", "src/main/java/Foo.java").needBlame()).isTrue(); assertThat(ref.fileData("foo", "src/main/java/Foo.java").scmAuthorsByLine()).isEqualTo("1=henryju,2=gaudin"); assertThat(ref.fileData("foo", "src/main/java/Foo.java").scmLastCommitDatetimesByLine()).isEqualTo("1=12345,2=3456"); assertThat(ref.fileData("foo", "src/main/java/Foo.java").scmRevisionsByLine()).isEqualTo("1=345,2=345"); |