]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-18856 Refactor 'new_code_periods'
authorDuarte Meneses <duarte.meneses@sonarsource.com>
Mon, 8 May 2023 20:03:15 +0000 (15:03 -0500)
committersonartech <sonartech@sonarsource.com>
Wed, 10 May 2023 20:05:28 +0000 (20:05 +0000)
server/sonar-db-dao/src/it/java/org/sonar/db/newcodeperiod/NewCodePeriodDaoIT.java
server/sonar-webserver-webapi/src/it/java/org/sonar/server/newcodeperiod/ws/ListActionIT.java
server/sonar-webserver-webapi/src/it/java/org/sonar/server/newcodeperiod/ws/SetActionIT.java
server/sonar-webserver-webapi/src/it/java/org/sonar/server/newcodeperiod/ws/ShowActionIT.java
server/sonar-webserver-webapi/src/it/java/org/sonar/server/newcodeperiod/ws/UnsetActionIT.java

index 52c731dbaf0e8d7a84a2e52d4d6022fdc9d09da8..208f8d9c664fb610286bbd240146d6cfabfa1637 100644 (file)
@@ -29,6 +29,8 @@ import org.sonar.core.util.UuidFactory;
 import org.sonar.db.DbSession;
 import org.sonar.db.DbTester;
 import org.sonar.db.component.BranchDto;
+import org.sonar.db.component.ComponentDbTester;
+import org.sonar.db.component.ProjectData;
 import org.sonar.db.project.ProjectDto;
 
 import static org.assertj.core.api.Assertions.assertThat;
@@ -42,7 +44,7 @@ import static org.sonar.db.newcodeperiod.NewCodePeriodType.SPECIFIC_ANALYSIS;
 public class NewCodePeriodDaoIT {
 
   @Rule
-  public DbTester db = DbTester.create(System2.INSTANCE);
+  public DbTester db = DbTester.create(System2.INSTANCE, true);
 
   private final DbSession dbSession = db.getSession();
   private final UuidFactory uuidFactory = new SequenceUuidFactory();
@@ -191,8 +193,9 @@ public class NewCodePeriodDaoIT {
 
   @Test
   public void select_branches_referencing() {
-    ProjectDto project = db.components().insertPrivateProject().getProjectDto();
-    BranchDto mainBranch = db.getDbClient().branchDao().selectByUuid(dbSession, project.getUuid()).get();
+    ProjectData projectData = db.components().insertPrivateProject();
+    ProjectDto project = projectData.getProjectDto();
+    BranchDto mainBranch = projectData.getMainBranchDto();
     BranchDto branch1 = db.components().insertProjectBranch(project);
     BranchDto branch2 = db.components().insertProjectBranch(project);
     BranchDto branch3 = db.components().insertProjectBranch(project);
index 040bf225dcd3cf37491fd4f40be9162fe9c21c82..68867b8bc10ddb6f298bdd7fd75a68740651771a 100644 (file)
@@ -81,7 +81,7 @@ import static org.sonar.db.component.SnapshotTesting.newAnalysis;
     @Rule
     public UserSessionRule userSession = UserSessionRule.standalone();
     @Rule
-    public DbTester db = DbTester.create(System2.INSTANCE);
+    public DbTester db = DbTester.create(System2.INSTANCE, true);
 
     private ComponentDbTester componentDb = new ComponentDbTester(db);
     private DbClient dbClient = db.getDbClient();
index 20baefcfb20fb4e9ce0c8a41063b1484e9dfadbf..ce442e615ef4bbb9a8e18b392c4cd24675428938 100644 (file)
@@ -64,7 +64,7 @@ public class SetActionIT {
   @Rule
   public UserSessionRule userSession = UserSessionRule.standalone();
   @Rule
-  public DbTester db = DbTester.create(System2.INSTANCE);
+  public DbTester db = DbTester.create(System2.INSTANCE, true);
 
   private ComponentDbTester componentDb = new ComponentDbTester(db);
   private DbClient dbClient = db.getDbClient();
index 930e9fde62122cc41471b57e488085796fa8ca0d..9a073dc3959cbfd9ed3ca2c89258e72ab29a2740 100644 (file)
@@ -53,7 +53,7 @@ public class ShowActionIT {
   @Rule
   public UserSessionRule userSession = UserSessionRule.standalone();
   @Rule
-  public DbTester db = DbTester.create(System2.INSTANCE);
+  public DbTester db = DbTester.create(System2.INSTANCE, true);
 
   private ComponentDbTester componentDb = new ComponentDbTester(db);
   private DbClient dbClient = db.getDbClient();
index c6e73d9de371807130f738b8cd7dcc3230ceea01..934d6f2ec0c54cd666093860e088851af9a86b02 100644 (file)
@@ -56,7 +56,7 @@ public class UnsetActionIT {
   @Rule
   public UserSessionRule userSession = UserSessionRule.standalone();
   @Rule
-  public DbTester db = DbTester.create(System2.INSTANCE);
+  public DbTester db = DbTester.create(System2.INSTANCE, true);
 
   private ComponentDbTester componentDb = new ComponentDbTester(db);
   private DbClient dbClient = db.getDbClient();