]> source.dussan.org Git - sonarqube.git/commitdiff
Ability to use functional categories in integration tests
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Fri, 10 Nov 2017 09:44:38 +0000 (10:44 +0100)
committerEric Hartmann <hartmann.eric@gmail.Com>
Tue, 14 Nov 2017 12:10:17 +0000 (13:10 +0100)
applied to "duplication" category

cix.sh
tests/pom.xml
tests/src/test/java/org/sonarqube/tests/Category4Suite.java
tests/src/test/java/org/sonarqube/tests/duplication/CrossModuleDuplicationsTest.java
tests/src/test/java/org/sonarqube/tests/duplication/CrossProjectDuplicationsOnRemoveFileTest.java
tests/src/test/java/org/sonarqube/tests/duplication/CrossProjectDuplicationsTest.java
tests/src/test/java/org/sonarqube/tests/duplication/DuplicationSuite.java [new file with mode: 0644]
tests/src/test/java/org/sonarqube/tests/duplication/DuplicationsTest.java
tests/src/test/java/org/sonarqube/tests/duplication/NewDuplicationsTest.java
tests/src/test/java/org/sonarqube/tests/lite/LiteTest.java

diff --git a/cix.sh b/cix.sh
index 02b2e4dd647af188cd63ffb74f3c55999213fb16..6d7f8d0fd5b1aef2e36139b170c31f4c2a12ea13 100755 (executable)
--- a/cix.sh
+++ b/cix.sh
@@ -3,6 +3,16 @@
 
 set -euo pipefail
 
+function runCategory {
+  mvn verify \
+    -f tests/pom.xml \
+    -Dcategory=$CATEGORY \
+    -Dorchestrator.configUrl=http://infra.internal.sonarsource.com/jenkins/orch-$DB_ENGINE.properties \
+    -Dorchestrator.workspace=target/$CATEGORY
+    -Dwith-db-drivers \
+    -B -e -V
+}
+
 case "$RUN_ACTIVITY" in
 
   run-db-unit-tests-*)
@@ -12,11 +22,46 @@ case "$RUN_ACTIVITY" in
 
   run-db-integration-tests-*)
     DB_ENGINE=$(sed "s/run-db-integration-tests-//g" <<< $RUN_ACTIVITY | cut -d \- -f 1)
-    CATEGORY=$(sed "s/run-db-integration-tests-//g" <<< $RUN_ACTIVITY | cut -d \- -f 2)
+    CATEGORY_GROUP=$(sed "s/run-db-integration-tests-//g" <<< $RUN_ACTIVITY | cut -d \- -f 2)
+
     if [[ "$GITHUB_BRANCH" == "PULLREQUEST-"* ]] && [[ "$DB_ENGINE" != "postgresql93" ]]; then
-     exit 0
+      # execute PR QA only on postgres
+      exit 0
     else
-     ./run-integration-tests.sh "${CATEGORY}" "http://infra.internal.sonarsource.com/jenkins/orch-${DB_ENGINE}.properties"
+      mvn clean package -B -e -V -f tests/plugins/pom.xml
+
+      case "$CATEGORY_GROUP" in
+        Category1)
+          CATEGORY=Category1 && runCategory
+          ;;
+
+        Category2)
+          CATEGORY=Category2 && runCategory
+          ;;
+
+        Category3)
+          CATEGORY=Category3 && runCategory
+          ;;
+
+        Category4)
+          CATEGORY=Category4 && runCategory
+          CATEGORY=duplication && runCategory
+          ;;
+
+        Category5)
+          CATEGORY=Category5 && runCategory
+          ;;
+
+        Category6)
+          CATEGORY=Category6 && runCategory
+          ;;
+
+        *)
+          echo "unknown CATEGORY_GROUP: $CATEGORY_GROUP"
+          exit 1
+          ;;
+      esac
+
     fi
     ;;
 
index 4850c7b66e29efc9cac674516b3ec0d8f7b8966a..9c2de4bb1a42aa9a9738b38e43ae298f0306ab17 100644 (file)
     <dependency>
       <groupId>org.sonarsource.sonarqube</groupId>
       <artifactId>sonar-application</artifactId>
-      <version>${project.parent.version}</version>
+      <version>${project.version}</version>
       <type>zip</type>
       <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>org.sonarsource.sonarqube</groupId>
       <artifactId>sonar-qa-util</artifactId>
