Search in sources :

Example 1 with Cdrom

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

the class BackendVmCdromResourceTest method testGetCurrentWithMatrixFalse.

@Test
public void testGetCurrentWithMatrixFalse() throws Exception {
    UriInfo uriInfo = setUpBasicUriExpectations();
    uriInfo = addMatrixParameterExpectations(uriInfo, "current", "false");
    setUriInfo(uriInfo);
    setUpEntityQueryExpectations(getVm());
    Cdrom cdrom = resource.get();
    verifyModel(cdrom);
}
Also used : Cdrom(org.ovirt.engine.api.model.Cdrom) UriInfo(javax.ws.rs.core.UriInfo) Test(org.junit.Test)

Example 2 with Cdrom

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

the class BackendVmCdromResourceTest method testUpdate.

@Test
public void testUpdate() throws Exception {
    setUpEntityQueryExpectations(getVm(A_ISO, A_ISO, VMStatus.Down));
    setUpEntityQueryExpectations(getVm(B_ISO, A_ISO, VMStatus.Down));
    setUriInfo(setUpActionExpectations(ActionType.UpdateVm, VmManagementParametersBase.class, new String[] { "VmStaticData.IsoPath" }, new Object[] { B_ISO }, true, true));
    Cdrom cdrom = getCdrom(B_ISO);
    cdrom = resource.update(cdrom);
    assertTrue(cdrom.isSetFile());
}
Also used : Cdrom(org.ovirt.engine.api.model.Cdrom) VmManagementParametersBase(org.ovirt.engine.core.common.action.VmManagementParametersBase) Test(org.junit.Test)

Example 3 with Cdrom

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

the class BackendVmCdromResourceTest method testGetCurrent.

@Test
public void testGetCurrent() throws Exception {
    UriInfo uriInfo = setUpBasicUriExpectations();
    uriInfo = addMatrixParameterExpectations(uriInfo, "current");
    setUriInfo(uriInfo);
    setUpEntityQueryExpectations(getVm());
    Cdrom cdrom = resource.get();
    verifyModelWithCurrentCd(cdrom);
}
Also used : Cdrom(org.ovirt.engine.api.model.Cdrom) UriInfo(javax.ws.rs.core.UriInfo) Test(org.junit.Test)

Example 4 with Cdrom

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

the class BackendVmCdromResourceTest method getCdrom.

private Cdrom getCdrom(String path) {
    Cdrom cdrom = new Cdrom();
    cdrom.setFile(new File());
    cdrom.getFile().setId(path);
    return cdrom;
}
Also used : Cdrom(org.ovirt.engine.api.model.Cdrom) File(org.ovirt.engine.api.model.File)

Example 5 with Cdrom

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

the class BackendVmCdromsResourceTest method testAddCdRom.

@Test
public void testAddCdRom() throws Exception {
    setUriInfo(setUpBasicUriExpectations());
    setUpEntityQueryExpectations(QueryType.GetVmByVmId, IdQueryParameters.class, new String[] { "Id" }, new Object[] { VM_ID }, getVm(), 1);
    setUpCreationExpectations(ActionType.UpdateVm, VmManagementParametersBase.class, new String[] {}, new Object[] {}, true, true, null, QueryType.GetVmByVmId, IdQueryParameters.class, new String[] { "Id" }, new Object[] { VM_ID }, getVm());
    Cdrom cdrom = getCdrom();
    Response response = collection.add(cdrom);
    assertEquals(201, response.getStatus());
    assertTrue(response.getEntity() instanceof Cdrom);
    verifyModel((Cdrom) response.getEntity());
}
Also used : Cdrom(org.ovirt.engine.api.model.Cdrom) Response(javax.ws.rs.core.Response) Test(org.junit.Test)

Aggregations

Cdrom (org.ovirt.engine.api.model.Cdrom)21 Test (org.junit.Test)15 File (org.ovirt.engine.api.model.File)6 UriInfo (javax.ws.rs.core.UriInfo)5 WebApplicationException (javax.ws.rs.WebApplicationException)4 Vm (org.ovirt.engine.api.model.Vm)2 VmManagementParametersBase (org.ovirt.engine.core.common.action.VmManagementParametersBase)2 Response (javax.ws.rs.core.Response)1 Action (org.ovirt.engine.api.model.Action)1 Cdroms (org.ovirt.engine.api.model.Cdroms)1 Floppies (org.ovirt.engine.api.model.Floppies)1 Floppy (org.ovirt.engine.api.model.Floppy)1 Vms (org.ovirt.engine.api.model.Vms)1 RunVmOnceParams (org.ovirt.engine.core.common.action.RunVmOnceParams)1