Search in sources :

Example 1 with SiteUpdateParam

use of com.emc.storageos.model.dr.SiteUpdateParam in project coprhd-controller by CoprHD.

the class DisasterRecoveryServiceTest method testUpdateSite.

@Test
public void testUpdateSite() {
    doReturn(standbySite1).when(drUtil).getSiteFromLocalVdc(standbySite1.getUuid());
    SiteUpdateParam updateParam = new SiteUpdateParam();
    try {
        drService.updateSite(standbySite1.getUuid(), updateParam);
        fail();
    } catch (InternalServerErrorException e) {
    // Ignore expected exception
    }
    updateParam.setName("New Name");
    updateParam.setDescription("New Description");
    drService.updateSite(standbySite1.getUuid(), updateParam);
}
Also used : InternalServerErrorException(com.emc.storageos.svcs.errorhandling.resources.InternalServerErrorException) SiteUpdateParam(com.emc.storageos.model.dr.SiteUpdateParam) Test(org.junit.Test)

Example 2 with SiteUpdateParam

use of com.emc.storageos.model.dr.SiteUpdateParam in project coprhd-controller by CoprHD.

the class DisasterRecovery method save.

@FlashException(keep = true, referrer = { "create", "edit" })
@Restrictions({ @Restrict("SECURITY_ADMIN"), @Restrict("RESTRICTED_SECURITY_ADMIN") })
public static void save(DisasterRecoveryForm disasterRecovery) {
    if (disasterRecovery != null) {
        disasterRecovery.validate("disasterRecovery");
        if (Validation.hasErrors()) {
            Common.handleError();
        }
        if (disasterRecovery.isNew()) {
            SiteAddParam standbySite = new SiteAddParam();
            standbySite.setName(disasterRecovery.name);
            standbySite.setVip(disasterRecovery.VirtualIP);
            standbySite.setUsername(disasterRecovery.userName);
            standbySite.setPassword(disasterRecovery.userPassword);
            standbySite.setDescription(disasterRecovery.description);
            SiteRestRep result = DisasterRecoveryUtils.addStandby(standbySite);
            flash.success(MessagesUtils.get(SAVED_SUCCESS, result.getName()));
            list();
        } else {
            SiteUpdateParam siteUpdateParam = new SiteUpdateParam();
            siteUpdateParam.setName(disasterRecovery.name);
            siteUpdateParam.setDescription(disasterRecovery.description);
            DisasterRecoveryUtils.updateSite(disasterRecovery.id, siteUpdateParam);
            flash.success(MessagesUtils.get(UPDATE_SUCCESS, disasterRecovery.name));
            list();
        }
    }
}
Also used : SiteAddParam(com.emc.storageos.model.dr.SiteAddParam) SiteRestRep(com.emc.storageos.model.dr.SiteRestRep) SiteUpdateParam(com.emc.storageos.model.dr.SiteUpdateParam) FlashException(controllers.util.FlashException) Restrictions(controllers.deadbolt.Restrictions)

Aggregations

SiteUpdateParam (com.emc.storageos.model.dr.SiteUpdateParam)2 SiteAddParam (com.emc.storageos.model.dr.SiteAddParam)1 SiteRestRep (com.emc.storageos.model.dr.SiteRestRep)1 InternalServerErrorException (com.emc.storageos.svcs.errorhandling.resources.InternalServerErrorException)1 Restrictions (controllers.deadbolt.Restrictions)1 FlashException (controllers.util.FlashException)1 Test (org.junit.Test)1