test_class.declarator: notifier
test_class.modifier: private
test_class.original_string: private BasicMailAlertNotifier notifier;
test_class.type: BasicMailAlertNotifier
test_class.var_name: notifier
test_class.declarator: spaceEnvironment
test_class.modifier: private
test_class.original_string: private InteractiveSpacesEnvironment spaceEnvironment;
test_class.type: InteractiveSpacesEnvironment
test_class.var_name: spaceEnvironment
test_class.declarator: mailSenderService
test_class.modifier: private
test_class.original_string: private MailSenderService mailSenderService;
test_class.type: MailSenderService
test_class.var_name: mailSenderService
test_class.declarator: alertService
test_class.modifier: private
test_class.original_string: private AlertService alertService;
test_class.type: AlertService
test_class.var_name: alertService
test_class.declarator: configuration
test_class.modifier: private
test_class.original_string: private Configuration configuration;
test_class.type: Configuration
test_class.var_name: configuration
test_class.file: service/interactivespaces-service-alert-notifier-mail/src/test/java/interactivespaces/service/alert/notifier/mail/internal/BasicMailAlertNotifierTest.java
test_class.identifier: BasicMailAlertNotifierTest
test_case.body: @Test
    public void testSendingMailByAlertType() {
      String alertType = "kiwi";
      String id = "orange";
      String message = "mango";
  
      String fromAddress = "elmer.fudd@gmail.com";
      Mockito
          .when(
              configuration
                  .getPropertyString(BasicMailAlertNotifier.CONFIGURATION_INTERACTIVESPACES_SERVICE_ALERT_NOTIFIER_MAIL_FROM
                      + "." + alertType)).thenReturn(fromAddress);
      String toAddress1 = "bugs.bunny@gmail.com";
      String toAddress2 = "road.runner@gmail.com";
      Mockito
          .when(
              configuration
                  .getPropertyString(BasicMailAlertNotifier.CONFIGURATION_INTERACTIVESPACES_SERVICE_ALERT_NOTIFIER_MAIL_TO
                      + "." + alertType)).thenReturn("  " + toAddress1 + "     " + toAddress2);
      String subject = "Wascally wabbit...";
      Mockito
          .when(
              configuration
                  .getPropertyString(BasicMailAlertNotifier.CONFIGURATION_INTERACTIVESPACES_SERVICE_ALERT_NOTIFIER_MAIL_SUBJECT
                      + "." + alertType)).thenReturn(subject);
  
      ArgumentCaptor<MailMessage> argument = ArgumentCaptor.forClass(MailMessage.class);
  
      notifier.notify(alertType, id, message);
  
      Mockito.verify(mailSenderService).sendMailMessage(argument.capture());
  
      assertEquals(fromAddress, argument.getValue().getFromAddress());
      assertEquals(Lists.newArrayList(toAddress1, toAddress2), argument.getValue().getToAdresses());
      assertEquals(subject, argument.getValue().getSubject());
      assertEquals(message, argument.getValue().getBody());
    }
test_case.class_method_signature: BasicMailAlertNotifierTest.testSendingMailByAlertType()
test_case.full_signature: @Test public void testSendingMailByAlertType()
test_case.identifier: testSendingMailByAlertType
test_case.invocations: thenReturn when getPropertyString thenReturn when getPropertyString thenReturn when getPropertyString forClass notify sendMailMessage verify capture assertEquals getFromAddress getValue assertEquals newArrayList getToAdresses getValue assertEquals getSubject getValue assertEquals getBody getValue
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testSendingMailByAlertType()
focal_class.declarator: CONFIGURATION_PREFIX_INTERACTIVESPACES_SERVICE_ALERT_NOTIFIER_MAIL =
        "interactivespaces.service.alert.notifier.mail."
focal_class.modifier: public static final
focal_class.original_string: public static final String CONFIGURATION_PREFIX_INTERACTIVESPACES_SERVICE_ALERT_NOTIFIER_MAIL =
        "interactivespaces.service.alert.notifier.mail.";
