aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch-protocol/src/test/java
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2014-11-03 11:07:31 +0100
committerJulien HENRY <julien.henry@sonarsource.com>2014-11-03 11:55:30 +0100
commit89eede7717dd056d314a214afb64a17be98fbc0e (patch)
tree3c9ed05a9749ea9a9557a2bb9a88b988f6ab26b1 /sonar-batch-protocol/src/test/java
parent19a6905ce6c877f1497b2ce47b7aeb478591b036 (diff)
downloadsonarqube-89eede7717dd056d314a214afb64a17be98fbc0e.tar.gz
sonarqube-89eede7717dd056d314a214afb64a17be98fbc0e.zip
SONAR-5815 Store last update time on source data
Diffstat (limited to 'sonar-batch-protocol/src/test/java')
-rw-r--r--sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/ProjectReferentialsTest.java13
1 files changed, 9 insertions, 4 deletions
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 5e537a1f523..8d55f4054dc 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
@@ -48,6 +48,7 @@ public class ProjectReferentialsTest {
ActiveRule activeRule = new ActiveRule("repo", "rule", "Rule", "MAJOR", "rule", "java");
activeRule.addParam("param1", "value1");
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"));
@@ -55,10 +56,11 @@ public class ProjectReferentialsTest {
JSONAssert
.assertEquals(
"{timestamp:10,"
- + "qprofilesByLanguage:{java:{key:\"squid-java\",name:Java,language:java,rulesUpdatedAt:\"Mar 14, 1984 12:00:00 AM\"}},"
+ + "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\"}}}}",
+ + "fileDataByModuleAndPath:{foo:{\"src/main/java/Foo.java\":{hash:xyz,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);
}
@@ -66,10 +68,11 @@ public class ProjectReferentialsTest {
public void testFromJson() throws JSONException, ParseException {
ProjectReferentials ref = ProjectReferentials
.fromJson("{timestamp:1,"
- + "qprofilesByLanguage:{java:{key:\"squid-java\",name:Java,language:java,rulesUpdatedAt:\"Mar 14, 1984 12:00:00 AM\"}},"
+ + "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,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);
@@ -92,5 +95,7 @@ public class ProjectReferentialsTest {
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");
+
+ assertThat(ref.lastAnalysisDate()).isEqualTo(new SimpleDateFormat("dd/MM/yyyy").parse("31/10/2014"));
}
}