ConfigReleaseIbatisDao extends SqlMapClientDaoSupport implements ConfigReleaseDao { @Override public void createConfigInstSnapshots(List<ConfigInstanceSnapshot> configInstSnapshots) { int batchSize = 20; int snapshotSize = configInstSnapshots.size(); for (int fromIndex = 0; fromIndex < snapshotSize;) { int toIndex = fromIndex + batchSize <= snapshotSize ? fromIndex + batchSize : snapshotSize; List<ConfigInstanceSnapshot> batchList = configInstSnapshots.subList(fromIndex, toIndex); getSqlMapClientTemplate().insert("ConfigRelease.insertConfigInstSnapshots", batchList); fromIndex = toIndex; } }  @Override int createSetTask(ConfigSetTask task); @SuppressWarnings("unchecked") @Override List<ConfigSetTask> getSetTask(int projectId, int envId, String[] features, String[] keys); @Override int createConfigSnapshotSet(ConfigSnapshotSet snapshot); @Override void createConfigSnapshots(List<ConfigSnapshot> configSnapshots); @Override void createConfigInstSnapshots(List<ConfigInstanceSnapshot> configInstSnapshots); @Override ConfigSnapshotSet findSnapshotSetToRollback(int projectId, int envId, String task); @SuppressWarnings("unchecked") @Override List<ConfigSnapshot> findConfigSnapshots(int snapshotSetId); @SuppressWarnings("unchecked") @Override List<ConfigInstanceSnapshot> findConfigInstSnapshots(int snapshotSetId);  }
@Test public void testCreateConfigInstSnapshots() { int setId = configReleaseDao.createConfigSnapshotSet(buildConfigSnapshotSet(Project_Foo_Id, Env1_Id, Task_1)); List<ConfigInstanceSnapshot> instSnapshots = new ArrayList<ConfigInstanceSnapshot>(); ConfigInstance instance = configDao.findInstance(foo1ConfigId, Env1_Id, ConfigInstance.NO_CONTEXT); ConfigInstanceSnapshot instSnapshot = new ConfigInstanceSnapshot(instance); instSnapshot.setSnapshotSetId(setId); instSnapshots.add(instSnapshot); try { configReleaseDao.createConfigInstSnapshots(instSnapshots); } catch (Exception e) { fail("create config instance snapshots failed."); } List<ConfigInstanceSnapshot> snapshotsFound = configReleaseDao.findConfigInstSnapshots(setId); assertNotNull(snapshotsFound); assertEquals(1, snapshotsFound.size()); }