]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-12364 - remove manual baseline column from usage
authorJacek <jacek.poreda@sonarsource.com>
Tue, 6 Aug 2019 12:54:29 +0000 (14:54 +0200)
committerSonarTech <sonartech@sonarsource.com>
Tue, 24 Sep 2019 18:21:12 +0000 (20:21 +0200)
server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/LoadPeriodsStepTest.java
server/sonar-db-dao/src/main/java/org/sonar/db/component/BranchDao.java
server/sonar-db-dao/src/main/java/org/sonar/db/component/BranchDto.java
server/sonar-db-dao/src/main/resources/org/sonar/db/component/BranchMapper.xml
server/sonar-db-dao/src/main/resources/org/sonar/db/purge/PurgeMapper.xml
server/sonar-db-dao/src/test/java/org/sonar/db/component/BranchDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeDaoTest.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/projectanalysis/ws/UnsetBaselineAction.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/projectanalysis/ws/UnsetBaselineActionTest.java

index af4e9d16984f02dc07a42053c66c9991e76da80c..d5419e335e84f8c8c612e69bcfefab0c362605ac 100644 (file)
@@ -57,6 +57,8 @@ import org.sonar.db.component.BranchType;
 import org.sonar.db.component.ComponentDto;
 import org.sonar.db.component.SnapshotDto;
 import org.sonar.db.event.EventTesting;
+import org.sonar.db.newcodeperiod.NewCodePeriodDto;
+import org.sonar.db.newcodeperiod.NewCodePeriodType;
 import org.sonar.db.organization.OrganizationDto;
 
 import static org.apache.commons.lang.RandomStringUtils.randomAlphabetic;
