use of org.ovirt.engine.core.common.businessentities.network.NetworkAttachment in project ovirt-engine by oVirt.
the class NetworkAttachmentValidatorTest method testNotRemovingManagementNetwork.
@Test
public void testNotRemovingManagementNetwork() {
NetworkAttachmentValidator networkAttachmentValidatorSpy = spy(createNetworkAttachmentValidator(new NetworkAttachment()));
doReturn(networkValidatorMock).when(networkAttachmentValidatorSpy).getNetworkValidator();
ValidationResult propagatedResult = new ValidationResult(EngineMessage.NETWORK_CANNOT_REMOVE_MANAGEMENT_NETWORK, "a");
when(networkValidatorMock.notRemovingManagementNetwork()).thenReturn(propagatedResult);
assertThat("ValidationResult is not propagated correctly", networkAttachmentValidatorSpy.notRemovingManagementNetwork(), is(propagatedResult));
}
use of org.ovirt.engine.core.common.businessentities.network.NetworkAttachment in project ovirt-engine by oVirt.
the class NetworkAttachmentValidatorTest method testBootProtocolSetForRoleNetworkWhenBootProtocolIsDhcp.
@Test
public void testBootProtocolSetForRoleNetworkWhenBootProtocolIsDhcp() {
Network network = createNetwork();
NetworkAttachment attachment = createNetworkAttachmentWithIpv4Configuration(Ipv4BootProtocol.DHCP);
attachment.setNetworkId(network.getId());
doTestBootProtocolSetForRoleNetworkWhenNullValuedIpConfiguration(true, false, false, isValid(), network, attachment);
}
use of org.ovirt.engine.core.common.businessentities.network.NetworkAttachment in project ovirt-engine by oVirt.
the class NetworkAttachmentValidatorTest method testNotExternalNetworkWhenExternalNetworkIsProvided.
@Test
public void testNotExternalNetworkWhenExternalNetworkIsProvided() {
Network externalNetwork = new Network();
externalNetwork.setId(Guid.newGuid());
externalNetwork.setProvidedBy(new ProviderNetwork(Guid.newGuid(), ""));
when(networkDaoMock.get(eq(externalNetwork.getId()))).thenReturn(externalNetwork);
NetworkAttachment attachment = new NetworkAttachment();
attachment.setNetworkId(externalNetwork.getId());
assertThat(createNetworkAttachmentValidator(attachment).notExternalNetwork(), failsWith(EngineMessage.EXTERNAL_NETWORK_HAVING_NAME_CANNOT_BE_PROVISIONED));
}
use of org.ovirt.engine.core.common.businessentities.network.NetworkAttachment in project ovirt-engine by oVirt.
the class NetworkAttachmentValidatorTest method doTestBootProtocolSetForRoleNetworkWhenNullValuedIpConfiguration.
private void doTestBootProtocolSetForRoleNetworkWhenNullValuedIpConfiguration(boolean displayNetwork, Network network, Matcher<ValidationResult> matcher) {
NetworkAttachment attachment = new NetworkAttachment();
attachment.setIpConfiguration(null);
attachment.setNetworkId(network.getId());
doTestBootProtocolSetForRoleNetworkWhenNullValuedIpConfiguration(displayNetwork, false, false, matcher, network, attachment);
}
use of org.ovirt.engine.core.common.businessentities.network.NetworkAttachment in project ovirt-engine by oVirt.
the class NetworkAttachmentValidatorTest method testBootProtocolSetForRoleNetworkWhenIpConfigurationIsNull.
@Test
public void testBootProtocolSetForRoleNetworkWhenIpConfigurationIsNull() {
Network network = createNetwork();
NetworkAttachment attachment = createNetworkAttachmentWithIpv4Configuration(Ipv4BootProtocol.NONE);
attachment.setNetworkId(network.getId());
doTestBootProtocolSetForRoleNetworkWhenNullValuedIpConfiguration(true, true, false, failsWith(EngineMessage.ACTION_TYPE_FAILED_ROLE_NETWORK_HAS_NO_BOOT_PROTOCOL, ReplacementUtils.createSetVariableString(NetworkAttachmentValidator.VAR_ACTION_TYPE_FAILED_ROLE_NETWORK_HAS_NO_BOOT_PROTOCOL_ENTITY, network.getName())), network, attachment);
}
Aggregations