Search in sources :

Example 11 with Cdrom

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

the class BackendVmCdromResourceTest method testGetCurrentWithMatrixTrue.

@Test
public void testGetCurrentWithMatrixTrue() throws Exception {
    UriInfo uriInfo = setUpBasicUriExpectations();
    uriInfo = addMatrixParameterExpectations(uriInfo, "current", "true");
    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 12 with Cdrom

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

the class BackendVmCdromResourceTest method testGet.

@Test
public void testGet() throws Exception {
    setUriInfo(setUpBasicUriExpectations());
    setUpEntityQueryExpectations(getVm());
    Cdrom cdrom = resource.get();
    verifyModel(cdrom);
}
Also used : Cdrom(org.ovirt.engine.api.model.Cdrom) Test(org.junit.Test)

Example 13 with Cdrom

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

the class BackendVmCdromResourceTest method testChangeCdUsingMatrixParameter.

@Test
public void testChangeCdUsingMatrixParameter() throws Exception {
    UriInfo uriInfo = setUpBasicUriExpectations();
    uriInfo = addMatrixParameterExpectations(uriInfo, "current");
    setUriInfo(uriInfo);
    setUpEntityQueryExpectations(getVm());
    setUpActionExpectations(ActionType.ChangeDisk, ChangeDiskCommandParameters.class, new String[] { "CdImagePath" }, new Object[] { A_ISO }, true, true);
    Cdrom cdrom = getCdrom(A_ISO);
    cdrom = resource.update(cdrom);
    assertTrue(cdrom.isSetFile());
}
Also used : Cdrom(org.ovirt.engine.api.model.Cdrom) UriInfo(javax.ws.rs.core.UriInfo) Test(org.junit.Test)

Example 14 with Cdrom

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

the class BackendVmCdromResourceTest method testUpdateIncompleteParameters.

@Test
public void testUpdateIncompleteParameters() throws Exception {
    setUriInfo(setUpBasicUriExpectations());
    Cdrom cdrom = new Cdrom();
    cdrom.setFile(null);
    try {
        resource.update(cdrom);
        fail("expected WebApplicationException on incomplete parameters");
    } catch (WebApplicationException wae) {
        verifyIncompleteException(wae, "Cdrom", "update", "file");
    }
}
Also used : Cdrom(org.ovirt.engine.api.model.Cdrom) WebApplicationException(javax.ws.rs.WebApplicationException) Test(org.junit.Test)

Example 15 with Cdrom

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

the class BackendVmCdromResourceTest method testChangeCdUsingQueryParameter.

@Test
public void testChangeCdUsingQueryParameter() throws Exception {
    resource.setUriInfo(setUpChangeCdUriQueryExpectations());
    setUpEntityQueryExpectations(getVm());
    setUpActionExpectations(ActionType.ChangeDisk, ChangeDiskCommandParameters.class, new String[] { "CdImagePath" }, new Object[] { A_ISO }, true, true);
    Cdrom cdrom = getCdrom(A_ISO);
    cdrom = resource.update(cdrom);
    assertTrue(cdrom.isSetFile());
}
Also used : Cdrom(org.ovirt.engine.api.model.Cdrom) 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