Search in sources :

Example 16 with Cdrom

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

the class BackendVmCdromResourceTest method testEjectCd.

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

Example 17 with Cdrom

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

the class BackendVmCdromResourceTest method testUpdateNotFound.

@Test
public void testUpdateNotFound() throws Exception {
    setUriInfo(setUpBasicUriExpectations());
    setUpEntityQueryExpectations(null);
    try {
        Cdrom cdrom = getCdrom(A_ISO);
        resource.update(cdrom);
        fail("expected WebApplicationException");
    } catch (WebApplicationException wae) {
        verifyNotFoundException(wae);
    }
}
Also used : Cdrom(org.ovirt.engine.api.model.Cdrom) WebApplicationException(javax.ws.rs.WebApplicationException) Test(org.junit.Test)

Example 18 with Cdrom

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

the class BackendVmCdromsResourceTest method getCdrom.

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

Example 19 with Cdrom

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

the class BackendVmCdromsResourceTest method testAddIncompleteParameters.

@Test
public void testAddIncompleteParameters() throws Exception {
    Cdrom model = new Cdrom();
    model.setName(NAMES[0]);
    model.setFile(new File());
    setUriInfo(setUpBasicUriExpectations());
    try {
        collection.add(model);
        fail("expected WebApplicationException on incomplete parameters");
    } catch (WebApplicationException wae) {
        verifyIncompleteException(wae, "Cdrom", "add", "file.id");
    }
}
Also used : Cdrom(org.ovirt.engine.api.model.Cdrom) WebApplicationException(javax.ws.rs.WebApplicationException) File(org.ovirt.engine.api.model.File) Test(org.junit.Test)

Example 20 with Cdrom

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

the class BackendTemplateCdromResourceTest method testGet.

@Test
public void testGet() throws Exception {
    setUriInfo(setUpBasicUriExpectations());
    setUpEntityQueryExpectations(getTemplate());
    Cdrom cdrom = resource.get();
    verifyModel(cdrom);
    verifyLinks(cdrom);
}
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