]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-19558 Fix duplication indexes tests to support
authorLéo Geoffroy <leo.geoffroy@sonarsource.com>
Thu, 22 Jun 2023 15:50:35 +0000 (17:50 +0200)
committersonartech <sonartech@sonarsource.com>
Mon, 26 Jun 2023 20:03:54 +0000 (20:03 +0000)
server/sonar-ce-task-projectanalysis/src/it/java/org/sonar/ce/task/projectanalysis/step/LoadCrossProjectDuplicationsRepositoryStepIT.java
server/sonar-db-dao/src/it/java/org/sonar/db/duplication/DuplicationDaoIT.java

index 613c40d17e37dbcd1e37b42eda7a2905ad6d2c54..e1a812d52e9a00a79bf1f4027c72346ea2426f5a 100644 (file)
@@ -101,8 +101,7 @@ public class LoadCrossProjectDuplicationsRepositoryStepIT {
 
   @Before
   public void setUp() {
-    ComponentDto project = ComponentTesting.newPrivateProjectDto();
-    dbTester.components().insertComponent(project);
+    ComponentDto project = dbTester.components().insertPrivateProject().getMainBranchComponent();
     SnapshotDto projectSnapshot = SnapshotTesting.newAnalysis(project);
     dbClient.snapshotDao().insert(dbSession, projectSnapshot);
     dbSession.commit();
@@ -315,8 +314,7 @@ public class LoadCrossProjectDuplicationsRepositoryStepIT {
   }
 
   private ComponentDto createProject(String projectKey) {
-    ComponentDto project = ComponentTesting.newPrivateProjectDto().setKey(projectKey);
-    return dbTester.components().insertComponent(project);
+    return dbTester.components().insertPrivateProject(p->p.setKey(projectKey)).getMainBranchComponent();
   }
 
   private SnapshotDto createProjectSnapshot(ComponentDto project) {
index f69c74cbbd8061ad87510c6c6d00cec8d75c828f..b5d89740698557afc28353e7d5a925a521d7ff75 100644 (file)
@@ -42,7 +42,7 @@ import static org.sonar.db.component.ComponentTesting.newPrivateProjectDto;
 public class DuplicationDaoIT {
 
   @Rule
-  public DbTester db = DbTester.create(System2.INSTANCE);
+  public DbTester db = DbTester.create(System2.INSTANCE, true);
 
   private final DbSession dbSession = db.getSession();
   private final DuplicationDao dao = db.getDbClient().duplicationDao();