Search in sources :

Example 21 with GlusterHookEntity

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity in project ovirt-engine by oVirt.

the class GetGlusterHooksQueryTest method getExpectedHooksList.

private List<GlusterHookEntity> getExpectedHooksList() {
    List<GlusterHookEntity> glusterHooks = new ArrayList<>();
    GlusterHookEntity hook = new GlusterHookEntity();
    hook.setClusterId(CLUSTER_ID);
    hook.setGlusterCommand("start");
    hook.setStage("POST");
    hook.setName("cifs_config");
    hook.setStatus(GlusterHookStatus.ENABLED);
    hook.setChecksum("e72c504dc16c8fcd2fe8c74bb492affa");
    hook.setContentType(GlusterHookContentType.TEXT);
    hook.setConflictStatus(0);
    glusterHooks.add(hook);
    hook = new GlusterHookEntity();
    hook.setClusterId(CLUSTER_ID);
    hook.setGlusterCommand("create");
    hook.setStage("PRE");
    hook.setName("virt_config");
    hook.setStatus("DISABLED");
    hook.setChecksum("d72c504dc16c8fcd2fe8c74bb492affb");
    hook.setContentType(GlusterHookContentType.BINARY);
    hook.setConflictStatus(0);
    glusterHooks.add(hook);
    return glusterHooks;
}
Also used : GlusterHookEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity) ArrayList(java.util.ArrayList)

Example 22 with GlusterHookEntity

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity in project ovirt-engine by oVirt.

the class AddGlusterHookCommandTest method validateFailsOnNoConflictServers.

@Test
public void validateFailsOnNoConflictServers() {
    GlusterHookEntity hook = getHookEntity();
    setUpMocksForAdd(true, hook);
    assertFalse(cmd.validate());
    assertTrue(cmd.getReturnValue().getValidationMessages().contains(EngineMessage.ACTION_TYPE_FAILED_GLUSTER_HOOK_NO_CONFLICT_SERVERS.toString()));
}
Also used : GlusterHookEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity) Test(org.junit.Test)

Example 23 with GlusterHookEntity

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity in project ovirt-engine by oVirt.

the class UpdateGlusterHookCommandTest method validateFailsOnNoConflictServers.

@Test
public void validateFailsOnNoConflictServers() {
    GlusterHookEntity hook = getHookEntity();
    hook.setServerHooks(Collections.singletonList(getGlusterServerHook(0, GlusterHookStatus.MISSING)));
    setUpMocksForUpdate(true, hook);
    assertFalse(cmd.validate());
    assertTrue(cmd.getReturnValue().getValidationMessages().contains(EngineMessage.ACTION_TYPE_FAILED_GLUSTER_HOOK_NO_CONFLICT_SERVERS.toString()));
}
Also used : GlusterHookEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity) Test(org.junit.Test)

Example 24 with GlusterHookEntity

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity in project ovirt-engine by oVirt.

the class ClusterGlusterHookListModel method onDisableHook.

private void onDisableHook() {
    if (getConfirmWindow() == null) {
        return;
    }
    ConfirmationModel model = (ConfirmationModel) getConfirmWindow();
    if (model.getProgress() != null) {
        return;
    }
    ArrayList<ActionParametersBase> list = new ArrayList<>();
    for (Object item : getSelectedItems()) {
        GlusterHookEntity hook = (GlusterHookEntity) item;
        list.add(new GlusterHookParameters(hook.getId()));
    }
    model.startProgress();
    Frontend.getInstance().runMultipleAction(ActionType.DisableGlusterHook, list, result -> {
        ConfirmationModel localModel = (ConfirmationModel) result.getState();
        localModel.stopProgress();
        cancelConfirmation();
    }, model);
}
Also used : GlusterHookParameters(org.ovirt.engine.core.common.action.gluster.GlusterHookParameters) GlusterHookEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity) ArrayList(java.util.ArrayList) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 25 with GlusterHookEntity

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity in project ovirt-engine by oVirt.

the class ClusterGlusterHookListModel method resolveConflicts.

