Search in sources :

Example 66 with Vm

use of org.ovirt.engine.api.model.Vm in project ovirt-engine by oVirt.

the class VmMapperTest method ovfConfigurationMap.

@Test
public void ovfConfigurationMap() {
    String ovfConfig = "config";
    ConfigurationType configurationType = ConfigurationType.OVF;
    Vm model = new Vm();
    VmMapper.map(ovfConfig, ConfigurationType.OVF, model);
    assertNotNull(model.getInitialization());
    assertNotNull(model.getInitialization().getConfiguration());
    assertEquals(ovfConfig, model.getInitialization().getConfiguration().getData());
    assertEquals(model.getInitialization().getConfiguration().getType(), configurationType);
}
Also used : ConfigurationType(org.ovirt.engine.api.model.ConfigurationType) Vm(org.ovirt.engine.api.model.Vm) Test(org.junit.Test)

Example 67 with Vm

use of org.ovirt.engine.api.model.Vm in project ovirt-engine by oVirt.

the class VmMapperTest method testGuestOs2.

@Test
public void testGuestOs2() {
    org.ovirt.engine.core.common.businessentities.VM vm = new org.ovirt.engine.core.common.businessentities.VM();
    VmDynamic vmDynamic = new VmDynamic();
    vmDynamic.setStatus(VMStatus.Up);
    vmDynamic.setGuestOsType(OsType.Windows);
    vmDynamic.setGuestOsCodename("");
    vmDynamic.setGuestOsDistribution("");
    vmDynamic.setGuestOsVersion("6.2.4800");
    vmDynamic.setGuestOsArch(ArchitectureType.x86_64);
    vmDynamic.setGuestOsKernelVersion("");
    vm.setDynamicData(vmDynamic);
    Vm map = VmMapper.map(vm, (Vm) null);
    assertNotNull(map.getGuestOperatingSystem());
    assertEquals("Windows", map.getGuestOperatingSystem().getFamily());
    assertEquals("", map.getGuestOperatingSystem().getCodename());
    assertEquals("", map.getGuestOperatingSystem().getDistribution());
    assertEquals("6.2.4800", map.getGuestOperatingSystem().getVersion().getFullVersion());
    assertNotNull(map.getGuestOperatingSystem().getVersion().getMajor());
    assertEquals(6, (long) map.getGuestOperatingSystem().getVersion().getMajor());
    assertNotNull(map.getGuestOperatingSystem().getVersion().getMinor());
    assertEquals(2, (long) map.getGuestOperatingSystem().getVersion().getMinor());
    assertNotNull(map.getGuestOperatingSystem().getVersion().getBuild());
    assertEquals(4800, (long) map.getGuestOperatingSystem().getVersion().getBuild());
    assertNull(map.getGuestOperatingSystem().getVersion().getRevision());
    assertEquals("x86_64", map.getGuestOperatingSystem().getArchitecture());
    assertNull(map.getGuestOperatingSystem().getKernel());
}
Also used : VmDynamic(org.ovirt.engine.core.common.businessentities.VmDynamic) Vm(org.ovirt.engine.api.model.Vm) Test(org.junit.Test)

Example 68 with Vm

use of org.ovirt.engine.api.model.Vm in project ovirt-engine by oVirt.

the class VmMapperTest method testGuestFQDN.

@Test
public void testGuestFQDN() {
    org.ovirt.engine.core.common.businessentities.VM vm = new org.ovirt.engine.core.common.businessentities.VM();
    VmDynamic vmDynamic = new VmDynamic();
    vmDynamic.setStatus(VMStatus.Up);
    vmDynamic.setFqdn("localhost.localdomain");
    vm.setDynamicData(vmDynamic);
    Vm map = VmMapper.map(vm, (Vm) null);
    assertNotNull(map.getFqdn());
    assertEquals("localhost.localdomain", map.getFqdn());
}
Also used : VmDynamic(org.ovirt.engine.core.common.businessentities.VmDynamic) Vm(org.ovirt.engine.api.model.Vm) Test(org.junit.Test)

Example 69 with Vm

use of org.ovirt.engine.api.model.Vm in project ovirt-engine by oVirt.

the class VmMapperTest method testMapHostId.

