use of org.ovirt.engine.core.bll.ValidationResult in project ovirt-engine by oVirt.
the class HostInterfaceValidatorTest method testInterfaceInHostWhenInDifferentHost.
@Test
public void testInterfaceInHostWhenInDifferentHost() throws Exception {
VdsNetworkInterface vdsNetworkInterface = createVdsNetworkInterfaceWithName();
vdsNetworkInterface.setVdsId(Guid.newGuid());
Guid hostId = Guid.newGuid();
final EngineMessage engineMessage = EngineMessage.NIC_NOT_EXISTS_ON_HOST;
Matcher<ValidationResult> matcher = failsWith(engineMessage, ReplacementUtils.getVariableAssignmentString(engineMessage, hostId.toString()));
assertThat(new HostInterfaceValidator(vdsNetworkInterface).interfaceInHost(hostId), matcher);
}
use of org.ovirt.engine.core.bll.ValidationResult in project ovirt-engine by oVirt.
the class HostInterfaceValidatorTest method testInterfaceAlreadyLabeledWithWhenInterfaceIsLabeledBySameLabel.
@Test
public void testInterfaceAlreadyLabeledWithWhenInterfaceIsLabeledBySameLabel() throws Exception {
String labelA = "labelA";
VdsNetworkInterface vdsNetworkInterface = createVdsNetworkInterfaceWithName();
vdsNetworkInterface.setLabels(Collections.singleton(labelA));
Matcher<ValidationResult> matcher = failsWith(EngineMessage.INTERFACE_ALREADY_LABELED, ReplacementUtils.createSetVariableString(HostInterfaceValidator.VAR_LABELED_NIC, vdsNetworkInterface.getName()), ReplacementUtils.createSetVariableString(HostInterfaceValidator.VAR_NIC_LABEL, labelA));
assertThat(new HostInterfaceValidator(vdsNetworkInterface).interfaceAlreadyLabeledWith(labelA), matcher);
}
use of org.ovirt.engine.core.bll.ValidationResult in project ovirt-engine by oVirt.
the class HostInterfaceValidatorTest method testInterfaceIsBondWhenInterfaceIsNotBonded.
@Test
public void testInterfaceIsBondWhenInterfaceIsNotBonded() throws Exception {
VdsNetworkInterface iface = createVdsNetworkInterfaceWithName();
iface.setBonded(false);
final EngineMessage engineMessage = EngineMessage.NETWORK_INTERFACE_IS_NOT_BOND;
Matcher<ValidationResult> matcher = failsWith(engineMessage, ReplacementUtils.getVariableAssignmentString(engineMessage, iface.getName()));
assertThat(new HostInterfaceValidator(iface).interfaceIsBondOrNull(), matcher);
}
use of org.ovirt.engine.core.bll.ValidationResult in project ovirt-engine by oVirt.
the class HostInterfaceValidatorTest method testInterfaceIsValidSlaveWhenInterfaceIsBond.
@Test
public void testInterfaceIsValidSlaveWhenInterfaceIsBond() throws Exception {
VdsNetworkInterface vdsNetworkInterface = createVdsNetworkInterfaceWithName();
vdsNetworkInterface.setBonded(true);
Matcher<ValidationResult> matcher = failsWith(EngineMessage.NETWORK_INTERFACE_BOND_OR_VLAN_CANNOT_BE_SLAVE, ReplacementUtils.createSetVariableString(HostInterfaceValidator.VAR_NIC_NAME, vdsNetworkInterface.getName()));
assertThat(new HostInterfaceValidator(vdsNetworkInterface).interfaceIsValidSlave(), matcher);
}
use of org.ovirt.engine.core.bll.ValidationResult in project ovirt-engine by oVirt.
the class UpdateStoragePoolCommandTest method poolHasDefaultCluster.
@Test
public void poolHasDefaultCluster() {
mcr.mockConfigValue(ConfigValues.AutoRegistrationDefaultClusterID, DEFAULT_CLUSTER_ID);
addDefaultClusterToPool();
doReturn(new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_STORAGE_POOL_WITH_DEFAULT_CLUSTER_CANNOT_BE_LOCALFS)).when(poolValidator).isNotLocalfsWithDefaultCluster();
ValidateTestUtils.runAndAssertValidateFailure(cmd, EngineMessage.ACTION_TYPE_FAILED_STORAGE_POOL_WITH_DEFAULT_CLUSTER_CANNOT_BE_LOCALFS);
}
Aggregations