aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2017-07-29 10:41:44 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2017-07-29 12:56:08 +0200
commit99c6c21439cd7fc6313a6418fab238f2927dc410 (patch)
treeb27136b06a622a1b13dca87e3a700edf5e012c6d /server
parent587e5f676e750c0c79ab45730a01c0f7ed1cb183 (diff)
downloadsonarqube-99c6c21439cd7fc6313a6418fab238f2927dc410.tar.gz
sonarqube-99c6c21439cd7fc6313a6418fab238f2927dc410.zip
Remove useless usages of projects.authorization_updated_at
but keep the db column
Diffstat (limited to 'server')
-rw-r--r--server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java2
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/DaoModule.java4
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/DbClient.java9
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/MyBatis.java6
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDto.java15
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/component/ResourceDao.java38
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/component/ResourceDto.java10
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/component/ResourceMapper.java28
-rw-r--r--server/sonar-db-dao/src/main/resources/org/sonar/db/component/ComponentMapper.xml3
-rw-r--r--server/sonar-db-dao/src/main/resources/org/sonar/db/component/ResourceMapper.xml12
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/DaoModuleTest.java2
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDaoTest.java5
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDtoTest.java5
-rw-r--r--server/sonar-db-dao/src/test/java/org/sonar/db/component/ResourceDaoTest.java49
-rw-r--r--server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/delete.xml2
-rw-r--r--server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/insert-result.xml2
-rw-r--r--server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/insert_disabled_component-result.xml2
-rw-r--r--server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/selectForIndexing.xml4
-rw-r--r--server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/select_provisioned_projects.xml10
-rw-r--r--server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/shared.xml8
-rw-r--r--server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/update-result.xml2
-rw-r--r--server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/update.xml2
-rw-r--r--server/sonar-db-dao/src/test/resources/org/sonar/db/component/ResourceDaoTest/update_authorization_date-result.xml2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/permission/PermissionTemplateService.java1
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/permission/PermissionUpdater.java4
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/permission/index/AuthorizationTypeSupport.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/permission/index/PermissionIndexer.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/permission/index/PermissionIndexerDao.java18
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexDebtTest.java2
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexProjectStatisticsTest.java2
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexTest.java2
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexerTest.java7
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/issue/ws/TagsActionTest.java2
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/measure/index/ProjectMeasuresIndexTest.java6
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/measure/index/ProjectMeasuresIndexTextSearchTest.java2
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/permission/PermissionTemplateServiceTest.java7
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/permission/index/PermissionIndexerDaoTest.java5
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/permission/index/PermissionIndexerTester.java6
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/projecttag/ws/SearchActionTest.java2
39 files changed, 41 insertions, 251 deletions
diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java
index 17eee92bbe0..71e6a8b17f2 100644
--- a/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java
+++ b/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java
@@ -135,7 +135,7 @@ public class ComputeEngineContainerImplTest {
assertThat(picoContainer.getParent().getParent().getParent().getComponentAdapters()).hasSize(
COMPONENTS_IN_LEVEL_1_AT_CONSTRUCTION
+ 25 // level 1
- + 47 // content of DaoModule
+ + 46 // content of DaoModule
+ 3 // content of EsSearchModule
+ 58 // content of CorePropertyDefinitions
);
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/DaoModule.java b/server/sonar-db-dao/src/main/java/org/sonar/db/DaoModule.java
index 9ee4a9586cf..a6f33ee50a6 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/DaoModule.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/DaoModule.java
@@ -29,13 +29,12 @@ import org.sonar.db.ce.CeTaskInputDao;
import org.sonar.db.component.ComponentDao;
import org.sonar.db.component.ComponentKeyUpdaterDao;
import org.sonar.db.component.ComponentLinkDao;
-import org.sonar.db.component.ResourceDao;
import org.sonar.db.component.SnapshotDao;
import org.sonar.db.duplication.DuplicationDao;
+import org.sonar.db.es.EsQueueDao;
import org.sonar.db.event.EventDao;
import org.sonar.db.issue.IssueChangeDao;
import org.sonar.db.issue.IssueDao;
-import org.sonar.db.es.EsQueueDao;
import org.sonar.db.loadedtemplate.LoadedTemplateDao;
import org.sonar.db.measure.MeasureDao;
import org.sonar.db.measure.custom.CustomMeasureDao;
@@ -111,7 +110,6 @@ public class DaoModule extends Module {
QualityGateConditionDao.class,
QualityGateDao.class,
QualityProfileDao.class,
- ResourceDao.class,
RoleDao.class,
RuleDao.class,
RuleRepositoryDao.class,
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/DbClient.java b/server/sonar-db-dao/src/main/java/org/sonar/db/DbClient.java
index bd0fd55735e..2948b8469f8 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/DbClient.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/DbClient.java
@@ -28,13 +28,12 @@ import org.sonar.db.ce.CeTaskInputDao;
import org.sonar.db.component.ComponentDao;
import org.sonar.db.component.ComponentKeyUpdaterDao;
import org.sonar.db.component.ComponentLinkDao;
-import org.sonar.db.component.ResourceDao;
import org.sonar.db.component.SnapshotDao;
import org.sonar.db.duplication.DuplicationDao;
+import org.sonar.db.es.EsQueueDao;
import org.sonar.db.event.EventDao;
import org.sonar.db.issue.IssueChangeDao;
import org.sonar.db.issue.IssueDao;
-import org.sonar.db.es.EsQueueDao;
import org.sonar.db.loadedtemplate.LoadedTemplateDao;
import org.sonar.db.measure.MeasureDao;
import org.sonar.db.measure.custom.CustomMeasureDao;
@@ -84,7 +83,6 @@ public class DbClient {
private final InternalPropertiesDao internalPropertiesDao;
private final SnapshotDao snapshotDao;
private final ComponentDao componentDao;
- private final ResourceDao resourceDao;
private final ComponentKeyUpdaterDao componentKeyUpdaterDao;
private final MeasureDao measureDao;
private final UserDao userDao;
@@ -141,7 +139,6 @@ public class DbClient {
internalPropertiesDao = getDao(map, InternalPropertiesDao.class);
snapshotDao = getDao(map, SnapshotDao.class);
componentDao = getDao(map, ComponentDao.class);
- resourceDao = getDao(map, ResourceDao.class);
componentKeyUpdaterDao = getDao(map, ComponentKeyUpdaterDao.class);
measureDao = getDao(map, MeasureDao.class);
userDao = getDao(map, UserDao.class);
@@ -236,10 +233,6 @@ public class DbClient {
return componentDao;
}
- public ResourceDao resourceDao() {
- return resourceDao;
- }
-
public ComponentKeyUpdaterDao componentKeyUpdaterDao() {
return componentKeyUpdaterDao;
}
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/MyBatis.java b/server/sonar-db-dao/src/main/java/org/sonar/db/MyBatis.java
index ea1251d69fe..3e879c9e948 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/MyBatis.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/MyBatis.java
@@ -41,7 +41,6 @@ import org.sonar.db.component.ComponentLinkMapper;
import org.sonar.db.component.ComponentMapper;
import org.sonar.db.component.FilePathWithHashDto;
import org.sonar.db.component.ResourceDto;
-import org.sonar.db.component.ResourceMapper;
import org.sonar.db.component.SnapshotDto;
import org.sonar.db.component.SnapshotMapper;
import org.sonar.db.component.UuidWithProjectUuidDto;
@@ -49,13 +48,13 @@ import org.sonar.db.component.ViewsSnapshotDto;
import org.sonar.db.debt.RequirementMigrationDto;
import org.sonar.db.duplication.DuplicationMapper;
import org.sonar.db.duplication.DuplicationUnitDto;
+import org.sonar.db.es.EsQueueMapper;
import org.sonar.db.event.EventDto;
import org.sonar.db.event.EventMapper;
import org.sonar.db.issue.IssueChangeDto;
import org.sonar.db.issue.IssueChangeMapper;
import org.sonar.db.issue.IssueDto;
import org.sonar.db.issue.IssueMapper;
-import org.sonar.db.es.EsQueueMapper;
import org.sonar.db.loadedtemplate.LoadedTemplateDto;
import org.sonar.db.loadedtemplate.LoadedTemplateMapper;
import org.sonar.db.measure.MeasureDto;
@@ -181,9 +180,6 @@ public class MyBatis implements Startable {
confBuilder.loadAlias("UuidWithProjectUuid", UuidWithProjectUuidDto.class);
confBuilder.loadAlias("ViewsSnapshot", ViewsSnapshotDto.class);
- // ResourceMapper has to be loaded before IssueMapper because this last one used it
- confBuilder.loadMapper(ResourceMapper.class);
-
// keep them sorted alphabetically
Class<?>[] mappers = {
ActiveRuleMapper.class,
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDto.java b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDto.java
index 215a248c0c4..87385285a86 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDto.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDto.java
@@ -124,7 +124,6 @@ public class ComponentDto implements Component {
private boolean isPrivate = false;
private Date createdAt;
- private Long authorizationUpdatedAt;
public static String formatUuidPathFromParent(ComponentDto parent) {
checkArgument(!Strings.isNullOrEmpty(parent.getUuidPath()));
@@ -348,19 +347,6 @@ public class ComponentDto implements Component {
return this;
}
- /**
- * Only available on projects
- */
- @CheckForNull
- public Long getAuthorizationUpdatedAt() {
- return authorizationUpdatedAt;
- }
-
- public ComponentDto setAuthorizationUpdatedAt(@Nullable Long authorizationUpdatedAt) {
- this.authorizationUpdatedAt = authorizationUpdatedAt;
- return this;
- }
-
public String getKey() {
return key();
}
@@ -444,7 +430,6 @@ public class ComponentDto implements Component {
.append("longName", longName)
.append("language", language)
.append("enabled", enabled)
- .append("authorizationUpdatedAt", authorizationUpdatedAt)
.append("private", isPrivate)
.toString();
}
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ResourceDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ResourceDao.java
deleted file mode 100644
index 9c481d66682..00000000000
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ResourceDao.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.db.component;
-
-import org.sonar.api.utils.System2;
-import org.sonar.db.Dao;
-import org.sonar.db.DbSession;
-
-public class ResourceDao implements Dao {
-
- private final System2 system2;
-
- public ResourceDao(System2 system2) {
- this.system2 = system2;
- }
-
- public void updateAuthorizationDate(Long projectId, DbSession session) {
- session.getMapper(ResourceMapper.class).updateAuthorizationDate(projectId, system2.now());
- }
-
-}
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ResourceDto.java b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ResourceDto.java
index 0fc5e2415b8..b8cc1cf53f6 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ResourceDto.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ResourceDto.java
@@ -47,7 +47,6 @@ public class ResourceDto {
private String copyComponentUuid;
private String developerUuid;
private Date createdAt;
- private Long authorizationUpdatedAt;
public Long getId() {
return id;
@@ -221,13 +220,4 @@ public class ResourceDto {
this.createdAt = date;
return this;
}
-
- public Long getAuthorizationUpdatedAt() {
- return authorizationUpdatedAt;
- }
-
- public ResourceDto setAuthorizationUpdatedAt(Long authorizationUpdatedAt) {
- this.authorizationUpdatedAt = authorizationUpdatedAt;
- return this;
- }
}
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ResourceMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/component/ResourceMapper.java
deleted file mode 100644
index 06bc63393c9..00000000000
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ResourceMapper.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.db.component;
-
-import org.apache.ibatis.annotations.Param;
-
-public interface ResourceMapper {
-
- void updateAuthorizationDate(@Param("projectId") Long projectId, @Param("authorizationDate") Long authorizationDate);
-
-}
diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ComponentMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ComponentMapper.xml
index fecf8cf8715..43450db333a 100644
--- a/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ComponentMapper.xml
+++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ComponentMapper.xml
@@ -25,7 +25,6 @@
p.copy_component_uuid as copyComponentUuid,
p.developer_uuid as developerUuid,
p.private as isPrivate,
- p.authorization_updated_at as authorizationUpdatedAt,
p.created_at as createdAt
</sql>
@@ -473,7 +472,6 @@
developer_uuid,
enabled,
created_at,
- authorization_updated_at,
b_changed,
b_copy_component_uuid,
b_description,
@@ -509,7 +507,6 @@
#{developerUuid,jdbcType=VARCHAR},
#{enabled,jdbcType=BOOLEAN},
#{createdAt,jdbcType=TIMESTAMP},
- #{authorizationUpdatedAt,jdbcType=BIGINT},
${_false},
null,
null,
diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ResourceMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ResourceMapper.xml
deleted file mode 100644
index 2ef477b7975..00000000000
--- a/server/sonar-db-dao/src/main/resources/org/sonar/db/component/ResourceMapper.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd">
-
-<mapper namespace="org.sonar.db.component.ResourceMapper">
-
- <update id="updateAuthorizationDate" parameterType="map">
- update projects set authorization_updated_at=#{authorizationDate}
- where id=#{projectId,jdbcType=BIGINT}
- </update>
-
-</mapper>
-
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/DaoModuleTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/DaoModuleTest.java
index 2ffc454abd9..4e2c7cb812e 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/DaoModuleTest.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/DaoModuleTest.java
@@ -29,6 +29,6 @@ public class DaoModuleTest {
public void verify_count_of_added_components() {
ComponentContainer container = new ComponentContainer();
new DaoModule().configure(container);
- assertThat(container.size()).isEqualTo(2 + 47);
+ assertThat(container.size()).isEqualTo(2 + 46);
}
}
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDaoTest.java
index c9c83436a8e..4aa72117939 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDaoTest.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDaoTest.java
@@ -215,7 +215,6 @@ public class ComponentDaoTest {
assertThat(result.scope()).isEqualTo("PRJ");
assertThat(result.getRootUuid()).isEqualTo("U1");
assertThat(result.projectUuid()).isEqualTo("U1");
- assertThat(result.getAuthorizationUpdatedAt()).isEqualTo(123_456_789L);
}
@Test
@@ -697,7 +696,6 @@ public class ComponentDaoTest {
.setDeveloperUuid("uuid_7")
.setEnabled(true)
.setCreatedAt(DateUtils.parseDate("2014-06-18"))
- .setAuthorizationUpdatedAt(123456789L)
.setTags(newArrayList("platform", "analyzers"));
underTest.insert(dbSession, componentDto);
@@ -728,8 +726,7 @@ public class ComponentDaoTest {
.setPath("src/org/struts/RequestContext.java")
.setRootUuid("uuid_3")
.setEnabled(false)
- .setCreatedAt(DateUtils.parseDate("2014-06-18"))
- .setAuthorizationUpdatedAt(123456789L);
+ .setCreatedAt(DateUtils.parseDate("2014-06-18"));
underTest.insert(dbSession, componentDto);
dbSession.commit();
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDtoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDtoTest.java
index 8c70e78e17f..64200c148fa 100644
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDtoTest.java
+++ b/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDtoTest.java
@@ -43,9 +43,7 @@ public class ComponentDtoTest {
.setPath("src/org/struts/RequestContext.java")
.setCopyComponentUuid("uuid_5")
.setRootUuid("uuid_3")
- .setDeveloperUuid("uuid_6")
- .setAuthorizationUpdatedAt(123456789L)
- ;
+ .setDeveloperUuid("uuid_6");
assertThat(componentDto.getId()).isEqualTo(1L);
assertThat(componentDto.key()).isEqualTo("org.struts:struts-core:src/org/struts/RequestContext.java");
@@ -60,7 +58,6 @@ public class ComponentDtoTest {
assertThat(componentDto.getRootUuid()).isEqualTo("uuid_3");
assertThat(componentDto.getCopyResourceUuid()).isEqualTo("uuid_5");
assertThat(componentDto.getDeveloperUuid()).isEqualTo("uuid_6");
- assertThat(componentDto.getAuthorizationUpdatedAt()).isEqualTo(123456789L);
assertThat(componentDto.isPrivate()).isFalse();
}
diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/component/ResourceDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/component/ResourceDaoTest.java
deleted file mode 100644
index aa2a4b72132..00000000000
--- a/server/sonar-db-dao/src/test/java/org/sonar/db/component/ResourceDaoTest.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-package org.sonar.db.component;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonar.api.utils.System2;
-import org.sonar.db.DbTester;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-public class ResourceDaoTest {
-
- private static System2 system = mock(System2.class);
-
- @Rule
- public DbTester dbTester = DbTester.create(system);
-
- private ResourceDao underTest = dbTester.getDbClient().resourceDao();
-
- @Test
- public void update_authorization_date() {
- dbTester.prepareDbUnit(getClass(), "update_authorization_date.xml");
-
- when(system.now()).thenReturn(987654321L);
- underTest.updateAuthorizationDate(1L, dbTester.getSession());
- dbTester.getSession().commit();
-
- dbTester.assertDbUnit(getClass(), "update_authorization_date-result.xml", "projects");
- }
-}
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/delete.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/delete.xml
index b953654da8c..94d71265174 100644
--- a/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/delete.xml
+++ b/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/delete.xml
@@ -22,7 +22,7 @@
copy_resource_id="[null]"
person_id="[null]"
path="[null]"
- authorization_updated_at="123456789"/>
+ authorization_updated_at="[null]"/>
<!-- module -->
<projects organization_uuid="org1"
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/insert-result.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/insert-result.xml
index dfeb40750ab..2eecae17795 100644
--- a/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/insert-result.xml
+++ b/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/insert-result.xml
@@ -22,7 +22,7 @@
enabled="[true]"
copy_component_uuid="uuid_5"
developer_uuid="uuid_7"
- authorization_updated_at="123456789"
+ authorization_updated_at="[null]"
created_at="2014-06-18"
b_changed="[false]"
b_copy_component_uuid="[null]"
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/insert_disabled_component-result.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/insert_disabled_component-result.xml
index 0012dbd3a6c..46a6410768a 100644
--- a/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/insert_disabled_component-result.xml
+++ b/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/insert_disabled_component-result.xml
@@ -22,7 +22,7 @@
copy_component_uuid="[null]"
developer_uuid="[null]"
deprecated_kee="[null]"
- authorization_updated_at="123456789"
+ authorization_updated_at="[null]"
created_at="2014-06-18"
b_changed="[false]"
b_copy_component_uuid="[null]"
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/selectForIndexing.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/selectForIndexing.xml
index 3f85dda60d3..a66dddbe865 100644
--- a/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/selectForIndexing.xml
+++ b/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/selectForIndexing.xml
@@ -30,7 +30,7 @@
copy_component_uuid="[null]"
developer_uuid="[null]"
path="path_of_U1"
- authorization_updated_at="123456789"/>
+ authorization_updated_at="[null]"/>
<!-- module -->
<projects organization_uuid="org1"
@@ -122,7 +122,7 @@
copy_component_uuid="[null]"
developer_uuid="[null]"
path="path_of_U5"
- authorization_updated_at="123456789"/>
+ authorization_updated_at="[null]"/>
<!-- module -->
<projects organization_uuid="org1"
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/select_provisioned_projects.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/select_provisioned_projects.xml
index f1a2ed878ac..4b5d4bac103 100644
--- a/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/select_provisioned_projects.xml
+++ b/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/select_provisioned_projects.xml
@@ -28,7 +28,7 @@
copy_component_uuid="[null]"
developer_uuid="[null]"
path="[null]"
- authorization_updated_at="123456789"/>
+ authorization_updated_at="[null]"/>
<!-- root project -->
<projects organization_uuid="org1"
@@ -52,7 +52,7 @@
copy_component_uuid="[null]"
developer_uuid="[null]"
path="[null]"
- authorization_updated_at="123456789"/>
+ authorization_updated_at="[null]"/>
<snapshots id="1"
uuid="u1"
component_uuid="ABCD"
@@ -269,7 +269,7 @@
copy_component_uuid="[null]"
developer_uuid="[null]"
path="[null]"
- authorization_updated_at="123456789"/>
+ authorization_updated_at="[null]"/>
<!-- Developer and technical project copy -->
<projects organization_uuid="org1"
@@ -292,7 +292,7 @@
copy_component_uuid="[null]"
developer_uuid="[null]"
path="[null]"
- authorization_updated_at="123456789"/>
+ authorization_updated_at="[null]"/>
<projects organization_uuid="org1"
id="12"
root_uuid="OPQR"
@@ -313,6 +313,6 @@
copy_component_uuid="ABCD"
developer_uuid="OPQR"
path="[null]"
- authorization_updated_at="123456789"/>
+ authorization_updated_at="[null]"/>
</dataset>
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/shared.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/shared.xml
index c435f025563..fa6ce4ff052 100644
--- a/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/shared.xml
+++ b/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/shared.xml
@@ -37,7 +37,7 @@
copy_component_uuid="[null]"
developer_uuid="[null]"
path="path_of_U1"
- authorization_updated_at="123456789"/>
+ authorization_updated_at="[null]"/>
<snapshots id="1"
uuid="u1"
component_uuid="ABCD"
@@ -254,7 +254,7 @@
copy_component_uuid="[null]"
developer_uuid="[null]"
path="[null]"
- authorization_updated_at="123456789"/>
+ authorization_updated_at="[null]"/>
<!-- Developer and technical project copy -->
<projects organization_uuid="org1"
@@ -277,7 +277,7 @@
copy_component_uuid="[null]"
developer_uuid="[null]"
path="[null]"
- authorization_updated_at="123456789"/>
+ authorization_updated_at="[null]"/>
<projects organization_uuid="org1"
id="12"
scope="PRJ"
@@ -298,6 +298,6 @@
copy_component_uuid="U1"
developer_uuid="developer_uuid_of_U7"
path="[null]"
- authorization_updated_at="123456789"/>
+ authorization_updated_at="[null]"/>
</dataset>
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/update-result.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/update-result.xml
index b5e1fd3d88a..a3f5e6f11c9 100644
--- a/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/update-result.xml
+++ b/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/update-result.xml
@@ -21,7 +21,7 @@
enabled="[false]"
copy_component_uuid="uuid_6"
developer_uuid="uuid_9"
- authorization_updated_at="12345678910"
+ authorization_updated_at="[null]"
created_at="2014-06-18"
/>
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/update.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/update.xml
index 83a35b23765..7cb7764fd47 100644
--- a/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/update.xml
+++ b/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ComponentDaoTest/update.xml
@@ -21,7 +21,7 @@
enabled="[true]"
copy_component_uuid="uuid_5"
developer_uuid="[null]"
- authorization_updated_at="123456789"
+ authorization_updated_at="[null]"
created_at="2014-06-18"
/>
diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ResourceDaoTest/update_authorization_date-result.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ResourceDaoTest/update_authorization_date-result.xml
index f01a38d0fd9..6381dbc4ab5 100644
--- a/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ResourceDaoTest/update_authorization_date-result.xml
+++ b/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ResourceDaoTest/update_authorization_date-result.xml
@@ -23,7 +23,7 @@
created_at="[null]"
path="/old/foo/bar"
deprecated_kee="old deprecated key"
- authorization_updated_at="987654321"
+ authorization_updated_at="[null]"
b_changed="[false]"
b_copy_component_uuid="[null]"
b_description="[null]"
diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/PermissionTemplateService.java b/server/sonar-server/src/main/java/org/sonar/server/permission/PermissionTemplateService.java
index ddfcaabc81b..ebcdb291e0d 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/permission/PermissionTemplateService.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/permission/PermissionTemplateService.java
@@ -128,7 +128,6 @@ public class PermissionTemplateService {
}
private void copyPermissions(DbSession dbSession, PermissionTemplateDto template, ComponentDto project, @Nullable Integer projectCreatorUserId) {
- dbClient.resourceDao().updateAuthorizationDate(project.getId(), dbSession);
dbClient.groupPermissionDao().deleteByRootComponentId(dbSession, project.getId());
dbClient.userPermissionDao().deleteProjectPermissions(dbSession, project.getId());
diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/PermissionUpdater.java b/server/sonar-server/src/main/java/org/sonar/server/permission/PermissionUpdater.java
index 126ba94a36c..49e61615dc6 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/permission/PermissionUpdater.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/permission/PermissionUpdater.java
@@ -61,10 +61,6 @@ public class PermissionUpdater {
projectOrViewUuids.add(projectId.get().getUuid());
}
}
- for (Long projectId : projectIds) {
- dbClient.resourceDao().updateAuthorizationDate(projectId, dbSession);
- }
-
projectIndexers.commitAndIndexByProjectUuids(dbSession, projectOrViewUuids, ProjectIndexer.Cause.PERMISSION_CHANGE);
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/index/AuthorizationTypeSupport.java b/server/sonar-server/src/main/java/org/sonar/server/permission/index/AuthorizationTypeSupport.java
index 90f7289ab37..f1ba4e881dd 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/permission/index/AuthorizationTypeSupport.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/permission/index/AuthorizationTypeSupport.java
@@ -43,7 +43,6 @@ public class AuthorizationTypeSupport {
public static final String TYPE_AUTHORIZATION = "authorization";
public static final String FIELD_GROUP_IDS = "groupIds";
public static final String FIELD_USER_IDS = "userIds";
- public static final String FIELD_UPDATED_AT = "updatedAt";
/**
* When true, then anybody can access to the project. In that case
@@ -85,7 +84,6 @@ public class AuthorizationTypeSupport {
NewIndex.NewIndexType authType = type.getIndex().createType(TYPE_AUTHORIZATION);
authType.setAttribute("_routing", ImmutableMap.of("required", true));
- authType.createDateTimeField(FIELD_UPDATED_AT);
authType.createLongField(FIELD_GROUP_IDS);
authType.createLongField(FIELD_USER_IDS);
authType.createBooleanField(FIELD_ALLOW_ANYONE);
diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/index/PermissionIndexer.java b/server/sonar-server/src/main/java/org/sonar/server/permission/index/PermissionIndexer.java
index 078fe2f1091..a373828c2d3 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/permission/index/PermissionIndexer.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/permission/index/PermissionIndexer.java
@@ -29,7 +29,6 @@ import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.elasticsearch.action.index.IndexRequest;
-import org.sonar.api.utils.DateUtils;
import org.sonar.core.util.stream.MoreCollectors;
import org.sonar.db.DbClient;
import org.sonar.db.DbSession;
@@ -182,7 +181,6 @@ public class PermissionIndexer implements ProjectIndexer {
private static IndexRequest newIndexRequest(PermissionIndexerDao.Dto dto, IndexType indexType) {
Map<String, Object> doc = new HashMap<>();
- doc.put(AuthorizationTypeSupport.FIELD_UPDATED_AT, DateUtils.longToDate(dto.getUpdatedAt()));
if (dto.isAllowAnyone()) {
doc.put(AuthorizationTypeSupport.FIELD_ALLOW_ANYONE, true);
// no need to feed users and groups
diff --git a/server/sonar-server/src/main/java/org/sonar/server/permission/index/PermissionIndexerDao.java b/server/sonar-server/src/main/java/org/sonar/server/permission/index/PermissionIndexerDao.java
index a854f9caaca..3f7f5951896 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/permission/index/PermissionIndexerDao.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/permission/index/PermissionIndexerDao.java
@@ -43,15 +43,13 @@ public class PermissionIndexerDao {
public static final class Dto {
private final String projectUuid;
- private final long updatedAt;
private final String qualifier;
private final List<Integer> userIds = new ArrayList<>();
private final List<Integer> groupIds = new ArrayList<>();
private boolean allowAnyone = false;
- public Dto(String projectUuid, long updatedAt, String qualifier) {
+ public Dto(String projectUuid, String qualifier) {
this.projectUuid = projectUuid;
- this.updatedAt = updatedAt;
this.qualifier = qualifier;
}
@@ -59,10 +57,6 @@ public class PermissionIndexerDao {
return projectUuid;
}
- public long getUpdatedAt() {
- return updatedAt;
- }
-
public String getQualifier() {
return qualifier;
}
@@ -103,7 +97,6 @@ public class PermissionIndexerDao {
" project_authorization.project as project, " +
" project_authorization.user_id as user_id, " +
" project_authorization.group_id as group_id, " +
- " project_authorization.updated_at as updated_at, " +
" project_authorization.qualifier as qualifier " +
"FROM ( " +
@@ -111,7 +104,6 @@ public class PermissionIndexerDao {
" SELECT '" + RowKind.USER + "' as kind," +
" projects.uuid AS project, " +
- " projects.authorization_updated_at AS updated_at, " +
" projects.qualifier AS qualifier, " +
" user_roles.user_id AS user_id, " +
" NULL AS group_id " +
@@ -127,7 +119,6 @@ public class PermissionIndexerDao {
" SELECT '" + RowKind.GROUP + "' as kind," +
" projects.uuid AS project, " +
- " projects.authorization_updated_at AS updated_at, " +
" projects.qualifier AS qualifier, " +
" NULL AS user_id, " +
" groups.id AS group_id " +
@@ -145,7 +136,6 @@ public class PermissionIndexerDao {
" SELECT '" + RowKind.ANYONE + "' as kind," +
" projects.uuid AS project, " +
- " projects.authorization_updated_at AS updated_at, " +
" projects.qualifier AS qualifier, " +
" NULL AS user_id, " +
" NULL AS group_id " +
@@ -160,7 +150,6 @@ public class PermissionIndexerDao {
// private project is returned when no authorization
" SELECT '" + RowKind.NONE + "' as kind," +
" projects.uuid AS project, " +
- " projects.authorization_updated_at AS updated_at, " +
" projects.qualifier AS qualifier, " +
" NULL AS user_id, " +
" NULL AS group_id " +
@@ -240,9 +229,8 @@ public class PermissionIndexerDao {
Dto dto = dtosByProjectUuid.get(projectUuid);
if (dto == null) {
- long updatedAt = rs.getLong(5);
- String qualifier = rs.getString(6);
- dto = new Dto(projectUuid, updatedAt, qualifier);
+ String qualifier = rs.getString(5);
+ dto = new Dto(projectUuid, qualifier);
dtosByProjectUuid.put(projectUuid, dto);
}
switch (rowKind) {
diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexDebtTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexDebtTest.java
index cb287e0b7dd..de3b0f85311 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexDebtTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexDebtTest.java
@@ -290,7 +290,7 @@ public class IssueIndexDebtTest {
}
private void addIssueAuthorization(String projectUuid) {
- PermissionIndexerDao.Dto access = new PermissionIndexerDao.Dto(projectUuid, system2.now(), Qualifiers.PROJECT);
+ PermissionIndexerDao.Dto access = new PermissionIndexerDao.Dto(projectUuid, Qualifiers.PROJECT);
access.allowAnyone();
authorizationIndexerTester.allow(access);
}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexProjectStatisticsTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexProjectStatisticsTest.java
index e943f2bf424..62083883974 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexProjectStatisticsTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexProjectStatisticsTest.java
@@ -248,7 +248,7 @@ public class IssueIndexProjectStatisticsTest {
private void indexIssues(IssueDoc... issues) {
issueIndexer.index(asList(issues).iterator());
for (IssueDoc issue : issues) {
- PermissionIndexerDao.Dto access = new PermissionIndexerDao.Dto(issue.projectUuid(), system2.now(), "TRK");
+ PermissionIndexerDao.Dto access = new PermissionIndexerDao.Dto(issue.projectUuid(), "TRK");
access.allowAnyone();
authorizationIndexerTester.allow(access);
}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexTest.java
index 7e68dac492b..5479f94e56a 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexTest.java
@@ -1141,7 +1141,7 @@ public class IssueIndexTest {
private void indexIssues(IssueDoc... issues) {
issueIndexer.index(asList(issues).iterator());
for (IssueDoc issue : issues) {
- PermissionIndexerDao.Dto access = new PermissionIndexerDao.Dto(issue.projectUuid(), system2.now(), "TRK");
+ PermissionIndexerDao.Dto access = new PermissionIndexerDao.Dto(issue.projectUuid(), "TRK");
access.allowAnyone();
authorizationIndexerTester.allow(access);
}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexerTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexerTest.java
index c6d34448095..5de19c6ad50 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexerTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexerTest.java
@@ -19,11 +19,8 @@
*/
package org.sonar.server.issue.index;
-import java.util.ArrayList;
-import java.util.Collections;
import java.util.Arrays;
import java.util.Collection;
-import java.util.Date;
import java.util.List;
import java.util.function.Predicate;
import java.util.stream.Collectors;
@@ -91,8 +88,8 @@ public class IssueIndexerTest {
assertThat(scope.getIndexType().getType()).isEqualTo(TYPE_AUTHORIZATION);
Predicate<PermissionIndexerDao.Dto> projectPredicate = scope.getProjectPredicate();
- PermissionIndexerDao.Dto project = new PermissionIndexerDao.Dto("P1", 1_000, Qualifiers.PROJECT);
- PermissionIndexerDao.Dto file = new PermissionIndexerDao.Dto("F1", 1_000, Qualifiers.FILE);
+ PermissionIndexerDao.Dto project = new PermissionIndexerDao.Dto("P1", Qualifiers.PROJECT);
+ PermissionIndexerDao.Dto file = new PermissionIndexerDao.Dto("F1", Qualifiers.FILE);
assertThat(projectPredicate.test(project)).isTrue();
assertThat(projectPredicate.test(file)).isFalse();
}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/TagsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/TagsActionTest.java
index 69d49c14489..3c54528d4bb 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/issue/ws/TagsActionTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/issue/ws/TagsActionTest.java
@@ -237,7 +237,7 @@ public class TagsActionTest {
}
private void grantAccess(IssueDto issue) {
- PermissionIndexerDao.Dto access = new PermissionIndexerDao.Dto(issue.getProjectUuid(), System2.INSTANCE.now(), "TRK");
+ PermissionIndexerDao.Dto access = new PermissionIndexerDao.Dto(issue.getProjectUuid(), "TRK");
access.addUserId(userSession.getUserId());
permissionIndexerTester.allow(access);
}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/measure/index/ProjectMeasuresIndexTest.java b/server/sonar-server/src/test/java/org/sonar/server/measure/index/ProjectMeasuresIndexTest.java
index ea43ada08c6..734ce81bce9 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/measure/index/ProjectMeasuresIndexTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/measure/index/ProjectMeasuresIndexTest.java
@@ -1381,7 +1381,7 @@ public class ProjectMeasuresIndexTest {
private void index(ProjectMeasuresDoc... docs) {
es.putDocuments(INDEX_TYPE_PROJECT_MEASURES, docs);
for (ProjectMeasuresDoc doc : docs) {
- PermissionIndexerDao.Dto access = new PermissionIndexerDao.Dto(doc.getId(), System.currentTimeMillis(), Qualifiers.PROJECT);
+ PermissionIndexerDao.Dto access = new PermissionIndexerDao.Dto(doc.getId(), Qualifiers.PROJECT);
access.allowAnyone();
authorizationIndexerTester.allow(access);
}
@@ -1390,7 +1390,7 @@ public class ProjectMeasuresIndexTest {
private void indexForUser(UserDto user, ProjectMeasuresDoc... docs) {
es.putDocuments(INDEX_TYPE_PROJECT_MEASURES, docs);
for (ProjectMeasuresDoc doc : docs) {
- PermissionIndexerDao.Dto access = new PermissionIndexerDao.Dto(doc.getId(), System.currentTimeMillis(), Qualifiers.PROJECT);
+ PermissionIndexerDao.Dto access = new PermissionIndexerDao.Dto(doc.getId(), Qualifiers.PROJECT);
access.addUserId(user.getId());
authorizationIndexerTester.allow(access);
}
@@ -1399,7 +1399,7 @@ public class ProjectMeasuresIndexTest {
private void indexForGroup(GroupDto group, ProjectMeasuresDoc... docs) {
es.putDocuments(INDEX_TYPE_PROJECT_MEASURES, docs);
for (ProjectMeasuresDoc doc : docs) {
- PermissionIndexerDao.Dto access = new PermissionIndexerDao.Dto(doc.getId(), System.currentTimeMillis(), Qualifiers.PROJECT);
+ PermissionIndexerDao.Dto access = new PermissionIndexerDao.Dto(doc.getId(), Qualifiers.PROJECT);
access.addGroupId(group.getId());
authorizationIndexerTester.allow(access);
}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/measure/index/ProjectMeasuresIndexTextSearchTest.java b/server/sonar-server/src/test/java/org/sonar/server/measure/index/ProjectMeasuresIndexTextSearchTest.java
index a733d4a3887..bdfe00318a1 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/measure/index/ProjectMeasuresIndexTextSearchTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/measure/index/ProjectMeasuresIndexTextSearchTest.java
@@ -290,7 +290,7 @@ public class ProjectMeasuresIndexTextSearchTest {
private void index(ProjectMeasuresDoc... docs) {
es.putDocuments(INDEX_TYPE_PROJECT_MEASURES, docs);
stream(docs).forEach(doc -> {
- PermissionIndexerDao.Dto access = new PermissionIndexerDao.Dto(doc.getId(), System.currentTimeMillis(), Qualifiers.PROJECT);
+ PermissionIndexerDao.Dto access = new PermissionIndexerDao.Dto(doc.getId(), Qualifiers.PROJECT);
access.allowAnyone();
authorizationIndexerTester.allow(access);
});
diff --git a/server/sonar-server/src/test/java/org/sonar/server/permission/PermissionTemplateServiceTest.java b/server/sonar-server/src/test/java/org/sonar/server/permission/PermissionTemplateServiceTest.java
index 3dd184769bb..4699021a370 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/permission/PermissionTemplateServiceTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/permission/PermissionTemplateServiceTest.java
@@ -292,8 +292,6 @@ public class PermissionTemplateServiceTest {
assertThat(selectProjectPermissionsOfGroup(organization, userGroup, project)).containsOnly("user", "codeviewer");
assertThat(selectProjectPermissionsOfGroup(organization, null, project)).isEmpty();
assertThat(selectProjectPermissionsOfUser(user, project)).containsOnly("admin");
-
- checkAuthorizationUpdatedAtIsUpdated(project);
}
private List<String> selectProjectPermissionsOfGroup(OrganizationDto organizationDto, @Nullable GroupDto groupDto, ComponentDto project) {
@@ -343,9 +341,4 @@ public class PermissionTemplateServiceTest {
.isEqualTo(expectedResult);
}
- private void checkAuthorizationUpdatedAtIsUpdated(ComponentDto project) {
- assertThat(dbTester.getDbClient().componentDao().selectOrFailById(session, project.getId()).getAuthorizationUpdatedAt())
- .isNotNull();
- }
-
}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/permission/index/PermissionIndexerDaoTest.java b/server/sonar-server/src/test/java/org/sonar/server/permission/index/PermissionIndexerDaoTest.java
index 28d08710e54..407ad0eb6c5 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/permission/index/PermissionIndexerDaoTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/permission/index/PermissionIndexerDaoTest.java
@@ -99,14 +99,12 @@ public class PermissionIndexerDaoTest {
assertThat(privateProject1Authorization.getGroupIds()).containsOnly(group.getId());
assertThat(privateProject1Authorization.isAllowAnyone()).isFalse();
assertThat(privateProject1Authorization.getUserIds()).containsOnly(user1.getId(), user2.getId());
- assertThat(privateProject1Authorization.getUpdatedAt()).isNotNull();
assertThat(privateProject1Authorization.getQualifier()).isEqualTo(PROJECT);
PermissionIndexerDao.Dto privateProject2Authorization = getByProjectUuid(privateProject2.uuid(), dtos);
assertThat(privateProject2Authorization.getGroupIds()).isEmpty();
assertThat(privateProject2Authorization.isAllowAnyone()).isFalse();
assertThat(privateProject2Authorization.getUserIds()).containsOnly(user1.getId());
- assertThat(privateProject2Authorization.getUpdatedAt()).isNotNull();
assertThat(privateProject2Authorization.getQualifier()).isEqualTo(PROJECT);
PermissionIndexerDao.Dto view2Authorization = getByProjectUuid(view2.uuid(), dtos);
@@ -133,14 +131,12 @@ public class PermissionIndexerDaoTest {
assertThat(privateProject1Authorization.getGroupIds()).containsOnly(group.getId());
assertThat(privateProject1Authorization.isAllowAnyone()).isFalse();
assertThat(privateProject1Authorization.getUserIds()).containsOnly(user1.getId(), user2.getId());
- assertThat(privateProject1Authorization.getUpdatedAt()).isNotNull();
assertThat(privateProject1Authorization.getQualifier()).isEqualTo(PROJECT);
PermissionIndexerDao.Dto privateProject2Authorization = dtos.get(privateProject2.uuid());
assertThat(privateProject2Authorization.getGroupIds()).isEmpty();
assertThat(privateProject2Authorization.isAllowAnyone()).isFalse();
assertThat(privateProject2Authorization.getUserIds()).containsOnly(user1.getId());
- assertThat(privateProject2Authorization.getUpdatedAt()).isNotNull();
assertThat(privateProject2Authorization.getQualifier()).isEqualTo(PROJECT);
PermissionIndexerDao.Dto view2Authorization = dtos.get(view2.uuid());
@@ -237,7 +233,6 @@ public class PermissionIndexerDaoTest {
assertThat(view1Authorization.getGroupIds()).isEmpty();
assertThat(view1Authorization.isAllowAnyone()).isTrue();
assertThat(view1Authorization.getUserIds()).isEmpty();
- assertThat(view1Authorization.getUpdatedAt()).isNotNull();
assertThat(view1Authorization.getQualifier()).isEqualTo(qualifier);
}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/permission/index/PermissionIndexerTester.java b/server/sonar-server/src/test/java/org/sonar/server/permission/index/PermissionIndexerTester.java
index 011935efddf..5632ba076b4 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/permission/index/PermissionIndexerTester.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/permission/index/PermissionIndexerTester.java
@@ -38,21 +38,21 @@ public class PermissionIndexerTester {
}
public PermissionIndexerTester allowOnlyAnyone(ComponentDto project) {
- PermissionIndexerDao.Dto dto = new PermissionIndexerDao.Dto(project.uuid(), System.currentTimeMillis(), project.qualifier());
+ PermissionIndexerDao.Dto dto = new PermissionIndexerDao.Dto(project.uuid(), project.qualifier());
dto.allowAnyone();
permissionIndexer.index(asList(dto));
return this;
}
public PermissionIndexerTester allowOnlyUser(ComponentDto project, UserDto user) {
- PermissionIndexerDao.Dto dto = new PermissionIndexerDao.Dto(project.uuid(), System.currentTimeMillis(), project.qualifier())
+ PermissionIndexerDao.Dto dto = new PermissionIndexerDao.Dto(project.uuid(), project.qualifier())
.addUserId(user.getId());
permissionIndexer.index(asList(dto));
return this;
}
public PermissionIndexerTester allowOnlyGroup(ComponentDto project, GroupDto group) {
- PermissionIndexerDao.Dto dto = new PermissionIndexerDao.Dto(project.uuid(), System.currentTimeMillis(), project.qualifier())
+ PermissionIndexerDao.Dto dto = new PermissionIndexerDao.Dto(project.uuid(), project.qualifier())
.addGroupId(group.getId());
permissionIndexer.index(asList(dto));
return this;
diff --git a/server/sonar-server/src/test/java/org/sonar/server/projecttag/ws/SearchActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/projecttag/ws/SearchActionTest.java
index c4f39080a9d..e5b5bf0fe80 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/projecttag/ws/SearchActionTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/projecttag/ws/SearchActionTest.java
@@ -113,7 +113,7 @@ public class SearchActionTest {
private void index(ProjectMeasuresDoc... docs) {
es.putDocuments(INDEX_TYPE_PROJECT_MEASURES, docs);
for (ProjectMeasuresDoc doc : docs) {
- PermissionIndexerDao.Dto access = new PermissionIndexerDao.Dto(doc.getId(), System.currentTimeMillis(), Qualifiers.PROJECT);
+ PermissionIndexerDao.Dto access = new PermissionIndexerDao.Dto(doc.getId(), Qualifiers.PROJECT);
access.allowAnyone();
authorizationIndexerTester.allow(access);
}