Search in sources :

Example 11 with Action

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

the class BackendStorageDomainResourceTest method reduceLuns.

@Test
public void reduceLuns() throws Exception {
    List<String> paramsLuns = new LinkedList<>();
    paramsLuns.add(GUIDS[2].toString());
    paramsLuns.add(GUIDS[3].toString());
    setUriInfo(setUpActionExpectations(ActionType.ReduceSANStorageDomainDevices, ReduceSANStorageDomainDevicesCommandParameters.class, new String[] { "DevicesToReduce", "StorageDomainId" }, new Object[] { paramsLuns, GUIDS[0] }, true, true));
    Action action = new Action();
    LogicalUnits luns = new LogicalUnits();
    paramsLuns.forEach(s -> {
        LogicalUnit lun = new LogicalUnit();
        lun.setId(s);
        luns.getLogicalUnits().add(lun);
    });
    action.setLogicalUnits(luns);
    verifyActionResponse(resource.reduceLuns(action));
}
Also used : Action(org.ovirt.engine.api.model.Action) LogicalUnits(org.ovirt.engine.api.model.LogicalUnits) LogicalUnit(org.ovirt.engine.api.model.LogicalUnit) ReduceSANStorageDomainDevicesCommandParameters(org.ovirt.engine.core.common.action.ReduceSANStorageDomainDevicesCommandParameters) LinkedList(java.util.LinkedList) Test(org.junit.Test)

Example 12 with Action

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

the class BackendHostResourceTest method testIscsiDiscover.

@Test
public void testIscsiDiscover() throws Exception {
    IscsiDetails iscsiDetails = new IscsiDetails();
    iscsiDetails.setAddress(ISCSI_SERVER_ADDRESS);
    iscsiDetails.setPort(ISCSI_PORT_INT);
    iscsiDetails.setUsername(ISCSI_USER_NAME);
    iscsiDetails.setPassword(ISCSI_USER_PASS);
    Action action = new Action();
    action.setIscsi(iscsiDetails);
    QueryReturnValue queryResult = new QueryReturnValue();
    queryResult.setSucceeded(true);
    when(backend.runQuery(eq(QueryType.DiscoverSendTargets), eqParams(DiscoverSendTargetsQueryParameters.class, addSession("VdsId", "Connection.Connection", "Connection.Port", "Connection.UserName", "Connection.Password"), addSession(GUIDS[0], ISCSI_SERVER_ADDRESS, ISCSI_PORT_STRING, ISCSI_USER_NAME, ISCSI_USER_PASS)))).thenReturn(queryResult);
    enqueueInteraction(() -> verify(backend, atLeastOnce()).runQuery(eq(QueryType.DiscoverSendTargets), eqParams(DiscoverSendTargetsQueryParameters.class, addSession("VdsId", "Connection.Connection", "Connection.Port", "Connection.UserName", "Connection.Password"), addSession(GUIDS[0], ISCSI_SERVER_ADDRESS, ISCSI_PORT_STRING, ISCSI_USER_NAME, ISCSI_USER_PASS))));
    resource.iscsiDiscover(action);
}
Also used : Action(org.ovirt.engine.api.model.Action) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) IscsiDetails(org.ovirt.engine.api.model.IscsiDetails) DiscoverSendTargetsQueryParameters(org.ovirt.engine.core.common.queries.DiscoverSendTargetsQueryParameters) Test(org.junit.Test)

Example 13 with Action

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

the class BackendTemplateDiskResourceTest method testIncompleteCopy.

@Test
public void testIncompleteCopy() throws Exception {
    setUriInfo(setUpBasicUriExpectations());
    try {
        resource.copy(new Action());
        fail("expected WebApplicationException on incomplete parameters");
    } catch (WebApplicationException wae) {
        verifyIncompleteException(wae, "Action", "copy", "storageDomain.id|name");
    }
}
Also used : Action(org.ovirt.engine.api.model.Action) WebApplicationException(javax.ws.rs.WebApplicationException) Test(org.junit.Test)

Example 14 with Action

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

the class BackendTemplateDiskResourceTest method setUpCopyParams.

private Action setUpCopyParams(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;
}
Also used : Action(org.ovirt.engine.api.model.Action) StorageDomain(org.ovirt.engine.api.model.StorageDomain)

Example 15 with Action

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

the class BackendTemplateDiskResourceTest 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");
    }
}
Also used : Action(org.ovirt.engine.api.model.Action) WebApplicationException(javax.ws.rs.WebApplicationException) 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