Search in sources :

Example 56 with Action

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

the class BackendGlusterVolumeResourceTest method testSetOption.

@Test
public void testSetOption() throws Exception {
    setupParentExpectations();
    resource.setParent(volumesResourceMock);
    setUriInfo(setUpActionExpectations(ActionType.SetGlusterVolumeOption, GlusterVolumeOptionParameters.class, new String[] { "VolumeId" }, new Object[] { GUIDS[0] }));
    Action action = new Action();
    action.setOption(new Option());
    action.getOption().setName("auth.allow");
    action.getOption().setValue("*");
    verifyActionResponse(resource.setOption(action));
}
Also used : GlusterVolumeOptionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeOptionParameters) Action(org.ovirt.engine.api.model.Action) Option(org.ovirt.engine.api.model.Option) Test(org.junit.Test) AbstractBackendSubResourceTest(org.ovirt.engine.api.restapi.resource.AbstractBackendSubResourceTest)

Example 57 with Action

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

the class V3ActionInAdapter method adapt.

@Override
public Action adapt(V3Action from) {
    Action to = new Action();
    if (from.isSetId()) {
        to.setId(from.getId());
    }
    if (from.isSetHref()) {
        to.setHref(from.getHref());
    }
    if (from.isSetLinks()) {
        to.getLinks().addAll(adaptIn(from.getLinks()));
    }
    if (from.isSetAsync()) {
        to.setAsync(from.isAsync());
    }
    if (from.isSetBricks()) {
        to.setBricks(adaptIn(from.getBricks()));
    }
    if (from.isSetCertificates()) {
        to.setCertificates(adaptIn(from.getCertificates()));
    }
    if (from.isSetCheckConnectivity()) {
        to.setCheckConnectivity(from.isCheckConnectivity());
    }
    if (from.isSetClone()) {
        to.setClone(from.isClone());
    }
    if (from.isSetCluster()) {
        to.setCluster(adaptIn(from.getCluster()));
    }
    if (from.isSetConnectivityTimeout()) {
        to.setConnectivityTimeout(from.getConnectivityTimeout());
    }
    if (from.isSetDiscardSnapshots()) {
        to.setDiscardSnapshots(from.isDiscardSnapshots());
    }
    if (from.isSetDisk()) {
        to.setDisk(adaptIn(from.getDisk()));
    }
    if (from.isSetDisks()) {
        to.setDisks(adaptIn(from.getDisks()));
    }
    if (from.isSetExclusive()) {
        to.setExclusive(from.isExclusive());
    }
    if (from.isSetFault()) {
        to.setFault(adaptIn(from.getFault()));
    }
    if (from.isSetFenceType()) {
        to.setFenceType(from.getFenceType());
    }
    if (from.isSetFixLayout()) {
        to.setFixLayout(from.isFixLayout());
    }
    if (from.isSetForce()) {
        to.setForce(from.isForce());
    }
    if (from.isSetGracePeriod()) {
        to.setGracePeriod(adaptIn(from.getGracePeriod()));
    }
    if (from.isSetHost()) {
        to.setHost(adaptIn(from.getHost()));
    }
    if (from.isSetImage()) {
        to.setImage(from.getImage());
    }
    if (from.isSetImportAsTemplate()) {
        to.setImportAsTemplate(from.isImportAsTemplate());
    }
    if (from.isSetIsAttached()) {
        to.setIsAttached(from.isIsAttached());
    }
    if (from.isSetIscsi()) {
        to.setIscsi(adaptIn(from.getIscsi()));
    }
    if (from.isSetIscsiTargets()) {
        to.setIscsiTargets(new Action.IscsiTargetsList());
        to.getIscsiTargets().getIscsiTargets().addAll(from.getIscsiTargets());
    }
    if (from.isSetJob()) {
        to.setJob(adaptIn(from.getJob()));
    }
    if (from.isSetLogicalUnits()) {
        to.setLogicalUnits(adaptIn(from.getLogicalUnits()));
    }
    if (from.isSetMaintenanceEnabled()) {
        to.setMaintenanceEnabled(from.isMaintenanceEnabled());
    }
    if (from.isSetModifiedBonds()) {
        to.setModifiedBonds(adaptIn(from.getModifiedBonds()));
    }
    if (from.isSetModifiedLabels()) {
        to.setModifiedLabels(adaptIn(from.getModifiedLabels()));
    }
    if (from.isSetModifiedNetworkAttachments()) {
        to.setModifiedNetworkAttachments(adaptIn(from.getModifiedNetworkAttachments()));
    }
    if (from.isSetOption()) {
        to.setOption(adaptIn(from.getOption()));
    }
    if (from.isSetPause()) {
        to.setPause(from.isPause());
    }
    if (from.isSetPowerManagement()) {
        to.setPowerManagement(adaptIn(from.getPowerManagement()));
    }
    if (from.isSetProxyTicket()) {
        to.setProxyTicket(adaptIn(from.getProxyTicket()));
    }
    if (from.isSetReason()) {
        to.setReason(from.getReason());
    }
    if (from.isSetRemovedBonds()) {
        to.setRemovedBonds(adaptIn(from.getRemovedBonds()));
    }
    if (from.isSetRemovedLabels()) {
        to.setRemovedLabels(adaptIn(from.getRemovedLabels()));
    }
    if (from.isSetRemovedNetworkAttachments()) {
        to.setRemovedNetworkAttachments(adaptIn(from.getRemovedNetworkAttachments()));
    }
    if (from.isSetResolutionType()) {
        to.setResolutionType(from.getResolutionType());
    }
    if (from.isSetRestoreMemory()) {
        to.setRestoreMemory(from.isRestoreMemory());
    }
    if (from.isSetRootPassword()) {
        to.setRootPassword(from.getRootPassword());
    }
    if (from.isSetSnapshot()) {
        to.setSnapshot(adaptIn(from.getSnapshot()));
    }
    if (from.isSetSsh()) {
        to.setSsh(adaptIn(from.getSsh()));
    }
    if (from.isSetStatus() && from.getStatus().isSetState()) {
        to.setStatus(from.getStatus().getState());
    }
    if (from.isSetStorageDomain()) {
        to.setStorageDomain(adaptIn(from.getStorageDomain()));
    }
    if (from.isSetStorageDomains()) {
        to.setStorageDomains(adaptIn(from.getStorageDomains()));
    }
    if (from.isSetSucceeded()) {
        to.setSucceeded(from.isSucceeded());
    }
    if (from.isSetSynchronizedNetworkAttachments()) {
        to.setSynchronizedNetworkAttachments(adaptIn(from.getSynchronizedNetworkAttachments()));
    }
    if (from.isSetTemplate()) {
        to.setTemplate(adaptIn(from.getTemplate()));
    }
    if (from.isSetTicket()) {
        to.setTicket(adaptIn(from.getTicket()));
    }
    if (from.isSetUseCloudInit()) {
        to.setUseCloudInit(from.isUseCloudInit());
    }
    if (from.isSetUseSysprep()) {
        to.setUseSysprep(from.isUseSysprep());
    }
    if (from.isSetVirtualFunctionsConfiguration()) {
        to.setVirtualFunctionsConfiguration(adaptIn(from.getVirtualFunctionsConfiguration()));
    }
    if (from.isSetVm()) {
        to.setVm(adaptIn(from.getVm()));
    }
    return to;
}
Also used : V3Action(org.ovirt.engine.api.v3.types.V3Action) Action(org.ovirt.engine.api.model.Action)

