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");
}
}
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");
}
}
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");
}
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");
}
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");
}
}
Aggregations