MigrationClusterDao extends AbstractXpipeConsoleDAO { public List<MigrationClusterTbl> findUnfinishedByClusterId(final long clusterId){ return queryHandler.handleQuery(new DalQuery<List<MigrationClusterTbl>>() { @Override public List<MigrationClusterTbl> doQuery() throws DalException { return migrationClusterTblDao.findUnfinishedByClusterId(clusterId, MigrationClusterTblEntity.READSET_FULL); } }); }  @PostConstruct void postConstruct(); List<MigrationClusterTbl> find(long size, long offset); List<MigrationClusterTbl> findByCluster(long clusterId, long size, long offset); long countAllByCluster(long clusterId); List<MigrationClusterTbl> findUnfinishedByClusterId(final long clusterId); MigrationClusterTbl getById(long id); void insert(MigrationClusterTbl migrationCluster); void updateStartTime(long id, Date date); void updateStatusAndEndTimeById(long id, MigrationStatus status, Date endTime); void updatePublishInfoById(long id, String publishInfo); MigrationClusterTbl findByEventIdAndClusterId(final long eventId, final long clusterId); List<MigrationClusterTbl> findAllByClusterId(final long clusterId); MigrationClusterTbl findfindByPK(final long id);  }
@Test public void testFindUnfinishedByClusterId() throws SQLException, IOException { int count = 0; for(MigrationStatus migrationStatus : MigrationStatus.values()){ if(!migrationStatus.isTerminated()){ count++; } MigrationClusterTbl tbl = createMigrationClusterTbl(migrationStatus); tbl.setClusterId(clusterId); migrationClusterDao.insert(tbl); } List<MigrationClusterTbl> unfinished = migrationClusterDao.findUnfinishedByClusterId(clusterId); logger.debug("{}", unfinished); Assert.assertEquals(count, unfinished.size()); long previousId = Long.MIN_VALUE; for(MigrationClusterTbl tbl : unfinished){ long currentId = tbl.getId(); Assert.assertTrue(currentId > previousId); previousId = currentId; } }