@Override protected StoragePoolIsoMap generateNewEntity() { return new StoragePoolIsoMap (FixturesTool.STORAGE_DOMAIN_SCALE_SD6, FixturesTool.DATA_CENTER, StorageDomainStatus.Unattached); }
public Guid getStoragePoolId() { return getStoragePoolIsoMapData().getStoragePoolId(); }
public StoragePoolIsoMap(Guid storage_id, Guid storage_pool_id, StorageDomainStatus status) { this(); setStorageId(storage_id); setStoragePoolId(storage_pool_id); this.setStatus(status); }
@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); }
@Override public StorageDomainStatus getStatus() { return getStoragePoolIsoMapData().getStatus(); }
@Override public void setStatus(StorageDomainStatus status) { getStoragePoolIsoMapData().setStatus(status); }
@Test public void testGetAllStoragePoolIsoMapsForIso() { List<StoragePoolIsoMap> result = dao.getAllForStorage(FixturesTool.STORAGE_DOMAIN_SCALE_SD5); assertNotNull(result); assertFalse(result.isEmpty()); for (StoragePoolIsoMap mapping : result) { assertEquals(FixturesTool.STORAGE_DOMAIN_SCALE_SD5, mapping.getStorageId()); } } }
public void setStoragePoolId(Guid storagePoolId) { getStoragePoolIsoMapData().setStoragePoolId(storagePoolId); }
@Override public void setId(Guid id) { getStorageStaticData().setId(id); getStorageDynamicData().setId(id); getStoragePoolIsoMapData().setStorageId(id); }
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"); }
@Override protected void updateExistingEntity() { existingEntity.setStatus(StorageDomainStatus.Active); }
public StorageDomain() { staticData = new StorageDomainStatic(); dynamicData = new StorageDomainDynamic(); setStoragePoolIsoMapData(new StoragePoolIsoMap()); storageDomainSharedStatus = StorageDomainSharedStatus.Unattached; hostedEngineStorage = false; }
@Test public void testGetAllStoragePoolIsoMapsForStoragePool() { List<StoragePoolIsoMap> result = dao.getAllForStoragePool(FixturesTool.DATA_CENTER); assertNotNull(result); assertFalse(result.isEmpty()); for (StoragePoolIsoMap mapping : result) { assertEquals(FixturesTool.DATA_CENTER, mapping.getStoragePoolId()); } }
public static Stream<BusinessEntity<?>> data() { RandomUtils random = RandomUtils.instance(); VdsStatic vdsStatic = new VdsStatic(random.nextString(10), random.nextString(10), random.nextInt(), random.nextInt(), random.nextString(10), Guid.newGuid(), Guid.newGuid(), random.nextString(10), random.nextBoolean(), random.nextEnum(VDSType.class), Guid.newGuid()); return Stream.of( vdsStatic, randomVdsDynamic(), randomVdsStatistics(), new VdsSpmIdMap(Guid.newGuid(), Guid.newGuid(), random.nextInt()), randomStorageDomainStatic(), new StorageDomainDynamic(random.nextInt(), Guid.newGuid(), random.nextInt()), randomStoragePool(), new StoragePoolIsoMap(Guid.newGuid(), Guid.newGuid(), random.nextEnum(StorageDomainStatus.class)), randomRole(), new IdContainerClass<>(new VdsSpmIdMap(Guid.newGuid(), Guid.newGuid(), random.nextInt())), new IdContainerClass<>(Guid.newGuid()) ); }