use of org.ovirt.engine.core.common.businessentities.network.NetworkClusterId in project ovirt-engine by oVirt.
the class DefaultRouteUtilImplTest method testIsDefaultRouteWhenNetworkClusterExist.
private void testIsDefaultRouteWhenNetworkClusterExist(boolean isDefaultRoute) {
NetworkCluster networkCluster = new NetworkCluster();
networkCluster.setDefaultRoute(isDefaultRoute);
when(networkClusterDao.get(new NetworkClusterId(clusterId, networkId))).thenReturn(networkCluster);
assertThat(underTest.isDefaultRouteNetwork(networkId, clusterId), is(isDefaultRoute));
}
use of org.ovirt.engine.core.common.businessentities.network.NetworkClusterId in project ovirt-engine by oVirt.
the class DefaultRouteUtilImplTest method testIsDefaultRouteWhenNetworkClusterDoesNotExist.
@Test
public void testIsDefaultRouteWhenNetworkClusterDoesNotExist() throws Exception {
when(networkClusterDao.get(new NetworkClusterId(clusterId, networkId))).thenReturn(null);
assertThat(underTest.isDefaultRouteNetwork(networkId, clusterId), is(false));
}
use of org.ovirt.engine.core.common.businessentities.network.NetworkClusterId in project ovirt-engine by oVirt.
the class NetworkAttachmentValidatorTest method testNetworkAttachedToClusterWhenAttached.
@Test
public void testNetworkAttachedToClusterWhenAttached() {
Network network = new Network();
network.setId(Guid.newGuid());
NetworkAttachment attachment = new NetworkAttachment();
attachment.setNetworkId(network.getId());
NetworkClusterId networkClusterId = new NetworkClusterId(host.getClusterId(), attachment.getNetworkId());
when(networkClusterDaoMock.get(eq(networkClusterId))).thenReturn(new NetworkCluster());
assertThat(createNetworkAttachmentValidator(attachment).networkAttachedToCluster(), isValid());
}
use of org.ovirt.engine.core.common.businessentities.network.NetworkClusterId in project ovirt-engine by oVirt.
the class NetworkAttachmentValidatorTest method doTestBootProtocolSetForRoleNetworkWhenNullValuedIpConfiguration.
private void doTestBootProtocolSetForRoleNetworkWhenNullValuedIpConfiguration(boolean displayNetwork, boolean migrationNetwork, boolean glusterNetwork, Matcher<ValidationResult> matcher, Network network, NetworkAttachment attachment) {
NetworkCluster networkCluster = new NetworkCluster();
networkCluster.setDisplay(displayNetwork);
networkCluster.setMigration(migrationNetwork);
networkCluster.setGluster(glusterNetwork);
NetworkClusterId networkClusterId = new NetworkClusterId(host.getClusterId(), attachment.getNetworkId());
when(networkClusterDaoMock.get(eq(networkClusterId))).thenReturn(networkCluster);
when(networkDaoMock.get(eq(network.getId()))).thenReturn(network);
assertThat(createNetworkAttachmentValidator(attachment).bootProtocolSetForRoleNetwork(), matcher);
}
use of org.ovirt.engine.core.common.businessentities.network.NetworkClusterId in project ovirt-engine by oVirt.
the class ManageNetworkClustersCommand method validateInputForDuplication.
private ValidationResult validateInputForDuplication() {
final Set<NetworkClusterId> networkClusterIds = new HashSet<>();
final Iterable<NetworkCluster> inputNetworkClusters = Stream.of(getParameters().getAttachments(), getParameters().getDetachments(), getParameters().getUpdates()).flatMap(Collection::stream).collect(Collectors.toList());
for (NetworkCluster networkCluster : inputNetworkClusters) {
if (networkClusterIds.contains(networkCluster.getId())) {
final String networkClusterReplacement = String.format("${NetworkCluster} %s", networkCluster.getId());
return new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_DUPLICATE_NETWORK_CLUSTER_INPUT, networkClusterReplacement);
} else {
networkClusterIds.add(networkCluster.getId());
}
}
return ValidationResult.VALID;
}
Aggregations