@Test public void testgetByRid() throws Exception{ CmdletInfo cmdlet1 = new CmdletInfo(0, 1, CmdletState.EXECUTING, "test", 123123333L, 232444444L); CmdletInfo cmdlet2 = new CmdletInfo(1, 1, CmdletState.PAUSED, "tt", 123178333L, 232444994L); CmdletInfo cmdlet3 = new CmdletInfo(2, 1, CmdletState.EXECUTING, "test", 123123333L, 232444444L); CmdletInfo cmdlet4 = new CmdletInfo(3, 1, CmdletState.PAUSED, "tt", 123178333L, 232444994L); CmdletInfo cmdlet5 = new CmdletInfo(4, 1, CmdletState.EXECUTING, "test", 123123333L, 232444444L); CmdletInfo cmdlet6 = new CmdletInfo(5, 1, CmdletState.PAUSED, "tt", 123178333L, 232444994L); cmdletDao.insert(new CmdletInfo[]{cmdlet1, cmdlet2, cmdlet3, cmdlet4, cmdlet5, cmdlet6}); List<CmdletInfo> cmdlets = cmdletDao.getByRid(1, 1, 2); List<String> order = new ArrayList<>(); order.add("cid"); List<Boolean> desc = new ArrayList<>(); desc.add(false); Assert.assertTrue(cmdlets.size() == 2); cmdlets = cmdletDao.getByRid(1, 1, 2, order, desc); Assert.assertTrue(cmdlets.size() == 2); Assert.assertTrue(cmdlets.get(0).equals(cmdlet2)); Assert.assertTrue(cmdletDao.getNumByRid(1) == 6); }
public List<CmdletInfo> getByRid(long rid) { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); return jdbcTemplate.query( "SELECT * FROM " + TABLE_NAME + " WHERE rid = ?", new Object[]{rid}, new CmdletRowMapper()); }
CmdletDao { public List<CmdletInfo> getByRid(long rid) { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); return jdbcTemplate.query( "SELECT * FROM " + TABLE_NAME + " WHERE rid = ?", new Object[]{rid}, new CmdletRowMapper()); } }
CmdletDao { public List<CmdletInfo> getByRid(long rid) { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); return jdbcTemplate.query( "SELECT * FROM " + TABLE_NAME + " WHERE rid = ?", new Object[]{rid}, new CmdletRowMapper()); } CmdletDao(DataSource dataSource); }
CmdletDao { public List<CmdletInfo> getByRid(long rid) { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); return jdbcTemplate.query( "SELECT * FROM " + TABLE_NAME + " WHERE rid = ?", new Object[]{rid}, new CmdletRowMapper()); } CmdletDao(DataSource dataSource); void setDataSource(DataSource dataSource); List<CmdletInfo> getAll(); List<CmdletInfo> getAPageOfCmdlet(long start, long offset,
      List<String> orderBy, List<Boolean> isDesc); List<CmdletInfo> getAPageOfCmdlet(long start, long offset); List<CmdletInfo> getByIds(List<Long> aids); CmdletInfo getById(long cid); List<CmdletInfo> getByRid(long rid); long getNumByRid(long rid); List<CmdletInfo> getByRid(long rid, long start, long offset); List<CmdletInfo> getByRid(long rid, long start, long offset,
      List<String> orderBy, List<Boolean> isDesc); List<CmdletInfo> getByState(CmdletState state); int getNumCmdletsInTerminiatedStates(); List<CmdletInfo> getByCondition(
      String cidCondition, String ridCondition, CmdletState state); void delete(long cid); int[] batchDelete(final List<Long> cids); int deleteBeforeTime(long timestamp); int deleteKeepNewCmd(long num); void deleteAll(); void insert(CmdletInfo cmdletInfo); void insert(CmdletInfo[] cmdletInfos); int[] replace(final CmdletInfo[] cmdletInfos); int update(long cid, int state); int update(long cid, String parameters, int state); int update(final CmdletInfo cmdletInfo); int[] update(final List<CmdletInfo> cmdletInfos); long getMaxId(); }
CmdletDao { public List<CmdletInfo> getByRid(long rid) { JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); return jdbcTemplate.query( "SELECT * FROM " + TABLE_NAME + " WHERE rid = ?", new Object[]{rid}, new CmdletRowMapper()); } CmdletDao(DataSource dataSource); void setDataSource(DataSource dataSource); List<CmdletInfo> getAll(); List<CmdletInfo> getAPageOfCmdlet(long start, long offset,
      List<String> orderBy, List<Boolean> isDesc); List<CmdletInfo> getAPageOfCmdlet(long start, long offset); List<CmdletInfo> getByIds(List<Long> aids); CmdletInfo getById(long cid); List<CmdletInfo> getByRid(long rid); long getNumByRid(long rid); List<CmdletInfo> getByRid(long rid, long start, long offset); List<CmdletInfo> getByRid(long rid, long start, long offset,
      List<String> orderBy, List<Boolean> isDesc); List<CmdletInfo> getByState(CmdletState state); int getNumCmdletsInTerminiatedStates(); List<CmdletInfo> getByCondition(
      String cidCondition, String ridCondition, CmdletState state); void delete(long cid); int[] batchDelete(final List<Long> cids); int deleteBeforeTime(long timestamp); int deleteKeepNewCmd(long num); void deleteAll(); void insert(CmdletInfo cmdletInfo); void insert(CmdletInfo[] cmdletInfos); int[] replace(final CmdletInfo[] cmdletInfos); int update(long cid, int state); int update(long cid, String parameters, int state); int update(final CmdletInfo cmdletInfo); int[] update(final List<CmdletInfo> cmdletInfos); long getMaxId();  }