aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-webserver-es
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2020-03-24 11:13:08 -0500
committersonartech <sonartech@sonarsource.com>2020-04-14 20:04:04 +0000
commitd8081f847f92247a64166572605876e67e9a34ed (patch)
tree6d267df0fdb86df044c04c7436e465318cdf8afa /server/sonar-webserver-es
parentd662d0c0269e1a12da0c3ecdb8f9d33b765ccdcc (diff)
downloadsonarqube-d8081f847f92247a64166572605876e67e9a34ed.tar.gz
sonarqube-d8081f847f92247a64166572605876e67e9a34ed.zip
SONAR-13193 Stop using legacy project ID and use project UUID instead
Diffstat (limited to 'server/sonar-webserver-es')
-rw-r--r--server/sonar-webserver-es/src/main/java/org/sonar/server/permission/index/PermissionIndexerDao.java4
-rw-r--r--server/sonar-webserver-es/src/test/java/org/sonar/server/permission/index/PermissionIndexerDaoTest.java2
-rw-r--r--server/sonar-webserver-es/src/test/java/org/sonar/server/permission/index/PermissionIndexerTest.java4
3 files changed, 5 insertions, 5 deletions
diff --git a/server/sonar-webserver-es/src/main/java/org/sonar/server/permission/index/PermissionIndexerDao.java b/server/sonar-webserver-es/src/main/java/org/sonar/server/permission/index/PermissionIndexerDao.java
index 90d7c5e3a5b..c695f67ddbe 100644
--- a/server/sonar-webserver-es/src/main/java/org/sonar/server/permission/index/PermissionIndexerDao.java
+++ b/server/sonar-webserver-es/src/main/java/org/sonar/server/permission/index/PermissionIndexerDao.java
@@ -60,7 +60,7 @@ public class PermissionIndexerDao {
" user_roles.user_id AS user_id, " +
" NULL AS group_id " +
" FROM components c " +
- " INNER JOIN user_roles ON user_roles.resource_id = c.id AND user_roles.role = 'user' " +
+ " INNER JOIN user_roles ON user_roles.component_uuid = c.uuid AND user_roles.role = 'user' " +
" WHERE " +
" (c.qualifier = 'TRK' " +
" or c.qualifier = 'VW' " +
@@ -77,7 +77,7 @@ public class PermissionIndexerDao {
" NULL AS user_id, " +
" groups.id AS group_id " +
" FROM components c " +
- " INNER JOIN group_roles ON group_roles.resource_id = c.id AND group_roles.role = 'user' " +
+ " INNER JOIN group_roles ON group_roles.component_uuid = c.uuid AND group_roles.role = 'user' " +
" INNER JOIN groups ON groups.id = group_roles.group_id " +
" WHERE " +
" (c.qualifier = 'TRK' " +
diff --git a/server/sonar-webserver-es/src/test/java/org/sonar/server/permission/index/PermissionIndexerDaoTest.java b/server/sonar-webserver-es/src/test/java/org/sonar/server/permission/index/PermissionIndexerDaoTest.java
index 55f31f0795b..b40dd5448f7 100644
--- a/server/sonar-webserver-es/src/test/java/org/sonar/server/permission/index/PermissionIndexerDaoTest.java
+++ b/server/sonar-webserver-es/src/test/java/org/sonar/server/permission/index/PermissionIndexerDaoTest.java
@@ -175,7 +175,7 @@ public class PermissionIndexerDaoTest {
.setOrganizationUuid(group.getOrganizationUuid())
.setGroupId(group.getId())
.setRole(USER)
- .setResourceId(project.getId());
+ .setComponentUuid(project.uuid());
dbClient.groupPermissionDao().insert(dbSession, dto);
}
dbSession.commit();
diff --git a/server/sonar-webserver-es/src/test/java/org/sonar/server/permission/index/PermissionIndexerTest.java b/server/sonar-webserver-es/src/test/java/org/sonar/server/permission/index/PermissionIndexerTest.java
index be49eeb2254..5a10ece3e7c 100644
--- a/server/sonar-webserver-es/src/test/java/org/sonar/server/permission/index/PermissionIndexerTest.java
+++ b/server/sonar-webserver-es/src/test/java/org/sonar/server/permission/index/PermissionIndexerTest.java
@@ -85,7 +85,7 @@ public class PermissionIndexerTest {
assertThat(es.countDocuments(INDEX_TYPE_FOO_AUTH)).isEqualTo(2);
// Simulate a indexation issue
- db.getDbClient().componentDao().delete(db.getSession(), project1.getId());
+ db.getDbClient().componentDao().delete(db.getSession(), project1.uuid());
underTest.prepareForRecovery(db.getSession(), asList(project1.uuid()), ProjectIndexer.Cause.PROJECT_DELETION);
assertThat(db.countRowsOfTable(db.getSession(), "es_queue")).isEqualTo(1);
Collection<EsQueueDto> esQueueDtos = db.getDbClient().esQueueDao().selectForRecovery(db.getSession(), Long.MAX_VALUE, 2);
@@ -304,7 +304,7 @@ public class PermissionIndexerTest {
indexPermissions(project, ProjectIndexer.Cause.PROJECT_CREATION);
verifyAuthorized(project, user);
- db.getDbClient().componentDao().delete(db.getSession(), project.getId());
+ db.getDbClient().componentDao().delete(db.getSession(), project.uuid());
indexPermissions(project, ProjectIndexer.Cause.PROJECT_DELETION);
verifyNotAuthorized(project, user);