diff options
author | Belen Pruvost <belen.pruvost@sonarsource.com> | 2022-06-02 14:23:15 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-06-02 20:03:18 +0000 |
commit | 1dfb0dffa770b324711e1a95fe814226e1220306 (patch) | |
tree | 4a01302e73c8833f9936fd189ae7cb94b19281bd | |
parent | a5ef0bb06e670b09d1f0ab9b39553d69f3e92cd1 (diff) | |
download | sonarqube-1dfb0dffa770b324711e1a95fe814226e1220306.tar.gz sonarqube-1dfb0dffa770b324711e1a95fe814226e1220306.zip |
SONAR-16423 - Project license API changes
5 files changed, 8 insertions, 22 deletions
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/MyBatis.java b/server/sonar-db-dao/src/main/java/org/sonar/db/MyBatis.java index 112752428a3..76c699ab92c 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/MyBatis.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/MyBatis.java @@ -76,6 +76,7 @@ import org.sonar.db.issue.NewCodeReferenceIssueDto; import org.sonar.db.issue.PrIssueDto; import org.sonar.db.mapping.ProjectMappingDto; import org.sonar.db.mapping.ProjectMappingsMapper; +import org.sonar.db.measure.LargestBranchNclocDto; import org.sonar.db.measure.LiveMeasureMapper; import org.sonar.db.measure.MeasureDto; import org.sonar.db.measure.MeasureMapper; @@ -201,6 +202,7 @@ public class MyBatis { confBuilder.loadAlias("Issue", IssueDto.class); confBuilder.loadAlias("NewCodeReferenceIssue", NewCodeReferenceIssueDto.class); confBuilder.loadAlias("Measure", MeasureDto.class); + confBuilder.loadAlias("LargestBranchNclocDto", LargestBranchNclocDto.class); confBuilder.loadAlias("NotificationQueue", NotificationQueueDto.class); confBuilder.loadAlias("PermissionTemplateCharacteristic", PermissionTemplateCharacteristicDto.class); confBuilder.loadAlias("PermissionTemplateGroup", PermissionTemplateGroupDto.class); diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/measure/LargestBranchNclocDto.java b/server/sonar-db-dao/src/main/java/org/sonar/db/measure/LargestBranchNclocDto.java index 579fe18f344..a6d41c798b0 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/measure/LargestBranchNclocDto.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/measure/LargestBranchNclocDto.java @@ -27,7 +27,6 @@ public class LargestBranchNclocDto { private long loc; private String branchName; private String branchType; - private long lastAnalysisDate; public String getProjectUuid() { return projectUuid; @@ -82,13 +81,4 @@ public class LargestBranchNclocDto { this.loc = loc; return this; } - - public long getLastAnalysisDate() { - return lastAnalysisDate; - } - - public LargestBranchNclocDto setLastAnalysisDate(long lastAnalysisDate) { - this.lastAnalysisDate = lastAnalysisDate; - return this; - } } diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/measure/LiveMeasureMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/measure/LiveMeasureMapper.xml index 3fe2bcd3fc5..3516f05dcda 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/measure/LiveMeasureMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/measure/LiveMeasureMapper.xml @@ -71,14 +71,13 @@ ) sumncloc </select> - <select id="getLargestBranchNclocPerProject" parameterType="map" resultType="org.sonar.db.measure.LargestBranchNclocDto"> + <select id="getLargestBranchNclocPerProject" parameterType="map" resultType="LargestBranchNclocDto"> select tie_breaker.projectUuid, tie_breaker.projectName, tie_breaker.projectKey, ncloc as loc, pb.kee as branchName, - pb.branch_type as branchType, - s.created_at as lastAnalysisDate + pb.branch_type as branchType from (select counter.projectUuid as projectUuid, counter.maxncloc ncloc, @@ -107,8 +106,6 @@ group by counter.projectUuid, counter.maxncloc, counter.projectName, counter.projectKey) tie_breaker inner join components c2 on c2.kee = tie_breaker.component_kee inner join project_branches pb on c2.uuid = pb.uuid - inner join snapshots s on s.component_uuid = c2.uuid - where s.islast = ${_true} order by ncloc desc </select> diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/measure/LargestBranchNclocDtoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/measure/LargestBranchNclocDtoTest.java index e5b2f71e2fb..2103a769736 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/measure/LargestBranchNclocDtoTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/measure/LargestBranchNclocDtoTest.java @@ -37,7 +37,6 @@ public class LargestBranchNclocDtoTest { assertThat(underTest.getLoc()).isEqualTo(123L); assertThat(underTest.getBranchName()).isEqualTo("branchName"); assertThat(underTest.getBranchType()).isEqualTo("branchType"); - assertThat(underTest.getLastAnalysisDate()).isEqualTo(1L); } private void setUnderTest() { @@ -47,8 +46,7 @@ public class LargestBranchNclocDtoTest { .setProjectKey("projectKey") .setLoc(123L) .setBranchName("branchName") - .setBranchType("branchType") - .setLastAnalysisDate(1L); + .setBranchType("branchType"); } } diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/ProjectsService.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/ProjectsService.java index 27cc69dbb3a..90781ba4bb2 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/ProjectsService.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projects/ProjectsService.java @@ -22,7 +22,6 @@ package org.sonarqube.ws.client.projects; import java.util.stream.Collectors; import javax.annotation.Generated; import org.sonarqube.ws.MediaTypes; -import org.sonarqube.ws.Projects; import org.sonarqube.ws.Projects.CreateWsResponse; import org.sonarqube.ws.Projects.SearchMyProjectsWsResponse; import org.sonarqube.ws.Projects.SearchWsResponse; @@ -101,10 +100,10 @@ public class ProjectsService extends BaseService { * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/projects/license_usage">Further information about this action online (including a response example)</a> * @since 9.4 */ - public String licenseUsage() { + public WsResponse licenseUsage() { GetRequest getRequest = new GetRequest(path("license_usage")) - .setMediaType(MediaTypes.CSV); - return call(getRequest).content(); + .setMediaType(MediaTypes.JSON); + return call(getRequest); } /** |