use of org.ovirt.engine.core.common.businessentities.VmStatic in project ovirt-engine by oVirt.
the class VmStaticDaoTest method testGetAllByCluster.
/**
* Ensures that all static VMs for the specified VDS group are returned.
*/
@Test
public void testGetAllByCluster() {
List<VmStatic> result = dao.getAllByCluster(FixturesTool.CLUSTER);
assertNotNull(result);
assertFalse(result.isEmpty());
for (VmStatic vm : result) {
assertEquals(FixturesTool.CLUSTER, vm.getClusterId());
}
}
use of org.ovirt.engine.core.common.businessentities.VmStatic in project ovirt-engine by oVirt.
the class VmStaticDaoTest method testGetAllStaticByName.
/**
* Ensures that all VMs are returned.
*/
@Test
public void testGetAllStaticByName() {
List<VmStatic> result = dao.getAllByName(FixturesTool.VM_RHEL5_POOL_50_NAME);
assertNotNull(result);
assertFalse(result.isEmpty());
for (VmStatic vm : result) {
assertEquals(FixturesTool.VM_RHEL5_POOL_50_NAME, vm.getName());
}
}
use of org.ovirt.engine.core.common.businessentities.VmStatic in project ovirt-engine by oVirt.
the class VmStaticDaoTest method testRemoveWithoutPermissions.
@Test
public void testRemoveWithoutPermissions() {
for (Snapshot s : dbFacade.getSnapshotDao().getAll()) {
dbFacade.getSnapshotDao().remove(s.getId());
}
PermissionDao permissionsDao = dbFacade.getPermissionDao();
int numberOfPermissionsBeforeRemove = permissionsDao.getAllForEntity(getExistingEntityId()).size();
dao.remove(getExistingEntityId(), false);
VmStatic result = dao.get(getExistingEntityId());
assertNull(result);
assertEquals("vm permissions changed during remove although shouldnt have.", numberOfPermissionsBeforeRemove, permissionsDao.getAllForEntity(getExistingEntityId()).size());
}
use of org.ovirt.engine.core.common.businessentities.VmStatic in project ovirt-engine by oVirt.
the class VmStaticDaoTest method initVmStaticsOrderedByPriority.
/**
* Creates an array of VM static which was initiated for MigrationSupport order, and modified the priority to
* reflect the precedence of the priority column on top the MigrationSupport.
*
* @return an array of VmStatics, in descending order according to: auto_startup, priority, MigrationSupport. The
* priority is the one being checked.
*/
private VmStatic[] initVmStaticsOrderedByPriority(List<VmStatic> vmStatics) {
VmStatic[] vmStaticArray = initVmStaticsOrderedByMigrationSupport(vmStatics);
// Swapping the first two VmStatics
VmStatic tempVmStatic = vmStaticArray[0];
vmStaticArray[0] = vmStaticArray[1];
vmStaticArray[1] = tempVmStatic;
int arrayLength = vmStaticArray.length;
// Setting the array in descending order due to their priorities to maintain its correctness
for (int i = 0; i < arrayLength; i++) {
vmStaticArray[i].setPriority(arrayLength - i + 1);
}
updateArrayOfVmStaticsInDb(vmStaticArray);
return vmStaticArray;
}
use of org.ovirt.engine.core.common.businessentities.VmStatic in project ovirt-engine by oVirt.
the class VmStaticDaoTest method testRemove.
@Test
@Override
public void testRemove() {
for (Snapshot s : dbFacade.getSnapshotDao().getAll()) {
dbFacade.getSnapshotDao().remove(s.getId());
}
dao.remove(getExistingEntityId());
VmStatic result = dao.get(getExistingEntityId());
assertNull(result);
PermissionDao permissionsDao = dbFacade.getPermissionDao();
assertEquals("vm permissions wasn't removed", 0, permissionsDao.getAllForEntity(getExistingEntityId()).size());
}
Aggregations