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);
}
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();
}
}
}
Aggregations