Search in sources :

Example 16 with Action

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

the class BackendJobResourceTest method testEnd.

@Test
public void testEnd() throws Exception {
    setUriInfo(setUpActionExpectations(ActionType.EndExternalJob, EndExternalJobParameters.class, new String[] { "JobId", "Status", "Force" }, new Object[] { GUIDS[0], true, false }, true, true));
    Action action = new Action();
    action.setSucceeded(true);
    verifyActionResponse(resource.end(action));
}
Also used : Action(org.ovirt.engine.api.model.Action) EndExternalJobParameters(org.ovirt.engine.core.common.action.EndExternalJobParameters) Test(org.junit.Test)

Example 17 with Action

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

the class BackendSnapshotResourceTest method testRestore.

@Test
public void testRestore() {
    setUriInfo(setUpBasicUriExpectations());
    setUpTryBackExpectations();
    setUpRestoreExpectations();
    resource.restore(new Action());
}
Also used : Action(org.ovirt.engine.api.model.Action) Test(org.junit.Test)

Example 18 with Action

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

the class BackendHostResourceTest method testManualFence.

@Test
public void testManualFence() throws Exception {
    setUpGetEntityWithNoCertificateInfoExpectations();
    setUriInfo(setUpActionExpectations(ActionType.FenceVdsManualy, FenceVdsManualyParameters.class, new String[] { "VdsId", "StoragePoolId" }, new Object[] { GUIDS[0], GUIDS[1] }));
    Action action = new Action();
    action.setFenceType(FenceType.MANUAL.value());
    verifyActionResponse(resource.fence(action));
}
Also used : Action(org.ovirt.engine.api.model.Action) FenceVdsManualyParameters(org.ovirt.engine.core.common.action.FenceVdsManualyParameters) Test(org.junit.Test)

Example 19 with Action

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

the class BackendHostResourceTest method testIncompleteFence.

@Test
public void testIncompleteFence() throws Exception {
    setUriInfo(setUpBasicUriExpectations());
    try {
        resource.fence(new Action());
        fail("expected WebApplicationException on incomplete parameters");
    } catch (WebApplicationException wae) {
        verifyIncompleteException(wae, "Action", "fence", "fenceType");
    }
}
Also used : Action(org.ovirt.engine.api.model.Action) WebApplicationException(javax.ws.rs.WebApplicationException) Test(org.junit.Test)

Example 20 with Action

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

the class BackendHostResourceTest method testFenceStatus.

@Test
public void testFenceStatus() throws Exception {
    FenceOperationResult retVal = new FenceOperationResult(FenceOperationResult.Status.SUCCESS, PowerStatus.ON);
    setUpEntityQueryExpectations(QueryType.GetVdsFenceStatus, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[0] }, retVal);
    Action action = new Action();
    action.setFenceType(FenceType.STATUS.value());
    verifyActionResponse(resource.fence(action));
    PowerManagementStatus status = action.getPowerManagement().getStatus();
    assertEquals(PowerManagementStatus.ON, status);
}
Also used : Action(org.ovirt.engine.api.model.Action) FenceOperationResult(org.ovirt.engine.core.common.businessentities.pm.FenceOperationResult) PowerManagementStatus(org.ovirt.engine.api.model.PowerManagementStatus) Test(org.junit.Test)

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