@Override public StorageDomainStatus getStatus() { return getStoragePoolIsoMapData().getStatus(); }
@Override public void update(StoragePoolIsoMap map) { updateStatus(map.getId(), map.getStatus()); }
@Override public String toString() { return ToStringBuilder.forInstance(this) .append("id", getId()) .append("status", getStatus()) .build(); } }
@Override public void save(StoragePoolIsoMap map) { MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource().addValue("storage_id", map.getStorageId()).addValue("storage_pool_id", map.getStoragePoolId()).addValue("status", map.getStatus()); getCallsHandler().executeModification("Insertstorage_pool_iso_map", parameterSource); }
public void getStorageConnectionsByStorageTypeWithRecords(EnumSet<StorageDomainStatus> statuses, Collection<Guid> expectedDomains) { List<StoragePoolIsoMap> poolIsoMap = storagePoolIsoMapDao.getAllForStoragePool(FixturesTool.STORAGE_POOL_MIXED_TYPES); List<Guid> storageDomainIds = poolIsoMap.stream() .filter(isoMap -> statuses.contains(isoMap.getStatus())) .map(StoragePoolIsoMap::getStorageId) .collect(Collectors.toList()); assertTrue(CollectionUtils.isEqualCollection(expectedDomains, storageDomainIds), "the list of the pool domains expected to be in the given statuses doesn't match the queried data"); List<StorageServerConnections> result = dao.getStorageConnectionsByStorageTypeAndStatus(FixturesTool.STORAGE_POOL_MIXED_TYPES, StorageType.NFS, statuses); assertFalse(result.isEmpty(), "there should be connections for the tested domains to verify the correctness"); for (StorageServerConnections storageServerConnection : result) { assertEquals(StorageType.NFS, storageServerConnection.getStorageType(), "connections were loaded with incorrect storage type"); } List<StorageServerConnections> domainConnections = new LinkedList<>(); for (Guid domainId : storageDomainIds) { domainConnections.addAll(dao.getAllForDomain(domainId)); } assertTrue(CollectionUtils.isEqualCollection(domainConnections, result), "the connections loaded by the given dao function should match the connections loaded separately"); }