use of org.ovirt.engine.core.common.businessentities.BusinessEntityMap in project ovirt-engine by oVirt.
the class ReportedConfigurationsFiller method fillReportedConfigurations.
public void fillReportedConfigurations(List<NetworkAttachment> networkAttachments, Guid hostId) {
List<VdsNetworkInterface> allInterfacesForHost = interfaceDao.getAllInterfacesForVds(hostId);
Guid clusterId = getClusterId(hostId);
BusinessEntityMap<Network> networkMap = new BusinessEntityMap<>(networkDao.getAllForCluster(clusterId));
fillReportedConfigurations(allInterfacesForHost, networkMap, networkAttachments, vdsDynamicDao.get(hostId).getReportedDnsResolverConfiguration(), clusterId);
}
use of org.ovirt.engine.core.common.businessentities.BusinessEntityMap in project ovirt-engine by oVirt.
the class NetworkAttachmentsValidatorTest method testVerifyUserAttachmentsDoesNotReferenceSameNetworkDuplicatelyWhenDuplicatesPresent.
@Test
public void testVerifyUserAttachmentsDoesNotReferenceSameNetworkDuplicatelyWhenDuplicatesPresent() {
Network duplicatelyReferencedNetwork = createNetworkWithId();
duplicatelyReferencedNetwork.setName("networkName");
NetworkAttachment networkAttachmentA = createNetworkAttachment(duplicatelyReferencedNetwork);
NetworkAttachment networkAttachmentB = createNetworkAttachment(duplicatelyReferencedNetwork);
List<NetworkAttachment> attachments = Arrays.asList(networkAttachmentA, networkAttachmentB);
BusinessEntityMap<Network> networksMap = new BusinessEntityMap<>(Collections.singletonList(duplicatelyReferencedNetwork));
NetworkAttachmentsValidator validator = new NetworkAttachmentsValidator(attachments, networksMap, networkExclusivenessValidator);
List<String> replacements = new ArrayList<>();
replacements.addAll(ReplacementUtils.replaceWith("ACTION_TYPE_FAILED_NETWORK_ATTACHMENTS_REFERENCES_SAME_NETWORK_DUPLICATELY_LIST", Arrays.asList(networkAttachmentA.getId(), networkAttachmentB.getId())));
replacements.add(ReplacementUtils.createSetVariableString("ACTION_TYPE_FAILED_NETWORK_ATTACHMENTS_REFERENCES_SAME_NETWORK_DUPLICATELY_ENTITY", duplicatelyReferencedNetwork.getName()));
assertThat(validator.verifyUserAttachmentsDoesNotReferenceSameNetworkDuplicately(), failsWith(EngineMessage.ACTION_TYPE_FAILED_NETWORK_ATTACHMENTS_REFERENCES_SAME_NETWORK_DUPLICATELY, replacements));
}
Aggregations