From c860ec4843789922e35570e9d2ada1568de98288 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Mon, 27 Jun 2016 18:18:05 +0200 Subject: [PATCH] Remove unused method ComponentDao#existsById() --- .../main/java/org/sonar/db/component/ComponentDao.java | 7 ++----- .../java/org/sonar/db/component/ComponentDaoTest.java | 8 -------- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/sonar-db/src/main/java/org/sonar/db/component/ComponentDao.java b/sonar-db/src/main/java/org/sonar/db/component/ComponentDao.java index 256e03ec2ce..6742bec2cc0 100644 --- a/sonar-db/src/main/java/org/sonar/db/component/ComponentDao.java +++ b/sonar-db/src/main/java/org/sonar/db/component/ComponentDao.java @@ -85,10 +85,6 @@ public class ComponentDao implements Dao { return mapper(session).countByQuery(query); } - public boolean existsById(Long id, DbSession session) { - return mapper(session).countById(id) > 0; - } - public List selectSubProjectsByComponentUuids(DbSession session, Collection keys) { if (keys.isEmpty()) { return emptyList(); @@ -157,7 +153,8 @@ public class ComponentDao implements Dao { /** * List of ancestors, ordered from root to parent. The list is empty - * if the component is a tree root. + * if the component is a tree root. Disabled components are excluded by design + * as tree represents the more recent analysis. */ public List selectAncestors(DbSession dbSession, ComponentDto component) { if (component.isRoot()) { diff --git a/sonar-db/src/test/java/org/sonar/db/component/ComponentDaoTest.java b/sonar-db/src/test/java/org/sonar/db/component/ComponentDaoTest.java index 2dd1d5d229b..ce4f17e78ea 100644 --- a/sonar-db/src/test/java/org/sonar/db/component/ComponentDaoTest.java +++ b/sonar-db/src/test/java/org/sonar/db/component/ComponentDaoTest.java @@ -321,14 +321,6 @@ public class ComponentDaoTest { assertThat(underTest.selectById(dbSession, 111L)).isAbsent(); } - @Test - public void count_by_id() { - db.prepareDbUnit(getClass(), "shared.xml"); - - assertThat(underTest.existsById(4L, dbSession)).isTrue(); - assertThat(underTest.existsById(111L, dbSession)).isFalse(); - } - @Test public void select_component_keys_by_qualifiers() { db.prepareDbUnit(getClass(), "shared.xml"); -- 2.39.5