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));
}
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;
}
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));
}
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);
}
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));
}
Aggregations