Search in sources :

Example 6 with GlusterServerHook

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

the class GlusterHooksDaoTest method testRemove.

@Test
public void testRemove() {
    dao.remove(FixturesTool.HOOK_ID);
    GlusterHookEntity hook = dao.getById(FixturesTool.HOOK_ID);
    assertNull(hook);
    GlusterServerHook serverhook = dao.getGlusterServerHook(FixturesTool.HOOK_ID, FixturesTool.VDS_GLUSTER_SERVER2);
    assertNull(serverhook);
}
Also used : GlusterHookEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity) GlusterServerHook(org.ovirt.engine.core.common.businessentities.gluster.GlusterServerHook) Test(org.junit.Test)

Example 7 with GlusterServerHook

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

the class GlusterHooksDaoTest method testUpdateGlusterHookChecksum.

@Test
public void testUpdateGlusterHookChecksum() {
    dao.updateGlusterServerHookChecksum(FixturesTool.HOOK_ID, FixturesTool.VDS_GLUSTER_SERVER2, CHECKSUM);
    GlusterServerHook serverhook = dao.getGlusterServerHook(FixturesTool.HOOK_ID, FixturesTool.VDS_GLUSTER_SERVER2);
    assertNotNull(serverhook);
    assertEquals(GlusterHookStatus.ENABLED, serverhook.getStatus());
    assertEquals(CHECKSUM, serverhook.getChecksum());
}
Also used : GlusterServerHook(org.ovirt.engine.core.common.businessentities.gluster.GlusterServerHook) Test(org.junit.Test)

Example 8 with GlusterServerHook

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

the class GlusterHooksDaoTest method testRemoveServerHook.

@Test
public void testRemoveServerHook() {
    dao.removeGlusterServerHook(FixturesTool.HOOK_ID, FixturesTool.VDS_GLUSTER_SERVER2);
    GlusterServerHook serverhook = dao.getGlusterServerHook(FixturesTool.HOOK_ID, FixturesTool.VDS_GLUSTER_SERVER2);
    assertNull(serverhook);
}
Also used : GlusterServerHook(org.ovirt.engine.core.common.businessentities.gluster.GlusterServerHook) Test(org.junit.Test)

Example 9 with GlusterServerHook

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

the class GetGlusterHookContentQuery method executeQueryCommand.

@Override
protected void executeQueryCommand() {
    GlusterHookEntity hook = glusterHooksDao.getById(getParameters().getGlusterHookId());
    String content = "";
    if (getParameters().getGlusterServerId() == null) {
        if (hook.getContentType().equals(GlusterHookContentType.TEXT)) {
            content = glusterHooksDao.getGlusterHookContent(getParameters().getGlusterHookId());
        }
    } else {
        GlusterServerHook serverHook = glusterHooksDao.getGlusterServerHook(hook.getId(), getParameters().getGlusterServerId());
        if (serverHook != null && serverHook.getContentType() == GlusterHookContentType.TEXT) {
            VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GetGlusterHookContent, new GlusterHookVDSParameters(getParameters().getGlusterServerId(), hook.getGlusterCommand(), hook.getStage(), hook.getName()));
            if (returnValue.getSucceeded()) {
                content = (String) returnValue.getReturnValue();
            }
        }
    }
    content = StringUtils.newStringUtf8(Base64.decodeBase64(content));
    getQueryReturnValue().setReturnValue(content);
}
Also used : GlusterHookEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity) GlusterServerHook(org.ovirt.engine.core.common.businessentities.gluster.GlusterServerHook) GlusterHookVDSParameters(org.ovirt.engine.core.common.vdscommands.gluster.GlusterHookVDSParameters) VDSReturnValue(org.ovirt.engine.core.common.vdscommands.VDSReturnValue)

Example 10 with GlusterServerHook

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

the class GlusterHookCommandTest method getGlusterServerHook.

protected GlusterServerHook getGlusterServerHook(int index, GlusterHookStatus status) {
    GlusterServerHook serverHook = new GlusterServerHook();
    serverHook.setServerId(GUIDS[index]);
    serverHook.setStatus(status);
    serverHook.setChecksum("CHECKSUM");
    return serverHook;
}
Also used : GlusterServerHook(org.ovirt.engine.core.common.businessentities.gluster.GlusterServerHook)

Aggregations

GlusterServerHook (org.ovirt.engine.core.common.businessentities.gluster.GlusterServerHook)22 GlusterHookEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterHookEntity)8 ArrayList (java.util.ArrayList)6 Test (org.junit.Test)5 VDS (org.ovirt.engine.core.common.businessentities.VDS)5 Guid (org.ovirt.engine.core.compat.Guid)5 GlusterHookContentType (org.ovirt.engine.core.common.businessentities.gluster.GlusterHookContentType)4 VDSReturnValue (org.ovirt.engine.core.common.vdscommands.VDSReturnValue)4 List (java.util.List)3 Callable (java.util.concurrent.Callable)3 GlusterHookStatus (org.ovirt.engine.core.common.businessentities.gluster.GlusterHookStatus)3 GlusterHookVDSParameters (org.ovirt.engine.core.common.vdscommands.gluster.GlusterHookVDSParameters)3 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)3 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)3 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 Set (java.util.Set)2 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)2 ActionType (org.ovirt.engine.core.common.action.ActionType)2 GlusterClusterParameters (org.ovirt.engine.core.common.action.gluster.GlusterClusterParameters)2