]> source.dussan.org Git - sonarqube.git/commitdiff
SGB-214 Fix measure_data type on tests
authorLéo Geoffroy <leo.geoffroy@sonarsource.com>
Thu, 7 Nov 2024 16:07:37 +0000 (17:07 +0100)
committersonartech <sonartech@sonarsource.com>
Fri, 8 Nov 2024 20:02:47 +0000 (20:02 +0000)
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v108/MigrateBranchesLiveMeasuresToMeasuresIT.java

index 74813eea032f90a3e77585d4e3d1c9f8d29279eb..b41e0d0224677831af7a138538fa19036909aa58 100644 (file)
@@ -202,7 +202,7 @@ class MigrateBranchesLiveMeasuresToMeasuresIT {
     insertNotMigratedBranch(branch);
     String component1 = uuidFactory.create();
     metricsToMigrate.forEach(metricUuid -> insertMeasure(branch, component1, metricUuid,
-      Map.of("measure_data", "{\"LOW\":3,\"MEDIUM\":0,\"HIGH\":4,\"total\":7}")));
+      Map.of("measure_data", "{\"LOW\":3,\"MEDIUM\":0,\"HIGH\":4,\"total\":7}".getBytes(StandardCharsets.UTF_8))));
 
     underTest.execute();
 
@@ -236,12 +236,12 @@ class MigrateBranchesLiveMeasuresToMeasuresIT {
     String component1 = uuidFactory.create();
     insertMeasure(branch, component1, nclocMetricUuid, Map.of("value", 120));
     // total is not a number
-    insertMeasure(branch, component1, maintainabilityMetricUuid, Map.of("measure_data", "{\"LOW\":3,\"MEDIUM\":0,\"HIGH\":4," +
-      "\"total\":\"ABC\"}"));
+    insertMeasure(branch, component1, maintainabilityMetricUuid, Map.of("measure_data", "{\"LOW\":3,\"MEDIUM\":0,\"HIGH\":4,\"total\":\"ABC\"}"
+      .getBytes(StandardCharsets.UTF_8)));
     // total cannot fit in a long
-    insertMeasure(branch, component1, reliabilityMetricUuid, Map.of("measure_data", "{\"LOW\":3,\"MEDIUM\":0,\"HIGH\":4," +
-      "\"total\":98723987498723987429874928748748}"));
-    insertMeasure(branch, component1, securityMetricUuid, Map.of("measure_data", "{\"LOW\":3,\"MEDIUM\":0,\"HIGH\":4,\"total\":37}"));
+    insertMeasure(branch, component1, reliabilityMetricUuid, Map.of("measure_data", "{\"LOW\":3,\"MEDIUM\":0,\"HIGH\":4,\"total\":98723987498723987429874928748748}"
+      .getBytes(StandardCharsets.UTF_8)));
+    insertMeasure(branch, component1, securityMetricUuid, Map.of("measure_data", "{\"LOW\":3,\"MEDIUM\":0,\"HIGH\":4,\"total\":37}".getBytes(StandardCharsets.UTF_8)));
 
     logTester.setLevel(Level.DEBUG);
     underTest.execute();
@@ -259,8 +259,7 @@ class MigrateBranchesLiveMeasuresToMeasuresIT {
       "ncloc", 120.0,
       CoreMetrics.MAINTAINABILITY_ISSUES_KEY, "{\"LOW\":3,\"MEDIUM\":0,\"HIGH\":4,\"total\":\"ABC\"}",
       CoreMetrics.RELIABILITY_ISSUES_KEY, "{\"LOW\":3,\"MEDIUM\":0,\"HIGH\":4,\"total\":98723987498723987429874928748748}",
-      CoreMetrics.SECURITY_ISSUES_KEY, "{\"LOW\":3,\"MEDIUM\":0,\"HIGH\":4,\"total\":37}"
-    );
+      CoreMetrics.SECURITY_ISSUES_KEY, "{\"LOW\":3,\"MEDIUM\":0,\"HIGH\":4,\"total\":37}");
 
     Map<String, Object> expectedNewMetrics = Map.of(SoftwareQualitiesMetrics.SOFTWARE_QUALITY_SECURITY_ISSUES_KEY, 37.0);