Category2)
CATEGORY=Category2 && runCategory
CATEGORY=test && runCategory
+ CATEGORY=qualityModel && runCategory
;;
Category3)
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 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.qa.util;
+
+import com.google.common.base.Joiner;
+
+import static com.google.common.base.Preconditions.checkState;
+
+public class QModelTester {
+
+ private static final String DEV_COST_PROPERTY = "sonar.technicalDebt.developmentCost";
+ private static final String RATING_GRID_PROPERTY = "sonar.technicalDebt.ratingGrid";
+ private static final String DEV_COST_LANGUAGE_PROPERTY = "languageSpecificParameters";
+ private static final String DEV_COST_LANGUAGE_NAME_PROPERTY = DEV_COST_LANGUAGE_PROPERTY + ".0.language";
+ private static final String DEV_COST_LANGUAGE_COST_PROPERTY = DEV_COST_LANGUAGE_PROPERTY + ".0.man_days";
+ private static final Joiner COMMA_JOINER = Joiner.on(",");
+
+ private final TesterSession session;
+
+ QModelTester(TesterSession session) {
+ this.session = session;
+ }
+
+ public void updateDevelopmentCost(int developmentCost) {
+ session.settings().setGlobalSettings(DEV_COST_PROPERTY, Integer.toString(developmentCost));
+ }
+
+ public void updateLanguageDevelopmentCost(String language, int developmentCost) {
+ session.settings().setGlobalSettings(DEV_COST_LANGUAGE_PROPERTY, "0");
+ session.settings().setGlobalSettings(DEV_COST_LANGUAGE_NAME_PROPERTY, language);
+ session.settings().setGlobalSettings(DEV_COST_LANGUAGE_COST_PROPERTY, Integer.toString(developmentCost));
+ }
+
+ public void updateRatingGrid(Double... ratingGrid) {
+ checkState(ratingGrid.length == 4, "Rating grid must contains 4 values");
+ session.settings().setGlobalSettings(RATING_GRID_PROPERTY, COMMA_JOINER.join(ratingGrid));
+ }
+}
return rootSession.projects();
}
+ @Override
+ public QModelTester qModel() {
+ return rootSession.qModel();
+ }
+
@Override
public QProfileTester qProfiles() {
return rootSession.qProfiles();
return new ProjectTester(this);
}
+ @Override
+ public QModelTester qModel() {
+ return new QModelTester(this);
+ }
+
@Override
public QProfileTester qProfiles() {
return new QProfileTester(this);
ProjectTester projects();
+ QModelTester qModel();
+
QProfileTester qProfiles();
UserTester users();
import org.sonarqube.tests.issue.IssueWorkflowTest;
import org.sonarqube.tests.issue.IssuesPageTest;
import org.sonarqube.tests.issue.NewIssuesMeasureTest;
-import org.sonarqube.tests.qualityModel.MaintainabilityMeasureTest;
-import org.sonarqube.tests.qualityModel.MaintainabilityRatingMeasureTest;
-import org.sonarqube.tests.qualityModel.NewDebtRatioMeasureTest;
-import org.sonarqube.tests.qualityModel.ReliabilityMeasureTest;
-import org.sonarqube.tests.qualityModel.SecurityMeasureTest;
-import org.sonarqube.tests.qualityModel.TechnicalDebtAndIssueNewMeasuresTest;
-import org.sonarqube.tests.qualityModel.TechnicalDebtInIssueChangelogTest;
-import org.sonarqube.tests.qualityModel.TechnicalDebtTest;
import org.sonarqube.tests.rule.RulesPageTest;
import static util.ItUtils.pluginArtifact;
IssueWorkflowTest.class,
NewIssuesMeasureTest.class,
IssueCreationDateQPChangedTest.class,
- // debt
- MaintainabilityMeasureTest.class,
- MaintainabilityRatingMeasureTest.class,
- NewDebtRatioMeasureTest.class,
- ReliabilityMeasureTest.class,
- SecurityMeasureTest.class,
- TechnicalDebtInIssueChangelogTest.class,
- TechnicalDebtAndIssueNewMeasuresTest.class,
- TechnicalDebtTest.class,
- // ui
IssuesPageTest.class,
// rule
RulesPageTest.class,
+++ /dev/null
-/*
- * SonarQube
- * Copyright (C) 2009-2017 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.qualityModel;
-
-import com.google.common.base.Joiner;
-import com.google.common.collect.ImmutableSet;
-import com.sonar.orchestrator.Orchestrator;
-import java.util.Set;
-import org.junit.rules.ExternalResource;
-
-import static com.google.common.base.Preconditions.checkState;
-import static util.ItUtils.setServerProperty;
-
-/**
- * This rule should be used when dealing with technical debt properties, in order to always be sure that the properties are correctly reset between each tests.
- */
-public class DebtConfigurationRule extends ExternalResource {
-
- private static final String DEV_COST_PROPERTY = "sonar.technicalDebt.developmentCost";
- private static final String RATING_GRID_PROPERTY = "sonar.technicalDebt.ratingGrid";
-
- private static final String DEV_COST_LANGUAGE_PROPERTY = "languageSpecificParameters";
- private static final String DEV_COST_LANGUAGE_NAME_PROPERTY = DEV_COST_LANGUAGE_PROPERTY + ".0.language";
- private static final String DEV_COST_LANGUAGE_COST_PROPERTY = DEV_COST_LANGUAGE_PROPERTY + ".0.man_days";
-
- private static final Joiner COMA_JOINER = Joiner.on(",");
-
- private static final Set<String> DEV_COST_PROPERTIES = ImmutableSet.of(
- DEV_COST_PROPERTY,
- DEV_COST_LANGUAGE_PROPERTY,
- DEV_COST_LANGUAGE_NAME_PROPERTY,
- DEV_COST_LANGUAGE_COST_PROPERTY,
- RATING_GRID_PROPERTY);
-
- private final Orchestrator orchestrator;
-
- private DebtConfigurationRule(Orchestrator orchestrator) {
- this.orchestrator = orchestrator;
- }
-
- public static DebtConfigurationRule create(Orchestrator orchestrator) {
- return new DebtConfigurationRule(orchestrator);
- }
-
- @Override
- protected void before() throws Throwable {
- reset();
- }
-
- @Override
- protected void after() {
- reset();
- }
-
- public void reset() {
- resetDevelopmentCost();
- resetRatingGrid();
- }
-
- public DebtConfigurationRule updateDevelopmentCost(int developmentCost) {
- setProperty(DEV_COST_PROPERTY, Integer.toString(developmentCost));
- return this;
- }
-
- public DebtConfigurationRule updateLanguageDevelopmentCost(String language, int developmentCost) {
- setServerProperty(orchestrator, DEV_COST_LANGUAGE_PROPERTY, "0");
- setServerProperty(orchestrator, DEV_COST_LANGUAGE_NAME_PROPERTY, language);
- setServerProperty(orchestrator, DEV_COST_LANGUAGE_COST_PROPERTY, Integer.toString(developmentCost));
- return this;
- }
-
- public void resetDevelopmentCost() {
- for (String property : DEV_COST_PROPERTIES) {
- resetProperty(property);
- }
- }
-
- public DebtConfigurationRule updateRatingGrid(Double... ratingGrid) {
- checkState(ratingGrid.length == 4, "Rating grid must contains 4 values");
- setProperty(RATING_GRID_PROPERTY, COMA_JOINER.join(ratingGrid));
- return this;
- }
-
- public DebtConfigurationRule resetRatingGrid() {
- resetProperty(RATING_GRID_PROPERTY);
- return this;
- }
-
- private void setProperty(String property, String value) {
- setServerProperty(orchestrator, property, value);
- }
-
- private void resetProperty(String property) {
- setProperty(property, null);
- }
-
-}
import com.sonar.orchestrator.Orchestrator;
import com.sonar.orchestrator.build.SonarScanner;
-import org.sonarqube.tests.Category2Suite;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
+import org.sonarqube.qa.util.Tester;
import util.ItUtils;
import static org.assertj.core.api.Assertions.assertThat;
private static final String EFFORT_TO_REACH_MAINTAINABILITY_RATING_A_METRIC = "effort_to_reach_maintainability_rating_a";
@ClassRule
- public static Orchestrator orchestrator = Category2Suite.ORCHESTRATOR;
+ public static Orchestrator orchestrator = QualityModelSuite.ORCHESTRATOR;
@Rule
- public DebtConfigurationRule debtConfiguration = DebtConfigurationRule.create(orchestrator);
+ public Tester tester = new Tester(orchestrator);
@Before
public void init() {
- orchestrator.resetData();
-
// Set rating grid values to not depend from default value
- debtConfiguration.updateRatingGrid(0.1d, 0.2d, 0.5d, 1d);
+ tester.qModel().updateRatingGrid(0.1d, 0.2d, 0.5d, 1d);
orchestrator.getServer().provisionProject(PROJECT, PROJECT);
}
import com.sonar.orchestrator.Orchestrator;
import com.sonar.orchestrator.build.SonarScanner;
-import org.sonarqube.tests.Category2Suite;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
+import org.sonarqube.qa.util.Tester;
import util.ItUtils;
import static org.assertj.core.api.Assertions.assertThat;
private static final String FILE = "com.sonarsource.it.samples:multi-modules-sample:module_a:module_a1:src/main/xoo/com/sonar/it/samples/modules/a1/HelloA1.xoo";
@ClassRule
- public static Orchestrator orchestrator = Category2Suite.ORCHESTRATOR;
+ public static Orchestrator orchestrator = QualityModelSuite.ORCHESTRATOR;
@Rule
- public DebtConfigurationRule debtConfiguration = DebtConfigurationRule.create(orchestrator);
+ public Tester tester = new Tester(orchestrator);
@Before
public void init() {
- orchestrator.resetData();
-
// Set rating grid values to not depend from default value
- debtConfiguration.updateRatingGrid(0.1d, 0.2d, 0.5d, 1d);
+ tester.qModel().updateRatingGrid(0.1d, 0.2d, 0.5d, 1d);
}
@Test
assertThat(getMeasureAsDouble(orchestrator, "sample", "sqale_rating")).isEqualTo(1);
- debtConfiguration.updateDevelopmentCost(2);
+ tester.qModel().updateDevelopmentCost(2);
orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample")));
assertThat(getMeasureAsDouble(orchestrator, "sample", "sqale_rating")).isEqualTo(4);
assertThat(getMeasureAsDouble(orchestrator, PROJECT, "sqale_rating")).isEqualTo(1);
- debtConfiguration.updateLanguageDevelopmentCost("xoo", 1);
+ tester.qModel().updateLanguageDevelopmentCost("xoo", 1);
orchestrator.executeBuild(
SonarScanner.create(projectDir("shared/xoo-multi-modules-sample"))
.setProfile("one-issue-per-line"));
assertThat(getMeasureAsDouble(orchestrator, "sample", "sqale_rating")).isEqualTo(1);
- debtConfiguration.updateRatingGrid(0.001d, 0.005d, 0.01d, 0.015d);
+ tester.qModel().updateRatingGrid(0.001d, 0.005d, 0.01d, 0.015d);
orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample")));
assertThat(getMeasureAsDouble(orchestrator, "sample", "sqale_rating")).isEqualTo(5);
import com.sonar.orchestrator.Orchestrator;
import java.util.Date;
import javax.annotation.Nullable;
-import org.junit.AfterClass;
-import org.junit.Before;
import org.junit.ClassRule;
+import org.junit.Rule;
import org.junit.Test;
-import org.sonarqube.tests.Category2Suite;
+import org.sonarqube.qa.util.Tester;
import util.ItUtils;
import static org.apache.commons.lang.time.DateUtils.addDays;
import static org.assertj.core.api.Assertions.within;
import static util.ItUtils.formatDate;
import static util.ItUtils.getLeakPeriodValue;
-import static util.ItUtils.resetPeriod;
-import static util.ItUtils.setServerProperty;
import static util.ItUtils.toDate;
/**
public class NewDebtRatioMeasureTest {
private static final String NEW_DEBT_RATIO_METRIC_KEY = "new_sqale_debt_ratio";
-
private static final Date FIRST_COMMIT_DATE = toDate("2016-09-01");
private static final Date SECOND_COMMIT_DATE = toDate("2016-09-17");
private static final Date THIRD_COMMIT_DATE = toDate("2016-09-20");
@ClassRule
- public static Orchestrator orchestrator = Category2Suite.ORCHESTRATOR;
-
- @AfterClass
- public static void reset() throws Exception {
- resetPeriod(orchestrator);
- }
+ public static Orchestrator orchestrator = QualityModelSuite.ORCHESTRATOR;
- @Before
- public void cleanUpAnalysisData() {
- orchestrator.resetData();
- }
+ @Rule
+ public Tester tester = new Tester(orchestrator);
@Test
public void new_debt_ratio_is_computed_from_new_debt_and_new_ncloc_count_per_file() throws Exception {
- setServerProperty(orchestrator, "sonar.leak.period", "previous_version");
+ tester.settings().setGlobalSettings("sonar.leak.period", "previous_version");
// run analysis on the day of after the first commit, with 'one-issue-per-line' profile
defineQualityProfile("one-issue-per-line");
@Test
public void compute_new_debt_ratio_using_number_days_in_leak_period() throws Exception {
- setServerProperty(orchestrator, "sonar.leak.period", "30");
+ tester.settings().setGlobalSettings("sonar.leak.period", "30");
// run analysis on the day of after the first commit, with 'one-issue-per-line' profile
defineQualityProfile("one-issue-per-line");
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 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.qualityModel;
+
+import com.sonar.orchestrator.Orchestrator;
+import org.junit.ClassRule;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+import static util.ItUtils.xooPlugin;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+ MaintainabilityMeasureTest.class,
+ MaintainabilityRatingMeasureTest.class,
+ NewDebtRatioMeasureTest.class,
+ ReliabilityMeasureTest.class,
+ SecurityMeasureTest.class,
+ TechnicalDebtAndIssueNewMeasuresTest.class,
+ TechnicalDebtInIssueChangelogTest.class,
+ TechnicalDebtTest.class,
+})
+public class QualityModelSuite {
+
+ @ClassRule
+ public static final Orchestrator ORCHESTRATOR = Orchestrator.builderEnv()
+ .addPlugin(xooPlugin())
+
+ // reduce memory for Elasticsearch
+ .setServerProperty("sonar.search.javaOpts", "-Xms128m -Xmx128m")
+
+ .build();
+
+}
import com.sonar.orchestrator.Orchestrator;
import com.sonar.orchestrator.build.SonarScanner;
-import org.sonarqube.tests.Category2Suite;
import java.util.Map;
import org.junit.Before;
import org.junit.ClassRule;
+import org.junit.Rule;
import org.junit.Test;
+import org.sonarqube.qa.util.Tester;
import org.sonarqube.ws.WsMeasures;
import util.ItUtils;
private static final String[] METRICS = new String[] {BUGS_METRIC, RELIABILITY_RATING_METRIC, RELIABILITY_REMEDIATION_EFFORT_METRIC};
@ClassRule
- public static Orchestrator orchestrator = Category2Suite.ORCHESTRATOR;
+ public static Orchestrator orchestrator = QualityModelSuite.ORCHESTRATOR;
- @Before
- public void init() {
- orchestrator.resetData();
+ @Rule
+ public Tester tester = new Tester(orchestrator);
+ @Before
+ public void setUp() {
orchestrator.getServer().provisionProject(PROJECT, PROJECT);
}
import com.sonar.orchestrator.Orchestrator;
import com.sonar.orchestrator.build.SonarScanner;
-import org.sonarqube.tests.Category2Suite;
import java.util.Map;
import org.junit.Before;
import org.junit.ClassRule;
+import org.junit.Rule;
import org.junit.Test;
+import org.sonarqube.qa.util.Tester;
import org.sonarqube.ws.WsMeasures;
import util.ItUtils;
private static final String[] METRICS = new String[] {VULNERABILITIES_METRIC, SECURITY_REMEDIATION_EFFORT_METRIC, SECURITY_RATING_METRIC};
@ClassRule
- public static Orchestrator orchestrator = Category2Suite.ORCHESTRATOR;
+ public static Orchestrator orchestrator = QualityModelSuite.ORCHESTRATOR;
+
+ @Rule
+ public Tester tester = new Tester(orchestrator);
@Before
public void init() {
- orchestrator.resetData();
-
orchestrator.getServer().provisionProject(PROJECT, PROJECT);
}
import com.sonar.orchestrator.Orchestrator;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
-import org.junit.AfterClass;
-import org.junit.Before;
import org.junit.ClassRule;
+import org.junit.Rule;
import org.junit.Test;
-import org.sonarqube.tests.Category2Suite;
+import org.sonarqube.qa.util.Tester;
import util.ItUtils;
import static org.assertj.core.api.Assertions.assertThat;
import static util.ItUtils.getLeakPeriodValue;
-import static util.ItUtils.setServerProperty;
/**
* SONAR-4776, SONAR-9534
private static final String DATE_31_DAYS_AGO = DateTimeFormatter.ofPattern("yyyy-MM-dd").format(LocalDate.now().minusDays(31));
@ClassRule
- public static Orchestrator orchestrator = Category2Suite.ORCHESTRATOR;
+ public static Orchestrator orchestrator = QualityModelSuite.ORCHESTRATOR;
- @AfterClass
- public static void resetPeriod() throws Exception {
- ItUtils.resetPeriod(orchestrator);
- }
-
- @Before
- public void cleanUpAnalysisData() {
- orchestrator.resetData();
- }
+ @Rule
+ public Tester tester = new Tester(orchestrator);
@Test
public void since_30_days_with_constant_effort() throws Exception {
- setServerProperty(orchestrator, "sonar.leak.period", "30");
- defineQualityProfile("one-issue-per-line");
+ tester.settings().setGlobalSettings("sonar.leak.period", "30");
+ restoreQualityProfile("one-issue-per-line");
provisionSampleProject();
// Execute an analysis in the past to have a past snapshot without any issues
@Test
public void since_30_days_with_effort_change() throws Exception {
- setServerProperty(orchestrator, "sonar.leak.period", "30");
- defineQualityProfile("one-issue-per-line");
+ tester.settings().setGlobalSettings("sonar.leak.period", "30");
+ restoreQualityProfile("one-issue-per-line");
provisionSampleProject();
// Execute an analysis in the past to have a past snapshot without any issues
@Test
public void since_previous_version_with_constant_effort() throws Exception {
- setServerProperty(orchestrator, "sonar.leak.period", "previous_version");
- defineQualityProfile("one-issue-per-line");
+ tester.settings().setGlobalSettings("sonar.leak.period", "previous_version");
+ restoreQualityProfile("one-issue-per-line");
provisionSampleProject();
// Execute an analysis in the past to have a past snapshot without any issues
@Test
public void since_previous_version_with_effort_change() throws Exception {
- setServerProperty(orchestrator, "sonar.leak.period", "previous_version");
- defineQualityProfile("one-issue-per-line");
+ tester.settings().setGlobalSettings( "sonar.leak.period", "previous_version");
+ restoreQualityProfile("one-issue-per-line");
provisionSampleProject();
// Execute an analysis in the past to have a past snapshot without any issues
orchestrator.getServer().provisionProject("sample", "sample");
}
- private void defineQualityProfile(String qualityProfileKey) {
+ private void restoreQualityProfile(String qualityProfileKey) {
ItUtils.restoreProfile(orchestrator, getClass().getResource("/measure/" + qualityProfileKey + ".xml"));
}
import com.sonar.orchestrator.Orchestrator;
import com.sonar.orchestrator.build.SonarScanner;
-import org.sonarqube.tests.Category2Suite;
import java.util.List;
-import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
-import org.sonar.wsclient.issue.Issue;
-import org.sonar.wsclient.issue.IssueClient;
-import org.sonar.wsclient.issue.IssueQuery;
+import org.sonarqube.qa.util.Tester;
import org.sonarqube.ws.Issues;
+import org.sonarqube.ws.client.issue.SearchWsRequest;
import util.ItUtils;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.tuple;
-import static util.ItUtils.newAdminWsClient;
import static util.ItUtils.projectDir;
/**
public class TechnicalDebtInIssueChangelogTest {
@ClassRule
- public static Orchestrator orchestrator = Category2Suite.ORCHESTRATOR;
+ public static Orchestrator orchestrator = QualityModelSuite.ORCHESTRATOR;
@Rule
- public DebtConfigurationRule debtConfiguration = DebtConfigurationRule.create(orchestrator);
-
- @Before
- public void deleteAnalysisData() {
- orchestrator.resetData();
- }
+ public Tester tester = new Tester(orchestrator);
@Test
public void display_debt_in_issue_changelog() throws Exception {
orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample"))
.setProperties("sonar.oneIssuePerFile.effortToFix", "10"));
- IssueClient issueClient = orchestrator.getServer().wsClient().issueClient();
- Issue issue = issueClient.find(IssueQuery.create()).list().get(0);
+ Issues.Issue firstIssue = tester.wsClient().issues().search(new SearchWsRequest()).getIssues(0);
- List<Issues.ChangelogWsResponse.Changelog> changes = changelog(issue.key()).getChangelogList();
+ List<Issues.ChangelogWsResponse.Changelog> changes = changelog(firstIssue.getKey()).getChangelogList();
assertThat(changes).hasSize(1);
assertThat(changes.get(0).getDiffsList())
.extracting(Issues.ChangelogWsResponse.Changelog.Diff::getKey, Issues.ChangelogWsResponse.Changelog.Diff::getOldValue, Issues.ChangelogWsResponse.Changelog.Diff::getNewValue)
.containsOnly(tuple("effort", "10", "100"));
}
- private static Issues.ChangelogWsResponse changelog(String issueKey) {
- return newAdminWsClient(orchestrator).issues().changelog(issueKey);
+ private Issues.ChangelogWsResponse changelog(String issueKey) {
+ return tester.wsClient().issues().changelog(issueKey);
}
}
import com.sonar.orchestrator.Orchestrator;
import com.sonar.orchestrator.build.SonarScanner;
-import org.sonarqube.tests.Category2Suite;
import java.util.List;
-import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
-import org.sonar.wsclient.issue.Issue;
-import org.sonar.wsclient.issue.IssueQuery;
+import org.sonarqube.qa.util.Tester;
+import org.sonarqube.ws.Issues;
+import org.sonarqube.ws.client.issue.SearchWsRequest;
import util.ItUtils;
import static org.assertj.core.api.Assertions.assertThat;
public class TechnicalDebtTest {
@ClassRule
- public static Orchestrator orchestrator = Category2Suite.ORCHESTRATOR;
+ public static Orchestrator orchestrator = QualityModelSuite.ORCHESTRATOR;
@Rule
- public DebtConfigurationRule debtConfiguration = DebtConfigurationRule.create(orchestrator);
-
- @Before
- public void deleteAnalysisData() {
- orchestrator.resetData();
- }
+ public Tester tester = new Tester(orchestrator);
/**
* SONAR-4716
orchestrator.executeBuild(SonarScanner.create(projectDir("shared/xoo-sample")));
// All the issues should have a technical debt
- List<Issue> issues = orchestrator.getServer().wsClient().issueClient().find(IssueQuery.create()).list();
+ List<Issues.Issue> issues = tester.wsClient().issues().search(new SearchWsRequest()).getIssuesList();
assertThat(issues).isNotEmpty();
- for (Issue issue : issues) {
- assertThat(issue.debt()).isEqualTo("1min");
+ for (Issues.Issue issue : issues) {
+ assertThat(issue.getDebt()).isEqualTo("1min");
}
}