From 0d4d37faf7a8c7e1c252c24c286d830802cfbb7b Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Thu, 10 Aug 2017 12:02:19 +0200 Subject: SONAR-9664 Add IT for custom rules backdating --- .../tests/issue/IssueCreationDatePluginChangedTest.java | 8 +++++--- .../IssueCreationDatePluginChangedTest/one-rule.xml | 11 ----------- .../issue/IssueCreationDatePluginChangedTest/profile.xml | 16 ++++++++++++++++ 3 files changed, 21 insertions(+), 14 deletions(-) delete mode 100644 tests/src/test/resources/issue/IssueCreationDatePluginChangedTest/one-rule.xml create mode 100644 tests/src/test/resources/issue/IssueCreationDatePluginChangedTest/profile.xml (limited to 'tests/src/test') 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 getIssues(IssueQuery query) { diff --git a/tests/src/test/resources/issue/IssueCreationDatePluginChangedTest/one-rule.xml b/tests/src/test/resources/issue/IssueCreationDatePluginChangedTest/one-rule.xml deleted file mode 100644 index 8857d01b00f..00000000000 --- a/tests/src/test/resources/issue/IssueCreationDatePluginChangedTest/one-rule.xml +++ /dev/null @@ -1,11 +0,0 @@ - - creation-date-plugin - xoo - - - back - Rule - MAJOR - - - diff --git a/tests/src/test/resources/issue/IssueCreationDatePluginChangedTest/profile.xml b/tests/src/test/resources/issue/IssueCreationDatePluginChangedTest/profile.xml new file mode 100644 index 00000000000..2d5d3461c2f --- /dev/null +++ b/tests/src/test/resources/issue/IssueCreationDatePluginChangedTest/profile.xml @@ -0,0 +1,16 @@ + + creation-date-plugin + xoo + + + back + Rule + MAJOR + + + back + Custom + MAJOR + + + -- cgit v1.2.3