Example 58 with Action

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

the class BackendGlusterBricksResourceTest method testRemove.

@Test
public void testRemove() throws Exception {
    setUpGetEntityExpectations(QueryType.GetGlusterVolumeById, IdQueryParameters.class, new String[] { "Id" }, new Object[] { volumeId }, helper.getVolumeEntity(0));
    setUriInfo(setUpActionExpectations(ActionType.GlusterVolumeRemoveBricks, GlusterVolumeRemoveBricksParameters.class, new String[] { "VolumeId", "Bricks" }, new Object[] { volumeId, getBrickEntitiesToRemove() }, true, true));
    Action action = new Action();
    action.setBricks(getBrickModelsToRemove());
    verifyRemove(collection.remove(action));
}
Also used : Action(org.ovirt.engine.api.model.Action) GlusterVolumeRemoveBricksParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeRemoveBricksParameters) Test(org.junit.Test) AbstractBackendCollectionResourceTest(org.ovirt.engine.api.restapi.resource.AbstractBackendCollectionResourceTest)

Example 59 with Action

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

the class BackendGlusterBricksResourceTest method testMigrate.

@Test
public void testMigrate() throws Exception {
    GlusterBrick brick = new GlusterBrick();
    GlusterVolume volume = new GlusterVolume();
    brick.setName(serverName + ":" + brickDir);
    volume.setId(volumeId.toString());
    brick.setGlusterVolume(volume);
    GlusterBricks bricks = mock(GlusterBricks.class);
    when(bricks.getGlusterBricks()).thenReturn(Collections.singletonList(brick));
    setUriInfo(setUpActionExpectations(ActionType.StartRemoveGlusterVolumeBricks, GlusterVolumeRemoveBricksParameters.class, new String[] {}, new Object[] {}, true, true));
    Action action = new Action();
    action.setBricks(bricks);
    collection.migrate(action);
}
Also used : Action(org.ovirt.engine.api.model.Action) GlusterVolume(org.ovirt.engine.api.model.GlusterVolume) GlusterBricks(org.ovirt.engine.api.model.GlusterBricks) GlusterBrick(org.ovirt.engine.api.model.GlusterBrick) GlusterVolumeRemoveBricksParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeRemoveBricksParameters) Test(org.junit.Test) AbstractBackendCollectionResourceTest(org.ovirt.engine.api.restapi.resource.AbstractBackendCollectionResourceTest)

Example 60 with Action

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

the class BackendGlusterHookResourceTest method testResolveCopy.

@Test
public void testResolveCopy() throws Exception {
    setUriInfo(setUpActionExpectations(ActionType.UpdateGlusterHook, GlusterHookManageParameters.class, new String[] { "HookId" }, new Object[] { hookId }));
    Action action = new Action();
    action.setResolutionType("copy");
    verifyActionResponse(resource.resolve(action));
}
Also used : GlusterHookManageParameters(org.ovirt.engine.core.common.action.gluster.GlusterHookManageParameters) Action(org.ovirt.engine.api.model.Action) Test(org.junit.Test) AbstractBackendSubResourceTest(org.ovirt.engine.api.restapi.resource.AbstractBackendSubResourceTest)

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