ConfigIbatisDao extends SqlMapClientDaoSupport implements ConfigDao { @SuppressWarnings("unchecked") @Override public List<ConfigInstance> findInstancesByConfig(int configId, Integer maxPerEnv) { if (maxPerEnv == null) { return getSqlMapClientTemplate().queryForList("Config.findInstance", Maps.entry("configId", configId).get()); } return getSqlMapClientTemplate().queryForList("Config.findMaxInstsBySeq", Maps.entry("configId", configId).entry("max", maxPerEnv).get()); }  @SuppressWarnings("unchecked") List<Config> findConfigByProject(int projectId); @SuppressWarnings({ "unchecked" }) List<ConfigInstance> findInstancesByProjectAndEnv(int projectId, int envId); Config getConfig(int configId); @Override Config getNextConfig(int configId); @Override Config getPrevConfig(int configId); @Override int updateConfig(Config config); @SuppressWarnings("unchecked") @Override Map<Integer, ConfigInstance> findDefaultInstances(int projectId, int envId); @SuppressWarnings("unchecked") @Override List<Integer> findHasInstanceConfigs(int projectId, int envId); @SuppressWarnings("unchecked") @Override List<Integer> findHasContextInstConfigs(int projectId, int envId); @Override int deleteInstances(int configId, Integer envId); int deleteInstance(int configId, int envId, String group); @Override int deleteConfig(int configId); @Override int createConfig(Config config); @Override int getMaxConfigSeq(int projectId); @Override int getMaxConfigInstSeq(int configId, int envId); @Override Config findConfigByKey(String key); @SuppressWarnings("unchecked") @Override List<Config> findConfigByKeys(List<String> keys); @SuppressWarnings("unchecked") @Override List<Config> findConfigByKeyPattern(String keyPattern); @Override ConfigInstance findInstance(int configId, int envId, String context); @Override int createInstance(ConfigInstance instance); @Override int updateInstance(ConfigInstance instance); @SuppressWarnings("unchecked") @Override List<ConfigInstance> findInstancesByConfig(int configId, Integer maxPerEnv); @SuppressWarnings("unchecked") @Override List<ConfigInstance> findInstancesByConfig(int configId, int envId, Integer maxPerEnv); @Override int getConfigInstCount(int configId, int envId); @Override int updateModifyStatus(int configId, int envId); int createStatus(ConfigStatus status); int deleteStatus(int configId, int envId); @SuppressWarnings("unchecked") @Override List<ConfigStatus> findStatus(int projectId, int envId); @SuppressWarnings("unchecked") @Override List<ConfigStatus> findModifyTime(int projectId, int envId); @Override long getConfigCount(ConfigCriteria criteria); @SuppressWarnings("unchecked") @Override List<Config> getConfigList(ConfigCriteria criteria, Paginater paginater); @Override long getSearchConfigCount(ConfigCriteria criteria); @SuppressWarnings("unchecked") @Override List<Config> getSearchConfigList(ConfigCriteria criteria, Paginater paginater); @Override boolean hasConfigReferencedTo(String configKey, int envId); @SuppressWarnings("unchecked") @Override List<ConfigInstance> getInstanceReferencedTo(String configKey, int envId); @SuppressWarnings("unchecked") @Override List<Integer> getProjectHasReferencedConfigs(int projectId); @Override List<Config> findConfigByPrefix(String prefix); @Override ConfigInstance findInstance(String key, int envId, String context); @Override List<ConfigInstance> findInstancesByKeys(List<String> keyList, int envId, String group); @Override List<ConfigInstance> findInstancesByPrefix(String prefix, int envId, String group); @Override List<ConfigInstance> findInstancesByProject(int projectId, int envId, String group);  }
@Test public void testFindInstanceByConfig() { List<ConfigInstance> instances = configDao.findInstancesByConfig(foo1ConfigId, 10); assertNotNull(instances); assertEquals(3, instances.size()); }
@Test public void testFindInstanceByConfigAndEnv() { List<ConfigInstance> instances = configDao.findInstancesByConfig(foo1ConfigId, Env1_Id, 10); assertNotNull(instances); assertEquals(2, instances.size()); }