]> source.dussan.org Git - sonarqube.git/commitdiff
Reactivate Category2 in QA
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Fri, 4 May 2018 14:10:33 +0000 (16:10 +0200)
committerSonarTech <sonartech@sonarsource.com>
Fri, 4 May 2018 18:20:47 +0000 (20:20 +0200)
* Reactivate Category2 in Jenkins
* Execute ExternalIssueTest in its own Suite

tests/src/test/java/org/sonarqube/tests/issue/ExternalIssueSuite.java [new file with mode: 0644]
tests/src/test/java/org/sonarqube/tests/issue/ExternalIssueTest.java
tests/src/test/java/org/sonarqube/tests/issue/IssueSuite.java

diff --git a/tests/src/test/java/org/sonarqube/tests/issue/ExternalIssueSuite.java b/tests/src/test/java/org/sonarqube/tests/issue/ExternalIssueSuite.java
new file mode 100644 (file)
index 0000000..c5aa35f
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2018 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program 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.
+ *
+ * This program 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.sonarqube.tests.issue;
+
+import com.sonar.orchestrator.Orchestrator;
+import org.junit.ClassRule;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import util.ItUtils;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+  ExternalIssueTest.class
+})
+/**
+ * This test uses its own suite because it creates external rules
+ */
+public class ExternalIssueSuite {
+
+  @ClassRule
+  public static final Orchestrator ORCHESTRATOR = ItUtils.newOrchestratorBuilder()
+    .addPlugin(ItUtils.xooPlugin())
+    .build();
+}
index 4639acc353a7194d300caff9282b7e05a0925dcb..5aa33193a6b4cfb2a20823e979fd0126cb51cc39 100644 (file)
@@ -39,20 +39,17 @@ import static org.assertj.core.api.Assertions.assertThat;
 public class ExternalIssueTest {
   private static final String PROJECT_KEY = "project";
 
-  // This class uses its own instance of the server because it creates external rules in it
   @ClassRule
-  public static final Orchestrator ORCHESTRATOR = ItUtils.newOrchestratorBuilder()
-    .addPlugin(ItUtils.xooPlugin())
-    .build();
+  public static final Orchestrator orchestrator = ExternalIssueSuite.ORCHESTRATOR;
 
   @Rule
-  public Tester tester = new Tester(ORCHESTRATOR);
+  public Tester tester = new Tester(orchestrator);
 
   @Before
   public void setUp() {
-    ORCHESTRATOR.getServer().provisionProject(PROJECT_KEY, PROJECT_KEY);
-    ItUtils.restoreProfile(ORCHESTRATOR, getClass().getResource("/issue/ExternalIssueTest/no-rules.xml"));
-    ORCHESTRATOR.getServer().associateProjectToQualityProfile(PROJECT_KEY, "xoo", "no-rules");
+    orchestrator.getServer().provisionProject(PROJECT_KEY, PROJECT_KEY);
+    ItUtils.restoreProfile(orchestrator, getClass().getResource("/issue/ExternalIssueTest/no-rules.xml"));
+    orchestrator.getServer().associateProjectToQualityProfile(PROJECT_KEY, "xoo", "no-rules");
   }
 
   @Test
@@ -60,7 +57,7 @@ public class ExternalIssueTest {
     noIssues();
     ruleDoesntExist("external_xoo:OneExternalIssuePerLine");
 
-    ItUtils.runProjectAnalysis(ORCHESTRATOR, "shared/xoo-sample",
+    ItUtils.runProjectAnalysis(orchestrator, "shared/xoo-sample",
       "sonar.oneExternalIssuePerLine.activate", "true");
     List<Issue> issuesList = tester.wsClient().issues().search(new SearchRequest()).getIssuesList();
     assertThat(issuesList).hasSize(17);
@@ -76,7 +73,7 @@ public class ExternalIssueTest {
     ruleExists("external_xoo:OneExternalIssuePerLine");
 
     // second analysis, issue tracking should work
-    ItUtils.runProjectAnalysis(ORCHESTRATOR, "shared/xoo-sample",
+    ItUtils.runProjectAnalysis(orchestrator, "shared/xoo-sample",
       "sonar.oneExternalIssuePerLine.activate", "true");
     issuesList = tester.wsClient().issues().search(new SearchRequest()).getIssuesList();
     assertThat(issuesList).hasSize(17);
@@ -88,7 +85,7 @@ public class ExternalIssueTest {
     ruleDoesntExist("external_externalXoo:rule1");
     ruleDoesntExist("external_externalXoo:rule2");
 
-    ItUtils.runProjectAnalysis(ORCHESTRATOR, "shared/xoo-sample",
+    ItUtils.runProjectAnalysis(orchestrator, "shared/xoo-sample",
       "sonar.externalIssuesReportPaths", "externalIssues.json");
 
     List<Issue> issuesList = tester.wsClient().issues().search(new SearchRequest()
index 8afe1a764ea2225de10280209aa2c88eb532cd6e..cc6a0097e410ccf87615d932c3c20fd5a12dc668 100644 (file)
@@ -33,7 +33,6 @@ import static util.ItUtils.xooPlugin;
   AutoAssignTest.class,
   CommonRulesTest.class,
   CustomRulesTest.class,
-  ExternalIssueTest.class,
   IssueActionTest.class,
   IssueBulkChangeTest.class,
   IssueChangelogTest.class,