aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-db-dao
diff options
context:
space:
mode:
authorWojtek Wajerowicz <115081248+wojciech-wajerowicz-sonarsource@users.noreply.github.com>2023-10-11 14:20:13 +0200
committersonartech <sonartech@sonarsource.com>2023-10-20 20:02:39 +0000
commit4670e9985e7b7bedf952c99a498a3a1c13912dd0 (patch)
tree6bc0c337fce2667fba8db9d2cf828d4a79b9978d /server/sonar-db-dao
parentda75e87d29efe342fa2761def532f0ea94f71cd1 (diff)
downloadsonarqube-4670e9985e7b7bedf952c99a498a3a1c13912dd0.tar.gz
sonarqube-4670e9985e7b7bedf952c99a498a3a1c13912dd0.zip
SONAR-20699 Send DevOps platform information for GitHub from the scanner.
Diffstat (limited to 'server/sonar-db-dao')
-rw-r--r--server/sonar-db-dao/src/it/java/org/sonar/db/ce/CeQueueDaoIT.java14
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/ce/CeTaskCharacteristicDto.java12
2 files changed, 15 insertions, 11 deletions
diff --git a/server/sonar-db-dao/src/it/java/org/sonar/db/ce/CeQueueDaoIT.java b/server/sonar-db-dao/src/it/java/org/sonar/db/ce/CeQueueDaoIT.java
index 2d6044b4312..ecdfa83badd 100644
--- a/server/sonar-db-dao/src/it/java/org/sonar/db/ce/CeQueueDaoIT.java
+++ b/server/sonar-db-dao/src/it/java/org/sonar/db/ce/CeQueueDaoIT.java
@@ -46,12 +46,12 @@ import static org.assertj.core.api.Assertions.entry;
import static org.assertj.core.groups.Tuple.tuple;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
+import static org.sonar.core.ce.CeTaskCharacteristics.BRANCH;
+import static org.sonar.core.ce.CeTaskCharacteristics.PULL_REQUEST;
import static org.sonar.db.ce.CeQueueDto.Status.IN_PROGRESS;
import static org.sonar.db.ce.CeQueueDto.Status.PENDING;
import static org.sonar.db.ce.CeQueueTesting.newCeQueueDto;
import static org.sonar.db.ce.CeQueueTesting.reset;
-import static org.sonar.db.ce.CeTaskCharacteristicDto.BRANCH_KEY;
-import static org.sonar.db.ce.CeTaskCharacteristicDto.PULL_REQUEST;
public class CeQueueDaoIT {
private static final long INIT_TIME = 1_450_000_000_000L;
@@ -295,7 +295,7 @@ public class CeQueueDaoIT {
List<CeQueueDto> notPendingForWorker = underTestAlwaysIncreasingSystem2.selectNotPendingForWorker(db.getSession(), WORKER_UUID_1);
assertThat(notPendingForWorker).extracting(CeQueueDto::getUuid)
- .contains(inProgressTaskWorker1.getUuid());
+ .contains(inProgressTaskWorker1.getUuid());
}
@Test
@@ -655,7 +655,7 @@ public class CeQueueDaoIT {
assertThat(prOrBranchTasks).hasSize(1);
assertThat(prOrBranchTasks.get(0))
.extracting(PrOrBranchTask::getBranchType, PrOrBranchTask::getComponentUuid, PrOrBranchTask::getEntityUuid, PrOrBranchTask::getTaskType)
- .containsExactly(BRANCH_KEY, COMPONENT_UUID_1, ENTITY_UUID_1, CeTaskTypes.REPORT);
+ .containsExactly(BRANCH, COMPONENT_UUID_1, ENTITY_UUID_1, CeTaskTypes.REPORT);
}
@Test
@@ -667,12 +667,12 @@ public class CeQueueDaoIT {
.setTaskType(CeTaskTypes.REPORT)
.setCreatedAt(123L));
List<PrOrBranchTask> prOrBranchTasks = underTest.selectOldestPendingPrOrBranch(db.getSession());
- insertCharacteristic(BRANCH_KEY, "123", "c1", TASK_UUID_1);
+ insertCharacteristic(BRANCH, "123", "c1", TASK_UUID_1);
assertThat(prOrBranchTasks).hasSize(1);
assertThat(prOrBranchTasks.get(0))
.extracting(PrOrBranchTask::getBranchType, PrOrBranchTask::getComponentUuid, PrOrBranchTask::getEntityUuid, PrOrBranchTask::getTaskType)
- .containsExactly(BRANCH_KEY, COMPONENT_UUID_1, ENTITY_UUID_1, CeTaskTypes.REPORT);
+ .containsExactly(BRANCH, COMPONENT_UUID_1, ENTITY_UUID_1, CeTaskTypes.REPORT);
}
@Test
@@ -725,7 +725,7 @@ public class CeQueueDaoIT {
assertThat(prOrBranchTasks).hasSize(1);
assertThat(prOrBranchTasks.get(0))
.extracting(PrOrBranchTask::getBranchType, PrOrBranchTask::getComponentUuid, PrOrBranchTask::getEntityUuid, PrOrBranchTask::getTaskType)
- .containsExactly(BRANCH_KEY, COMPONENT_UUID_1, ENTITY_UUID_1, CeTaskTypes.REPORT);
+ .containsExactly(BRANCH, COMPONENT_UUID_1, ENTITY_UUID_1, CeTaskTypes.REPORT);
}
private void insertPending(CeQueueDto dto) {
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/ce/CeTaskCharacteristicDto.java b/server/sonar-db-dao/src/main/java/org/sonar/db/ce/CeTaskCharacteristicDto.java
index 04a53f9107e..54b22d05bd4 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/ce/CeTaskCharacteristicDto.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/ce/CeTaskCharacteristicDto.java
@@ -21,12 +21,16 @@ package org.sonar.db.ce;
import java.util.Set;
+import static org.sonar.core.ce.CeTaskCharacteristics.BRANCH;
+import static org.sonar.core.ce.CeTaskCharacteristics.BRANCH_TYPE;
+import static org.sonar.core.ce.CeTaskCharacteristics.DEVOPS_PLATFORM_PROJECT_IDENTIFIER;
+import static org.sonar.core.ce.CeTaskCharacteristics.DEVOPS_PLATFORM_URL;
+import static org.sonar.core.ce.CeTaskCharacteristics.PULL_REQUEST;
+
public class CeTaskCharacteristicDto {
- public static final String BRANCH_KEY = "branch";
- public static final String BRANCH_TYPE_KEY = "branchType";
- public static final String PULL_REQUEST = "pullRequest";
- public static final Set<String> SUPPORTED_KEYS = Set.of(BRANCH_KEY, BRANCH_TYPE_KEY, PULL_REQUEST);
+
+ public static final Set<String> SUPPORTED_KEYS = Set.of(BRANCH, BRANCH_TYPE, PULL_REQUEST, DEVOPS_PLATFORM_URL, DEVOPS_PLATFORM_PROJECT_IDENTIFIER);
private String uuid;
private String taskUuid;