diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2017-01-23 23:49:22 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2017-01-24 09:39:43 +0100 |
commit | eae20d0b93407af371d8600a9e04a5dffd3e0a50 (patch) | |
tree | 5618a4afbd59e2c7c9d8e74746c44c06736b2116 | |
parent | 5542384ebb07ce5f95251dfc26425197249378fa (diff) | |
download | sonarqube-eae20d0b93407af371d8600a9e04a5dffd3e0a50.tar.gz sonarqube-eae20d0b93407af371d8600a9e04a5dffd3e0a50.zip |
Drop unused methods in SnapshotDao
4 files changed, 0 insertions, 45 deletions
diff --git a/sonar-db/src/main/java/org/sonar/db/component/SnapshotDao.java b/sonar-db/src/main/java/org/sonar/db/component/SnapshotDao.java index bde593592a5..236b1459866 100644 --- a/sonar-db/src/main/java/org/sonar/db/component/SnapshotDao.java +++ b/sonar-db/src/main/java/org/sonar/db/component/SnapshotDao.java @@ -29,7 +29,6 @@ import javax.annotation.Nullable; import org.apache.ibatis.session.RowBounds; import org.sonar.db.Dao; import org.sonar.db.DbSession; -import org.sonar.db.RowNotFoundException; import static com.google.common.base.Preconditions.checkState; import static com.google.common.collect.FluentIterable.from; @@ -50,22 +49,6 @@ public class SnapshotDao implements Dao { return mapper(session).selectByKey(id); } - /** - * @deprecated use {@link #selectByUuid(DbSession, String)} - */ - @Deprecated - public SnapshotDto selectOrFailById(DbSession session, long id) { - SnapshotDto value = selectById(session, id); - if (value == null) { - throw new RowNotFoundException(String.format("Snapshot id does not exist: %d", id)); - } - return value; - } - - public List<SnapshotDto> selectByIds(DbSession dbSession, Collection<Long> snapshotIds) { - return executeLargeInputs(snapshotIds, mapper(dbSession)::selectByIds); - } - public Optional<SnapshotDto> selectByUuid(DbSession dbSession, String analysisUuid) { List<SnapshotDto> dtos = mapper(dbSession).selectByUuids(Collections.singletonList(analysisUuid)); if (dtos.isEmpty()) { diff --git a/sonar-db/src/main/java/org/sonar/db/component/SnapshotMapper.java b/sonar-db/src/main/java/org/sonar/db/component/SnapshotMapper.java index 56c4b28bd38..4abd2972eae 100644 --- a/sonar-db/src/main/java/org/sonar/db/component/SnapshotMapper.java +++ b/sonar-db/src/main/java/org/sonar/db/component/SnapshotMapper.java @@ -30,8 +30,6 @@ public interface SnapshotMapper { @CheckForNull SnapshotDto selectByKey(long id); - List<SnapshotDto> selectByIds(@Param("ids") List<Long> ids); - List<SnapshotDto> selectByUuids(@Param("uuids") List<String> uuids); void insert(SnapshotDto snapshot); diff --git a/sonar-db/src/main/resources/org/sonar/db/component/SnapshotMapper.xml b/sonar-db/src/main/resources/org/sonar/db/component/SnapshotMapper.xml index 1a2fa61ff2e..79051c4042e 100644 --- a/sonar-db/src/main/resources/org/sonar/db/component/SnapshotMapper.xml +++ b/sonar-db/src/main/resources/org/sonar/db/component/SnapshotMapper.xml @@ -41,18 +41,6 @@ where s.id=#{key,jdbcType=BIGINT} </select> - <select id="selectByIds" parameterType="Long" resultType="Snapshot"> - SELECT - <include refid="snapshotColumns" /> - FROM - snapshots s - WHERE - s.id in - <foreach collection="ids" item="id" separator="," open="(" close=")"> - #{id,jdbcType=BIGINT} - </foreach> - </select> - <select id="selectByUuids" parameterType="List" resultType="Snapshot"> SELECT <include refid="snapshotColumns"/> diff --git a/sonar-db/src/test/java/org/sonar/db/component/SnapshotDaoTest.java b/sonar-db/src/test/java/org/sonar/db/component/SnapshotDaoTest.java index f7d622198be..faf2c5e4d2a 100644 --- a/sonar-db/src/test/java/org/sonar/db/component/SnapshotDaoTest.java +++ b/sonar-db/src/test/java/org/sonar/db/component/SnapshotDaoTest.java @@ -30,7 +30,6 @@ import org.sonar.api.utils.System2; import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.DbTester; -import org.sonar.db.organization.OrganizationDto; import org.sonar.db.organization.OrganizationTesting; import static com.google.common.collect.Lists.newArrayList; @@ -104,19 +103,6 @@ public class SnapshotDaoTest { } @Test - public void test_selectByIds() { - OrganizationDto organizationDto = db.organizations().insert(); - SnapshotDto snapshot1 = componentDb.insertProjectAndSnapshot(newProjectDto(organizationDto)); - SnapshotDto snapshot2 = componentDb.insertProjectAndSnapshot(newProjectDto(organizationDto)); - SnapshotDto snapshot3 = componentDb.insertProjectAndSnapshot(newProjectDto(organizationDto)); - - List<SnapshotDto> result = underTest.selectByIds(dbSession, newArrayList(snapshot1.getId(), snapshot2.getId(), snapshot3.getId(), 42L)); - - assertThat(result).hasSize(3); - assertThat(result).extracting("id").containsOnly(snapshot1.getId(), snapshot2.getId(), snapshot3.getId()); - } - - @Test public void selectLastSnapshotByRootComponentUuid_returns_absent_when_no_last_snapshot() { Optional<SnapshotDto> snapshot = underTest.selectLastAnalysisByRootComponentUuid(db.getSession(), "uuid_123"); |