Search in sources :

Example 81 with Action

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

the class BackendStorageDomainDiskResourceTest 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 82 with Action

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

the class BackendTemplateDiskResourceTest method testExport.

@Test
public void testExport() throws Exception {
    setUriInfo(setUpActionExpectations(ActionType.ExportRepoImage, ExportRepoImageParameters.class, new String[] { "ImageGroupID", "DestinationDomainId" }, new Object[] { GUIDS[1], 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 83 with Action

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

the class BackendResourceTest method testActionWithCorrelationId.

@Test
public void testActionWithCorrelationId() throws Exception {
    setUpGetEntityExpectations(false);
    resource.getCurrent().getParameters().put("correlation_id", "Some-Correlation-id");
    resource.setUriInfo(setUpActionExpectations(ActionType.UpdateVds, UpdateVdsActionParameters.class, new String[] { "RootPassword", "CorrelationId" }, new Object[] { NAMES[2], "Some-Correlation-id" }, true, true));
    Action action = new Action();
    action.setRootPassword(NAMES[2]);
    resource.install(action);
}
Also used : Action(org.ovirt.engine.api.model.Action) UpdateVdsActionParameters(org.ovirt.engine.core.common.action.hostdeploy.UpdateVdsActionParameters) Test(org.junit.Test)

Example 84 with Action

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

the class BackendVmResourceTest method doTestExport.

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

Example 85 with Action

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

the class BackendVmResourceTest method testMigrateWithHostName.

@Test
public void testMigrateWithHostName() throws Exception {
    setUpGetHostByNameExpectations(1);
    setUriInfo(setUpActionExpectations(ActionType.MigrateVmToServer, MigrateVmToServerParameters.class, new String[] { "VmId", "VdsId", "ForceMigrationForNonMigratableVm" }, new Object[] { GUIDS[0], GUIDS[1], Boolean.FALSE }));
    Action action = new Action();
    action.setHost(new Host());
    action.getHost().setName(NAMES[1]);
    verifyActionResponse(resource.migrate(action));
}
Also used : Action(org.ovirt.engine.api.model.Action) MigrateVmToServerParameters(org.ovirt.engine.core.common.action.MigrateVmToServerParameters) Host(org.ovirt.engine.api.model.Host) Test(org.junit.Test)

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