Search in sources :

Example 71 with Action

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

the class BackendHostResourceTest method doTestFence.

public void doTestFence(FenceType fenceType, ActionType actionType) throws Exception {
    setUriInfo(setUpActionExpectations(actionType, FenceVdsActionParameters.class, new String[] { "VdsId" }, new Object[] { GUIDS[0] }));
    Action action = new Action();
    action.setFenceType(fenceType.value());
    verifyActionResponse(resource.fence(action));
}
Also used : Action(org.ovirt.engine.api.model.Action) FenceVdsActionParameters(org.ovirt.engine.core.common.action.FenceVdsActionParameters)

Example 72 with Action

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

the class BackendStorageDomainTemplateResourceTest method doTestImport.

public void doTestImport(StorageDomain storageDomain, org.ovirt.engine.api.model.Cluster cluster, boolean importAsNewEntity) throws Exception {
    setUpGetEntityExpectations(1, StorageDomainType.ImportExport, GUIDS[2]);
    setUriInfo(setUpActionExpectations(ActionType.ImportVmTemplate, ImportVmTemplateParameters.class, new String[] { "ContainerId", "StorageDomainId", "SourceDomainId", "DestDomainId", "StoragePoolId", "ClusterId", "ImportAsNewEntity" }, new Object[] { TEMPLATE_ID, GUIDS[2], STORAGE_DOMAIN_ID, GUIDS[2], DATA_CENTER_ID, GUIDS[1], importAsNewEntity }));
    Action action = new Action();
    action.setStorageDomain(storageDomain);
    action.setCluster(cluster);
    action.setClone(importAsNewEntity);
    verifyActionResponse(resource.doImport(action));
}
Also used : Action(org.ovirt.engine.api.model.Action) ImportVmTemplateParameters(org.ovirt.engine.core.common.action.ImportVmTemplateParameters)

Example 73 with Action

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

the class BackendStorageDomainTemplateResourceTest method testIncompleteImport.

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

Example 74 with Action

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

the class BackendStorageDomainVmResourceTest method testIncompleteImport.

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

Example 75 with Action

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

the class BackendStorageDomainVmResourceTest method doTestImportAsync.

private void doTestImportAsync(AsyncTaskStatusEnum asyncStatus, CreationStatus actionStatus) throws Exception {
    setUpGetEntityExpectations(1, StorageDomainType.ImportExport, GUIDS[2]);
    setUpGetDataCenterByStorageDomainExpectations(GUIDS[3]);
    setUriInfo(setUpActionExpectations(ActionType.ImportVm, ImportVmParameters.class, new String[] { "ContainerId", "StorageDomainId", "SourceDomainId", "DestDomainId", "StoragePoolId", "ClusterId" }, new Object[] { VM_ID, GUIDS[2], STORAGE_DOMAIN_ID, GUIDS[2], DATA_CENTER_ID, GUIDS[1] }, asList(GUIDS[1]), asList(new AsyncTaskStatus(asyncStatus))));
    StorageDomain storageDomain = new StorageDomain();
    storageDomain.setId(GUIDS[2].toString());
    org.ovirt.engine.api.model.Cluster cluster = new org.ovirt.engine.api.model.Cluster();
    cluster.setId(GUIDS[1].toString());
    Action action = new Action();
    action.setStorageDomain(storageDomain);
    action.setCluster(cluster);
    Response response = resource.doImport(action);
    verifyActionResponse(response, URL_BASE, true, null);
    action = (Action) response.getEntity();
    assertTrue(action.isSetStatus());
    assertEquals(actionStatus.value(), action.getStatus());
}
Also used : Action(org.ovirt.engine.api.model.Action) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) Response(javax.ws.rs.core.Response) BackendStorageDomainVmsResourceTest.setUpStorageDomain(org.ovirt.engine.api.restapi.resource.BackendStorageDomainVmsResourceTest.setUpStorageDomain) StorageDomain(org.ovirt.engine.api.model.StorageDomain) AsyncTaskStatus(org.ovirt.engine.core.common.businessentities.AsyncTaskStatus) ImportVmParameters(org.ovirt.engine.core.common.action.ImportVmParameters)

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