Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-101178

AssertionError in testcases that involve sending mail

    Details

      Description

      Many test cases are failing because the mail sender is ignored, example of a failure:

           [exec] com.liferay.wiki.notifications.test.WikiUserNotificationTest > testAddUserNotification STARTED
           [exec] 10:03:03,321 WARN  [com.liferay.wiki.test-executor-thread][MailMessageListener:135] Email test@domain.invalid will be ignored as itis included in mail.send.blacklist
           [exec] 10:03:03,322 WARN  [com.liferay.wiki.test-executor-thread][MailMessageListener:52] Skipping email because the sender is not specified
           [exec] 
           [exec] com.liferay.wiki.notifications.test.WikiUserNotificationTest > testAddUserNotification FAILED
           [exec]     java.lang.AssertionError: expected:<1> but was:<0>
           [exec]     	at org.junit.Assert.fail(Assert.java:88)
           [exec]     	at org.junit.Assert.failNotEquals(Assert.java:834)
           [exec]     	at org.junit.Assert.assertEquals(Assert.java:645)
           [exec]     	at org.junit.Assert.assertEquals(Assert.java:631)
           [exec]     	at com.liferay.portal.notifications.test.util.BaseUserNotificationTestCase.testAddUserNotification(BaseUserNotificationTestCase.java:73)
           [exec]     	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           [exec]     	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
           [exec]     	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           [exec]     	at java.lang.reflect.Method.invoke(Method.java:498)
           [exec]     	at com.liferay.arquillian.extension.junit.bridge.server.TestExecutorRunnable$2.evaluate(TestExecutorRunnable.java:234)
           [exec]     	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
           [exec]     	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
           [exec]     	at com.liferay.portal.kernel.test.rule.AbstractTestRule$2.evaluate(AbstractTestRule.java:99)
           [exec]     	at com.liferay.portal.kernel.test.rule.AbstractTestRule$2.evaluate(AbstractTestRule.java:99)
           [exec]     	at com.liferay.portal.kernel.test.rule.AbstractTestRule$2.evaluate(AbstractTestRule.java:99)
           [exec]     	at com.liferay.portal.kernel.test.rule.AbstractTestRule$2.evaluate(AbstractTestRule.java:99)
           [exec]     	at com.liferay.portal.kernel.test.rule.AbstractTestRule$2.evaluate(AbstractTestRule.java:99)
           [exec]     	at com.liferay.portal.kernel.test.rule.AbstractTestRule$2.evaluate(AbstractTestRule.java:99)
           [exec]     	at com.liferay.portal.kernel.test.rule.TimeoutTestRule$1.evaluate(TimeoutTestRule.java:89)
           [exec]     	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
           [exec]     	at com.liferay.arquillian.extension.junit.bridge.server.TestExecutorRunnable$1.evaluate(TestExecutorRunnable.java:143)
           [exec]     	at com.liferay.portal.kernel.test.rule.AbstractTestRule$1.evaluate(AbstractTestRule.java:59)
           [exec]     	at com.liferay.portal.kernel.test.rule.AbstractTestRule$1.evaluate(AbstractTestRule.java:59)
           [exec]     	at com.liferay.portal.kernel.test.rule.AbstractTestRule$1.evaluate(AbstractTestRule.java:59)
           [exec]     	at com.liferay.portal.kernel.test.rule.AbstractTestRule$1.evaluate(AbstractTestRule.java:59)
           [exec]     	at com.liferay.portal.kernel.test.rule.AbstractTestRule$1.evaluate(AbstractTestRule.java:59)
           [exec]     	at com.liferay.portal.kernel.test.rule.AbstractTestRule$1.evaluate(AbstractTestRule.java:59)
           [exec]     	at com.liferay.portal.kernel.test.rule.AbstractTestRule$1.evaluate(AbstractTestRule.java:59)
           [exec]     	at com.liferay.portal.kernel.test.rule.AbstractTestRule$1.evaluate(AbstractTestRule.java:59)
           [exec]     	at com.liferay.portal.kernel.test.rule.AbstractTestRule$1.evaluate(AbstractTestRule.java:59)
           [exec]     	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
           [exec]     	at com.liferay.arquillian.extension.junit.bridge.server.TestExecutorRunnable._execute(TestExecutorRunnable.java:181)
           [exec]     	at com.liferay.arquillian.extension.junit.bridge.server.TestExecutorRunnable.run(TestExecutorRunnable.java:95)
           [exec]     	at java.lang.Thread.run(Thread.java:745)
      

      Important changes

      LPS-84320 denies sending mail when sender is unconfigured (e.g. test@liferay.com)

      In case email sender is not correctly configured in your server, mails won't be sent and you will start seeing following warn traces in the log file:

      • [liferay/mail-1][MailMessageListener:135] Email test@domain.invalid will be ignored because it is included in mail.send.blacklist
      • [liferay/mail-1][MailMessageListener:135] Email test@liferay.com will be ignored because it is included in mail.send.blacklist
      • [liferay/mail-1][MailMessageListener:52] Skipping email because the sender is not specified

      In order to avoid that warn traces and mail issues, you will have to configure a correct email in portal-ext.properties:

      admin.email.from.address=...your admin user email...
      announcements.email.to.address=...your no-reply email...

      Note: noreply@liferay.com, test@liferay.com, noreply@domain.invalid, and test@domain.invalid are considered invalid email addresses.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                brooke.dalton Brooke Dalton
                Reporter:
                brooke.dalton Brooke Dalton
                Participants of an Issue:
                Recent user:
                Jason Pince
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  9 weeks, 5 days ago

                  Packages

                  Version Package
                  7.0.X
                  7.1.X
                  7.2.X
                  7.2.1 CE GA2
                  Master