aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-db-dao/src/main
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2022-03-17 14:59:15 -0500
committersonartech <sonartech@sonarsource.com>2022-03-18 20:02:58 +0000
commit7aa77dfb2275f38de07c9d3b936e0eea43ac96af (patch)
tree0ff992bdb11f30f395243e86e1d3039847dd8231 /server/sonar-db-dao/src/main
parenteb34454afc19f4994ae587b43ff2d0c79978de23 (diff)
downloadsonarqube-7aa77dfb2275f38de07c9d3b936e0eea43ac96af.tar.gz
sonarqube-7aa77dfb2275f38de07c9d3b936e0eea43ac96af.zip
SONAR-16097 Apply feedback
Diffstat (limited to 'server/sonar-db-dao/src/main')
-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.java10
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/MyBatis.java5
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeCommands.java4
-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/java/org/sonar/db/scannercache/ScannerAnalysisCacheDao.java (renamed from server/sonar-db-dao/src/main/java/org/sonar/db/scannercache/ScannerCacheDao.java)10
-rw-r--r--server/sonar-db-dao/src/main/java/org/sonar/db/scannercache/ScannerAnalysisCacheMapper.java (renamed from server/sonar-db-dao/src/main/java/org/sonar/db/scannercache/ScannerCacheMapper.java)2
-rw-r--r--server/sonar-db-dao/src/main/resources/org/sonar/db/purge/PurgeMapper.xml4
-rw-r--r--server/sonar-db-dao/src/main/resources/org/sonar/db/scannercache/ScannerAnalysisCacheMapper.xml (renamed from server/sonar-db-dao/src/main/resources/org/sonar/db/scannercache/ScannerCacheMapper.xml)6
9 files changed, 23 insertions, 24 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 4649066af46..514b8396379 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
@@ -77,7 +77,7 @@ import org.sonar.db.qualityprofile.QualityProfileDao;
import org.sonar.db.qualityprofile.QualityProfileExportDao;
import org.sonar.db.rule.RuleDao;
import org.sonar.db.rule.RuleRepositoryDao;
-import org.sonar.db.scannercache.ScannerCacheDao;
+import org.sonar.db.scannercache.ScannerAnalysisCacheDao;
import org.sonar.db.schemamigration.SchemaMigrationDao;
import org.sonar.db.source.FileSourceDao;
import org.sonar.db.user.GroupDao;
@@ -157,7 +157,7 @@ public class DaoModule extends Module {
RuleDao.class,
RuleRepositoryDao.class,
SamlMessageIdDao.class,
- ScannerCacheDao.class,
+ ScannerAnalysisCacheDao.class,
SnapshotDao.class,
SchemaMigrationDao.class,
SessionTokensDao.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 2268ea41b53..d4738c368d1 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
@@ -77,7 +77,7 @@ import org.sonar.db.qualityprofile.QualityProfileDao;
import org.sonar.db.qualityprofile.QualityProfileExportDao;
import org.sonar.db.rule.RuleDao;
import org.sonar.db.rule.RuleRepositoryDao;
-import org.sonar.db.scannercache.ScannerCacheDao;
+import org.sonar.db.scannercache.ScannerAnalysisCacheDao;
import org.sonar.db.schemamigration.SchemaMigrationDao;
import org.sonar.db.source.FileSourceDao;
import org.sonar.db.user.GroupDao;
@@ -169,7 +169,7 @@ public class DbClient {
private final UserDismissedMessagesDao userDismissedMessagesDao;
private final ApplicationProjectsDao applicationProjectsDao;
private final ProjectBadgeTokenDao projectBadgeTokenDao;
- private final ScannerCacheDao scannerCacheDao;
+ private final ScannerAnalysisCacheDao scannerAnalysisCacheDao;
public DbClient(Database database, MyBatis myBatis, DBSessions dbSessions, Dao... daos) {
this.database = database;
@@ -250,7 +250,7 @@ public class DbClient {
samlMessageIdDao = getDao(map, SamlMessageIdDao.class);
userDismissedMessagesDao = getDao(map, UserDismissedMessagesDao.class);
applicationProjectsDao = getDao(map, ApplicationProjectsDao.class);
- scannerCacheDao = getDao(map, ScannerCacheDao.class);
+ scannerAnalysisCacheDao = getDao(map, ScannerAnalysisCacheDao.class);
}
public DbSession openSession(boolean batch) {
@@ -551,7 +551,7 @@ public class DbClient {
return projectBadgeTokenDao;
}
- public ScannerCacheDao scannerCacheDao() {
- return scannerCacheDao;
+ public ScannerAnalysisCacheDao scannerAnalysisCacheDao() {
+ return scannerAnalysisCacheDao;
}
}
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 6792608657e..05264bc1b8f 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
@@ -33,7 +33,6 @@ import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.apache.ibatis.session.TransactionIsolationLevel;
-import org.sonar.api.Startable;
import org.sonar.db.alm.pat.AlmPatMapper;
import org.sonar.db.alm.setting.AlmSettingMapper;
import org.sonar.db.alm.setting.ProjectAlmSettingMapper;
@@ -136,7 +135,7 @@ import org.sonar.db.rule.RuleDto;
import org.sonar.db.rule.RuleMapper;
import org.sonar.db.rule.RuleParamDto;
import org.sonar.db.rule.RuleRepositoryMapper;
-import org.sonar.db.scannercache.ScannerCacheMapper;
+import org.sonar.db.scannercache.ScannerAnalysisCacheMapper;
import org.sonar.db.schemamigration.SchemaMigrationDto;
import org.sonar.db.schemamigration.SchemaMigrationMapper;
import org.sonar.db.source.FileSourceMapper;
@@ -300,7 +299,7 @@ public class MyBatis {
RuleMapper.class,
RuleRepositoryMapper.class,
SamlMessageIdMapper.class,
- ScannerCacheMapper.class,
+ ScannerAnalysisCacheMapper.class,
SchemaMigrationMapper.class,
SessionTokenMapper.class,
SnapshotMapper.class,
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 c5d24de7b82..2b4255ef3e0 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
@@ -486,8 +486,8 @@ class PurgeCommands {
}
public void deleteScannerCache(String rootUuid) {
- profiler.start("deleteScannerCache (scanner_cache)");
- purgeMapper.deleteScannerCacheByBranchUuid(rootUuid);
+ profiler.start("deleteScannerCache (scanner_analysis_cache)");
+ purgeMapper.deleteScannerAnalysisCacheByBranchUuid(rootUuid);
session.commit();
profiler.stop();
}
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 ddbe7b627df..cd3f294fcc6 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
@@ -175,5 +175,5 @@ public interface PurgeMapper {
void deleteUserDismissedMessagesByProjectUuid(@Param("projectUuid") String projectUuid);
- void deleteScannerCacheByBranchUuid(@Param("branchUuid") String branchUuid);
+ void deleteScannerAnalysisCacheByBranchUuid(@Param("branchUuid") String branchUuid);
}
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/scannercache/ScannerCacheDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/scannercache/ScannerAnalysisCacheDao.java
index 717180948d9..4e95c6a946d 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/scannercache/ScannerCacheDao.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/scannercache/ScannerAnalysisCacheDao.java
@@ -30,7 +30,7 @@ import org.sonar.db.DbInputStream;
import org.sonar.db.DatabaseUtils;
import org.sonar.db.DbSession;
-public class ScannerCacheDao implements Dao {
+public class ScannerAnalysisCacheDao implements Dao {
public void removeAll(DbSession session) {
mapper(session).removeAll();
}
@@ -42,7 +42,7 @@ public class ScannerCacheDao implements Dao {
public void insert(DbSession dbSession, String branchUuid, InputStream data) {
Connection connection = dbSession.getConnection();
try (PreparedStatement stmt = connection.prepareStatement(
- "INSERT INTO scanner_cache (branch_uuid, data) VALUES (?, ?)")) {
+ "INSERT INTO scanner_analysis_cache (branch_uuid, data) VALUES (?, ?)")) {
stmt.setString(1, branchUuid);
stmt.setBinaryStream(2, data);
stmt.executeUpdate();
@@ -58,7 +58,7 @@ public class ScannerCacheDao implements Dao {
ResultSet rs = null;
DbInputStream result = null;
try {
- stmt = dbSession.getConnection().prepareStatement("SELECT data FROM scanner_cache WHERE branch_uuid=?");
+ stmt = dbSession.getConnection().prepareStatement("SELECT data FROM scanner_analysis_cache WHERE branch_uuid=?");
stmt.setString(1, branchUuid);
rs = stmt.executeQuery();
if (rs.next()) {
@@ -76,7 +76,7 @@ public class ScannerCacheDao implements Dao {
}
}
- private static ScannerCacheMapper mapper(DbSession session) {
- return session.getMapper(ScannerCacheMapper.class);
+ private static ScannerAnalysisCacheMapper mapper(DbSession session) {
+ return session.getMapper(ScannerAnalysisCacheMapper.class);
}
}
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/scannercache/ScannerCacheMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/scannercache/ScannerAnalysisCacheMapper.java
index 200d5eb1a38..bd0800e66f8 100644
--- a/server/sonar-db-dao/src/main/java/org/sonar/db/scannercache/ScannerCacheMapper.java
+++ b/server/sonar-db-dao/src/main/java/org/sonar/db/scannercache/ScannerAnalysisCacheMapper.java
@@ -21,7 +21,7 @@ package org.sonar.db.scannercache;
import org.apache.ibatis.annotations.Param;
-public interface ScannerCacheMapper {
+public interface ScannerAnalysisCacheMapper {
void removeAll();
void remove(@Param("branchUuid") String branchUuid);
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 738bf2e737d..20df7611c2b 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
@@ -593,8 +593,8 @@
delete from user_dismissed_messages where project_uuid = #{projectUuid,jdbcType=VARCHAR}
</delete>
- <delete id="deleteScannerCacheByBranchUuid">
- delete from scanner_cache where branch_uuid = #{branchUuid,jdbcType=VARCHAR}
+ <delete id="deleteScannerAnalysisCacheByBranchUuid">
+ delete from scanner_analysis_cache where branch_uuid = #{branchUuid,jdbcType=VARCHAR}
</delete>
</mapper>
diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/scannercache/ScannerCacheMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/scannercache/ScannerAnalysisCacheMapper.xml
index 887f694c8c0..bd135d11ddb 100644
--- a/server/sonar-db-dao/src/main/resources/org/sonar/db/scannercache/ScannerCacheMapper.xml
+++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/scannercache/ScannerAnalysisCacheMapper.xml
@@ -2,13 +2,13 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd">
-<mapper namespace="org.sonar.db.scannercache.ScannerCacheMapper">
+<mapper namespace="org.sonar.db.scannercache.ScannerAnalysisCacheMapper">
<delete id="removeAll">
- delete from scanner_cache
+ delete from scanner_analysis_cache
</delete>
<delete id="remove">
- delete from scanner_cache where branch_uuid = #{branchUuid,jdbcType=VARCHAR}
+ delete from scanner_analysis_cache where branch_uuid = #{branchUuid,jdbcType=VARCHAR}
</delete>
</mapper>