Search in sources :

Example 6 with Vm

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

the class CompletenessAssertorTest method testMissingParameterAlteratives.

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

Example 7 with Vm

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

the class CompletenessAssertorTest method testMissingParameter.

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

Example 8 with Vm

use of org.ovirt.engine.api.model.Vm 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 9 with Vm

use of org.ovirt.engine.api.model.Vm 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 10 with Vm

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

the class CompletenessAssertorTest method testMissingParameterSpecificReason.

@Test
public void testMissingParameterSpecificReason() throws Exception {
    Vm vm = new Vm();
    vm.setDescription("incomplete");
    try {
        CompletenessAssertor.validateParameters("Missing stuff", "{0} {1} required for {2}", vm, "status");
        fail("expected WebApplicationException on incomplete model");
    } catch (WebApplicationException wae) {
        verifyIncompleteException("Missing stuff", wae, "Vm", "status");
    }
}
Also used : WebApplicationException(javax.ws.rs.WebApplicationException) 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