focal_class.type: String
focal_class.var_name: CONFIGURATION_PREFIX_INTERACTIVESPACES_SERVICE_ALERT_NOTIFIER_MAIL
focal_class.declarator: CONFIGURATION_INTERACTIVESPACES_SERVICE_ALERT_NOTIFIER_MAIL_TO =
        CONFIGURATION_PREFIX_INTERACTIVESPACES_SERVICE_ALERT_NOTIFIER_MAIL + "to"
focal_class.modifier: public static final
focal_class.original_string: public static final String CONFIGURATION_INTERACTIVESPACES_SERVICE_ALERT_NOTIFIER_MAIL_TO =
        CONFIGURATION_PREFIX_INTERACTIVESPACES_SERVICE_ALERT_NOTIFIER_MAIL + "to";
focal_class.type: String
focal_class.var_name: CONFIGURATION_INTERACTIVESPACES_SERVICE_ALERT_NOTIFIER_MAIL_TO
focal_class.declarator: CONFIGURATION_INTERACTIVESPACES_SERVICE_ALERT_NOTIFIER_MAIL_FROM =
        CONFIGURATION_PREFIX_INTERACTIVESPACES_SERVICE_ALERT_NOTIFIER_MAIL + "from"
focal_class.modifier: public static final
focal_class.original_string: public static final String CONFIGURATION_INTERACTIVESPACES_SERVICE_ALERT_NOTIFIER_MAIL_FROM =
        CONFIGURATION_PREFIX_INTERACTIVESPACES_SERVICE_ALERT_NOTIFIER_MAIL + "from";
focal_class.type: String
focal_class.var_name: CONFIGURATION_INTERACTIVESPACES_SERVICE_ALERT_NOTIFIER_MAIL_FROM
focal_class.declarator: CONFIGURATION_INTERACTIVESPACES_SERVICE_ALERT_NOTIFIER_MAIL_SUBJECT =
        CONFIGURATION_PREFIX_INTERACTIVESPACES_SERVICE_ALERT_NOTIFIER_MAIL + "subject"
focal_class.modifier: public static final
focal_class.original_string: public static final String CONFIGURATION_INTERACTIVESPACES_SERVICE_ALERT_NOTIFIER_MAIL_SUBJECT =
        CONFIGURATION_PREFIX_INTERACTIVESPACES_SERVICE_ALERT_NOTIFIER_MAIL + "subject";
