Search in sources :

Example 1 with Action

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

the class BackendGlusterBrickResource method remove.

@Override
public Response remove() {
    get();
    GlusterBrick brick = new GlusterBrick();
    brick.setId(id);
    GlusterBricks bricks = new GlusterBricks();
    bricks.getGlusterBricks().add(brick);
    Action action = new Action();
    action.setBricks(bricks);
    return parent.remove(action);
}
Also used : Action(org.ovirt.engine.api.model.Action) GlusterBricks(org.ovirt.engine.api.model.GlusterBricks) GlusterBrick(org.ovirt.engine.api.model.GlusterBrick)

Example 2 with Action

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

the class BackendStorageDomainResourceTest method testRefreshLunsSize.

@Test
public void testRefreshLunsSize() throws Exception {
    List<String> lunsArray = new ArrayList();
    lunsArray.add(GUIDS[2].toString());
    setUriInfo(setUpActionExpectations(ActionType.RefreshLunsSize, ExtendSANStorageDomainParameters.class, new String[] { "LunIds" }, new Object[] { lunsArray }, true, true));
    Action action = new Action();
    LogicalUnits luns = new LogicalUnits();
    LogicalUnit lun = new LogicalUnit();
    lun.setId(GUIDS[2].toString());
    luns.getLogicalUnits().add(lun);
    action.setLogicalUnits(luns);
    verifyActionResponse(resource.refreshLuns(action));
}
Also used : Action(org.ovirt.engine.api.model.Action) LogicalUnits(org.ovirt.engine.api.model.LogicalUnits) LogicalUnit(org.ovirt.engine.api.model.LogicalUnit) ArrayList(java.util.ArrayList) ExtendSANStorageDomainParameters(org.ovirt.engine.core.common.action.ExtendSANStorageDomainParameters) Test(org.junit.Test)

Example 3 with Action

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

the class BackendStorageDomainTemplateResourceTest method testImportNotFound.

@Test
public void testImportNotFound() throws Exception {
    Action action = new Action();
    action.setStorageDomain(new StorageDomain());
    action.getStorageDomain().setId(GUIDS[2].toString());
    action.setCluster(new org.ovirt.engine.api.model.Cluster());
    action.getCluster().setId(GUIDS[1].toString());
    setUpGetEntityExpectations(StorageDomainType.ImportExport, GUIDS[2], true);
    setUpGetDataCenterByStorageDomainExpectations(STORAGE_DOMAIN_ID);
    try {
        resource.doImport(action);
        fail("expected WebApplicationException");
    } catch (WebApplicationException wae) {
        verifyNotFoundException(wae);
    }
}
Also used : Action(org.ovirt.engine.api.model.Action) BackendStorageDomainTemplatesResourceTest.setUpStorageDomain(org.ovirt.engine.api.restapi.resource.BackendStorageDomainTemplatesResourceTest.setUpStorageDomain) StorageDomain(org.ovirt.engine.api.model.StorageDomain) WebApplicationException(javax.ws.rs.WebApplicationException) Test(org.junit.Test)

Example 4 with Action

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

the class BackendStorageDomainTemplateResourceTest method doTestImportAsync.

private void doTestImportAsync(AsyncTaskStatusEnum asyncStatus, CreationStatus actionStatus) throws Exception {
    setUpGetEntityExpectations(1, StorageDomainType.ImportExport, GUIDS[2]);
    setUpGetDataCenterByStorageDomainExpectations(GUIDS[3]);
    setUriInfo(setUpActionExpectations(ActionType.ImportVmTemplate, ImportVmTemplateParameters.class, new String[] { "ContainerId", "StorageDomainId", "SourceDomainId", "DestDomainId", "StoragePoolId", "ClusterId" }, new Object[] { TEMPLATE_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) BackendStorageDomainTemplatesResourceTest.setUpStorageDomain(org.ovirt.engine.api.restapi.resource.BackendStorageDomainTemplatesResourceTest.setUpStorageDomain) StorageDomain(org.ovirt.engine.api.model.StorageDomain) AsyncTaskStatus(org.ovirt.engine.core.common.businessentities.AsyncTaskStatus) ImportVmTemplateParameters(org.ovirt.engine.core.common.action.ImportVmTemplateParameters)

Example 5 with Action

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

the class BackendStorageDomainTemplateResourceTest method doTestRegister.

public void doTestRegister(org.ovirt.engine.api.model.Cluster cluster, boolean importAsNewEntity) throws Exception {
    setUriInfo(setUpActionExpectations(ActionType.ImportVmTemplateFromConfiguration, ImportVmTemplateFromConfParameters.class, new String[] { "ContainerId", "StorageDomainId", "ClusterId", "ImportAsNewEntity", "ImagesExistOnTargetStorageDomain" }, new Object[] { TEMPLATE_ID, GUIDS[3], GUIDS[1], importAsNewEntity, true }));
    Action action = new Action();
    action.setCluster(cluster);
    action.setClone(importAsNewEntity);
    verifyActionResponse(resource.register(action));
}
Also used : ImportVmTemplateFromConfParameters(org.ovirt.engine.core.common.action.ImportVmTemplateFromConfParameters) Action(org.ovirt.engine.api.model.Action)

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