private void resolveConflicts() {
    if (getWindow() != null) {
        return;
    }
    final GlusterHookEntity hookEntity = getSelectedItem();
    if (hookEntity == null) {
        return;
    }
    final GlusterHookResolveConflictsModel conflictsModel = new GlusterHookResolveConflictsModel();
    conflictsModel.setTitle(ConstantsManager.getInstance().getConstants().resolveConflictsGlusterHookTitle());
    conflictsModel.setHelpTag(HelpTag.gluster_hook_resolve_conflicts);
    // $NON-NLS-1$
    conflictsModel.setHashName("gluster_hook_resolve_conflicts");
    hookEntity.setServerHooks(new ArrayList<GlusterServerHook>());
    conflictsModel.setGlusterHookEntity(hookEntity);
    setWindow(conflictsModel);
    conflictsModel.startProgress();
    AsyncDataProvider.getInstance().getGlusterHook(new AsyncQuery<>(returnValue -> {
        List<GlusterServerHook> serverHooks = returnValue.getServerHooks();
        hookEntity.setServerHooks(serverHooks);
        ArrayList<EntityModel<GlusterServerHook>> serverHookModels = new ArrayList<>();
        GlusterServerHook engineCopy = new GlusterServerHook();
        engineCopy.setHookId(hookEntity.getId());
        // $NON-NLS-1$
        engineCopy.setServerName("Engine (Master)");
        engineCopy.setStatus(hookEntity.getStatus());
        engineCopy.setContentType(hookEntity.getContentType());
        engineCopy.setChecksum(hookEntity.getChecksum());
        EntityModel<GlusterServerHook> engineCopyModel = new EntityModel<>(engineCopy);
        serverHookModels.add(engineCopyModel);
        for (GlusterServerHook serverHook : serverHooks) {
            serverHookModels.add(new EntityModel<>(serverHook));
        }
        conflictsModel.getHookSources().setItems(serverHookModels);
        conflictsModel.getHookSources().setSelectedItem(engineCopyModel);
        ArrayList<GlusterServerHook> serverHooksWithEngine = new ArrayList<>(serverHooks);
        serverHooksWithEngine.add(0, engineCopy);
        conflictsModel.getServerHooksList().setItems(serverHooksWithEngine);
        conflictsModel.getServerHooksList().setSelectedItem(engineCopy);
        conflictsModel.stopProgress();
        // $NON-NLS-1$
        UICommand command = UICommand.createDefaultOkUiCommand("OnResolveConflicts", ClusterGlusterHookListModel.this);
        conflictsModel.getCommands().add(command);
        // $NON-NLS-1$
        command = new UICommand("Cancel", ClusterGlusterHookListModel.this);
        command.setTitle(ConstantsManager.getInstance().getConstants().close());
        command.setIsCancel(true);
        conflictsModel.getCommands().add(command);
    }), hookEntity.getId(), true);
}
Also used : GlusterHookManageParameters(org.ovirt.engine.core.common.action.gluster.GlusterHookManageParameters) GlusterHookEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity) GlusterHookStatus(org.ovirt.engine.core.common.businessentities.gluster.GlusterHookStatus) Guid(org.ovirt.engine.core.compat.Guid) GlusterHookContentType(org.ovirt.engine.core.common.businessentities.gluster.GlusterHookContentType) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) IFrontendActionAsyncCallback(org.ovirt.engine.ui.uicompat.IFrontendActionAsyncCallback) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) GlusterServerHook(org.ovirt.engine.core.common.businessentities.gluster.GlusterServerHook) ApplicationMode(org.ovirt.engine.core.common.mode.ApplicationMode) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ArrayList(java.util.ArrayList) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) Frontend(org.ovirt.engine.ui.frontend.Frontend) List(java.util.List) GlusterHookParameters(org.ovirt.engine.core.common.action.gluster.GlusterHookParameters) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) GlusterClusterParameters(org.ovirt.engine.core.common.action.gluster.GlusterClusterParameters) GlusterHookEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity) GlusterServerHook(org.ovirt.engine.core.common.businessentities.gluster.GlusterServerHook) ArrayList(java.util.ArrayList) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ArrayList(java.util.ArrayList) List(java.util.List) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand)

Aggregations

GlusterHookEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity)34 Test (org.junit.Test)13 ArrayList (java.util.ArrayList)11 GlusterServerHook (org.ovirt.engine.core.common.businessentities.gluster.GlusterServerHook)8 Guid (org.ovirt.engine.core.compat.Guid)6 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)5 GlusterHookParameters (org.ovirt.engine.core.common.action.gluster.GlusterHookParameters)5 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)5 List (java.util.List)4 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)4 ActionType (org.ovirt.engine.core.common.action.ActionType)3 GlusterClusterParameters (org.ovirt.engine.core.common.action.gluster.GlusterClusterParameters)3 GlusterHookManageParameters (org.ovirt.engine.core.common.action.gluster.GlusterHookManageParameters)3 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)3 GlusterHookContentType (org.ovirt.engine.core.common.businessentities.gluster.GlusterHookContentType)3 GlusterHookStatus (org.ovirt.engine.core.common.businessentities.gluster.GlusterHookStatus)3 ApplicationMode (org.ovirt.engine.core.common.mode.ApplicationMode)3 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)3 Frontend (org.ovirt.engine.ui.frontend.Frontend)3 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)3