Search in sources :

Example 66 with Action

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

the class BackendHostResourceTest method testApproveChangingCluster.

@Test
public void testApproveChangingCluster() throws Exception {
    setUpGetEntityExpectations(4);
    setUriInfo(setUpActionExpectations(ActionType.ChangeVDSCluster, ChangeVDSClusterParameters.class, new String[] { "ClusterId", "VdsId" }, new Object[] { GUIDS[0], GUIDS[0] }, true, true, new ActionReturnValue(), false));
    setUriInfo(setUpActionExpectations(ActionType.UpdateVds, UpdateVdsActionParameters.class, new String[] {}, new Object[] {}, true, true));
    setUriInfo(setUpActionExpectations(ActionType.ApproveVds, ApproveVdsParameters.class, new String[] { "VdsId" }, new Object[] { GUIDS[0] }));
    org.ovirt.engine.api.model.Cluster cluster = new org.ovirt.engine.api.model.Cluster();
    cluster.setId(GUIDS[0].toString());
    Action action = new Action();
    action.setCluster(cluster);
    verifyActionResponse(resource.approve(action));
}
Also used : Action(org.ovirt.engine.api.model.Action) ApproveVdsParameters(org.ovirt.engine.core.common.action.hostdeploy.ApproveVdsParameters) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) UpdateVdsActionParameters(org.ovirt.engine.core.common.action.hostdeploy.UpdateVdsActionParameters) ChangeVDSClusterParameters(org.ovirt.engine.core.common.action.ChangeVDSClusterParameters) Test(org.junit.Test)

Example 67 with Action

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

the class BackendHostResourceTest method testUpgrade.

@Test
public void testUpgrade() throws Exception {
    setUriInfo(setUpActionExpectations(ActionType.UpgradeHost, UpgradeHostParameters.class, new String[] { "VdsId", "oVirtIsoFile" }, new Object[] { GUIDS[0], NAMES[0] }));
    Action action = new Action();
    action.setImage(NAMES[0]);
    verifyActionResponse(resource.upgrade(action));
}
Also used : UpgradeHostParameters(org.ovirt.engine.core.common.action.hostdeploy.UpgradeHostParameters) Action(org.ovirt.engine.api.model.Action) Test(org.junit.Test)

Example 68 with Action

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

the class BackendHostResourceTest method testInstall.

@Test
public void testInstall() throws Exception {
    setUpGetEntityWithNoCertificateInfoExpectations();
    setUriInfo(setUpActionExpectations(ActionType.UpdateVds, UpdateVdsActionParameters.class, new String[] { "RootPassword" }, new Object[] { NAMES[2] }));
    Action action = new Action();
    action.setRootPassword(NAMES[2]);
    verifyActionResponse(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 69 with Action

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

the class BackendHostResourceTest method testIscsiLogin.

@Test
public void testIscsiLogin() throws Exception {
    setUriInfo(setUpActionExpectations(ActionType.ConnectStorageToVds, StorageServerConnectionParametersBase.class, new String[] { "VdsId", "StorageServerConnection.Connection", "StorageServerConnection.Portal", "StorageServerConnection.Iqn", "StorageServerConnection.Port", "StorageServerConnection.StorageType", "StorageServerConnection.UserName", "StorageServerConnection.Password" }, new Object[] { GUIDS[0], ISCSI_SERVER_ADDRESS, // TODO: right now hard-coded, but this should change when VDSM and Backend support portal
    StorageServerConnections.DEFAULT_TPGT, ISCSI_IQN, ISCSI_PORT_STRING, ISCSI_STORAGE_TYPE, ISCSI_USER_NAME, ISCSI_USER_PASS }));
    Action action = new Action();
    IscsiDetails iscsiDetails = new IscsiDetails();
    iscsiDetails.setAddress(ISCSI_SERVER_ADDRESS);
    iscsiDetails.setPort(ISCSI_PORT_INT);
    iscsiDetails.setTarget(ISCSI_IQN);
    iscsiDetails.setUsername(ISCSI_USER_NAME);
    iscsiDetails.setPassword(ISCSI_USER_PASS);
    action.setIscsi(iscsiDetails);
    verifyActionResponse(resource.iscsiLogin(action));
}
Also used : Action(org.ovirt.engine.api.model.Action) IscsiDetails(org.ovirt.engine.api.model.IscsiDetails) StorageServerConnectionParametersBase(org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase) Test(org.junit.Test)

Example 70 with Action

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

the class BackendHostResourceTest method doTestActivateAsync.

private void doTestActivateAsync(AsyncTaskStatusEnum asyncStatus, CreationStatus actionStatus) throws Exception {
    setUriInfo(setUpActionExpectations(ActionType.ActivateVds, VdsActionParameters.class, new String[] { "VdsId" }, new Object[] { GUIDS[0] }, asList(GUIDS[1]), asList(new AsyncTaskStatus(asyncStatus))));
    Response response = resource.activate(new Action());
    verifyActionResponse(response, "hosts/" + GUIDS[0], true, null);
    Action action = (Action) response.getEntity();
    assertTrue(action.isSetStatus());
    assertEquals(actionStatus.value(), action.getStatus());
}
Also used : Response(javax.ws.rs.core.Response) Action(org.ovirt.engine.api.model.Action) AsyncTaskStatus(org.ovirt.engine.core.common.businessentities.AsyncTaskStatus) VdsActionParameters(org.ovirt.engine.core.common.action.VdsActionParameters) UpdateVdsActionParameters(org.ovirt.engine.core.common.action.hostdeploy.UpdateVdsActionParameters) FenceVdsActionParameters(org.ovirt.engine.core.common.action.FenceVdsActionParameters)

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