public class CeQueueDao implements Dao {
+ private static final RowBounds ONE_ROW_LIMIT = new RowBounds(0, 1);
+
private final System2 system2;
public CeQueueDao(System2 system2) {
}
public Optional<CeQueueDto> peek(DbSession session) {
- List<String> taskUuids = mapper(session).selectEligibleForPeek();
+ List<String> taskUuids = mapper(session).selectEligibleForPeek(ONE_ROW_LIMIT);
if (taskUuids.isEmpty()) {
return Optional.absent();
}
int countByQuery(@Param("query") CeTaskQuery query);
- List<String> selectEligibleForPeek();
+ List<String> selectEligibleForPeek(RowBounds rowBounds);
@CheckForNull
CeQueueDto selectByUuid(@Param("uuid") String uuid);
public DbTester db = DbTester.create(system2);
private CeQueueDao underTest = new CeQueueDao(system2);
- public static final String SELECT_QUEUE_UUID_AND_STATUS_QUERY = "select uuid,status from ce_queue";
+ private static final String SELECT_QUEUE_UUID_AND_STATUS_QUERY = "select uuid,status from ce_queue";
@Test
public void test_insert() {