--- /dev/null
+/*
+ * 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();
+}
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
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);
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);
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()