MigrationEventDao extends AbstractXpipeConsoleDAO { public List<Long> findAllUnfinished() { List<MigrationEventTbl> migrationEventTbls = queryHandler.handleQuery(new DalQuery<List<MigrationEventTbl>>() { @Override public List<MigrationEventTbl> doQuery() throws DalException { return migrationEventTblDao.findUnfinishedEvents(MigrationEventTblEntity.READSET_FULL); } }); List<Long> result = new LinkedList<>(); Set<Long> distinct = new HashSet<>(); for(MigrationEventTbl migrationEventTbl : migrationEventTbls){ Long id = migrationEventTbl.getId(); if(distinct.add(id)){ result.add(id); }else{ logger.info("[findAllUnfinished][already exist]{}", id); } } return result; }  List<MigrationClusterModel> getMigrationCluster(final long eventId); MigrationEvent buildMigrationEvent(final long eventId); @DalTransaction MigrationEvent createMigrationEvent(MigrationRequest migrationRequest); List<Long> findAllUnfinished();  }
@Test public void findUnfinishedEvents(){ List<Long> allUnfinished = migrationEventDao.findAllUnfinished(); logger.info("{}", allUnfinished.size()); Set<Long> all = new HashSet<>(); allUnfinished.forEach(id -> { Assert.assertTrue(all.add(id)); } ); }