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);
}
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));
}
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);
}
}
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());
}
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));
}
Aggregations