]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-15398 update class and method names
authorDuarte Meneses <duarte.meneses@sonarsource.com>
Wed, 17 Nov 2021 20:03:41 +0000 (14:03 -0600)
committersonartech <sonartech@sonarsource.com>
Thu, 18 Nov 2021 20:03:33 +0000 (20:03 +0000)
server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/component/ProjectViewAttributes.java
server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/step/PersistComponentsStep.java
server/sonar-ce-task-projectanalysis/src/test/java/org/sonar/ce/task/projectanalysis/step/ViewsPersistComponentsStepTest.java
server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDto.java
server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentUpdateDto.java
server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDaoTest.java
server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDtoTest.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/component/ws/TreeAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/ComponentAction.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/ComponentDtoToWsComponent.java
server/sonar-webserver-webapi/src/main/java/org/sonar/server/measure/ws/ComponentTreeAction.java

index 2541858fc57d50c83a80ccad265cd777fa10d490..e787b9083feae5e79ceca95a381260a382ee90e5 100644 (file)
@@ -27,21 +27,21 @@ import static java.util.Objects.requireNonNull;
 
 @Immutable
 public class ProjectViewAttributes {
-  private final String projectUuid;
+  private final String uuid;
   private final String originalKey;
   @CheckForNull
   private final Long analysisDate;
   private final String branchName;
 
-  public ProjectViewAttributes(String projectUuid, String originalKey, @Nullable Long analysisDate, @Nullable String branchName) {
-    this.projectUuid = requireNonNull(projectUuid, "projectUuid can't be null");
-    this.originalKey = requireNonNull(originalKey, "projectKey can't be null");
+  public ProjectViewAttributes(String uuid, String originalKey, @Nullable Long analysisDate, @Nullable String branchName) {
+    this.uuid = requireNonNull(uuid, "uuid can't be null");
+    this.originalKey = requireNonNull(originalKey, "originalKey can't be null");
     this.analysisDate = analysisDate;
     this.branchName = branchName;
   }
 
-  public String getProjectUuid() {
-    return projectUuid;
+  public String getUuid() {
+    return uuid;
   }
 
   @CheckForNull
@@ -49,7 +49,6 @@ public class ProjectViewAttributes {
     return analysisDate;
   }
 
-
   public String getBranchName() {
     return branchName;
   }
@@ -61,7 +60,7 @@ public class ProjectViewAttributes {
   @Override
   public String toString() {
     return "ProjectViewAttributes{" +
-      ", projectUuid='" + projectUuid + '\'' +
+      ", uuid='" + uuid + '\'' +
       ", branchName='" + branchName + '\'' +
       ", analysisDate=" + analysisDate +
       '}';
index 788fe06929a78c997986616fbcf021ffeac89264..67538b86af05876afb163b9c985967675fcd9061 100644 (file)
@@ -340,7 +340,7 @@ public class PersistComponentsStep implements ComputationStep {
       res.setQualifier(PROJECT);
       res.setName(projectView.getName());
       res.setLongName(res.name());
-      res.setCopyComponentUuid(projectView.getProjectViewAttributes().getProjectUuid());
+      res.setCopyComponentUuid(projectView.getProjectViewAttributes().getUuid());
 
       setRootAndParentModule(res, path);
 
@@ -395,7 +395,7 @@ public class PersistComponentsStep implements ComputationStep {
   }
 
   private static Optional<ComponentUpdateDto> compareForUpdate(ComponentDto existing, ComponentDto target) {
-    boolean hasDifferences = !StringUtils.equals(existing.getCopyResourceUuid(), target.getCopyResourceUuid()) ||
+    boolean hasDifferences = !StringUtils.equals(existing.getCopyComponentUuid(), target.getCopyComponentUuid()) ||
       !StringUtils.equals(existing.description(), target.description()) ||
       !StringUtils.equals(existing.getDbKey(), target.getDbKey()) ||
       !existing.isEnabled() ||
index 113e4f8ec31dce561a729650220fd80c94e6f84d..94500b7d4af50705977c9e9423beed20a57040d4 100644 (file)
@@ -207,7 +207,7 @@ public class ViewsPersistComponentsStepTest extends BaseStepTest {
     assertRowsCountInTableProjects(2);
 
     ComponentDto subView = getComponentFromDb(SUBVIEW_1_KEY);
-    assertThat(subView.getCopyResourceUuid()).isEqualTo("ORIGINAL_UUID");
+    assertThat(subView.getCopyComponentUuid()).isEqualTo("ORIGINAL_UUID");
   }
 
   @Test
@@ -368,7 +368,7 @@ public class ViewsPersistComponentsStepTest extends BaseStepTest {
     dbTester.commit();
 
     ComponentDto subViewReloaded = getComponentFromDb(SUBVIEW_1_KEY);
-    assertThat(subViewReloaded.getCopyResourceUuid()).isEqualTo("NEW_COPY");
+    assertThat(subViewReloaded.getCopyComponentUuid()).isEqualTo("NEW_COPY");
   }
 
   @Test
@@ -504,7 +504,7 @@ public class ViewsPersistComponentsStepTest extends BaseStepTest {
     assertThat(dto.moduleUuidPath()).isEqualTo("." + dto.uuid() + ".");
     assertThat(dto.qualifier()).isEqualTo(Qualifiers.VIEW);
     assertThat(dto.scope()).isEqualTo(Scopes.PROJECT);
-    assertThat(dto.getCopyResourceUuid()).isNull();
+    assertThat(dto.getCopyComponentUuid()).isNull();
     assertThat(dto.getCreatedAt()).isEqualTo(now);
   }
 
@@ -523,7 +523,7 @@ public class ViewsPersistComponentsStepTest extends BaseStepTest {
     assertThat(dto.moduleUuidPath()).isEqualTo("." + dto.uuid() + ".");
     assertThat(dto.qualifier()).isEqualTo(Qualifiers.APP);
     assertThat(dto.scope()).isEqualTo(Scopes.PROJECT);
-    assertThat(dto.getCopyResourceUuid()).isNull();
+    assertThat(dto.getCopyComponentUuid()).isNull();
     assertThat(dto.getCreatedAt()).isEqualTo(now);
   }
 
@@ -542,7 +542,7 @@ public class ViewsPersistComponentsStepTest extends BaseStepTest {
     assertThat(sv1Dto.moduleUuidPath()).isEqualTo(viewDto.moduleUuidPath() + sv1Dto.uuid() + ".");
     assertThat(sv1Dto.qualifier()).isEqualTo(Qualifiers.SUBVIEW);
     assertThat(sv1Dto.scope()).isEqualTo(Scopes.PROJECT);
-    assertThat(sv1Dto.getCopyResourceUuid()).isNull();
+    assertThat(sv1Dto.getCopyComponentUuid()).isNull();
     assertThat(sv1Dto.getCreatedAt()).isEqualTo(now);
   }
 
@@ -558,7 +558,7 @@ public class ViewsPersistComponentsStepTest extends BaseStepTest {
     assertThat(pv1Dto.moduleUuidPath()).isEqualTo(parentViewDto.moduleUuidPath() + pv1Dto.uuid() + ".");
     assertThat(pv1Dto.qualifier()).isEqualTo(Qualifiers.PROJECT);
     assertThat(pv1Dto.scope()).isEqualTo(Scopes.FILE);
-    assertThat(pv1Dto.getCopyResourceUuid()).isEqualTo(project.uuid());
+    assertThat(pv1Dto.getCopyComponentUuid()).isEqualTo(project.uuid());
     assertThat(pv1Dto.getCreatedAt()).isEqualTo(now);
   }
 
index 0f491d7f96a51b929bd2cefad14eaaec23520913..616f456c64e68ad683e0e75ed5b31d98ea7830b1 100644 (file)
@@ -352,7 +352,7 @@ public class ComponentDto {
   }
 
   @CheckForNull
-  public String getCopyResourceUuid() {
+  public String getCopyComponentUuid() {
     return copyComponentUuid;
   }
 
index cec683c65b4a2515dff3e85ae9bce1bf9fec0c02..ca262064df23b62b7a806b17c699827f40a868e3 100644 (file)
@@ -189,7 +189,7 @@ public class ComponentUpdateDto {
       .setUuid(from.uuid())
       .setBChanged(false)
       .setBKey(from.getDbKey())
-      .setBCopyComponentUuid(from.getCopyResourceUuid())
+      .setBCopyComponentUuid(from.getCopyComponentUuid())
       .setBDescription(from.description())
       .setBEnabled(from.isEnabled())
       .setBUuidPath(from.getUuidPath())
index d5aad6f2f474f3be0830ce1c3efe6be1e7550eeb..ccb93d46484c16a796b90eeb5a7b1b721bb55d0a 100644 (file)
@@ -149,7 +149,7 @@ public class ComponentDaoTest {
     assertThat(result.qualifier()).isEqualTo("TRK");
     assertThat(result.scope()).isEqualTo("PRJ");
     assertThat(result.language()).isNull();
-    assertThat(result.getCopyResourceUuid()).isNull();
+    assertThat(result.getCopyComponentUuid()).isNull();
     assertThat(result.isPrivate()).isTrue();
 
     assertThat(underTest.selectByUuid(dbSession, "UNKNOWN")).isEmpty();
@@ -178,7 +178,7 @@ public class ComponentDaoTest {
     assertThat(result.qualifier()).isEqualTo("TRK");
     assertThat(result.scope()).isEqualTo("FIL");
     assertThat(result.language()).isNull();
-    assertThat(result.getCopyResourceUuid()).isEqualTo(project.uuid());
+    assertThat(result.getCopyComponentUuid()).isEqualTo(project.uuid());
     assertThat(result.isPrivate()).isFalse();
   }
 
@@ -1272,7 +1272,7 @@ public class ComponentDaoTest {
     Map<String, Object> row1 = selectBColumnsForUuid("U1");
     assertThat(row1.get("bChanged")).isIn(true, /* for Oracle */1L, 1);
     assertThat(row1.get("bKey")).isEqualTo(dto1.getDbKey());
-    assertThat(row1.get("bCopyComponentUuid")).isEqualTo(dto1.getCopyResourceUuid());
+    assertThat(row1.get("bCopyComponentUuid")).isEqualTo(dto1.getCopyComponentUuid());
     assertThat(row1.get("bDescription")).isEqualTo(dto1.description());
     assertThat(row1.get("bEnabled")).isIn(false, /* for Oracle */0L, 0);
     assertThat(row1.get("bUuidPath")).isEqualTo(dto1.getUuidPath());
@@ -1287,7 +1287,7 @@ public class ComponentDaoTest {
     Map<String, Object> row2 = selectBColumnsForUuid("U2");
     assertThat(row2.get("bChanged")).isIn(true, /* for Oracle */1L, 1);
     assertThat(row2.get("bKey")).isEqualTo(dto2.getDbKey());
-    assertThat(row2.get("bCopyComponentUuid")).isEqualTo(dto2.getCopyResourceUuid());
+    assertThat(row2.get("bCopyComponentUuid")).isEqualTo(dto2.getCopyComponentUuid());
     assertThat(row2.get("bDescription")).isEqualTo(dto2.description());
     assertThat(row2.get("bEnabled")).isIn(false, /* for Oracle */0L, 0);
     assertThat(row2.get("bUuidPath")).isEqualTo(dto2.getUuidPath());
index bcb2da6030963779ded659f4607be54aae94cd34..64974077864f4d91614ca3b137eb966d221b76f4 100644 (file)
@@ -51,7 +51,7 @@ public class ComponentDtoTest {
     assertThat(componentDto.language()).isEqualTo("java");
     assertThat(componentDto.description()).isEqualTo("desc");
     assertThat(componentDto.getRootUuid()).isEqualTo("uuid_3");
-    assertThat(componentDto.getCopyResourceUuid()).isEqualTo("uuid_5");
+    assertThat(componentDto.getCopyComponentUuid()).isEqualTo("uuid_5");
     assertThat(componentDto.isPrivate()).isFalse();
   }
 
index 20b1bc58ba11049c85942fc61eb4d720a5e09421..2fe046f363c0571fc18524b65def00c0205fca95 100644 (file)
@@ -198,7 +198,7 @@ public class TreeAction implements ComponentsWsAction {
 
   private Map<String, ComponentDto> searchReferenceComponentsByUuid(DbSession dbSession, List<ComponentDto> components) {
     List<String> referenceComponentIds = components.stream()
-      .map(ComponentDto::getCopyResourceUuid)
+      .map(ComponentDto::getCopyComponentUuid)
       .filter(Objects::nonNull)
       .collect(toList());
     if (referenceComponentIds.isEmpty()) {
@@ -244,7 +244,7 @@ public class TreeAction implements ComponentsWsAction {
       wsComponent = componentDtoToWsComponent(component, parentProject.orElse(null), null);
     }
 
-    ComponentDto referenceComponent = referenceComponentsByUuid.get(component.getCopyResourceUuid());
+    ComponentDto referenceComponent = referenceComponentsByUuid.get(component.getCopyComponentUuid());
     if (referenceComponent != null) {
       wsComponent.setRefId(referenceComponent.uuid());
       wsComponent.setRefKey(referenceComponent.getKey());
index cbb16109ba254d0bc2713154523d1d16418d2aa9..284b417b54dd26ed5ca972e4b24452c3f8462581 100644 (file)
@@ -231,11 +231,11 @@ public class ComponentAction implements MeasuresWsAction {
   }
 
   private Optional<ComponentDto> getReferenceComponent(DbSession dbSession, ComponentDto component) {
-    if (component.getCopyResourceUuid() == null) {
+    if (component.getCopyComponentUuid() == null) {
       return Optional.empty();
     }
 
-    return dbClient.componentDao().selectByUuid(dbSession, component.getCopyResourceUuid());
+    return dbClient.componentDao().selectByUuid(dbSession, component.getCopyComponentUuid());
   }
 
   private static ComponentWsResponse buildResponse(ComponentRequest request, ComponentDto component, Optional<ComponentDto> refComponent,
index c2df3e2d68a0800b6a5491d8b91abdf38f6eefc0..69503b542c0f72491fe31f31bb448101c7659132 100644 (file)
@@ -37,7 +37,7 @@ class ComponentDtoToWsComponent {
                                                      Map<String, ComponentDto> referenceComponentsByUuid) {
     Component.Builder wsComponent = componentDtoToWsComponent(component);
 
-    ComponentDto referenceComponent = referenceComponentsByUuid.get(component.getCopyResourceUuid());
+    ComponentDto referenceComponent = referenceComponentsByUuid.get(component.getCopyComponentUuid());
     if (referenceComponent != null) {
       wsComponent.setRefKey(referenceComponent.getDbKey());
     }
index cfd5dd1150cf13424693d29458598ea9abb3fa83..194635013037853437ec7e61e8f4fb4fd9b8cc62 100644 (file)
@@ -371,7 +371,7 @@ public class ComponentTreeAction implements MeasuresWsAction {
   private static Measures.Component.Builder toWsComponent(ComponentDto component, Map<MetricDto, ComponentTreeData.Measure> measures,
     Map<String, ComponentDto> referenceComponentsByUuid) {
     Measures.Component.Builder wsComponent = componentDtoToWsComponent(component);
-    ComponentDto referenceComponent = referenceComponentsByUuid.get(component.getCopyResourceUuid());
+    ComponentDto referenceComponent = referenceComponentsByUuid.get(component.getCopyComponentUuid());
     if (referenceComponent != null) {
       wsComponent.setRefKey(referenceComponent.getKey());
       String displayQualifier = getDisplayQualifier(component, referenceComponent);
@@ -463,7 +463,7 @@ public class ComponentTreeAction implements MeasuresWsAction {
 
   private Map<String, ComponentDto> searchReferenceComponentsById(DbSession dbSession, List<ComponentDto> components) {
     List<String> referenceComponentUUids = components.stream()
-      .map(ComponentDto::getCopyResourceUuid)
+      .map(ComponentDto::getCopyComponentUuid)
       .filter(Objects::nonNull)
       .collect(MoreCollectors.toList(components.size()));
     if (referenceComponentUUids.isEmpty()) {