Search in sources :

Example 11 with GlusterGeoRepSessionDetails

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

the class GlusterVolumeGeoRepStatusDetail method getSessionDetails.

@Override
protected GlusterGeoRepSessionDetails getSessionDetails(Map<String, Object> innerMap) {
    GlusterGeoRepSessionDetails details = super.getSessionDetails(innerMap);
    if (details != null) {
        Long dataOpsPending = parseSafeLong(innerMap, DATA);
        Long metaOpsPending = parseSafeLong(innerMap, META);
        Long entryOpsPending = parseSafeLong(innerMap, ENTRY);
        Long failures = parseSafeLong(innerMap, FAILURES);
        details.setDataOpsPending(dataOpsPending);
        details.setMetaOpsPending(metaOpsPending);
        details.setEntryOpsPending(entryOpsPending);
        details.setFailures(failures);
        if (innerMap.containsKey(CHECK_POINT_COMPLETED)) {
            if ("YES".equalsIgnoreCase(innerMap.get(CHECK_POINT_COMPLETED).toString())) {
                details.setCheckpointCompleted(true);
            } else {
                details.setCheckpointCompleted(false);
            }
        }
        String timezone = innerMap.containsKey(TIMEZONE) ? innerMap.get(TIMEZONE).toString() : null;
        Long lastSynced = parseSafeLong(innerMap, LAST_SYNCED);
        Long checkPointTime = parseSafeLong(innerMap, CHECK_POINT_TIME);
        Long checkPointCompletionTime = parseSafeLong(innerMap, CHECK_POINT_COMPLETION_TIME);
        details.setLastSyncedAt(lastSynced != null ? new Date(lastSynced * 1000L) : null);
        details.setCheckPointCompletedAt(checkPointCompletionTime != null ? new Date(checkPointCompletionTime * 1000L) : null);
        details.setCheckPointTime(checkPointTime != null ? new Date(checkPointTime * 1000L) : null);
    }
    geoRepDetails.add(details);
    return details;
}
Also used : GlusterGeoRepSessionDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionDetails) Date(java.util.Date)

Example 12 with GlusterGeoRepSessionDetails

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

the class GlusterGeoRepDaoTest method testSaveDetails.

@Test
public void testSaveDetails() {
    GlusterGeoRepSessionDetails sessionDetails = getGlusterGeoRepSessionDetails();
    dao.saveDetails(sessionDetails);
    List<GlusterGeoRepSessionDetails> fetchedSessionDetails = dao.getGeoRepSessionDetails(FixturesTool.GLUSTER_GEOREP_SESSION_ID);
    assertEquals(sessionDetails, fetchedSessionDetails.get(0));
}
Also used : GlusterGeoRepSessionDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionDetails) Test(org.junit.Test)

Example 13 with GlusterGeoRepSessionDetails

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

the class GlusterGeoRepDaoTest method getGlusterGeoRepSessionDetails.

private GlusterGeoRepSessionDetails getGlusterGeoRepSessionDetails() {
    GlusterGeoRepSessionDetails sessionDetails = new GlusterGeoRepSessionDetails();
    sessionDetails.setSessionId(FixturesTool.GLUSTER_GEOREP_SESSION_ID);
    sessionDetails.setMasterBrickId(FixturesTool.GLUSTER_BRICK_UUID1);
    sessionDetails.setSlaveHostName("remoteHost");
    sessionDetails.setSlaveNodeUuid(FixturesTool.GLUSTER_SERVER_UUID1);
    sessionDetails.setStatus(GeoRepSessionStatus.ACTIVE);
    sessionDetails.setCheckPointStatus("NA");
    sessionDetails.setCrawlStatus(GeoRepCrawlStatus.CHANGELOG_CRAWL);
    sessionDetails.setDataOpsPending(100L);
    sessionDetails.setMetaOpsPending(40L);
    sessionDetails.setEntryOpsPending(10L);
    sessionDetails.setFailures(0L);
    sessionDetails.setCheckpointCompleted(false);
    sessionDetails.setCheckPointTime(new Date());
    sessionDetails.setLastSyncedAt(new Date());
    return sessionDetails;
}
Also used : GlusterGeoRepSessionDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionDetails) Date(java.util.Date)

Example 14 with GlusterGeoRepSessionDetails

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

the class VolumeGeoRepListModel method populateStatus.

private void populateStatus(final List<GlusterGeoRepSessionDetails> details) {
    final VolumeGeoRepSessionDetailsModel windowModel = new VolumeGeoRepSessionDetailsModel();
    windowModel.setHelpTag(HelpTag.geo_replication_status_detail);
    // $NON-NLS-1$
    windowModel.setHashName("geo_replication_status_detail");
    final UIConstants constants = ConstantsManager.getInstance().getConstants();
    windowModel.setTitle(constants.geoReplicationSessionDetailsTitle());
    // $NON-NLS-1$
    UICommand okCommand = new UICommand("closeWindow", this);
    okCommand.setIsCancel(true);
    okCommand.setTitle(constants.ok());
    windowModel.getCommands().add(okCommand);
    setWindow(windowModel);
    final List<EntityModel<GlusterGeoRepSessionDetails>> detailRows = new ArrayList<>();
    for (GlusterGeoRepSessionDetails detail : details) {
        detailRows.add(new EntityModel<>(detail));
    }
    windowModel.getGeoRepSessionSummary().setItems(detailRows, detailRows.get(0));
}
Also used : EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ArrayList(java.util.ArrayList) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) GlusterGeoRepSessionDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionDetails) UIConstants(org.ovirt.engine.ui.uicompat.UIConstants)

Aggregations

GlusterGeoRepSessionDetails (org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionDetails)14 ArrayList (java.util.ArrayList)4 Date (java.util.Date)3 GlusterGeoRepSession (org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession)3 Test (org.junit.Test)2 GlusterBrickEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity)2 Guid (org.ovirt.engine.core.compat.Guid)2 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)2 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)2 UIConstants (org.ovirt.engine.ui.uicompat.UIConstants)2 AbstractRenderer (com.google.gwt.text.shared.AbstractRenderer)1 Map (java.util.Map)1 GlusterVolumeGeoRepSessionParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeGeoRepSessionParameters)1 GlusterServer (org.ovirt.engine.core.common.businessentities.gluster.GlusterServer)1 FullDateTimeRenderer (org.ovirt.engine.ui.common.widget.renderer.FullDateTimeRenderer)1 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)1