aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-db-dao/src/main
diff options
context:
space:
mode:
authorLukasz Jarocki <lukasz.jarocki@sonarsource.com>2023-06-15 13:00:12 +0200
committersonartech <sonartech@sonarsource.com>2023-06-20 13:10:19 +0000
commit0a7bea6e115e9b4c9abd281b89fd70e7fb9114d8 (patch)
treed1816f3553c3d1631b4824489ec8d66ad079dc30 /server/sonar-db-dao/src/main
parent1738a073b09ca45a726f9305f355491627cf7a30 (diff)
downloadsonarqube-0a7bea6e115e9b4c9abd281b89fd70e7fb9114d8.tar.gz
sonarqube-0a7bea6e115e9b4c9abd281b89fd70e7fb9114d8.zip
SONAR-19556 updated integration tests in UserDismissedMessagesDaoIT
Diffstat (limited to 'server/sonar-db-dao/src/main')
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/DaoModule.java2
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/DbClient.java7
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/MyBatis.java4
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/mapping/ProjectMappingDto.java65
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/mapping/ProjectMappingsDao.java80
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/mapping/ProjectMappingsMapper.java33
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/mapping/package-info.java23
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeCommands.java7
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeDao.java1
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeMapper.java2
-rw-r--r--server/sonar-db-dao/src/main/resources/org/sonar/db/mapping/ProjectMappingsMapper.xml45
-rw-r--r--server/sonar-db-dao/src/main/resources/org/sonar/db/purge/PurgeMapper.xml4
12 files changed, 0 insertions, 273 deletions
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 aeb4c6ed446..d350c97108f 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
@@ -45,7 +45,6 @@ import org.sonar.db.event.EventComponentChangeDao;
import org.sonar.db.event.EventDao;
import org.sonar.db.issue.IssueChangeDao;
import org.sonar.db.issue.IssueDao;
-import org.sonar.db.mapping.ProjectMappingsDao;
import org.sonar.db.measure.LiveMeasureDao;
import org.sonar.db.measure.MeasureDao;
import org.sonar.db.metric.MetricDao;
@@ -149,7 +148,6 @@ public class DaoModule extends Module {
ProjectBadgeTokenDao.class,
PortfolioDao.class,
ProjectLinkDao.class,
- ProjectMappingsDao.class,
ProjectQgateAssociationDao.class,
PropertiesDao.class,
PurgeDao.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 7acf9c8ad5b..f1b9fa30b15 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
@@ -45,7 +45,6 @@ import org.sonar.db.event.EventComponentChangeDao;
import org.sonar.db.event.EventDao;
import org.sonar.db.issue.IssueChangeDao;
import org.sonar.db.issue.IssueDao;
-import org.sonar.db.mapping.ProjectMappingsDao;
import org.sonar.db.measure.LiveMeasureDao;
import org.sonar.db.measure.MeasureDao;
import org.sonar.db.metric.MetricDao;
@@ -169,7 +168,6 @@ public class DbClient {
private final LiveMeasureDao liveMeasureDao;
private final WebhookDao webhookDao;
private final WebhookDeliveryDao webhookDeliveryDao;
- private final ProjectMappingsDao projectMappingsDao;
private final NewCodePeriodDao newCodePeriodDao;
private final ProjectDao projectDao;
private final PortfolioDao portfolioDao;
@@ -257,7 +255,6 @@ public class DbClient {
liveMeasureDao = getDao(map, LiveMeasureDao.class);
webhookDao = getDao(map, WebhookDao.class);
webhookDeliveryDao = getDao(map, WebhookDeliveryDao.class);
- projectMappingsDao = getDao(map, ProjectMappingsDao.class);
internalComponentPropertiesDao = getDao(map, InternalComponentPropertiesDao.class);
newCodePeriodDao = getDao(map, NewCodePeriodDao.class);
projectDao = getDao(map, ProjectDao.class);
@@ -553,10 +550,6 @@ public class DbClient {
return webhookDeliveryDao;
}
- public ProjectMappingsDao projectMappingsDao() {
- return projectMappingsDao;
- }
-
public InternalComponentPropertiesDao internalComponentPropertiesDao() {
return internalComponentPropertiesDao;
}
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 88c2322862a..16752dbcb0a 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
@@ -76,8 +76,6 @@ import org.sonar.db.issue.IssueDto;
import org.sonar.db.issue.IssueMapper;
import org.sonar.db.issue.NewCodeReferenceIssueDto;
import org.sonar.db.issue.PrIssueDto;
-import org.sonar.db.mapping.ProjectMappingDto;
-import org.sonar.db.mapping.ProjectMappingsMapper;
import org.sonar.db.measure.LargestBranchNclocDto;
import org.sonar.db.measure.LiveMeasureMapper;
import org.sonar.db.measure.MeasureDto;
@@ -231,7 +229,6 @@ public class MyBatis {
confBuilder.loadAlias("AnalysisPropertyValuePerProject", AnalysisPropertyValuePerProject.class);
confBuilder.loadAlias("ProjectAlmKeyAndProject", ProjectAlmKeyAndProject.class);
confBuilder.loadAlias("PrAndBranchCountByProjectDto", PrBranchAnalyzedLanguageCountByProjectDto.class);
- confBuilder.loadAlias("ProjectMapping", ProjectMappingDto.class);
confBuilder.loadAlias("ProjectLocDistribution", ProjectLocDistributionDto.class);
confBuilder.loadAlias("PurgeableAnalysis", PurgeableAnalysisDto.class);
confBuilder.loadAlias("PushEvent", PushEventDto.class);
@@ -301,7 +298,6 @@ public class MyBatis {
ProjectMapper.class,
ProjectBadgeTokenMapper.class,
ProjectExportMapper.class,
- ProjectMappingsMapper.class,
ProjectQgateAssociationMapper.class,
PropertiesMapper.class,
PurgeMapper.class,
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/mapping/ProjectMappingDto.java b/server/sonar-db-dao/src/main/java/org/sonar/db/mapping/ProjectMappingDto.java
deleted file mode 100644
index 24606c40458..00000000000
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/mapping/ProjectMappingDto.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2023 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.mapping;
-
-/**
- * Generic purpose way to attach data to a project. For example to store the identifier
- * of the project in a remote system (ALM).
- * The pair (keyType, key) is unique.
- * Data is automatically purged when project is deleted.
- */
-public final class ProjectMappingDto {
- private String uuid;
- private String keyType;
- private String key;
- private String projectUuid;
-
- public String getUuid() {
- return uuid;
- }
-
- public void setUuid(String uuid) {
- this.uuid = uuid;
- }
-
- public String getKeyType() {
- return keyType;
- }
-
- public void setKeyType(String keyType) {
- this.keyType = keyType;
- }
-
- public String getKey() {
- return key;
- }
-
- public void setKey(String key) {
- this.key = key;
- }
-
- public String getProjectUuid() {
- return projectUuid;
- }
-
- public void setProjectUuid(String projectUuid) {
- this.projectUuid = projectUuid;
- }
-}
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/mapping/ProjectMappingsDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/mapping/ProjectMappingsDao.java
deleted file mode 100644
index 14dae4a1484..00000000000
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/mapping/ProjectMappingsDao.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2023 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.mapping;
-
-import java.util.Optional;
-import javax.annotation.Nullable;
-import org.sonar.api.utils.System2;
-import org.sonar.core.util.UuidFactory;
-import org.sonar.db.Dao;
-import org.sonar.db.DbSession;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static org.apache.commons.lang.StringUtils.isNotEmpty;
-
-public class ProjectMappingsDao implements Dao {
-
- public static final String BITBUCKETCLOUD_REPO_MAPPING = "bitbucketcloud.repo";
- private final System2 system2;
- private final UuidFactory uuidFactory;
-
- public ProjectMappingsDao(System2 system2, UuidFactory uuidFactory) {
- this.system2 = system2;
- this.uuidFactory = uuidFactory;
- }
-
- public void put(DbSession dbSession, String keyType, String key, String projectUuid) {
- checkKeyType(keyType);
- checkKey(key);
- checkArgument(isNotEmpty(projectUuid), "projectUuid can't be null nor empty");
-
- ProjectMappingsMapper mapper = getMapper(dbSession);
- mapper.deleteByKey(keyType, key);
- long now = system2.now();
- mapper.put(uuidFactory.create(), keyType, key, projectUuid, now);
- }
-
- public Optional<ProjectMappingDto> get(DbSession dbSession, String keyType, String key) {
- checkKeyType(keyType);
- checkKey(key);
-
- ProjectMappingsMapper mapper = getMapper(dbSession);
- return Optional.ofNullable(mapper.selectByKey(keyType, key));
- }
-
- public void clear(DbSession dbSession, String keyType, String key) {
- checkKeyType(keyType);
- checkKey(key);
- ProjectMappingsMapper mapper = getMapper(dbSession);
- mapper.deleteByKey(keyType, key);
- }
-
- private static void checkKeyType(@Nullable String keyType) {
- checkArgument(keyType != null && !keyType.isEmpty(), "key type can't be null nor empty");
- }
-
- private static void checkKey(@Nullable String key) {
- checkArgument(key != null && !key.isEmpty(), "key can't be null nor empty");
- }
-
- private static ProjectMappingsMapper getMapper(DbSession dbSession) {
- return dbSession.getMapper(ProjectMappingsMapper.class);
- }
-}
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/mapping/ProjectMappingsMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/mapping/ProjectMappingsMapper.java
deleted file mode 100644
index b04bf1f94a0..00000000000
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/mapping/ProjectMappingsMapper.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2023 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.mapping;
-
-import javax.annotation.CheckForNull;
-import org.apache.ibatis.annotations.Param;
-
-public interface ProjectMappingsMapper {
-
- @CheckForNull
- ProjectMappingDto selectByKey(@Param("keyType") String keyType, @Param("key") String key);
-
- void put(@Param("uuid") String uuid, @Param("keyType") String keyType, @Param("key") String key, @Param("projectUuid") String projectUuid, @Param("createdAt") long createdAt);
-
- void deleteByKey(@Param("keyType") String keyType, @Param("key") String key);
-}
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/mapping/package-info.java b/server/sonar-db-dao/src/main/java/org/sonar/db/mapping/package-info.java
deleted file mode 100644
index 6235e18382f..00000000000
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/mapping/package-info.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2023 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.
- */
-@ParametersAreNonnullByDefault
-package org.sonar.db.mapping;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeCommands.java b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeCommands.java
index 2bd50fd0d8e..9364e72325b 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeCommands.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeCommands.java
@@ -410,13 +410,6 @@ class PurgeCommands {
profiler.stop();
}
- void deleteProjectMappings(String rootUuid) {
- profiler.start("deleteProjectMappings (project_mappings)");
- purgeMapper.deleteProjectMappingsByProjectUuid(rootUuid);
- session.commit();
- profiler.stop();
- }
-
void deleteApplicationProjectsByProject(String projectUuid) {
profiler.start("deleteApplicationProjectsByProject (app_projects)");
purgeMapper.deleteAppBranchProjectBranchesByProjectUuid(projectUuid);
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeDao.java
index e82d08d5885..7f00a5af85c 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeDao.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeDao.java
@@ -241,7 +241,6 @@ public class PurgeDao implements Dao {
commands.deleteWebhooks(rootUuid);
commands.deleteWebhookDeliveries(rootUuid);
commands.deleteLiveMeasures(rootUuid);
- commands.deleteProjectMappings(rootUuid);
commands.deleteProjectAlmSettings(rootUuid);
commands.deletePermissions(rootUuid);
commands.deleteNewCodePeriods(rootUuid);
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeMapper.java
index 37d18192b92..d50cf87a01b 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeMapper.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeMapper.java
@@ -143,8 +143,6 @@ public interface PurgeMapper {
void deleteWebhookDeliveriesByProjectUuid(@Param("projectUuid") String projectUuid);
- void deleteProjectMappingsByProjectUuid(@Param("projectUuid") String projectUuid);
-
void deleteAppProjectsByAppUuid(@Param("applicationUuid") String applicationUuid);
void deleteAppProjectsByProjectUuid(@Param("projectUuid") String projectUuid);
diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/mapping/ProjectMappingsMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/mapping/ProjectMappingsMapper.xml
deleted file mode 100644
index 551eda2c4e1..00000000000
--- a/server/sonar-db-dao/src/main/resources/org/sonar/db/mapping/ProjectMappingsMapper.xml
+++ /dev/null
@@ -1,45 +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.mapping.ProjectMappingsMapper">
-
- <select id="selectByKey" parameterType="Map" resultType="ProjectMapping">
- select
- uuid as "uuid",
- key_type as "key_type",
- kee as "key",
- project_uuid as projectUuid
- from
- project_mappings
- where
- key_type = #{keyType, jdbcType=VARCHAR}
- and kee = #{key, jdbcType=VARCHAR}
- </select>
-
- <insert id="put" parameterType="Map" useGeneratedKeys="false">
- INSERT INTO project_mappings
- (
- uuid,
- key_type,
- kee,
- project_uuid,
- created_at
- )
- VALUES (
- #{uuid,jdbcType=VARCHAR},
- #{keyType,jdbcType=VARCHAR},
- #{key,jdbcType=VARCHAR},
- #{projectUuid,jdbcType=VARCHAR},
- #{createdAt,jdbcType=BIGINT}
- )
- </insert>
-
- <delete id="deleteByKey" parameterType="Map">
- delete from project_mappings
- where
- key_type=#{keyType,jdbcType=VARCHAR}
- and kee=#{key,jdbcType=VARCHAR}
- </delete>
-
-
-</mapper>
diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/purge/PurgeMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/purge/PurgeMapper.xml
index 7e1abf38c5a..03a38b3e3f5 100644
--- a/server/sonar-db-dao/src/main/resources/org/sonar/db/purge/PurgeMapper.xml
+++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/purge/PurgeMapper.xml
@@ -573,10 +573,6 @@
delete from webhook_deliveries where component_uuid=#{projectUuid,jdbcType=VARCHAR}
</delete>
- <delete id="deleteProjectMappingsByProjectUuid">
- delete from project_mappings where project_uuid=#{projectUuid,jdbcType=VARCHAR}
- </delete>
-
<delete id="deleteProjectAlmSettingsByProjectUuid">
delete from project_alm_settings where project_uuid=#{projectUuid,jdbcType=VARCHAR}
</delete>