Search in sources :

Example 86 with Action

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

the class BackendVmResourceTest method testStart.

@Test
public void testStart() throws Exception {
    setUriInfo(setUpActionExpectations(ActionType.RunVm, RunVmParams.class, new String[] { "VmId" }, new Object[] { GUIDS[0] }));
    Response response = resource.start(new Action());
    verifyActionResponse(response);
    verifyActionModel(((Action) response.getEntity()).getVm(), 0);
}
Also used : Response(javax.ws.rs.core.Response) Action(org.ovirt.engine.api.model.Action) RunVmParams(org.ovirt.engine.core.common.action.RunVmParams) Test(org.junit.Test)

Example 87 with Action

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

the class BackendVmResourceTest method testStartWithBootDev.

@Test
public void testStartWithBootDev() throws Exception {
    setUpWindowsGetEntityExpectations(1, false);
    setUriInfo(setUpActionExpectations(ActionType.RunVmOnce, RunVmOnceParams.class, new String[] { "VmId", "BootSequence" }, new Object[] { GUIDS[0], BootSequence.N }));
    Action action = new Action();
    action.setVm(new Vm());
    action.getVm().setOs(new OperatingSystem());
    action.getVm().getOs().setBoot(new Boot());
    action.getVm().getOs().getBoot().setDevices(new Boot.DevicesList());
    action.getVm().getOs().getBoot().getDevices().getDevices().add(BootDevice.NETWORK);
    verifyActionResponse(resource.start(action));
}
Also used : OperatingSystem(org.ovirt.engine.api.model.OperatingSystem) Action(org.ovirt.engine.api.model.Action) RunVmOnceParams(org.ovirt.engine.core.common.action.RunVmOnceParams) Vm(org.ovirt.engine.api.model.Vm) Boot(org.ovirt.engine.api.model.Boot) Test(org.junit.Test)

Example 88 with Action

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

the class BackendVmResourceTest method testUndoSnapshot.

@Test
public void testUndoSnapshot() throws Exception {
    setUriInfo(setUpActionExpectations(ActionType.RestoreAllSnapshots, RestoreAllSnapshotsParameters.class, new String[] { "VmId", "SnapshotAction" }, new Object[] { GUIDS[0], SnapshotActionEnum.UNDO }));
    Response response = resource.undoSnapshot(new Action());
    verifyActionResponse(response);
    Action action = (Action) response.getEntity();
    assertTrue(action.isSetStatus());
    assertEquals(CreationStatus.COMPLETE.value(), action.getStatus());
}
Also used : Response(javax.ws.rs.core.Response) RestoreAllSnapshotsParameters(org.ovirt.engine.core.common.action.RestoreAllSnapshotsParameters) Action(org.ovirt.engine.api.model.Action) Test(org.junit.Test)

Example 89 with Action

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

the class BackendVmResourceTest method testFreezeFilesystems.

@Test
public void testFreezeFilesystems() throws Exception {
    setUriInfo(setUpActionExpectations(ActionType.FreezeVm, VmOperationParameterBase.class, new String[] { "VmId" }, new Object[] { GUIDS[0] }));
    Action action = new Action();
    verifyActionResponse(resource.freezeFilesystems(action));
}
Also used : Action(org.ovirt.engine.api.model.Action) VmOperationParameterBase(org.ovirt.engine.core.common.action.VmOperationParameterBase) Test(org.junit.Test)

Example 90 with Action

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

the class BackendVmResourceTest method testStartWithModifiedGraphics.

private void testStartWithModifiedGraphics(GraphicsType graphicsType) throws Exception {
    setUpWindowsGetEntityExpectations(1, false);
    setUriInfo(setUpActionExpectations(ActionType.RunVmOnce, RunVmOnceParams.class, new String[] { "VmId", "RunOnceGraphics" }, new Object[] { GUIDS[0], Collections.singleton(graphicsType) }));
    Action action = new Action();
    action.setVm(new Vm());
    action.getVm().setDisplay(new Display());
    DisplayType display = (graphicsType == GraphicsType.VNC) ? DisplayType.VNC : DisplayType.SPICE;
    action.getVm().getDisplay().setType(display);
    verifyActionResponse(resource.start(action));
}
Also used : Action(org.ovirt.engine.api.model.Action) RunVmOnceParams(org.ovirt.engine.core.common.action.RunVmOnceParams) DisplayType(org.ovirt.engine.api.model.DisplayType) Vm(org.ovirt.engine.api.model.Vm) Display(org.ovirt.engine.api.model.Display)

Aggregations

Action (org.ovirt.engine.api.model.Action)100 Test (org.junit.Test)70 WebApplicationException (javax.ws.rs.WebApplicationException)17 Response (javax.ws.rs.core.Response)17 StorageDomain (org.ovirt.engine.api.model.StorageDomain)14 Vm (org.ovirt.engine.api.model.Vm)9 AbstractBackendSubResourceTest (org.ovirt.engine.api.restapi.resource.AbstractBackendSubResourceTest)9 AsyncTaskStatus (org.ovirt.engine.core.common.businessentities.AsyncTaskStatus)7 RunVmOnceParams (org.ovirt.engine.core.common.action.RunVmOnceParams)6 AbstractBackendCollectionResourceTest (org.ovirt.engine.api.restapi.resource.AbstractBackendCollectionResourceTest)5 GlusterVolumeRemoveBricksParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeRemoveBricksParameters)5 GlusterBrick (org.ovirt.engine.api.model.GlusterBrick)4 ExportRepoImageParameters (org.ovirt.engine.core.common.action.ExportRepoImageParameters)4 VmOperationParameterBase (org.ovirt.engine.core.common.action.VmOperationParameterBase)4 UpdateVdsActionParameters (org.ovirt.engine.core.common.action.hostdeploy.UpdateVdsActionParameters)4 GlusterBricks (org.ovirt.engine.api.model.GlusterBricks)3 Option (org.ovirt.engine.api.model.Option)3 BackendStorageDomainVmsResourceTest.setUpStorageDomain (org.ovirt.engine.api.restapi.resource.BackendStorageDomainVmsResourceTest.setUpStorageDomain)3 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)3 ArrayList (java.util.ArrayList)2