use of org.ovirt.engine.api.model.Action in project ovirt-engine by oVirt.
the class BackendStorageDomainVmResourceTest method doTestRegister.
public void doTestRegister(org.ovirt.engine.api.model.Cluster cluster, boolean importAsNewEntity) throws Exception {
setUriInfo(setUpActionExpectations(ActionType.ImportVmFromConfiguration, ImportVmFromConfParameters.class, new String[] { "ContainerId", "StorageDomainId", "ClusterId", "ImportAsNewEntity", "ImagesExistOnTargetStorageDomain" }, new Object[] { VM_ID, GUIDS[3], GUIDS[1], importAsNewEntity, true }));
Action action = new Action();
action.setCluster(cluster);
action.setClone(importAsNewEntity);
verifyActionResponse(resource.register(action));
}
use of org.ovirt.engine.api.model.Action in project ovirt-engine by oVirt.
the class BackendStorageDomainVmResourceTest method testImportWithDiskWithoutId.
@Test
public void testImportWithDiskWithoutId() throws Exception {
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());
setUpGetDataCenterByStorageDomainExpectations(STORAGE_DOMAIN_ID);
setUpGetEntityExpectations(1, StorageDomainType.ImportExport, GUIDS[2]);
UriInfo uriInfo = setUpBasicUriExpectations();
uriInfo = addMatrixParameterExpectations(uriInfo, BackendStorageDomainVmResource.COLLAPSE_SNAPSHOTS, Boolean.toString(true));
setUriInfo(uriInfo);
Action action = new Action();
action.setStorageDomain(storageDomain);
action.setCluster(cluster);
action.setClone(false);
Vm vm = new Vm();
DiskAttachments diskAttachments = new DiskAttachments();
DiskAttachment diskAttachment = new DiskAttachment();
diskAttachment.setDisk(new Disk());
diskAttachments.getDiskAttachments().add(diskAttachment);
vm.setDiskAttachments(diskAttachments);
action.setVm(vm);
try {
resource.doImport(action);
fail("expected WebApplicationException");
} catch (WebApplicationException wae) {
verifyIncompleteException(wae, "Disk", "setVolumesTypeFormat", "id");
}
}
use of org.ovirt.engine.api.model.Action in project ovirt-engine by oVirt.
the class BackendVmDiskResourceTest method setUpMoveParams.
private Action setUpMoveParams(boolean byName) {
Action action = new Action();
StorageDomain sd = new StorageDomain();
if (byName) {
sd.setName(NAMES[2]);
} else {
sd.setId(GUIDS[3].toString());
}
action.setStorageDomain(sd);
return action;
}
use of org.ovirt.engine.api.model.Action in project ovirt-engine by oVirt.
the class BackendVmDiskResourceTest method testActivate.
@Test
public void testActivate() throws Exception {
setUriInfo(setUpActionExpectations(ActionType.HotPlugDiskToVm, VmDiskOperationParameterBase.class, new String[] { "DiskVmElement" }, new Object[] { new DiskVmElement(DISK_ID, VM_ID) }, true, true));
Response response = resource.activate(new Action());
assertEquals(200, response.getStatus());
}
use of org.ovirt.engine.api.model.Action in project ovirt-engine by oVirt.
the class BackendVmDiskResourceTest 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");
}
}
Aggregations