use of org.ovirt.engine.api.model.Vm in project ovirt-engine by oVirt.
the class AffinityGroupMapperTest method testVmIds.
@Test
public void testVmIds() throws Exception {
AffinityGroup model = new AffinityGroup();
Vm vm = new Vm();
final Guid vmGuid = Guid.newGuid();
vm.setId(vmGuid.toString());
model.setVms(new Vms());
model.getVms().getVms().add(vm);
org.ovirt.engine.core.common.scheduling.AffinityGroup entity = new org.ovirt.engine.core.common.scheduling.AffinityGroup();
AffinityGroupMapper.map(model, entity);
assertEquals(vmGuid, entity.getVmIds().get(0));
}
use of org.ovirt.engine.api.model.Vm in project ovirt-engine by oVirt.
the class LinkFollowerTest method testFollowLinks.
@Test
public void testFollowLinks() throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
LinksTreeNode linksTree = linkFollower.createLinksTree(Vm.class, "nics,disk_attachments.disk");
Vm vm = createVm();
linkFollower.followLinks(vm, linksTree);
assertNotNull(vm.getNics());
assertNotNull(vm.getNics().getNics());
assertFalse(vm.getNics().getNics().isEmpty());
assertEquals(2, vm.getNics().getNics().size());
assertNotNull(vm.getDiskAttachments());
assertNotNull(vm.getDiskAttachments().getDiskAttachments());
assertFalse(vm.getDiskAttachments().getDiskAttachments().isEmpty());
assertEquals(3, vm.getDiskAttachments().getDiskAttachments().size());
assertNotNull(vm.getDiskAttachments().getDiskAttachments().get(0).getDisk());
assertNotNull(vm.getDiskAttachments().getDiskAttachments().get(1).getDisk());
assertNotNull(vm.getDiskAttachments().getDiskAttachments().get(2).getDisk());
}
use of org.ovirt.engine.api.model.Vm in project ovirt-engine by oVirt.
the class LinkHelperTest method testStatisticLinks.
@Test
public void testStatisticLinks() throws Exception {
Statistic statistic = new Statistic();
statistic.setId(STATISTIC_ID);
statistic.setVm(new Vm());
statistic.getVm().setId(VM_ID);
LinkHelper.addLinks(statistic);
assertEquals(STATISTIC_HREF, statistic.getHref());
}
use of org.ovirt.engine.api.model.Vm in project ovirt-engine by oVirt.
the class LinkHelperTest method testCdRomLinks.
@Test
public void testCdRomLinks() throws Exception {
Cdrom cdrom = new Cdrom();
cdrom.setId(CDROM_ID);
cdrom.setVm(new Vm());
cdrom.getVm().setId(VM_ID);
LinkHelper.addLinks(cdrom);
assertEquals(CDROM_HREF, cdrom.getHref());
}
use of org.ovirt.engine.api.model.Vm in project ovirt-engine by oVirt.
the class LinkHelperTest method testStorageDomainVmLinks.
@Test
public void testStorageDomainVmLinks() throws Exception {
Vm vm = new Vm();
vm.setId(VM_ID);
vm.setStorageDomain(new StorageDomain());
vm.getStorageDomain().setId(STORAGE_DOMAIN_ID);
vm = LinkHelper.addLinks(vm);
assertEquals(STORAGE_DOMAIN_VM_HREF, vm.getHref());
assertEquals(STORAGE_DOMAIN_HREF, vm.getStorageDomain().getHref());
}
Aggregations