@Test
public void testMapHostId() {
    org.ovirt.engine.core.common.businessentities.VM entity = new org.ovirt.engine.core.common.businessentities.VM();
    entity.setStatus(VMStatus.Up);
    Guid guid = Guid.newGuid();
    entity.setRunOnVds(guid);
    Vm model = VmMapper.map(entity, (Vm) null);
    assertEquals(guid.toString(), model.getHost().getId());
}
Also used : Vm(org.ovirt.engine.api.model.Vm) Guid(org.ovirt.engine.core.compat.Guid) Test(org.junit.Test)

Example 70 with Vm

use of org.ovirt.engine.api.model.Vm in project ovirt-engine by oVirt.

the class VmMapperTest method testGuestOs.

@Test
public void testGuestOs() {
    org.ovirt.engine.core.common.businessentities.VM vm = new org.ovirt.engine.core.common.businessentities.VM();
    VmDynamic vmDynamic = new VmDynamic();
    vmDynamic.setStatus(VMStatus.Up);
    vmDynamic.setGuestOsType(OsType.Linux);
    vmDynamic.setGuestOsCodename("Santiago");
    vmDynamic.setGuestOsDistribution("Red Hat Enterprise Linux Server");
    vmDynamic.setGuestOsVersion("6.5");
    vmDynamic.setGuestOsArch(ArchitectureType.x86_64);
    vmDynamic.setGuestOsKernelVersion("2.6.32-431.el6.x86_64");
    vm.setDynamicData(vmDynamic);
    Vm map = VmMapper.map(vm, (Vm) null);
    assertNotNull(map.getGuestOperatingSystem());
    assertEquals("Linux", map.getGuestOperatingSystem().getFamily());
    assertEquals("Santiago", map.getGuestOperatingSystem().getCodename());
    assertEquals("Red Hat Enterprise Linux Server", map.getGuestOperatingSystem().getDistribution());
    assertEquals("6.5", map.getGuestOperatingSystem().getVersion().getFullVersion());
    assertNotNull(map.getGuestOperatingSystem().getVersion().getMajor());
    assertEquals(6, (long) map.getGuestOperatingSystem().getVersion().getMajor());
    assertNotNull(map.getGuestOperatingSystem().getVersion().getMinor());
    assertEquals(5, (long) map.getGuestOperatingSystem().getVersion().getMinor());
    assertNull(map.getGuestOperatingSystem().getVersion().getBuild());
    assertNull(map.getGuestOperatingSystem().getVersion().getRevision());
    assertEquals("x86_64", map.getGuestOperatingSystem().getArchitecture());
    assertEquals("2.6.32-431.el6.x86_64", map.getGuestOperatingSystem().getKernel().getVersion().getFullVersion());
    assertEquals(2, (long) map.getGuestOperatingSystem().getKernel().getVersion().getMajor());
    assertEquals(6, (long) map.getGuestOperatingSystem().getKernel().getVersion().getMinor());
    assertEquals(32, (long) map.getGuestOperatingSystem().getKernel().getVersion().getBuild());
    assertEquals(431, (long) map.getGuestOperatingSystem().getKernel().getVersion().getRevision());
}
Also used : VmDynamic(org.ovirt.engine.core.common.businessentities.VmDynamic) Vm(org.ovirt.engine.api.model.Vm) Test(org.junit.Test)

Aggregations

Vm (org.ovirt.engine.api.model.Vm)145 Test (org.junit.Test)80 Response (javax.ws.rs.core.Response)26 Host (org.ovirt.engine.api.model.Host)21 WebApplicationException (javax.ws.rs.WebApplicationException)19 Guid (org.ovirt.engine.core.compat.Guid)15 Template (org.ovirt.engine.api.model.Template)11 Hosts (org.ovirt.engine.api.model.Hosts)10 Action (org.ovirt.engine.api.model.Action)9 VmPlacementPolicy (org.ovirt.engine.api.model.VmPlacementPolicy)9 Vms (org.ovirt.engine.api.model.Vms)8 RunVmOnceParams (org.ovirt.engine.core.common.action.RunVmOnceParams)8 VM (org.ovirt.engine.core.common.businessentities.VM)8 Disk (org.ovirt.engine.api.model.Disk)7 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)7 ArrayList (java.util.ArrayList)6 Nic (org.ovirt.engine.api.model.Nic)6 VmManagementParametersBase (org.ovirt.engine.core.common.action.VmManagementParametersBase)6 Configuration (org.ovirt.engine.api.model.Configuration)5 DiskAttachment (org.ovirt.engine.api.model.DiskAttachment)5