From 874bc9637ec63113201ba697aa55977427ffac01 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20Lesaint?= Date: Thu, 1 Sep 2016 17:54:19 +0200 Subject: [PATCH] SONAR-7676 removing dead code from Properties related classes PropertiesDao, PropertiesMapper, Persistentsettings and their tests --- .../sonar/ce/db/ReadOnlyPropertiesDao.java | 20 ------------ .../ce/db/ReadOnlyPropertiesDaoTest.java | 32 ------------------- .../org/sonar/db/property/PropertiesDao.java | 28 ---------------- .../sonar/db/property/PropertiesMapper.java | 9 ------ .../sonar/db/property/PropertiesMapper.xml | 21 ------------ .../sonar/db/property/PropertiesDaoTest.java | 27 ---------------- 6 files changed, 137 deletions(-) diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/db/ReadOnlyPropertiesDao.java b/server/sonar-ce/src/main/java/org/sonar/ce/db/ReadOnlyPropertiesDao.java index 373ae90e168..b33bbff2ec8 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/db/ReadOnlyPropertiesDao.java +++ b/server/sonar-ce/src/main/java/org/sonar/ce/db/ReadOnlyPropertiesDao.java @@ -69,11 +69,6 @@ public class ReadOnlyPropertiesDao extends PropertiesDao { // do nothing } - @Override - public void deleteGlobalProperties() { - // do nothing - } - @Override public void deleteGlobalProperty(String key, DbSession session) { // do nothing @@ -84,11 +79,6 @@ public class ReadOnlyPropertiesDao extends PropertiesDao { // do nothing } - @Override - public void deleteAllProperties(String key) { - // do nothing - } - @Override public void insertGlobalProperties(Map properties) { // do nothing @@ -99,16 +89,6 @@ public class ReadOnlyPropertiesDao extends PropertiesDao { // do nothing } - @Override - public void updateProperties(String key, String oldValue, String newValue) { - // do nothing - } - - @Override - public void updateProperties(String key, String oldValue, String newValue, DbSession session) { - // do nothing - } - @Override public void setProperty(org.sonar.core.properties.PropertyDto property) { // do nothing diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/db/ReadOnlyPropertiesDaoTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/db/ReadOnlyPropertiesDaoTest.java index bcb0549bc18..68cb9b46350 100644 --- a/server/sonar-ce/src/test/java/org/sonar/ce/db/ReadOnlyPropertiesDaoTest.java +++ b/server/sonar-ce/src/test/java/org/sonar/ce/db/ReadOnlyPropertiesDaoTest.java @@ -80,14 +80,6 @@ public class ReadOnlyPropertiesDaoTest { } - @Test - public void deleteGlobalProperties() { - underTest.deleteGlobalProperties(); - - assertNoInteraction(); - - } - @Test public void deleteGlobalProperty() { underTest.deleteGlobalProperty(null); @@ -104,14 +96,6 @@ public class ReadOnlyPropertiesDaoTest { } - @Test - public void deleteAllProperties() { - underTest.deleteAllProperties(null); - - assertNoInteraction(); - - } - @Test public void insertGlobalProperties() { underTest.insertGlobalProperties(null); @@ -128,22 +112,6 @@ public class ReadOnlyPropertiesDaoTest { } - @Test - public void updateProperties() { - underTest.updateProperties(null, null, null); - - assertNoInteraction(); - - } - - @Test - public void updateProperties1() { - underTest.updateProperties(null, null, null, dbSession); - - assertNoInteraction(); - - } - @Test public void setProperty() { underTest.setProperty(oldPropertyDto); diff --git a/sonar-db/src/main/java/org/sonar/db/property/PropertiesDao.java b/sonar-db/src/main/java/org/sonar/db/property/PropertiesDao.java index 16f22aba05d..86d8c594e96 100644 --- a/sonar-db/src/main/java/org/sonar/db/property/PropertiesDao.java +++ b/sonar-db/src/main/java/org/sonar/db/property/PropertiesDao.java @@ -206,13 +206,6 @@ public class PropertiesDao implements Dao { } } - public void deleteGlobalProperties() { - try (DbSession session = mybatis.openSession(false)) { - getMapper(session).deleteGlobalProperties(); - session.commit(); - } - } - public void deleteGlobalProperty(String key, DbSession session) { getMapper(session).deleteGlobalProperty(key); } @@ -224,13 +217,6 @@ public class PropertiesDao implements Dao { } } - public void deleteAllProperties(String key) { - try (DbSession session = mybatis.openSession(false)) { - getMapper(session).deleteAllProperties(key); - session.commit(); - } - } - public void insertGlobalProperties(Map properties) { try (DbSession session = mybatis.openSession(false)) { PropertiesMapper mapper = getMapper(session); @@ -260,20 +246,6 @@ public class PropertiesDao implements Dao { } } - /** - * Update all properties (global and projects ones) with a given key and value to a new value - */ - public void updateProperties(String key, String oldValue, String newValue) { - try (DbSession session = mybatis.openSession(false)) { - updateProperties(key, oldValue, newValue, session); - session.commit(); - } - } - - public void updateProperties(String key, String oldValue, String newValue, DbSession session) { - getMapper(session).updateProperties(key, oldValue, newValue); - } - private static PropertiesMapper getMapper(DbSession session) { return session.getMapper(PropertiesMapper.class); } diff --git a/sonar-db/src/main/java/org/sonar/db/property/PropertiesMapper.java b/sonar-db/src/main/java/org/sonar/db/property/PropertiesMapper.java index 781c1ecb79e..bb58987065d 100644 --- a/sonar-db/src/main/java/org/sonar/db/property/PropertiesMapper.java +++ b/sonar-db/src/main/java/org/sonar/db/property/PropertiesMapper.java @@ -33,10 +33,6 @@ public interface PropertiesMapper { List selectProjectProperties(String resourceKey); - List selectProjectPropertiesByResourceId(Long resourceId); - - List selectSetOfResourceProperties(@Param("rId") Long projectId, @Param("propKeys") List propertyKeys); - PropertyDto selectByKey(PropertyDto key); List selectByKeys(@Param("keys") List keys, @Nullable @Param("componentId") Long componentId); @@ -60,11 +56,6 @@ public interface PropertiesMapper { void deleteGlobalProperty(String key); - void deleteAllProperties(String key); - - void deleteGlobalProperties(); - void renamePropertyKey(@Param("oldKey") String oldKey, @Param("newKey") String newKey); - void updateProperties(@Param("key") String key, @Param("oldValue") String oldValue, @Param("newValue") String newValue); } diff --git a/sonar-db/src/main/resources/org/sonar/db/property/PropertiesMapper.xml b/sonar-db/src/main/resources/org/sonar/db/property/PropertiesMapper.xml index 6c8f3d3336a..e94a1cc31d1 100644 --- a/sonar-db/src/main/resources/org/sonar/db/property/PropertiesMapper.xml +++ b/sonar-db/src/main/resources/org/sonar/db/property/PropertiesMapper.xml @@ -41,12 +41,6 @@ where p.resource_id=r.id and p.user_id is null and r.kee=#{resourceKey} - - - -