aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatteo Mara <matteo.mara@sonarsource.com>2022-03-04 14:25:57 +0100
committersonartech <sonartech@sonarsource.com>2022-03-09 20:02:59 +0000
commit07bfdaa5256a44787aa15cf16155eaceaec9a452 (patch)
treefb4af39d93b44a610d50456597e3121911d03eda
parentcc3c0c7119ed51be19435872903f5090b092d415 (diff)
downloadsonarqube-07bfdaa5256a44787aa15cf16155eaceaec9a452.tar.gz
sonarqube-07bfdaa5256a44787aa15cf16155eaceaec9a452.zip
SONAR-16013 export database results to CSV
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/measure/LargestBranchNclocDto.java13
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/measure/LargestBranchNclocDtoTest.java10
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/measure/LiveMeasureDaoTest.java4
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/MediaTypes.java2
4 files changed, 3 insertions, 26 deletions
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 ae9728f0359..579fe18f344 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
@@ -91,17 +91,4 @@ public class LargestBranchNclocDto {
this.lastAnalysisDate = lastAnalysisDate;
return this;
}
-
- @Override
- public String toString() {
- return new StringBuilder("ProjectMaxNclocDto{")
- .append("projectUuid='").append(projectUuid).append('\'')
- .append(", projectName='").append(projectName).append('\'')
- .append(", projectKey='").append(projectKey).append('\'')
- .append(", loc=").append(loc)
- .append(", branchName='").append(branchName).append('\'')
- .append(", branchType='").append(branchType).append('\'')
- .append(", lastAnalysisDate=").append(lastAnalysisDate)
- .append('}').toString();
- }
}
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 f3d8d9a7d2f..e5b2f71e2fb 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
@@ -40,16 +40,6 @@ public class LargestBranchNclocDtoTest {
assertThat(underTest.getLastAnalysisDate()).isEqualTo(1L);
}
- @Test
- public void test_ToString() {
- assertThat(new LargestBranchNclocDto())
- .hasToString("ProjectMaxNclocDto{projectUuid='null', projectName='null', projectKey='null', loc=0, branchName='null', branchType='null', lastAnalysisDate=0}");
- setUnderTest();
- assertThat(underTest)
- .hasToString(
- "ProjectMaxNclocDto{projectUuid='projectUuid', projectName='projectName', projectKey='projectKey', loc=123, branchName='branchName', branchType='branchType', lastAnalysisDate=1}");
- }
-
private void setUnderTest() {
underTest
.setProjectUuid("projectUuid")
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/measure/LiveMeasureDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/measure/LiveMeasureDaoTest.java
index 36bbb9a8b6d..cfb9d3c6d13 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/measure/LiveMeasureDaoTest.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/measure/LiveMeasureDaoTest.java
@@ -327,7 +327,7 @@ public class LiveMeasureDaoTest {
@Test
public void get_branch_with_max_ncloc_per_project() {
- SetupProjectsWithLoc();
+ setupProjectsWithLoc();
List<LargestBranchNclocDto> results = underTest.getLargestBranchNclocPerProject(db.getSession());
@@ -700,7 +700,7 @@ public class LiveMeasureDaoTest {
"componentUuid", "projectUuid", "metricUuid", "value", "textValue", "data", "variation");
}
- private void SetupProjectsWithLoc() {
+ private void setupProjectsWithLoc() {
MetricDto ncloc = db.measures().insertMetric(m -> m.setKey("ncloc").setValueType(INT.toString()));
MetricDto lines = db.measures().insertMetric(m -> m.setKey("lines").setValueType(INT.toString()));
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/MediaTypes.java b/sonar-ws/src/main/java/org/sonarqube/ws/MediaTypes.java
index 284559d932a..8e2f39cdb9b 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/MediaTypes.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/MediaTypes.java
@@ -29,6 +29,7 @@ import static org.sonarqube.ws.WsUtils.isNullOrEmpty;
* @since 5.3
*/
public final class MediaTypes {
+ public static final String CSV = "text/csv";
public static final String DEFAULT = "application/octet-stream";
public static final String HTML = "text/html";
public static final String JAVASCRIPT = "application/javascript";
@@ -40,7 +41,6 @@ public final class MediaTypes {
public static final String ZIP = "application/zip";
private static final String BMP = "image/bmp";
private static final String CSS = "text/css";
- private static final String CSV = "text/csv";
private static final String DTD = "application/xml-dtd";
private static final String GIF = "image/gif";
private static final String ICO = "image/x-icon";