aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/test
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2017-08-10 12:02:19 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2017-09-07 08:33:31 +0200
commit0d4d37faf7a8c7e1c252c24c286d830802cfbb7b (patch)
treeef2f98d6e33b1eb3133553307664f696630b54e3 /tests/src/test
parent4f2c55e5f60c9c8108730a50e59c74344c5c195f (diff)
downloadsonarqube-0d4d37faf7a8c7e1c252c24c286d830802cfbb7b.tar.gz
sonarqube-0d4d37faf7a8c7e1c252c24c286d830802cfbb7b.zip
SONAR-9664 Add IT for custom rules backdating
Diffstat (limited to 'tests/src/test')
-rw-r--r--tests/src/test/java/org/sonarqube/tests/issue/IssueCreationDatePluginChangedTest.java8
-rw-r--r--tests/src/test/resources/issue/IssueCreationDatePluginChangedTest/profile.xml (renamed from tests/src/test/resources/issue/IssueCreationDatePluginChangedTest/one-rule.xml)5
2 files changed, 10 insertions, 3 deletions
diff --git a/tests/src/test/java/org/sonarqube/tests/issue/IssueCreationDatePluginChangedTest.java b/tests/src/test/java/org/sonarqube/tests/issue/IssueCreationDatePluginChangedTest.java
index e5bd0a3d55c..98ab45d77d3 100644
--- a/tests/src/test/java/org/sonarqube/tests/issue/IssueCreationDatePluginChangedTest.java
+++ b/tests/src/test/java/org/sonarqube/tests/issue/IssueCreationDatePluginChangedTest.java
@@ -59,6 +59,7 @@ public class IssueCreationDatePluginChangedTest {
public static final Orchestrator ORCHESTRATOR = Orchestrator.builderEnv()
.addPlugin(xooPlugin())
.addPlugin(ItUtils.pluginArtifact("backdating-plugin-v1"))
+ .addPlugin(ItUtils.pluginArtifact("backdating-customplugin"))
.build();
@Before
@@ -68,7 +69,7 @@ public class IssueCreationDatePluginChangedTest {
@Test
public void should_use_scm_date_for_new_issues_if_plugin_updated() {
- ItUtils.restoreProfile(ORCHESTRATOR, getClass().getResource("/issue/IssueCreationDatePluginChangedTest/one-rule.xml"));
+ ItUtils.restoreProfile(ORCHESTRATOR, getClass().getResource("/issue/IssueCreationDatePluginChangedTest/profile.xml"));
ORCHESTRATOR.getServer().provisionProject(SAMPLE_PROJECT_KEY, SAMPLE_PROJECT_NAME);
ORCHESTRATOR.getServer().associateProjectToQualityProfile(SAMPLE_PROJECT_KEY, LANGUAGE_XOO, SAMPLE_QUALITY_PROFILE_NAME);
@@ -95,13 +96,14 @@ public class IssueCreationDatePluginChangedTest {
ORCHESTRATOR.restartServer();
- // New analysis that should raise a new issue
+ // New analysis that should raise 2 new issues that will be backdated
ORCHESTRATOR.executeBuild(scanner);
issues = getIssues(issueQuery().components("creation-date-sample:src/main/xoo/sample/Sample.xoo"));
assertThat(issues)
.extracting(Issue::line, Issue::creationDate)
.containsExactly(tuple(1, dateTimeParse("2005-01-01T00:00:00+0000")),
- tuple(2, dateTimeParse("2005-01-01T00:00:00+0000")));
+ tuple(2, dateTimeParse("2005-01-01T00:00:00+0000")),
+ tuple(3, dateTimeParse("2005-01-01T00:00:00+0000")));
}
private static List<Issue> getIssues(IssueQuery query) {
diff --git a/tests/src/test/resources/issue/IssueCreationDatePluginChangedTest/one-rule.xml b/tests/src/test/resources/issue/IssueCreationDatePluginChangedTest/profile.xml
index 8857d01b00f..2d5d3461c2f 100644
--- a/tests/src/test/resources/issue/IssueCreationDatePluginChangedTest/one-rule.xml
+++ b/tests/src/test/resources/issue/IssueCreationDatePluginChangedTest/profile.xml
@@ -7,5 +7,10 @@
<key>Rule</key>
<priority>MAJOR</priority>
</rule>
+ <rule>
+ <repositoryKey>back</repositoryKey>
+ <key>Custom</key>
+ <priority>MAJOR</priority>
+ </rule>
</rules>
</profile>