focal_class.type: String
focal_class.var_name: CONFIGURATION_INTERACTIVESPACES_SERVICE_ALERT_NOTIFIER_MAIL_SUBJECT
focal_class.declarator: NAME = "alert.notifier.email"
focal_class.modifier: public static final
focal_class.original_string: public static final String NAME = "alert.notifier.email";
focal_class.type: String
focal_class.var_name: NAME
focal_class.declarator: alertService
focal_class.modifier: private final
focal_class.original_string: private final AlertService alertService;
focal_class.type: AlertService
focal_class.var_name: alertService
focal_class.declarator: mailSenderService
focal_class.modifier: private final
focal_class.original_string: private final MailSenderService mailSenderService;
focal_class.type: MailSenderService
focal_class.var_name: mailSenderService
focal_class.file: service/interactivespaces-service-alert-notifier-mail/src/main/java/interactivespaces/service/alert/notifier/mail/internal/BasicMailAlertNotifier.java
focal_class.identifier: BasicMailAlertNotifier
focal_class.interfaces: implements AlertNotifier
focal_class.class_method_signature: BasicMailAlertNotifier.BasicMailAlertNotifier(AlertService alertService, MailSenderService mailSenderService)
focal_class.full_signature: public  BasicMailAlertNotifier(AlertService alertService, MailSenderService mailSenderService)
focal_class.identifier: BasicMailAlertNotifier
focal_class.modifiers: public
focal_class.parameters: (AlertService alertService, MailSenderService mailSenderService)
focal_class.signature:  BasicMailAlertNotifier(AlertService alertService, MailSenderService mailSenderService)
focal_class.class_method_signature: BasicMailAlertNotifier.getName()
focal_class.full_signature: @Override public String getName()
focal_class.identifier: getName
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getName()
focal_class.class_method_signature: BasicMailAlertNotifier.startup()
focal_class.full_signature: @Override public void startup()
focal_class.identifier: startup
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void startup()
focal_class.class_method_signature: BasicMailAlertNotifier.shutdown()
focal_class.full_signature: @Override public void shutdown()
focal_class.identifier: shutdown
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void shutdown()
focal_class.class_method_signature: BasicMailAlertNotifier.notify(String alertType, String id, String message)
focal_class.full_signature: @Override public void notify(String alertType, String id, String message)
focal_class.identifier: notify
focal_class.modifiers: @Override public
focal_class.parameters: (String alertType, String id, String message)
focal_class.return: void
focal_class.signature: void notify(String alertType, String id, String message)
focal_class.class_method_signature: BasicMailAlertNotifier.addToAddresses(String alertType, ComposableMailMessage mail, Configuration config)
focal_class.full_signature: private void addToAddresses(String alertType, ComposableMailMessage mail, Configuration config)
focal_class.identifier: addToAddresses
focal_class.modifiers: private
focal_class.parameters: (String alertType, ComposableMailMessage mail, Configuration config)
focal_class.return: void
focal_class.signature: void addToAddresses(String alertType, ComposableMailMessage mail, Configuration config)
focal_class.class_method_signature: BasicMailAlertNotifier.addFromAddress(String alertType, ComposableMailMessage mail, Configuration config)
focal_class.full_signature: private void addFromAddress(String alertType, ComposableMailMessage mail, Configuration config)
focal_class.identifier: addFromAddress
focal_class.modifiers: private
focal_class.parameters: (String alertType, ComposableMailMessage mail, Configuration config)
focal_class.return: void
focal_class.signature: void addFromAddress(String alertType, ComposableMailMessage mail, Configuration config)
focal_class.class_method_signature: BasicMailAlertNotifier.addSubject(String alertType, ComposableMailMessage mail, Configuration config)
focal_class.full_signature: private void addSubject(String alertType, ComposableMailMessage mail, Configuration config)
focal_class.identifier: addSubject
focal_class.modifiers: private
focal_class.parameters: (String alertType, ComposableMailMessage mail, Configuration config)
focal_class.return: void
focal_class.signature: void addSubject(String alertType, ComposableMailMessage mail, Configuration config)
focal_class.class_method_signature: BasicMailAlertNotifier.getConfigValue(String configParameter, String alertType, Configuration config)
focal_class.full_signature: private String getConfigValue(String configParameter, String alertType, Configuration config)
focal_class.identifier: getConfigValue
focal_class.modifiers: private
focal_class.parameters: (String configParameter, String alertType, Configuration config)
focal_class.return: String
focal_class.signature: String getConfigValue(String configParameter, String alertType, Configuration config)
focal_class.superclass: extends BaseSupportedService
focal_method.body: @Override
    public void notify(String alertType, String id, String message) {
      try {
        Configuration config = getSpaceEnvironment().getSystemConfiguration();
  
        ComposableMailMessage mail = new SimpleMailMessage();
  
        try {
          addToAddresses(alertType, mail, config);
          addFromAddress(alertType, mail, config);
          addSubject(alertType, mail, config);
        } catch (SimpleInteractiveSpacesException e) {
          getSpaceEnvironment().getLog().warn(e.getCompoundMessage());
          getSpaceEnvironment().getLog().warn(
              String.format("Email alert failed for alert type %s, id %s, message %s", alertType, id, message));
          return;
        }
  
        mail.setBody(message);
  
        mailSenderService.sendMailMessage(mail);
      } catch (Throwable e) {
        getSpaceEnvironment().getLog().error(
            String.format("Email alert for alert type %s, id %s, message %s", alertType, id, message), e);
      }
    }
focal_method.class_method_signature: BasicMailAlertNotifier.notify(String alertType, String id, String message)
focal_method.full_signature: @Override public void notify(String alertType, String id, String message)
focal_method.identifier: notify
focal_method.invocations: getSystemConfiguration getSpaceEnvironment addToAddresses addFromAddress addSubject warn getLog getSpaceEnvironment getCompoundMessage warn getLog getSpaceEnvironment format setBody sendMailMessage error getLog getSpaceEnvironment format
focal_method.modifiers: @Override public
focal_method.parameters: (String alertType, String id, String message)
focal_method.return: void
focal_method.signature: void notify(String alertType, String id, String message)