use of org.ovirt.engine.api.model.Vm in project ovirt-engine by oVirt.
the class BackendVmsResourceTest method testAddSetAndUploadIconFailure.
@Test
public void testAddSetAndUploadIconFailure() throws Exception {
final Vm model = createModel(null);
model.setLargeIcon(IconTestHelpler.createIconWithData());
model.setSmallIcon(IconTestHelpler.createIcon(GUIDS[2]));
try {
collection.add(model);
fail("expected WebApplicationException");
} catch (WebApplicationException wae) {
verifyFault(wae, BAD_REQUEST);
}
}
use of org.ovirt.engine.api.model.Vm in project ovirt-engine by oVirt.
the class BackendVmsResourceTest method testAddWithClonePermissionsClone.
@Test
public void testAddWithClonePermissionsClone() throws Exception {
Vm model = createModel(null);
doTestAddWithClonePermissions(model, true);
}
use of org.ovirt.engine.api.model.Vm in project ovirt-engine by oVirt.
the class BackendVmsResourceTest method testAddNamedCluster.
@Test
public void testAddNamedCluster() throws Exception {
setUriInfo(setUpBasicUriExpectations());
setUriInfo(setUpBasicUriExpectations());
setUpGetPayloadExpectations(1, 2);
setUpGetBallooningExpectations(1, 2);
setUpGetGraphicsExpectations(1);
setUpGetConsoleExpectations(1, 2);
setUpGetVmOvfExpectations(2);
setUpGetVirtioScsiExpectations(2);
setUpGetSoundcardExpectations(1, 2);
setUpGetRngDeviceExpectations(1, 2);
setUpGetCertuficateExpectations(1, 2);
setUpEntityQueryExpectations(QueryType.GetVmTemplate, GetVmTemplateParameters.class, new String[] { "Id" }, new Object[] { GUIDS[1] }, getTemplateEntity(1));
setUpEntityQueryExpectations(QueryType.GetClusterByName, NameQueryParameters.class, new String[] { "Name" }, new Object[] { NAMES[2] }, setUpCluster(GUIDS[2]));
setUpCreationExpectations(ActionType.AddVm, AddVmParameters.class, new String[] { "StorageDomainId" }, new Object[] { GUIDS[0] }, true, true, GUIDS[2], QueryType.GetVmByVmId, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[2] }, getEntity(2));
Vm model = getModel(2);
model.setTemplate(new Template());
model.getTemplate().setId(GUIDS[1].toString());
model.setCluster(new org.ovirt.engine.api.model.Cluster());
model.getCluster().setName(NAMES[2]);
Response response = collection.add(model);
assertEquals(201, response.getStatus());
assertTrue(response.getEntity() instanceof Vm);
verifyModel((Vm) response.getEntity(), 2);
}
use of org.ovirt.engine.api.model.Vm in project ovirt-engine by oVirt.
the class BackendVmsResourceTest method testAddFromConfigurationNamedCluster.
@Test
public void testAddFromConfigurationNamedCluster() throws Exception {
setUriInfo(setUpBasicUriExpectations());
setUpGetPayloadExpectations(1, 2);
setUpGetBallooningExpectations(1, 2);
setUpGetGraphicsExpectations(1);
setUpGetCertuficateExpectations(1, 2);
setUpGetConsoleExpectations(2);
setUpGetVmOvfExpectations(2);
setUpGetVirtioScsiExpectations(2);
setUpGetSoundcardExpectations(2);
setUpGetRngDeviceExpectations(2);
Vm model = createModel(null);
org.ovirt.engine.core.common.businessentities.VM returnedVM = getEntity(2);
model.setInitialization(new Initialization());
model.getInitialization().setConfiguration(new Configuration());
model.getInitialization().getConfiguration().setData("asdasdasd");
model.getInitialization().getConfiguration().setType(org.ovirt.engine.api.model.ConfigurationType.OVF);
model.setCluster(new org.ovirt.engine.api.model.Cluster());
model.getCluster().setName(NAMES[1]);
setUpEntityQueryExpectations(QueryType.GetClusterByName, NameQueryParameters.class, new String[] { "Name" }, new Object[] { NAMES[1] }, setUpCluster(GUIDS[1]));
setUpGetEntityExpectations(QueryType.GetVmFromConfiguration, GetVmFromConfigurationQueryParameters.class, new String[] { "VmConfiguration", "ConfigurationType" }, new Object[] { model.getInitialization().getConfiguration().getData(), ConfigurationType.OVF }, returnedVM);
setUpCreationExpectations(ActionType.ImportVmFromConfiguration, ImportVmFromConfParameters.class, new String[] { "Vm", "ClusterId" }, new Object[] { returnedVM, GUIDS[1] }, true, true, GUIDS[2], QueryType.GetVmByVmId, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[2] }, returnedVM);
Response response = collection.add(model);
assertEquals(201, response.getStatus());
assertTrue(response.getEntity() instanceof Vm);
verifyModel((Vm) response.getEntity(), 2);
}
use of org.ovirt.engine.api.model.Vm in project ovirt-engine by oVirt.
the class BackendVmsResourceTest method testAddWithStorageDomain.
@Test
public void testAddWithStorageDomain() throws Exception {
setUpAddVm();
setUpCreationExpectations(ActionType.AddVm, AddVmParameters.class, new String[] { "StorageDomainId" }, new Object[] { GUIDS[1] }, true, true, GUIDS[2], QueryType.GetVmByVmId, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[2] }, getEntity(2));
Vm model = createModel(null);
addStorageDomainToModel(model);
Response response = collection.add(model);
assertEquals(201, response.getStatus());
assertTrue(response.getEntity() instanceof Vm);
verifyModel((Vm) response.getEntity(), 2);
}
Aggregations