-      <version>${project.parent.version}</version>
+      <version>${project.version}</version>
       <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.sonarsource.sonarqube</groupId>
       <artifactId>sonar-process</artifactId>
-      <version>${project.parent.version}</version>
+      <version>${project.version}</version>
       <scope>provided</scope>
     </dependency>
     <dependency>
       <groupId>org.sonarsource.sonarqube</groupId>
       <artifactId>sonar-ws</artifactId>
-      <version>${project.parent.version}</version>
+      <version>${project.version}</version>
       <scope>provided</scope>
     </dependency>
     <dependency>
           </argLine>
           <skipTests>${skipIts}</skipTests>
           <includes>
+            <include>*/${category}/*Suite.java</include>
+
+            <!-- deprecated categories -->
             <include>*/*${category}Suite.java</include>
           </includes>
         </configuration>
index 26e5a65c75f0d377f2059d6c501887a53532822e..55361639e587e772a494c7692435668329315504 100644 (file)
@@ -30,10 +30,6 @@ import org.sonarqube.tests.ce.CeWsTest;
 import org.sonarqube.tests.component.ComponentsWsTest;
 import org.sonarqube.tests.component.ProjectsWsTest;
 import org.sonarqube.tests.dbCleaner.PurgeTest;
-import org.sonarqube.tests.duplication.CrossProjectDuplicationsOnRemoveFileTest;
-import org.sonarqube.tests.duplication.CrossProjectDuplicationsTest;
-import org.sonarqube.tests.duplication.DuplicationsTest;
-import org.sonarqube.tests.duplication.NewDuplicationsTest;
 import org.sonarqube.tests.organization.RootUserTest;
 import org.sonarqube.tests.projectEvent.EventTest;
 import org.sonarqube.tests.projectEvent.ProjectActivityPageTest;
@@ -80,11 +76,6 @@ import static util.ItUtils.xooPlugin;
   // analysis exclusion
   FileExclusionsTest.class,
   IssueExclusionsTest.class,
-  // duplication
-  CrossProjectDuplicationsTest.class,
-  CrossProjectDuplicationsOnRemoveFileTest.class,
-  DuplicationsTest.class,
-  NewDuplicationsTest.class,
   // db cleaner
   PurgeTest.class,
   // project event
index a4588635e373d2b10b3cfb8f92c697a865a94851..e918190a6655766e9e1811aec1c24b08756388c1 100644 (file)
@@ -22,17 +22,16 @@ package org.sonarqube.tests.duplication;
 import com.google.common.collect.ImmutableMap;
 import com.sonar.orchestrator.Orchestrator;
 import com.sonar.orchestrator.build.SonarScanner;
-import org.sonarqube.tests.Category4Suite;
 import java.io.File;
 import java.io.IOException;
 import java.util.Map;
 import org.apache.commons.io.FileUtils;
 import org.junit.Before;
-import org.junit.BeforeClass;
 import org.junit.ClassRule;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
+import org.sonarqube.qa.util.Tester;
 import util.ItUtils;
 
 import static org.assertj.core.api.Assertions.assertThat;
