Search in sources :

Example 6 with StorageDomainDR

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

the class StorageDRListModel method syncSearch.

@Override
protected void syncSearch() {
    if (getEntity() == null) {
        return;
    }
    super.syncSearch();
    IdQueryParameters parameters = new IdQueryParameters(getEntity().getId());
    parameters.setRefresh(getIsQueryFirstTime());
    Frontend.getInstance().runQuery(QueryType.GetStorageDomainDR, parameters, new AsyncQuery<QueryReturnValue>(returnValue -> {
        List<StorageDomainDR> resultList = returnValue.getReturnValue();
        setItems(resultList);
        populateSessionsMap(resultList);
    }));
}
Also used : GlusterGeoRepSession(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession) QueryType(org.ovirt.engine.core.common.queries.QueryType) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) Linq(org.ovirt.engine.ui.uicommonweb.Linq) Guid(org.ovirt.engine.core.compat.Guid) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) StorageSyncSchedule(org.ovirt.engine.core.common.businessentities.gluster.StorageSyncSchedule) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) HashMap(java.util.HashMap) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) StorageDomainDR(org.ovirt.engine.core.common.businessentities.StorageDomainDR) ArrayList(java.util.ArrayList) ActionType(org.ovirt.engine.core.common.action.ActionType) Frontend(org.ovirt.engine.ui.frontend.Frontend) List(java.util.List) Map(java.util.Map) StorageSyncScheduleParameters(org.ovirt.engine.core.common.action.StorageSyncScheduleParameters) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) ArrayList(java.util.ArrayList) List(java.util.List)

Example 7 with StorageDomainDR

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

the class StorageDRListModel method editDR.

private void editDR() {
    if (getWindow() != null) {
        return;
    }
    final StorageDomain storageDomain = getEntity();
    if (storageDomain == null) {
        return;
    }
    final StorageDomainDR selectedDR = getSelectedItem();
    StorageSyncSchedule schedule = new StorageSyncSchedule(selectedDR.getScheduleCronExpression());
    final StorageDRModel model = new StorageDRModel();
    model.setHelpTag(HelpTag.new_storage_dr);
    model.setTitle(ConstantsManager.getInstance().getConstants().edit());
    // $NON-NLS-1$
    model.setHashName("edit_dr");
    model.getStorageDomain().setEntity(storageDomain);
    setWindow(model);
    model.startProgress();
    model.getFrequency().setSelectedItem(schedule.getFrequency());
    model.getHour().setSelectedItem(schedule.getHour());
    model.getMins().setSelectedItem(schedule.getMins());
    AsyncDataProvider.getInstance().getGlusterGeoRepSessionsForStorageDomain(new AsyncQuery<>(geoRepSessions -> {
        model.getGeoRepSession().setItems(geoRepSessions);
        model.getGeoRepSession().setSelectedItem(Linq.firstOrNull(geoRepSessions, new Linq.IdPredicate<>(selectedDR.getGeoRepSessionId())));
        model.stopProgress();
    }), storageDomain.getId());
    // $NON-NLS-1$
    UICommand okCommand = UICommand.createDefaultOkUiCommand("OnSave", this);
    model.getCommands().add(okCommand);
    // $NON-NLS-1$
    UICommand cancelCommand = UICommand.createCancelUiCommand("Cancel", this);
    model.getCommands().add(cancelCommand);
}
Also used : GlusterGeoRepSession(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession) QueryType(org.ovirt.engine.core.common.queries.QueryType) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) Linq(org.ovirt.engine.ui.uicommonweb.Linq) Guid(org.ovirt.engine.core.compat.Guid) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) StorageSyncSchedule(org.ovirt.engine.core.common.businessentities.gluster.StorageSyncSchedule) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) HashMap(java.util.HashMap) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) StorageDomainDR(org.ovirt.engine.core.common.businessentities.StorageDomainDR) ArrayList(java.util.ArrayList) ActionType(org.ovirt.engine.core.common.action.ActionType) Frontend(org.ovirt.engine.ui.frontend.Frontend) List(java.util.List) Map(java.util.Map) StorageSyncScheduleParameters(org.ovirt.engine.core.common.action.StorageSyncScheduleParameters) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) StorageSyncSchedule(org.ovirt.engine.core.common.businessentities.gluster.StorageSyncSchedule) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) StorageDomainDR(org.ovirt.engine.core.common.businessentities.StorageDomainDR) Linq(org.ovirt.engine.ui.uicommonweb.Linq) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand)

Example 8 with StorageDomainDR

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

the class StorageDomainDRDaoTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    dao = dbFacade.getStorageDomainDRDao();
    storageDomainDR = new StorageDomainDR();
    storageDomainDR.setStorageDomainId(FixturesTool.POSIX_STORAGE_DOMAIN_ID);
    storageDomainDR.setGeoRepSessionId(FixturesTool.GLUSTER_GEOREP_SESSION_ID2);
    storageDomainDR.setScheduleCronExpression("0 30 22 * * ? *");
    storageDomainDR.setJobId("qrtzjob1");
}
Also used : StorageDomainDR(org.ovirt.engine.core.common.businessentities.StorageDomainDR)

Example 9 with StorageDomainDR

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

the class StorageDomainDRDaoTest method testGetStorageDomainDR.

@Test
public void testGetStorageDomainDR() {
    StorageDomainDR result = dao.get(FixturesTool.POSIX_STORAGE_DOMAIN_ID, FixturesTool.GLUSTER_GEOREP_SESSION_ID2);
    assertEquals(storageDomainDR, result);
}
Also used : StorageDomainDR(org.ovirt.engine.core.common.businessentities.StorageDomainDR) Test(org.junit.Test)

Example 10 with StorageDomainDR

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

the class StorageDomainDRDaoTest method testSaveorUpdate.

@Test
public void testSaveorUpdate() {
    storageDomainDR.setScheduleCronExpression(null);
    dao.saveOrUpdate(storageDomainDR);
    StorageDomainDR result = dao.get(FixturesTool.POSIX_STORAGE_DOMAIN_ID, FixturesTool.GLUSTER_GEOREP_SESSION_ID2);
    assertEquals(storageDomainDR, result);
}
Also used : StorageDomainDR(org.ovirt.engine.core.common.businessentities.StorageDomainDR) Test(org.junit.Test)

Aggregations

StorageDomainDR (org.ovirt.engine.core.common.businessentities.StorageDomainDR)10 Test (org.junit.Test)4 GlusterGeoRepSession (org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession)4 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 StorageSyncSchedule (org.ovirt.engine.core.common.businessentities.gluster.StorageSyncSchedule)3 List (java.util.List)2 Map (java.util.Map)2 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)2 ActionType (org.ovirt.engine.core.common.action.ActionType)2 StorageSyncScheduleParameters (org.ovirt.engine.core.common.action.StorageSyncScheduleParameters)2 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)2 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)2 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)2 QueryType (org.ovirt.engine.core.common.queries.QueryType)2 Guid (org.ovirt.engine.core.compat.Guid)2 Frontend (org.ovirt.engine.ui.frontend.Frontend)2 Linq (org.ovirt.engine.ui.uicommonweb.Linq)2 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)2 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)2