use of org.ovirt.engine.core.bll.ValidationResult in project ovirt-engine by oVirt.
the class IscsiBondValidatorTest method iscsiBondDoesNotExist.
@Test
public void iscsiBondDoesNotExist() {
ValidationResult res = validator.isIscsiBondExist(null);
assertThat(res, failsWith(EngineMessage.ISCSI_BOND_NOT_EXIST));
}
use of org.ovirt.engine.core.bll.ValidationResult in project ovirt-engine by oVirt.
the class IscsiBondValidatorTest method addedLogicalNetworkBelongToAnotherDatacenter2.
@Test
public void addedLogicalNetworkBelongToAnotherDatacenter2() {
Guid dataCenterId = Guid.newGuid();
IscsiBond before = createIscsiBond("Before", dataCenterId);
IscsiBond after = createIscsiBond("After", dataCenterId);
List<Network> networks = new ArrayList<>();
networks.add(createNetwork(dataCenterId));
doReturn(networks).when(networkDao).getAllForDataCenter(dataCenterId);
before.getNetworkIds().add(networks.get(0).getId());
after.getNetworkIds().add(networks.get(0).getId());
after.getNetworkIds().add(Guid.newGuid());
ValidationResult res = validator.validateAddedLogicalNetworks(after, before);
assertThat(res, failsWith(EngineMessage.NETWORKS_DONT_EXIST_IN_DATA_CENTER));
assertEquals(2, res.getVariableReplacements().size());
assertEquals("$networkIds " + after.getNetworkIds().get(1).toString(), res.getVariableReplacements().get(0));
assertEquals("$dataCenterId " + after.getStoragePoolId().toString(), res.getVariableReplacements().get(1));
}
use of org.ovirt.engine.core.bll.ValidationResult 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.bll.ValidationResult in project ovirt-engine by oVirt.
the class GlusterBrickValidatorTest method canRebalanceOnDistributeReplicateVolumeWithFewBrickDown.
@Test
public void canRebalanceOnDistributeReplicateVolumeWithFewBrickDown() {
GlusterVolumeEntity volumeEntity = getDistributedReplicatedVolume(volumeId1, 12, 4);
volumeEntity.getBricks().get(0).setStatus(GlusterStatus.DOWN);
volumeEntity.getBricks().get(1).setStatus(GlusterStatus.DOWN);
volumeEntity.getBricks().get(2).setStatus(GlusterStatus.DOWN);
ValidationResult validationResult = brickValidator.canRebalance(volumeEntity);
assertThat(validationResult, isValid());
volumeEntity.getBricks().get(4).setStatus(GlusterStatus.DOWN);
volumeEntity.getBricks().get(5).setStatus(GlusterStatus.DOWN);
volumeEntity.getBricks().get(6).setStatus(GlusterStatus.DOWN);
validationResult = brickValidator.canRebalance(volumeEntity);
assertThat(validationResult, isValid());
}
use of org.ovirt.engine.core.bll.ValidationResult in project ovirt-engine by oVirt.
the class GlusterBrickValidatorTest method canRemoveBrickReduceReplicaMoreThanOne.
@Test
public void canRemoveBrickReduceReplicaMoreThanOne() {
GlusterVolumeEntity volumeEntity = getDistributedReplicatedVolume(volumeId1, 12, 4);
List<GlusterBrickEntity> bricksToRemove = new ArrayList<>();
bricksToRemove.add(volumeEntity.getBricks().get(0));
bricksToRemove.add(volumeEntity.getBricks().get(4));
bricksToRemove.add(volumeEntity.getBricks().get(8));
bricksToRemove.add(volumeEntity.getBricks().get(1));
bricksToRemove.add(volumeEntity.getBricks().get(5));
bricksToRemove.add(volumeEntity.getBricks().get(9));
ValidationResult validationResult = brickValidator.canRemoveBrick(bricksToRemove, volumeEntity, 2, false);
assertThat(validationResult, failsWith(EngineMessage.ACTION_TYPE_FAILED_CAN_NOT_REDUCE_REPLICA_COUNT_MORE_THAN_ONE));
}
Aggregations