use of org.ovirt.engine.api.model.Action in project ovirt-engine by oVirt.
the class BackendStorageDomainVmResourceTest 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, STORAGE_DOMAIN_ID, true);
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 BackendStorageDomainVmResourceTest method doTestImport.
public void doTestImport(StorageDomain storageDomain, org.ovirt.engine.api.model.Cluster cluster, boolean collapseSnapshots, boolean importAsNewEntity) throws Exception {
setUpGetEntityExpectations(1, StorageDomainType.ImportExport, GUIDS[2]);
UriInfo uriInfo = setUpActionExpectations(ActionType.ImportVm, ImportVmParameters.class, new String[] { "ContainerId", "StorageDomainId", "SourceDomainId", "DestDomainId", "StoragePoolId", "ClusterId", "CopyCollapse", "ImportAsNewEntity" }, new Object[] { VM_ID, GUIDS[2], STORAGE_DOMAIN_ID, GUIDS[2], DATA_CENTER_ID, GUIDS[1], collapseSnapshots, importAsNewEntity }, // valid,
true, // success
true, // taskReturn
null, // baseUri
null, // replay
false);
uriInfo = addMatrixParameterExpectations(uriInfo, BackendStorageDomainVmResource.COLLAPSE_SNAPSHOTS, Boolean.toString(collapseSnapshots));
setUriInfo(uriInfo);
Action action = new Action();
action.setStorageDomain(storageDomain);
action.setCluster(cluster);
action.setClone(importAsNewEntity);
verifyActionResponse(resource.doImport(action));
}
use of org.ovirt.engine.api.model.Action in project ovirt-engine by oVirt.
the class BackendStepResourceTest method testEnd.
@Test
public void testEnd() throws Exception {
setUriInfo(setUpActionExpectations(ActionType.EndExternalStep, EndExternalStepParameters.class, new String[] { "Id", "Status" }, new Object[] { GUIDS[0], true }, true, true));
Action action = new Action();
action.setSucceeded(true);
verifyActionResponse(resource.end(action));
}
use of org.ovirt.engine.api.model.Action in project ovirt-engine by oVirt.
the class BackendStorageDomainDiskResourceTest 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");
}
}
use of org.ovirt.engine.api.model.Action in project ovirt-engine by oVirt.
the class BackendStorageDomainImageResourceTest method testImport.
@Test
public void testImport() throws Exception {
setUpEntityQueryExpectations(QueryType.GetStoragePoolsByStorageDomainId, IdQueryParameters.class, new String[] { "Id" }, new Object[] { DESTINATION_DOMAIN_ID }, getStoragePoolList());
setUriInfo(setUpActionExpectations(ActionType.ImportRepoImage, ImportRepoImageParameters.class, new String[] { "SourceRepoImageId", "SourceStorageDomainId", "StoragePoolId", "StorageDomainId" }, new Object[] { IMAGE_ID.toString(), DOMAIN_ID, STORAGE_POOL_ID, DESTINATION_DOMAIN_ID }, true, true, null, null, true));
Action action = new Action();
action.setStorageDomain(new StorageDomain());
action.getStorageDomain().setId(DESTINATION_DOMAIN_ID.toString());
verifyActionResponse(resource.doImport(action), "storagedomains/" + DOMAIN_ID + "/images/" + IMAGE_ID, false);
}
Aggregations