use of org.ovirt.engine.api.model.VmPool in project ovirt-engine by oVirt.
the class BackendVmPoolsResourceTest method getModel.
private VmPool getModel(int index) {
VmPool model = new VmPool();
model.setName(NAMES[index]);
model.setDescription(DESCRIPTIONS[index]);
model.setId(GUIDS[index].toString());
model.setCluster(new Cluster());
model.getCluster().setId(GUIDS[2].toString());
model.setTemplate(new Template());
model.getTemplate().setId(GUIDS[1].toString());
return model;
}
use of org.ovirt.engine.api.model.VmPool in project ovirt-engine by oVirt.
the class BackendVmPoolsResourceTest method addWithName.
@Test
public void addWithName() throws Exception {
setUriInfo(setUpBasicUriExpectations());
setUpEntityQueryExpectations(QueryType.GetClusterById, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[2] }, getClusterEntity());
setUpEntityQueryExpectations(QueryType.GetVmTemplate, GetVmTemplateParameters.class, new String[] { "Name", "ClusterId" }, new Object[] { NAMES[1], GUIDS[2] }, getTemplateEntity());
setUpGetConsoleExpectations(1);
setUpGetRngDeviceExpectations(0);
setUpGetEntityExpectations(QueryType.GetVirtioScsiControllers, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[1] }, new ArrayList<>());
setUpGetEntityExpectations(QueryType.GetSoundDevices, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[1] }, new ArrayList<>());
addCommonAddExpectations();
setUpCreationExpectations(ActionType.AddVmPool, VmPoolParametersBase.class, new String[] { "StorageDomainId" }, new Object[] { GUIDS[0] }, true, true, GUIDS[0], QueryType.GetVmPoolById, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[0] }, getEntity(0));
VmPool pool = getModel(0);
pool.setId(null);
pool.getTemplate().setId(null);
pool.getTemplate().setName(NAMES[1]);
Response response = collection.add(pool);
assertEquals(201, response.getStatus());
assertTrue(response.getEntity() instanceof VmPool);
verifyModelTemplate((VmPool) response.getEntity());
}
Aggregations