Search in sources :

Example 21 with Host

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

the class CompletenessAssertorTest method testCompleteSubFieldAlternatives.

@Test
public void testCompleteSubFieldAlternatives() throws Exception {
    Vm vm = new Vm();
    vm.setHost(new Host());
    vm.getHost().setName("zog");
    CompletenessAssertor.validateParameters(vm, "host.id|name");
}
Also used : Vm(org.ovirt.engine.api.model.Vm) Host(org.ovirt.engine.api.model.Host) Test(org.junit.Test)

Example 22 with Host

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

the class CompletenessAssertorTest method testMissingSubField.

@Test
public void testMissingSubField() throws Exception {
    Vm vm = new Vm();
    vm.setDescription("incomplete");
    vm.setHost(new Host());
    try {
        CompletenessAssertor.validateParameters(vm, "host.id");
        fail("expected WebApplicationException on incomplete model");
    } catch (WebApplicationException wae) {
        verifyIncompleteException(wae, "Vm", "host.id");
    }
}
Also used : WebApplicationException(javax.ws.rs.WebApplicationException) Vm(org.ovirt.engine.api.model.Vm) Host(org.ovirt.engine.api.model.Host) Test(org.junit.Test)

Example 23 with Host

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

the class CompletenessAssertorTest method testCompleteSubField.

@Test
public void testCompleteSubField() throws Exception {
    Vm vm = new Vm();
    vm.setHost(new Host());
    vm.getHost().setId("0");
    CompletenessAssertor.validateParameters(vm, "host.id");
}
Also used : Vm(org.ovirt.engine.api.model.Vm) Host(org.ovirt.engine.api.model.Host) Test(org.junit.Test)

Example 24 with Host

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

the class CompletenessAssertorTest method testCompleteParameters.

@Test
public void testCompleteParameters() throws Exception {
    Vm vm = new Vm();
    vm.setName("foo");
    vm.setStatus(VmStatus.UP);
    vm.setHost(new Host());
    CompletenessAssertor.validateParameters(vm, "name", "host", "status");
}
Also used : Vm(org.ovirt.engine.api.model.Vm) Host(org.ovirt.engine.api.model.Host) Test(org.junit.Test)

Example 25 with Host

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

the class BackendHostNicsResource method addParents.

@Override
public HostNic addParents(HostNic hostNic) {
    final HostNic nic = super.addParents(hostNic);
    final Host host = new Host();
    host.setId(hostId);
    nic.setHost(host);
    if (nic.getPhysicalFunction() != null) {
        nic.getPhysicalFunction().setHost(host);
    }
    return nic;
}
Also used : HostNic(org.ovirt.engine.api.model.HostNic) Host(org.ovirt.engine.api.model.Host)

Aggregations

Host (org.ovirt.engine.api.model.Host)114 Test (org.junit.Test)58 Vm (org.ovirt.engine.api.model.Vm)21 Response (javax.ws.rs.core.Response)15 Hosts (org.ovirt.engine.api.model.Hosts)15 StorageDomain (org.ovirt.engine.api.model.StorageDomain)13 WebApplicationException (javax.ws.rs.WebApplicationException)12 VDS (org.ovirt.engine.core.common.businessentities.VDS)12 VmPlacementPolicy (org.ovirt.engine.api.model.VmPlacementPolicy)11 Guid (org.ovirt.engine.core.compat.Guid)10 Cluster (org.ovirt.engine.api.model.Cluster)7 HostNic (org.ovirt.engine.api.model.HostNic)6 StorageServerConnectionParametersBase (org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase)5 StorageServerConnections (org.ovirt.engine.core.common.businessentities.StorageServerConnections)5 HashSet (java.util.HashSet)4 ArrayList (java.util.ArrayList)3 AffinityGroup (org.ovirt.engine.api.model.AffinityGroup)3 HostStorage (org.ovirt.engine.api.model.HostStorage)3 HostType (org.ovirt.engine.api.model.HostType)3 Spm (org.ovirt.engine.api.model.Spm)3