@@ -206,7 +208,12 @@ public class LoadPeriodsStepTest extends BaseStepTest {
     SnapshotDto analysis3 = dbTester.components().insertSnapshot(branch, snapshot -> snapshot.setCreatedAt(1227157200000L).setLast(false)); // 2008-11-20
     SnapshotDto analysis4 = dbTester.components().insertSnapshot(branch, snapshot -> snapshot.setCreatedAt(1227358680000L).setLast(false)); // 2008-11-22
     SnapshotDto analysis5 = dbTester.components().insertSnapshot(branch, snapshot -> snapshot.setCreatedAt(1227934800000L).setLast(true)); // 2008-11-29
-    dbTester.getDbClient().branchDao().updateManualBaseline(dbTester.getSession(), branch.uuid(), analysis1.getUuid());
+    dbTester.newCodePeriods().insert(new NewCodePeriodDto()
+      .setProjectUuid(project.uuid())
+      .setBranchUuid(branch.uuid())
+      .setType(NewCodePeriodType.SPECIFIC_ANALYSIS)
+      .setValue(analysis1.getUuid()));
+
     dbTester.commit();
     when(system2Mock.now()).thenReturn(november30th2008.getTime());
     when(analysisMetadataHolder.isFirstAnalysis()).thenReturn(false);
index c5c77e7fad0f0aa6c829e6a5251bff1ebe617725..5192cbc9ffa20f8231d4d2314b3e6147fb13fc9d 100644 (file)
@@ -22,7 +22,6 @@ package org.sonar.db.component;
 import java.util.Collection;
 import java.util.List;
 import java.util.Optional;
-import javax.annotation.Nullable;
 import org.sonar.api.utils.System2;
 import org.sonar.db.Dao;
 import org.sonar.db.DbSession;
@@ -64,20 +63,6 @@ public class BranchDao implements Dao {
     return mapper(dbSession).updateMainBranchName(projectUuid, newBranchKey, now);
   }
 
-  /**
-   * Set or unset the uuid of the manual baseline analysis by updating the manual_baseline_analysis_uuid column, if:
-   *
-   * - the specified uuid exists
-   * - and the specified uuid corresponds to a long-living branch (including the main branch)
-   *
-   * @return the number of rows that were updated
-   */
-  @Deprecated
-  public int updateManualBaseline(DbSession dbSession, String uuid, @Nullable String analysisUuid) {
-    long now = system2.now();
-    return mapper(dbSession).updateManualBaseline(uuid, analysisUuid == null || analysisUuid.isEmpty() ? null : analysisUuid, now);
-  }
-
   public Optional<BranchDto> selectByBranchKey(DbSession dbSession, String projectUuid, String key) {
     return selectByKey(dbSession, projectUuid, key, KeyType.BRANCH);
   }
index 624213856f8c9c94e60544e441ed65ec7386bf46..172898056931fb693a354a59754e79fc823ef510 100644 (file)
@@ -76,7 +76,7 @@ public class BranchDto {
    * UUID of the branch:
    * - in which the short-lived branch or pull request will be merged into
    * - that is the base of long-lived branch.
-   *
+   * <p>
    * Can be null if information is not known.
    */
   @Nullable
@@ -88,12 +88,6 @@ public class BranchDto {
   @Nullable
   private byte[] pullRequestBinary;
 
-  /**
-   * The UUID of the analysis set by user as manual baseline for computation of the New Code Period, if any.
-   */
-  @Nullable
-  private String manualBaseline;
-
   public String getUuid() {
     return uuid;
   }
@@ -195,18 +189,6 @@ public class BranchDto {
     }
   }
 
-  @CheckForNull
-  @Deprecated
-  public String getManualBaseline() {
-    return manualBaseline;
-  }
-
-  @Deprecated
-  public BranchDto setManualBaseline(@Nullable String manualBaseline) {
-    this.manualBaseline = manualBaseline == null || manualBaseline.isEmpty() ? null : manualBaseline;
-    return this;
-  }
-
   @Override
   public boolean equals(Object o) {
     if (this == o) {
@@ -217,11 +199,10 @@ public class BranchDto {
     }
     BranchDto branchDto = (BranchDto) o;
     return Objects.equals(uuid, branchDto.uuid) &&
-        Objects.equals(projectUuid, branchDto.projectUuid) &&
-        Objects.equals(kee, branchDto.kee) &&
-        branchType == branchDto.branchType &&
-        Objects.equals(mergeBranchUuid, branchDto.mergeBranchUuid) &&
-        Objects.equals(manualBaseline, branchDto.manualBaseline);
+      Objects.equals(projectUuid, branchDto.projectUuid) &&
+      Objects.equals(kee, branchDto.kee) &&
+      branchType == branchDto.branchType &&
+      Objects.equals(mergeBranchUuid, branchDto.mergeBranchUuid);
   }
 
   @Override
@@ -231,15 +212,14 @@ public class BranchDto {
 
   @Override
   public String toString() {
-    StringBuilder sb = new StringBuilder("BranchDto{");
-    sb.append("uuid='").append(uuid).append('\'');
-    sb.append(", projectUuid='").append(projectUuid).append('\'');
-    sb.append(", kee='").append(kee).append('\'');
-    sb.append(", keyType=").append(keyType);
-    sb.append(", branchType=").append(branchType);
-    sb.append(", mergeBranchUuid='").append(mergeBranchUuid).append('\'');
-    sb.append(", manualBaseline='").append(manualBaseline).append('\'');
-    sb.append('}');
-    return sb.toString();
+    return new StringBuilder("BranchDto{")
+      .append("uuid='").append(uuid).append('\'')
+      .append(", projectUuid='").append(projectUuid).append('\'')
+      .append(", kee='").append(kee).append('\'')
+      .append(", keyType=").append(keyType)
+      .append(", branchType=").append(branchType)
+      .append(", mergeBranchUuid='").append(mergeBranchUuid).append('\'')
+      .append('}')
+      .toString();
   }
 }
index a7bdecd5d84130870ccce93f8e5af1a51aa5e3b8..7f54831c8e029f566e51619a85889aa2799fcbc1 100644 (file)
@@ -9,8 +9,7 @@
     pb.key_type as keyType,
     pb.branch_type as branchType,
     pb.merge_branch_uuid as mergeBranchUuid,
-    pb.pull_request_binary as pullRequestBinary,
-    pb.manual_baseline_analysis_uuid as manualBaseline
+    pb.pull_request_binary as pullRequestBinary
   </sql>
 
   <insert id="insert" parameterType="map" useGeneratedKeys="false">
@@ -22,7 +21,6 @@
       branch_type,
       merge_branch_uuid,
       pull_request_binary,
-      manual_baseline_analysis_uuid,
       created_at,
       updated_at
     ) values (
@@ -33,7 +31,6 @@
       #{dto.branchType, jdbcType=VARCHAR},
       #{dto.mergeBranchUuid, jdbcType=VARCHAR},
       #{dto.pullRequestBinary, jdbcType=BINARY},
-      #{dto.manualBaseline, jdbcType=VARCHAR},
       #{now, jdbcType=BIGINT},
       #{now, jdbcType=BIGINT}
     )
       uuid = #{projectUuid, jdbcType=VARCHAR}
   </update>
 
-  <update id="updateManualBaseline" parameterType="map" useGeneratedKeys="false">
-    update project_branches
-    set
-      manual_baseline_analysis_uuid = #{analysisUuid, jdbcType=VARCHAR},
-      updated_at = #{now, jdbcType=BIGINT}
-    where
-      uuid = #{uuid, jdbcType=VARCHAR}
-      and branch_type = 'LONG'
-  </update>
-
   <update id="update" parameterType="map" useGeneratedKeys="false">
     update project_branches
     set
index b84f18424689ab204ddad19e2036b7e1fe577af2..1bc48d06dc7d44f61038cf6dc46ee2cf5d2601a3 100644 (file)
@@ -27,6 +27,7 @@
       s.id as "analysisId", s.uuid as "analysisUuid", s.created_at as "date", ${_true} as "hasEvents", islast as "isLast", ve.name as "version"
     from snapshots s
       left outer join events ve on ve.analysis_uuid=s.uuid and ve.category='Version'
+      left outer join new_code_periods npc on ve.analysis_uuid=s.uuid and ve.category='Version'
     where
       s.component_uuid=#{componentUuid,jdbcType=VARCHAR}
       and s.status='P'
 
   <select id="selectManualBaseline" parameterType="String" resultType="String">
     select
-      manual_baseline_analysis_uuid
+      value
     from
-      project_branches pb
+      new_code_periods ncp
     where
-      pb.uuid=#{projectUuid,jdbcType=VARCHAR}
+      ncp.type='SPECIFIC_ANALYSIS'
+      AND ncp.branch_uuid=#{projectUuid,jdbcType=VARCHAR}
   </select>
 
   <select id="selectStaleShortLivingBranchesAndPullRequests" parameterType="map" resultType="String">
index 08ef36f8c54fcd6dd0298a16d756660ab9b57910..4e86529f544a1cb9ddf98cc26f45dbf9a6af8004 100644 (file)
@@ -21,14 +21,13 @@ package org.sonar.db.component;
 
 import com.tngtech.java.junit.dataprovider.DataProvider;
 import com.tngtech.java.junit.dataprovider.DataProviderRunner;
-import com.tngtech.java.junit.dataprovider.UseDataProvider;
 import java.util.Map;
 import javax.annotation.Nullable;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.sonar.api.utils.System2;
 import org.sonar.api.impl.utils.TestSystem2;
+import org.sonar.api.utils.System2;
 import org.sonar.db.DbSession;
 import org.sonar.db.DbTester;
 import org.sonar.db.protobuf.DbProjectBranches;
@@ -100,76 +99,19 @@ public class BranchDaoTest {
     assertThat(loaded.getBranchType()).isEqualTo(BranchType.LONG);
   }
 
-  @Test
-  @UseDataProvider("nullOrEmpty")
-  public void insert_null_or_empty_manual_baseline_analysis_uuid_is_null(@Nullable String nullOrEmpty) {
-    BranchDto dto = new BranchDto();
-    dto.setProjectUuid("U1");
-    dto.setUuid("U1");
-    dto.setBranchType(BranchType.LONG);
-    dto.setKey("foo");
-    dto.setManualBaseline(nullOrEmpty);
-
-    underTest.insert(dbSession, dto);
-
-    assertThat(underTest.selectByUuid(dbSession, dto.getUuid()).get().getManualBaseline()).isNull();
-  }
-
   @DataProvider
   public static Object[][] nullOrEmpty() {
-    return new Object[][] {
+    return new Object[][]{
       {null},
       {""}
     };
   }
 
-  @Test
-  public void insert_manual_baseline_analysis_uuid() {
-    String manualBaselineAnalysisUuid = randomAlphabetic(12);
-    BranchDto dto = new BranchDto();
-    dto.setProjectUuid("U1");
-    dto.setUuid("U1");
-    dto.setBranchType(BranchType.LONG);
-    dto.setKey("foo");
-    dto.setManualBaseline(manualBaselineAnalysisUuid);
-
-    underTest.insert(dbSession, dto);
-
-    assertThat(underTest.selectByUuid(dbSession, dto.getUuid()).get().getManualBaseline()).isEqualTo(manualBaselineAnalysisUuid);
-  }
-
-  @Test
-  @UseDataProvider("oldAndNewValuesCombinations")
-  public void update_manualBaselineAnalysisUuid_if_new_value_is_different(@Nullable String oldValue, @Nullable String newValue) {
-    BranchDto dto = new BranchDto();
-    dto.setProjectUuid("U1");
-    dto.setUuid("U1");
-    dto.setBranchType(BranchType.LONG);
-    dto.setKey("foo");
-    dto.setManualBaseline(oldValue);
-    underTest.insert(dbSession, dto);
-
-    BranchDto otherDtoThatShouldNotChange = new BranchDto();
-    otherDtoThatShouldNotChange.setProjectUuid("U2");
-    otherDtoThatShouldNotChange.setUuid("U2");
-    otherDtoThatShouldNotChange.setBranchType(BranchType.LONG);
-    otherDtoThatShouldNotChange.setKey("branch");
-    otherDtoThatShouldNotChange.setManualBaseline(oldValue);
-    underTest.insert(dbSession, otherDtoThatShouldNotChange);
-
-    assertThat(underTest.updateManualBaseline(dbSession, dto.getUuid(), newValue)).isEqualTo(1);
-
-    assertThat(underTest.selectByUuid(dbSession, dto.getUuid()).get().getManualBaseline())
-      .isEqualTo(emptyToNull(newValue));
-    assertThat(underTest.selectByUuid(dbSession, otherDtoThatShouldNotChange.getUuid()).get().getManualBaseline())
-      .isEqualTo(emptyToNull(oldValue));
-  }
-
   @DataProvider
   public static Object[][] oldAndNewValuesCombinations() {
     String value1 = randomAlphabetic(10);
     String value2 = randomAlphabetic(20);
-    return new Object[][] {
+    return new Object[][]{
       {null, value1},
       {"", value1},
       {value1, null},
@@ -181,26 +123,9 @@ public class BranchDaoTest {
     };
   }
 
-  @Test
-  @UseDataProvider("nonLongBranchType")
-  public void do_not_update_manual_baseline_of_non_long_branches(BranchType branchType) {
-    String analysisUuid = randomAlphabetic(12);
-    String otherAnalysisUuid = randomAlphabetic(12);
-    BranchDto noManualBaselineDto = ComponentTesting.newBranchDto(db.components().insertPrivateProject(), branchType);
-    BranchDto withManualBaselineDto = ComponentTesting.newBranchDto(db.components().insertPrivateProject(), branchType).setManualBaseline(analysisUuid);
-    underTest.insert(dbSession, noManualBaselineDto);
-    underTest.insert(dbSession, withManualBaselineDto);
-    dbSession.commit();
-
-    assertThat(underTest.updateManualBaseline(dbSession, noManualBaselineDto.getUuid(), null)).isZero();
-    assertThat(underTest.updateManualBaseline(dbSession, noManualBaselineDto.getUuid(), otherAnalysisUuid)).isZero();
-    assertThat(underTest.updateManualBaseline(dbSession, withManualBaselineDto.getUuid(), null)).isZero();
-    assertThat(underTest.updateManualBaseline(dbSession, withManualBaselineDto.getUuid(), otherAnalysisUuid)).isZero();
-  }
-
   @DataProvider
   public static Object[][] nonLongBranchType() {
-    return new Object[][] {
+    return new Object[][]{
       {BranchType.SHORT},
       {BranchType.PULL_REQUEST}
     };
@@ -427,7 +352,6 @@ public class BranchDaoTest {
     featureBranch.setBranchType(BranchType.SHORT);
     featureBranch.setKey("feature/foo");
     featureBranch.setMergeBranchUuid("U3");
-    featureBranch.setManualBaseline("analysisUUID");
     underTest.insert(dbSession, featureBranch);
 
     // select the feature branch
@@ -437,7 +361,6 @@ public class BranchDaoTest {
     assertThat(loaded.getProjectUuid()).isEqualTo(featureBranch.getProjectUuid());
     assertThat(loaded.getBranchType()).isEqualTo(featureBranch.getBranchType());
     assertThat(loaded.getMergeBranchUuid()).isEqualTo(featureBranch.getMergeBranchUuid());
-    assertThat(loaded.getManualBaseline()).isEqualTo(featureBranch.getManualBaseline());
 
     // select a branch on another project with same branch name
     assertThat(underTest.selectByBranchKey(dbSession, "U3", "feature/foo")).isEmpty();
@@ -459,7 +382,6 @@ public class BranchDaoTest {
     pullRequest.setBranchType(BranchType.PULL_REQUEST);
     pullRequest.setKey(pullRequestId);
     pullRequest.setMergeBranchUuid("U3");
-    pullRequest.setManualBaseline("analysisUUID");
     underTest.insert(dbSession, pullRequest);
 
     // select the feature branch
@@ -469,7 +391,6 @@ public class BranchDaoTest {
     assertThat(loaded.getProjectUuid()).isEqualTo(pullRequest.getProjectUuid());
     assertThat(loaded.getBranchType()).isEqualTo(pullRequest.getBranchType());
     assertThat(loaded.getMergeBranchUuid()).isEqualTo(pullRequest.getMergeBranchUuid());
-    assertThat(loaded.getManualBaseline()).isEqualTo(pullRequest.getManualBaseline());
 
     // select a branch on another project with same branch name
     assertThat(underTest.selectByPullRequestKey(dbSession, "U3", pullRequestId)).isEmpty();
index edf90466381743133a727f1de1acaf36138d115a..cb84041507d6e6c95f35cbbff677c831b6e5a941 100644 (file)
@@ -72,6 +72,8 @@ import org.sonar.db.measure.LiveMeasureDto;
 import org.sonar.db.measure.MeasureDto;
 import org.sonar.db.measure.custom.CustomMeasureDto;
 import org.sonar.db.metric.MetricDto;
+import org.sonar.db.newcodeperiod.NewCodePeriodDto;
+import org.sonar.db.newcodeperiod.NewCodePeriodType;
 import org.sonar.db.organization.OrganizationDto;
 import org.sonar.db.property.PropertyDto;
 import org.sonar.db.rule.RuleDefinitionDto;
@@ -418,7 +420,7 @@ public class PurgeDaoTest {
 
   @Test
   public void selectPurgeableAnalyses() {
-    SnapshotDto[] analyses = new SnapshotDto[] {
+    SnapshotDto[] analyses = new SnapshotDto[]{
       newSnapshot()
         .setUuid("u1")
         .setComponentUuid(PROJECT_UUID)
@@ -476,7 +478,13 @@ public class PurgeDaoTest {
       .setComponentUuid(project1.uuid())
       .setStatus(STATUS_PROCESSED)
       .setLast(false));
-    dbClient.branchDao().updateManualBaseline(dbSession, project1.uuid(), analysis1.getUuid());
+    dbClient.newCodePeriodDao().insert(dbSession,
+      new NewCodePeriodDto()
+        .setProjectUuid(project1.uuid())
+        .setBranchUuid(project1.uuid())
+        .setType(NewCodePeriodType.SPECIFIC_ANALYSIS)
+        .setValue(analysis1.getUuid())
+    );
     ComponentDto project2 = db.components().insertPrivateProject();
     SnapshotDto analysis2 = db.components().insertSnapshot(newSnapshot()
       .setComponentUuid(project2.uuid())
@@ -497,7 +505,13 @@ public class PurgeDaoTest {
       .setComponentUuid(project.uuid())
       .setStatus(STATUS_PROCESSED)
       .setLast(false));
-    dbClient.branchDao().updateManualBaseline(dbSession, project.uuid(), analysisProject.getUuid());
+    dbClient.newCodePeriodDao().insert(dbSession,
+      new NewCodePeriodDto()
+        .setProjectUuid(project.uuid())
+        .setBranchUuid(project.uuid())
+        .setType(NewCodePeriodType.SPECIFIC_ANALYSIS)
+        .setValue(analysisProject.getUuid())
+    );
     ComponentDto branch1 = db.components().insertProjectBranch(project);
     SnapshotDto analysisBranch1 = db.components().insertSnapshot(newSnapshot()
       .setComponentUuid(branch1.uuid())
@@ -508,7 +522,13 @@ public class PurgeDaoTest {
       .setComponentUuid(branch2.uuid())
       .setStatus(STATUS_PROCESSED)
       .setLast(false));
-    dbClient.branchDao().updateManualBaseline(dbSession, branch2.uuid(), analysisBranch2.getUuid());
+    dbClient.newCodePeriodDao().insert(dbSession,
+      new NewCodePeriodDto()
+        .setProjectUuid(project.uuid())
+        .setBranchUuid(branch2.uuid())
+        .setType(NewCodePeriodType.SPECIFIC_ANALYSIS)
+        .setValue(analysisBranch2.getUuid())
+    );
     dbSession.commit();
 
     assertThat(underTest.selectPurgeableAnalyses(project.uuid(), dbSession))
@@ -1577,7 +1597,7 @@ public class PurgeDaoTest {
 
   @SafeVarargs
   private final void insertCeActivityAndChildDataWithDate(String ceActivityUuid, LocalDateTime dateTime,
-    Consumer<CeQueueDto>... queueDtoConsumers) {
+                                                          Consumer<CeQueueDto>... queueDtoConsumers) {
     long date = dateTime.toInstant(UTC).toEpochMilli();
     CeQueueDto queueDto = new CeQueueDto();
     queueDto.setUuid(ceActivityUuid);
index b8af1a56e945070a2c73dd7a45b86fdea54b77be..150ef9c045f8e328c1a4778c4a7d5da7a8d7b870 100644 (file)
@@ -91,7 +91,7 @@ public class UnsetBaselineAction implements ProjectAnalysesWsAction {
       userSession.checkComponentPermission(UserRole.ADMIN, projectBranch);
 
       String projectUuid = projectBranch.getMainBranchProjectUuid() != null ? projectBranch.getMainBranchProjectUuid() : projectBranch.uuid();
-      String branchUuid = branchKey != null ? projectBranch.uuid() : null;
+      String branchUuid = projectBranch.uuid();
       dbClient.newCodePeriodDao().deleteByProjectUuidAndBranchUuid(dbSession, projectUuid, branchUuid);
       dbSession.commit();
     }
index d99009ee5b86fc126f16204ed32466b3c6b66c95..641c14572695bb5bcce83d565b3a6999471b80d3 100644 (file)
@@ -23,6 +23,7 @@ import com.google.common.collect.ImmutableMap;
 import com.tngtech.java.junit.dataprovider.DataProvider;
 import com.tngtech.java.junit.dataprovider.DataProviderRunner;
 import com.tngtech.java.junit.dataprovider.UseDataProvider;
+import java.util.Optional;
 import javax.annotation.Nullable;
 import org.junit.Rule;
 import org.junit.Test;
@@ -38,6 +39,7 @@ import org.sonar.db.component.BranchDto;
 import org.sonar.db.component.BranchType;
 import org.sonar.db.component.ComponentDto;
 import org.sonar.db.component.SnapshotDto;
+import org.sonar.db.newcodeperiod.NewCodePeriodDto;
 import org.sonar.db.organization.OrganizationDto;
 import org.sonar.server.component.TestComponentFinder;
 import org.sonar.server.exceptions.ForbiddenException;
@@ -174,7 +176,7 @@ public class UnsetBaselineActionTest {
 
   @DataProvider
   public static Object[][] nullOrEmptyOrValue() {
-    return new Object[][] {
+    return new Object[][]{
       {null},
       {""},
       {randomAlphabetic(10)},
@@ -193,7 +195,7 @@ public class UnsetBaselineActionTest {
 
   @DataProvider
   public static Object[][] nullOrEmpty() {
-    return new Object[][] {
+    return new Object[][]{
       {null},
       {""},
     };
@@ -201,7 +203,7 @@ public class UnsetBaselineActionTest {
 
   @DataProvider
   public static Object[][] nonexistentParamsAndFailureMessage() {
-    return new Object[][] {
+    return new Object[][]{
       {ImmutableMap.of(PARAM_PROJECT, "nonexistent"), "Component 'nonexistent' on branch .* not found"},
       {ImmutableMap.of(PARAM_BRANCH, "nonexistent"), "Component .* on branch 'nonexistent' not found"}
     };
@@ -273,10 +275,14 @@ public class UnsetBaselineActionTest {
 
   private void verifyManualBaseline(ComponentDto project, @Nullable SnapshotDto projectAnalysis) {
     BranchDto branchDto = db.getDbClient().branchDao().selectByUuid(dbSession, project.uuid()).get();
+    Optional<NewCodePeriodDto> newCodePeriod = db.getDbClient().newCodePeriodDao().selectByBranch(dbSession, branchDto.getProjectUuid(), branchDto.getUuid());
     if (projectAnalysis == null) {
-      assertThat(branchDto.getManualBaseline()).isNull();
+      assertThat(newCodePeriod).isNotNull();
+      assertThat(newCodePeriod).isEmpty();
     } else {
-      assertThat(branchDto.getManualBaseline()).isEqualTo(projectAnalysis.getUuid());
+      assertThat(newCodePeriod).isNotNull();
+      assertThat(newCodePeriod).isNotEmpty();
+      assertThat(newCodePeriod.get().getValue()).isEqualTo(projectAnalysis.getUuid());
     }
   }