IndexVolumeDaoImpl implements IndexVolumeDao { @Override public IndexVolume update(IndexVolume indexVolume) { return genericDao.update(indexVolume); } @Inject  IndexVolumeDaoImpl(final IndexDbConnProvider indexDbConnProvider,
                       final ExpressionMapperFactory expressionMapperFactory); @Override IndexVolume create(final IndexVolume indexVolume); @Override IndexVolume update(IndexVolume indexVolume); @Override Optional<IndexVolume> fetch(final int id); @Override boolean delete(final int id); @Override List<IndexVolume> getAll(); @Override List<IndexVolume> getVolumesInGroupOnNode(final String groupName, final String nodeName); @Override List<IndexVolume> getVolumesInGroup(final String groupName); @Override void updateVolumeState(final int id,
                                  final Long updateTimeMs,
                                  final Long bytesUsed,
                                  final Long bytesFree,
                                  final Long bytesTotal); @Override ResultPage<IndexVolume> find(final ExpressionCriteria criteria);  }
@Test void testUpdate() { final var nodeName = TestData.createNodeName(); final var path = TestData.createPath(); final var indexVolumeGroup = createGroup(TestData.createVolumeGroupName()); final var indexVolume = createVolume(nodeName, path, indexVolumeGroup.getId()); final var newNodeName = TestData.createNodeName(); final var newPath = TestData.createPath(); indexVolume.setNodeName(newNodeName); indexVolume.setPath(newPath); final var updatedIndexVolume = indexVolumeDao.update(indexVolume); assertThat(updatedIndexVolume.getNodeName()).isEqualTo(newNodeName); assertThat(updatedIndexVolume.getPath()).isEqualTo(newPath); }
@Test void testMustHaveGroup() { final var indexVolumeGroup01 = createGroup(TestData.createVolumeGroupName()); final var indexVolume = createVolume(indexVolumeGroup01.getId()); indexVolume.setIndexVolumeGroupId(null); assertThrows(DataAccessException.class, () -> indexVolumeDao.update(indexVolume)); }