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;
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);
private long loc;
private String branchName;
private String branchType;
- private long lastAnalysisDate;
public String getProjectUuid() {
return projectUuid;
this.loc = loc;
return this;
}
-
- public long getLastAnalysisDate() {
- return lastAnalysisDate;
- }
-
- public LargestBranchNclocDto setLastAnalysisDate(long lastAnalysisDate) {
- this.lastAnalysisDate = lastAnalysisDate;
- return this;
- }
}
) 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,
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>
assertThat(underTest.getLoc()).isEqualTo(123L);
assertThat(underTest.getBranchName()).isEqualTo("branchName");
assertThat(underTest.getBranchType()).isEqualTo("branchType");
- assertThat(underTest.getLastAnalysisDate()).isEqualTo(1L);
}
private void setUnderTest() {
.setProjectKey("projectKey")
.setLoc(123L)
.setBranchName("branchName")
- .setBranchType("branchType")
- .setLastAnalysisDate(1L);
+ .setBranchType("branchType");
}
}
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;
* @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);
}
/**