]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-10594 remove unused RuleRepositoryDao#selectByKey()
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Tue, 17 Apr 2018 11:36:39 +0000 (13:36 +0200)
committerSonarTech <sonartech@sonarsource.com>
Thu, 10 May 2018 18:20:52 +0000 (20:20 +0200)
server/sonar-db-dao/src/main/java/org/sonar/db/rule/RuleRepositoryDao.java
server/sonar-db-dao/src/main/resources/org/sonar/db/rule/RuleRepositoryMapper.xml
server/sonar-db-dao/src/test/java/org/sonar/db/rule/RuleRepositoryDaoTest.java

index 4e1d4563ae01c60c4e59d27df0c1c015b382c56a..1d9775d8a3eaeab6810c5605ae5acb58f2bff5af 100644 (file)
@@ -21,7 +21,6 @@ package org.sonar.db.rule;
 
 import java.util.Collection;
 import java.util.List;
-import java.util.Optional;
 import org.sonar.api.utils.System2;
 import org.sonar.db.Dao;
 import org.sonar.db.DbSession;
@@ -50,10 +49,6 @@ public class RuleRepositoryDao implements Dao {
     return dbSession.getMapper(RuleRepositoryMapper.class).selectByLanguage(language);
   }
 
-  public Optional<RuleRepositoryDto> selectByKey(DbSession dbSession, String key) {
-    return Optional.ofNullable(dbSession.getMapper(RuleRepositoryMapper.class).selectByKey(key));
-  }
-
   public void truncate(DbSession dbSession) {
     dbSession.getMapper(RuleRepositoryMapper.class).truncate();
   }
index 1e9ad4f9889841d7e22f8848be7cd46df4092c92..33596dd920e3b8d7152c9ab82e46d244a53e9553 100644 (file)
     order by kee
   </select>
 
-  <select id="selectByKey" parameterType="String" resultType="org.sonar.db.rule.RuleRepositoryDto">
-    select <include refid="sqlColumns"/>
-    from rule_repositories
-    where kee = #{key}
-  </select>
-
   <update id="truncate">
     delete from rule_repositories
   </update>
index 84f7883125f2ee51f5814c5bcc69411e3587afdd..3e90955f27c70c605295b0f4cef4da54bafd6603 100644 (file)
@@ -88,16 +88,6 @@ public class RuleRepositoryDaoTest {
     assertThat(underTest.selectByLanguage(dbSession, "missing")).hasSize(0);
   }
 
-  @Test
-  public void selectByKey() {
-    DbSession dbSession = dbTester.getSession();
-    RuleRepositoryDto dto1 = new RuleRepositoryDto("findbugs", "java", "Findbugs");
-    underTest.insert(dbSession, asList(dto1));
-
-    assertThat(underTest.selectByKey(dbSession, "findbugs").get().getKey()).isEqualTo("findbugs");
-    assertThat(underTest.selectByKey(dbSession, "missing")).isNotPresent();
-  }
-
   @Test
   public void truncate() {
     DbSession dbSession = dbTester.getSession();