Search in sources :

Example 26 with Action

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

the class BackendVmDiskResourceTest method testIncompleteMove.

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

Example 27 with Action

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

the class BackendVmDiskResourceTest method testExport.

@Test
public void testExport() throws Exception {
    setUriInfo(setUpActionExpectations(ActionType.ExportRepoImage, ExportRepoImageParameters.class, new String[] { "ImageGroupID", "DestinationDomainId" }, new Object[] { DISK_ID, GUIDS[3] }, true, true, null, null, true));
    Action action = new Action();
    action.setStorageDomain(new StorageDomain());
    action.getStorageDomain().setId(GUIDS[3].toString());
    verifyActionResponse(resource.export(action));
}
Also used : Action(org.ovirt.engine.api.model.Action) StorageDomain(org.ovirt.engine.api.model.StorageDomain) ExportRepoImageParameters(org.ovirt.engine.core.common.action.ExportRepoImageParameters) Test(org.junit.Test)

Example 28 with Action

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

the class BackendTemplateResourceTest method testIncompleteExport.

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

Example 29 with Action

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

the class BackendTemplateResourceTest method doTestExport.

protected void doTestExport(StorageDomain storageDomain, boolean exclusive) throws Exception {
    setUriInfo(setUpActionExpectations(ActionType.ExportVmTemplate, MoveOrCopyParameters.class, new String[] { "ContainerId", "StorageDomainId", "ForceOverride" }, new Object[] { GUIDS[0], GUIDS[2], exclusive }));
    Action action = new Action();
    action.setStorageDomain(storageDomain);
    if (exclusive) {
        action.setExclusive(exclusive);
    }
    verifyActionResponse(resource.export(action));
}
Also used : Action(org.ovirt.engine.api.model.Action) MoveOrCopyParameters(org.ovirt.engine.core.common.action.MoveOrCopyParameters)

Example 30 with Action

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

the class BackendTemplateResourceTest method doTestExportAsync.

private void doTestExportAsync(AsyncTaskStatusEnum asyncStatus, CreationStatus actionStatus) throws Exception {
    setUriInfo(setUpActionExpectations(ActionType.ExportVmTemplate, MoveOrCopyParameters.class, new String[] { "ContainerId", "StorageDomainId", "ForceOverride" }, new Object[] { GUIDS[0], GUIDS[2], false }, asList(GUIDS[1]), asList(new AsyncTaskStatus(asyncStatus))));
    Action action = new Action();
    StorageDomain storageDomain = new StorageDomain();
    storageDomain.setId(GUIDS[2].toString());
    action.setStorageDomain(storageDomain);
    Response response = resource.export(action);
    verifyActionResponse(response, "templates/" + GUIDS[0], true, null);
    action = (Action) response.getEntity();
    assertTrue(action.isSetStatus());
    assertEquals(actionStatus.value(), action.getStatus());
}
Also used : Response(javax.ws.rs.core.Response) Action(org.ovirt.engine.api.model.Action) StorageDomain(org.ovirt.engine.api.model.StorageDomain) AsyncTaskStatus(org.ovirt.engine.core.common.businessentities.AsyncTaskStatus) MoveOrCopyParameters(org.ovirt.engine.core.common.action.MoveOrCopyParameters)

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