Search in sources :

Example 6 with VmPool

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;
}
Also used : VmPool(org.ovirt.engine.api.model.VmPool) Cluster(org.ovirt.engine.api.model.Cluster) Template(org.ovirt.engine.api.model.Template) VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate)

Example 7 with VmPool

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());
}
Also used : Response(javax.ws.rs.core.Response) VmPool(org.ovirt.engine.api.model.VmPool) Test(org.junit.Test)

Aggregations

VmPool (org.ovirt.engine.api.model.VmPool)7 Cluster (org.ovirt.engine.api.model.Cluster)4 Template (org.ovirt.engine.api.model.Template)4 Vm (org.ovirt.engine.api.model.Vm)3 Response (javax.ws.rs.core.Response)2 Test (org.junit.Test)2 Display (org.ovirt.engine.api.model.Display)2 Host (org.ovirt.engine.api.model.Host)2 VmTemplate (org.ovirt.engine.core.common.businessentities.VmTemplate)2 Boot (org.ovirt.engine.api.model.Boot)1 DataCenter (org.ovirt.engine.api.model.DataCenter)1 Disk (org.ovirt.engine.api.model.Disk)1 ExternalHostProvider (org.ovirt.engine.api.model.ExternalHostProvider)1 GuestOperatingSystem (org.ovirt.engine.api.model.GuestOperatingSystem)1 HighAvailability (org.ovirt.engine.api.model.HighAvailability)1 InstanceType (org.ovirt.engine.api.model.InstanceType)1 Kernel (org.ovirt.engine.api.model.Kernel)1 OperatingSystem (org.ovirt.engine.api.model.OperatingSystem)1 StorageDomain (org.ovirt.engine.api.model.StorageDomain)1 TimeZone (org.ovirt.engine.api.model.TimeZone)1