@@ -44,19 +43,16 @@ public class CrossModuleDuplicationsTest {
   private File projectDir;
 
   @ClassRule
-  public static Orchestrator orchestrator = Category4Suite.ORCHESTRATOR;
+  public static Orchestrator orchestrator = DuplicationSuite.ORCHESTRATOR;
 
   @Rule
   public TemporaryFolder temp = new TemporaryFolder();
 
-  @BeforeClass
-  public static void analyzeProjects() {
-
-  }
+  @Rule
+  public Tester tester = new Tester(orchestrator);
 
   @Before
-  public void setUpProject() throws IOException {
-    orchestrator.resetData();
+  public void setUp() throws IOException {
     ItUtils.restoreProfile(orchestrator, getClass().getResource("/duplication/xoo-duplication-profile.xml"));
 
     FileUtils.copyDirectory(ItUtils.projectDir(PROJECT_DIR), temp.getRoot());
@@ -116,7 +112,7 @@ public class CrossModuleDuplicationsTest {
     verifyDuplicationMeasures(PROJECT_KEY + ":module2", 0, 0, 0, 0);
   }
 
-  private static SonarScanner analyzeProject(File projectDir, String projectKey, boolean create, String... additionalProperties) {
+  private static void analyzeProject(File projectDir, String projectKey, boolean create, String... additionalProperties) {
     if (create) {
       orchestrator.getServer().provisionProject(projectKey, projectKey);
       orchestrator.getServer().associateProjectToQualityProfile(projectKey, "xoo", "xoo-duplication-profile");
@@ -129,9 +125,7 @@ public class CrossModuleDuplicationsTest {
       builder.put(additionalProperties[i], additionalProperties[i + 1]);
     }
     SonarScanner scan = sonarRunner.setDebugLogs(true).setProperties(builder.build());
-    orchestrator.executeBuild(scan);
-    return scan;
-  }
+    orchestrator.executeBuild(scan); }
 
   private static void verifyDuplicationMeasures(String componentKey, int duplicatedBlocks, int duplicatedLines, int duplicatedFiles, double duplicatedLinesDensity) {
     Map<String, Double> measures = getMeasuresAsDoubleByMetricKey(orchestrator, componentKey, "duplicated_lines", "duplicated_blocks", "duplicated_files", "duplicated_lines_density");
index 8813c2cb053b2a04aeea2806b97b1c5921aa6847..9846fb89fc99ffcdfc2d82690326e524027d4134 100644 (file)
 package org.sonarqube.tests.duplication;
 
 import com.sonar.orchestrator.Orchestrator;
-import org.sonarqube.tests.Category4Suite;
 import org.apache.commons.io.IOUtils;
-import org.junit.BeforeClass;
 import org.junit.ClassRule;
+import org.junit.Rule;
 import org.junit.Test;
+import org.sonarqube.qa.util.Tester;
+import org.sonarqube.ws.client.GetRequest;
+import org.sonarqube.ws.client.PostRequest;
 import util.ItUtils;
 
 import static org.assertj.core.api.Assertions.assertThat;
@@ -35,45 +37,37 @@ import static util.selenium.Selenese.runSelenese;
 
 public class CrossProjectDuplicationsOnRemoveFileTest {
 
-  static final String ORIGIN_PROJECT = "origin-project";
-  static final String DUPLICATE_PROJECT = "duplicate-project";
-  static final String DUPLICATE_FILE = DUPLICATE_PROJECT + ":src/main/xoo/sample/File1.xoo";
+  private static final String ORIGIN_PROJECT = "origin-project";
+  private static final String DUPLICATE_PROJECT = "duplicate-project";
+  private static final String DUPLICATE_FILE = DUPLICATE_PROJECT + ":src/main/xoo/sample/File1.xoo";
 
   @ClassRule
-  public static Orchestrator orchestrator = Category4Suite.ORCHESTRATOR;
+  public static Orchestrator orchestrator = DuplicationSuite.ORCHESTRATOR;
 
-  @BeforeClass
-  public static void analyzeProjects() {
-    orchestrator.resetData();
-    ItUtils.restoreProfile(orchestrator, CrossProjectDuplicationsOnRemoveFileTest.class.getResource("/duplication/xoo-duplication-profile.xml"));
+  @Rule
+  public Tester tester = new Tester(orchestrator);
 
+  @Test
+  public void duplications_show_ws_does_not_contain_key_of_deleted_file() throws Exception {
+    // analyze projects
+    ItUtils.restoreProfile(orchestrator, CrossProjectDuplicationsOnRemoveFileTest.class.getResource("/duplication/xoo-duplication-profile.xml"));
     analyzeProject(ORIGIN_PROJECT, "duplications/cross-project/origin");
     analyzeProject(DUPLICATE_PROJECT, "duplications/cross-project/duplicate");
 
     // Remove origin project
-    orchestrator.getServer().adminWsClient().post("api/projects/bulk_delete", "keys", ORIGIN_PROJECT);
+    tester.wsClient().wsConnector().call(new PostRequest("api/projects/bulk_delete").setParam("keys", ORIGIN_PROJECT));
     assertThat(getComponent(orchestrator, ORIGIN_PROJECT)).isNull();
-  }
-
-  @Test
-  public void duplications_show_ws_does_not_contain_key_of_deleted_file() throws Exception {
-    String duplication = orchestrator.getServer().adminWsClient().get("api/duplications/show", "key", DUPLICATE_FILE);
 
+    // api/duplications/show does not return the deleted file
+    String json = tester.wsClient().wsConnector().call(new GetRequest("api/duplications/show").setParam("key", DUPLICATE_FILE)).content();
     assertEquals(IOUtils.toString(CrossProjectDuplicationsTest.class.getResourceAsStream(
       "/duplication/CrossProjectDuplicationsOnRemoveFileTest/duplications_on_removed_file-expected.json"), "UTF-8"),
-      duplication, false);
-
+      json, false);
     // Only one file should be reference, so the reference 2 on origin-project must not exist
-    assertThat(duplication).doesNotContain("\"2\"");
-    assertThat(duplication).doesNotContain("origin-project");
-  }
+    assertThat(json).doesNotContain("\"2\"");
+    assertThat(json).doesNotContain("origin-project");
 
-  /**
-   * SONAR-3277
-   */
-  @Test
-  public void display_message_in_viewer_when_duplications_with_deleted_files_are_found() throws Exception {
-    // TODO stas, please replace this IT by a medium test
+    // SONAR-3277 display message in source viewer when duplications on deleted files are found
     runSelenese(orchestrator,
       "/duplication/CrossProjectDuplicationsOnRemoveFileTest/duplications-with-deleted-project.html");
   }
index 81708b22d2cebcb9d81886c87dfc7a6fda7bb242..10d46f72611386df2419fd9c5a03a884690b75f1 100644 (file)
@@ -21,13 +21,13 @@ package org.sonarqube.tests.duplication;
 
 import com.google.common.collect.ObjectArrays;
 import com.sonar.orchestrator.Orchestrator;
-import org.sonarqube.tests.Category4Suite;
 import java.util.Map;
 import org.apache.commons.io.IOUtils;
-import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.ClassRule;
 import org.junit.Test;
+import org.junit.rules.RuleChain;
+import org.sonarqube.qa.util.Tester;
 import org.sonarqube.ws.client.GetRequest;
 import org.sonarqube.ws.client.issue.SearchWsRequest;
 import util.ItUtils;
@@ -40,31 +40,32 @@ import static util.ItUtils.getMeasureAsDouble;
 import static util.ItUtils.getMeasuresAsDoubleByMetricKey;
 import static util.ItUtils.newAdminWsClient;
 import static util.ItUtils.runProjectAnalysis;
-import static util.ItUtils.setServerProperty;
 import static util.selenium.Selenese.runSelenese;
 
 public class CrossProjectDuplicationsTest {
 
-  static final String ORIGIN_PROJECT = "origin-project";
-  static final String DUPLICATE_PROJECT = "duplicate-project";
-  static final String PROJECT_WITH_EXCLUSION = "project-with-exclusion";
-  static final String PROJECT_WITHOUT_ENOUGH_TOKENS = "project_without_enough_tokens";
-
-  static final String DUPLICATE_FILE = DUPLICATE_PROJECT + ":src/main/xoo/sample/File1.xoo";
-  static final String BRANCH = "with-branch";
-
-  static final String ORIGIN_PATH = "duplications/cross-project/origin";
-  static final String DUPLICATE_PATH = "duplications/cross-project/duplicate";
+  private static final String ORIGIN_PROJECT = "origin-project";
+  private static final String DUPLICATE_PROJECT = "duplicate-project";
+  private static final String PROJECT_WITH_EXCLUSION = "project-with-exclusion";
+  private static final String PROJECT_WITHOUT_ENOUGH_TOKENS = "project_without_enough_tokens";
+  private static final String DUPLICATE_FILE = DUPLICATE_PROJECT + ":src/main/xoo/sample/File1.xoo";
+  private static final String BRANCH = "with-branch";
+  private static final String ORIGIN_PATH = "duplications/cross-project/origin";
+  private static final String DUPLICATE_PATH = "duplications/cross-project/duplicate";
 
   @ClassRule
-  public static Orchestrator orchestrator = Category4Suite.ORCHESTRATOR;
+  public static Orchestrator orchestrator = DuplicationSuite.ORCHESTRATOR;
 
   @ClassRule
   public static final IssueRule issueRule = IssueRule.from(orchestrator);
 
+  private static Tester tester = new Tester(orchestrator);
+
+  @ClassRule
+  public static RuleChain ruleChain = RuleChain.outerRule(orchestrator).around(tester);
+
   @BeforeClass
   public static void analyzeProjects() {
-    orchestrator.resetData();
     ItUtils.restoreProfile(orchestrator, CrossProjectDuplicationsTest.class.getResource("/duplication/xoo-duplication-profile.xml"));
 
     analyzeProject(ORIGIN_PROJECT, ORIGIN_PATH);
@@ -73,15 +74,10 @@ public class CrossProjectDuplicationsTest {
     analyzeProject(PROJECT_WITH_EXCLUSION, DUPLICATE_PATH, "sonar.cpd.exclusions", "**/File*");
 
     // Set minimum tokens to a big value in order to not get duplications
-    setServerProperty(orchestrator, "sonar.cpd.xoo.minimumTokens", "1000");
+    tester.settings().setGlobalSettings("sonar.cpd.xoo.minimumTokens", "1000");
     analyzeProject(PROJECT_WITHOUT_ENOUGH_TOKENS, DUPLICATE_PATH);
   }
 
-  @AfterClass
-  public static void resetServerProperties() throws Exception {
-    setServerProperty(orchestrator, "sonar.cpd.xoo.minimumTokens", null);
-  }
-
   @Test
   public void origin_project_has_no_duplication_as_it_has_not_been_analyzed_twice() throws Exception {
     assertProjectHasNoDuplication(ORIGIN_PROJECT);
diff --git a/tests/src/test/java/org/sonarqube/tests/duplication/DuplicationSuite.java b/tests/src/test/java/org/sonarqube/tests/duplication/DuplicationSuite.java
new file mode 100644 (file)
index 0000000..6d28b0b
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * 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.duplication;
+
+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({
+  CrossModuleDuplicationsTest.class,
+  CrossProjectDuplicationsOnRemoveFileTest.class,
+  CrossProjectDuplicationsTest.class,
+  DuplicationsTest.class,
+  NewDuplicationsTest.class,
+})
+public class DuplicationSuite {
+  @ClassRule
+  public static final Orchestrator ORCHESTRATOR = Orchestrator.builderEnv()
+    .addPlugin(xooPlugin())
+
+    // reduce Elasticsearch memory
+    .setServerProperty("sonar.search.javaOpts", "-Xms128m -Xmx128m")
+
+    .build();
+}
index a81249726362020eaf68caa54afaf3ba2ce43b3d..671513c579a997441dc63cf3c3ceab67b0887b2a 100644 (file)
@@ -21,15 +21,14 @@ package org.sonarqube.tests.duplication;
 
 import com.google.common.collect.ObjectArrays;
 import com.sonar.orchestrator.Orchestrator;
-import org.sonarqube.tests.Category4Suite;
 import java.util.Map;
 import org.apache.commons.io.IOUtils;
-import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.ClassRule;
 import org.junit.Test;
+import org.junit.rules.RuleChain;
+import org.sonarqube.qa.util.Tester;
 import org.sonarqube.ws.client.GetRequest;
-import org.sonarqube.ws.client.WsClient;
 import org.sonarqube.ws.client.WsResponse;
 import org.sonarqube.ws.client.issue.SearchWsRequest;
 import util.ItUtils;
@@ -40,42 +39,34 @@ import static java.util.Collections.singletonList;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.skyscreamer.jsonassert.JSONAssert.assertEquals;
 import static util.ItUtils.getMeasuresAsDoubleByMetricKey;
-import static util.ItUtils.newAdminWsClient;
 import static util.ItUtils.runProjectAnalysis;
-import static util.ItUtils.setServerProperty;
 
 public class DuplicationsTest {
 
-  static final String DUPLICATIONS = "file-duplications";
-  static final String DUPLICATIONS_WITH_EXCLUSIONS = "file-duplications-with-exclusions";
-  static final String WITHOUT_ENOUGH_TOKENS = "project_without_enough_tokens";
+  private static final String DUPLICATIONS = "file-duplications";
+  private static final String DUPLICATIONS_WITH_EXCLUSIONS = "file-duplications-with-exclusions";
+  private static final String WITHOUT_ENOUGH_TOKENS = "project_without_enough_tokens";
 
   @ClassRule
-  public static Orchestrator orchestrator = Category4Suite.ORCHESTRATOR;
+  public static Orchestrator orchestrator = DuplicationSuite.ORCHESTRATOR;
 
   @ClassRule
   public static final IssueRule issueRule = IssueRule.from(orchestrator);
 
-  private static WsClient adminWsClient;
+  private static Tester tester = new Tester(orchestrator);
+
+  @ClassRule
+  public static RuleChain ruleChain = RuleChain.outerRule(orchestrator).around(tester);
 
   @BeforeClass
   public static void analyzeProjects() {
-    orchestrator.resetData();
-
     ItUtils.restoreProfile(orchestrator, DuplicationsTest.class.getResource("/duplication/xoo-duplication-profile.xml"));
     analyzeProject(DUPLICATIONS);
     analyzeProject(DUPLICATIONS_WITH_EXCLUSIONS, "sonar.cpd.exclusions", "**/File*");
 
     // Set minimum tokens to a big value in order to not get duplications
-    setServerProperty(orchestrator, "sonar.cpd.xoo.minimumTokens", "1000");
+    tester.settings().setGlobalSettings("sonar.cpd.xoo.minimumTokens", "1000");
     analyzeProject(WITHOUT_ENOUGH_TOKENS);
-
-    adminWsClient = newAdminWsClient(orchestrator);
-  }
-
-  @AfterClass
-  public static void resetProperties() throws Exception {
-    setServerProperty(orchestrator, "sonar.cpd.xoo.minimumTokens", null);
   }
 
   private static Map<String, Double> getMeasures(String key) {
@@ -180,7 +171,7 @@ public class DuplicationsTest {
   // SONAR-9441
   @Test
   public void fail_properly_when_no_parameter() {
-    WsResponse result = adminWsClient.wsConnector().call(new GetRequest("api/duplications/show"));
+    WsResponse result = tester.wsClient().wsConnector().call(new GetRequest("api/duplications/show"));
 
     assertThat(result.code()).isEqualTo(HTTP_BAD_REQUEST);
     assertThat(result.content()).contains("Either 'uuid' or 'key' must be provided");
index c16b3441f5d029996338043411a649a71af1bf5f..76b6a277a55c40e5549121e122b5cc57b76fb995 100644 (file)
 package org.sonarqube.tests.duplication;
 
 import com.sonar.orchestrator.Orchestrator;
-import org.sonarqube.tests.Category4Suite;
 import java.util.Map;
 import org.assertj.core.data.Offset;
 import org.junit.BeforeClass;
 import org.junit.ClassRule;
 import org.junit.Test;
+import org.junit.rules.RuleChain;
+import org.sonarqube.qa.util.Tester;
 import org.sonarqube.ws.WsMeasures;
 
 import static java.lang.Double.parseDouble;
@@ -35,15 +36,18 @@ import static util.ItUtils.runProjectAnalysis;
 
 public class NewDuplicationsTest {
 
-  static final Offset<Double> DEFAULT_OFFSET = Offset.offset(0.1d);
+  private static final Offset<Double> DEFAULT_OFFSET = Offset.offset(0.1d);
 
   @ClassRule
-  public static Orchestrator orchestrator = Category4Suite.ORCHESTRATOR;
+  public static Orchestrator orchestrator = DuplicationSuite.ORCHESTRATOR;
+
+  private static Tester tester = new Tester(orchestrator);
+
+  @ClassRule
+  public static RuleChain ruleChain = RuleChain.outerRule(orchestrator).around(tester);
 
   @BeforeClass
   public static void analyzeProjects() {
-    orchestrator.resetData();
-
     runProjectAnalysis(orchestrator, "duplications/new-duplications-v1",
       "sonar.projectDate", "2015-02-01",
       "sonar.scm.disabled", "false");
index 2585f27d65ae20d5b4110a1616f77071c03df4cc..d1acdb6518813cc14f7cecb7ecae5f8c58ee9b97 100644 (file)
@@ -53,8 +53,7 @@ public class LiteTest {
   private static Tester tester = new Tester(orchestrator);
 
   @ClassRule
-  public static RuleChain ruleChain = RuleChain.outerRule(orchestrator)
-    .around(tester);
+  public static RuleChain ruleChain = RuleChain.outerRule(orchestrator).around(tester);
 
   @BeforeClass
   public static void setUp() {