Search in sources :

Example 1 with RemoveGlusterServerParameters

use of org.ovirt.engine.core.common.action.gluster.RemoveGlusterServerParameters in project ovirt-engine by oVirt.

the class ClusterGeneralModel method onDetachNewGlusterHosts.

public void onDetachNewGlusterHosts() {
    if (getWindow() == null) {
        return;
    }
    final DetachGlusterHostsModel hostsModel = (DetachGlusterHostsModel) getWindow();
    if (!hostsModel.validate()) {
        return;
    }
    boolean force = hostsModel.getForce().getEntity();
    ArrayList<ActionParametersBase> parametersList = new ArrayList<>();
    for (Object model : hostsModel.getHosts().getSelectedItems()) {
        String host = (String) ((EntityModel) model).getEntity();
        parametersList.add(new RemoveGlusterServerParameters(getEntity().getId(), host, force));
    }
    Frontend.getInstance().runMultipleAction(ActionType.RemoveGlusterServer, parametersList);
    cancel();
}
Also used : ArrayList(java.util.ArrayList) DetachGlusterHostsModel(org.ovirt.engine.ui.uicommonweb.models.gluster.DetachGlusterHostsModel) RemoveGlusterServerParameters(org.ovirt.engine.core.common.action.gluster.RemoveGlusterServerParameters) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 2 with RemoveGlusterServerParameters

use of org.ovirt.engine.core.common.action.gluster.RemoveGlusterServerParameters in project ovirt-engine by oVirt.

the class RemoveGlusterServerCommandTest method validateSucceeds.

@Test
public void validateSucceeds() {
    cmd = spy(new RemoveGlusterServerCommand(new RemoveGlusterServerParameters(CLUSTER_ID, SERVER_NAME, false), null));
    prepareMocks(cmd);
    assertTrue(cmd.validate());
}
Also used : RemoveGlusterServerParameters(org.ovirt.engine.core.common.action.gluster.RemoveGlusterServerParameters) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Example 3 with RemoveGlusterServerParameters

use of org.ovirt.engine.core.common.action.gluster.RemoveGlusterServerParameters in project ovirt-engine by oVirt.

the class RemoveGlusterServerCommandTest method validateFailsOnNull.

@Test
public void validateFailsOnNull() {
    cmd = spy(new RemoveGlusterServerCommand(new RemoveGlusterServerParameters(CLUSTER_ID, null, false), null));
    prepareMocks(cmd);
    assertFalse(cmd.validate());
}
Also used : RemoveGlusterServerParameters(org.ovirt.engine.core.common.action.gluster.RemoveGlusterServerParameters) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Aggregations

RemoveGlusterServerParameters (org.ovirt.engine.core.common.action.gluster.RemoveGlusterServerParameters)3 Test (org.junit.Test)2 BaseCommandTest (org.ovirt.engine.core.bll.BaseCommandTest)2 ArrayList (java.util.ArrayList)1 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)1 DetachGlusterHostsModel (org.ovirt.engine.ui.uicommonweb.models.gluster.DetachGlusterHostsModel)1