Search in sources :

Example 11 with PropertyInfoUpdate

use of com.emc.storageos.model.property.PropertyInfoUpdate in project coprhd-controller by CoprHD.

the class ConfigServiceTest method testEmailUsingAuthAndCerts.

@Test
public void testEmailUsingAuthAndCerts() {
    ConnectEmcEmail email = new ConnectEmcEmail();
    email.setEmailSender("DONOTREPLY@customer.com");
    email.setEmailServer("mailhub.lss.emc.com");
    email.setNotifyEmailAddress("joe.customer@customer.com");
    email.setPrimaryEmailAddress("emailalertesg@emc.com");
    email.setSafeEncryption("no");
    email.setUserName("root");
    email.setPassword("ChangeMe");
    try {
        email.setStartTls("yes");
        email.setSmtpAuthType("login");
    } catch (Exception e) {
        Assert.fail();
    }
    PropertyInfoUpdate propInfo = ConfigService.ConfigureConnectEmc.configureEmail(email);
    Assert.assertEquals(propInfo.getProperty("system_connectemc_smtp_server"), email.getEmailServer());
    Assert.assertEquals(propInfo.getProperty("system_connectemc_smtp_emcto"), email.getPrimaryEmailAddress());
    Assert.assertEquals(propInfo.getProperty("system_connectemc_smtp_from"), email.getEmailSender());
    Assert.assertEquals(propInfo.getProperty("system_connectemc_smtp_to"), email.getNotifyEmailAddress());
    Assert.assertEquals(propInfo.getProperty("system_connectemc_smtp_enabletls"), email.getStartTls());
    Assert.assertEquals(propInfo.getProperty("system_connectemc_encrypt"), email.getSafeEncryption());
    Assert.assertEquals(propInfo.getProperty("system_connectemc_smtp_authtype"), email.getSmtpAuthType());
    Assert.assertEquals(propInfo.getProperty("system_connectemc_smtp_username"), email.getUserName());
    Assert.assertEquals(propInfo.getProperty("system_connectemc_smtp_password"), email.getPassword());
}
Also used : ConnectEmcEmail(com.emc.vipr.model.sys.eventhandler.ConnectEmcEmail) PropertyInfoUpdate(com.emc.storageos.model.property.PropertyInfoUpdate) Test(org.junit.Test)

Example 12 with PropertyInfoUpdate

use of com.emc.storageos.model.property.PropertyInfoUpdate in project coprhd-controller by CoprHD.

the class ConfigPropertyUtils method saveProperties.

public static void saveProperties(ViPRSystemClient client, Map<String, String> updatedProperties) {
    if (Logger.isDebugEnabled()) {
        Logger.debug("Saving properties");
        for (Map.Entry<String, String> entry : updatedProperties.entrySet()) {
            Logger.debug(" %s = %s", entry.getKey(), entry.getValue());
        }
    }
    PropertyInfoUpdate propertyInfoUpdate = new PropertyInfoUpdate();
    propertyInfoUpdate.addProperties(updatedProperties);
    client.config().setProperties(propertyInfoUpdate);
    // Reload the SMTP settings into play if any of the properties have changed
    if (containsSmtpSettings(updatedProperties)) {
        loadSmtpSettingsIntoPlay();
    }
}
Also used : Map(java.util.Map) PropertyInfoUpdate(com.emc.storageos.model.property.PropertyInfoUpdate)

Aggregations

PropertyInfoUpdate (com.emc.storageos.model.property.PropertyInfoUpdate)12 Test (org.junit.Test)5 ConnectEmcEmail (com.emc.vipr.model.sys.eventhandler.ConnectEmcEmail)4 PropertyInfoRestRep (com.emc.storageos.model.property.PropertyInfoRestRep)3 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)2 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)2 CoordinatorClientException (com.emc.storageos.systemservices.exceptions.CoordinatorClientException)2 LocalRepositoryException (com.emc.storageos.systemservices.exceptions.LocalRepositoryException)2 ConnectEmcFtps (com.emc.vipr.model.sys.eventhandler.ConnectEmcFtps)1 Calendar (java.util.Calendar)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1