[MAGNOLIA-983] magnolia-module-mail: Tests are broken on Mac OS X Created: 20/Jul/06  Updated: 23/Jan/13  Resolved: 27/Jun/08

Status: Closed
Project: Magnolia
Component/s: None
Affects Version/s: 3.0 RC3
Fix Version/s: 3.6

Type: Bug Priority: Minor
Reporter: Oliver Lietz Assignee: Magnolia International
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

OS: Mac OS X 10.4.7 PowerPC
Java: java version "1.5.0_06", Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-112), Java HotSpot(TM) Client VM (build 1.5.0_06-64, mixed mode, sharing)


Attachments: File AbstractMailTest.diff     File HtmlMailTest.diff     File HtmlMailTest.diff     File MgnlMailFactoryTest.diff     File MgnlMailFactoryTest.diff     File magnolia-pom.diff     File pom.diff     File pom.xml-patch     File subethamail.tar.gz    
Issue Links:
supersession
is superseded by MAGNOLIA-1934 Review and fix mail tests. Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

The tests for magnolia-module-mail are broken - hang on execution. Other platforms not tested so far.

(will try to debug when some spare time)



 Comments   
Comment by Oliver Lietz [ 21/Jul/06 ]

"server = SimpleSmtpServer.start(SMTP_PORT);" fails silently in AbstractMailTest

Throws an exception when trying to bind to privileged port (running as normal user):

java.net.BindException: Permission denied
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
at java.net.ServerSocket.bind(ServerSocket.java:319)
at java.net.ServerSocket.<init>(ServerSocket.java:185)
at java.net.ServerSocket.<init>(ServerSocket.java:97)
at com.dumbster.smtp.SimpleSmtpServer.run(Unknown Source)
at java.lang.Thread.run(Thread.java:613)

Same silent failure when running as root with privileged port.

Comment by Oliver Lietz [ 24/Jul/06 ]

It's slightly different on FreeBSD, but tests fail also:

------------------------------------------------------
T E S T S
-------------------------------------------------------
Running info.magnolia.cms.mail.AttachmentMailTest
INFO info.magnolia.cms.mail.AttachmentMailTest AttachmentMailTest.java(testAttachmentFile:20) 24.07.2006 17:28:40 file:/home/data/magnolia/magnolia-trunk/magnolia-module-mail/target/test-classes/magnolia.pdf
INFO info.magnolia.cms.mail.AttachmentMailTest AttachmentMailTest.java(testAttachmentFile:22) 24.07.2006 17:28:40 /home/data/magnolia/magnolia-trunk/magnolia-module-mail/target/test-classes/magnolia.pdf
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.43 sec
Running info.magnolia.cms.mail.HtmlMailTest
INFO info.magnolia.cms.mail.handlers.SimpleMailHandler SimpleMailHandler.java(sendMail:33) 24.07.2006 17:28:41 Mail has been sent to: [niko@macnica.com]
INFO info.magnolia.cms.mail.templates.MgnlEmail HtmlEmail.java(turnOnMultipart:61) 24.07.2006 17:28:42 Could not turn on multipart
INFO info.magnolia.cms.mail.templates.MgnlEmail MgnlMultipartEmail.java(addAttachment:54) 24.07.2006 17:28:42 Found new attachment with name :att
INFO info.magnolia.cms.mail.handlers.SimpleMailHandler SimpleMailHandler.java(sendMail:33) 24.07.2006 17:28:42 Mail has been sent to: [niko@macnica.com]
INFO info.magnolia.cms.mail.templates.MgnlEmail MgnlMultipartEmail.java(addAttachment:54) 24.07.2006 17:28:42 Found new attachment with name :att1
INFO info.magnolia.cms.mail.templates.MgnlEmail MgnlMultipartEmail.java(addAttachment:54) 24.07.2006 17:28:42 Found new attachment with name :att2
INFO info.magnolia.cms.mail.handlers.SimpleMailHandler SimpleMailHandler.java(sendMail:33) 24.07.2006 17:28:43 Mail has been sent to: [niko@macnica.com]
INFO info.magnolia.cms.mail.templates.MgnlEmail MgnlMultipartEmail.java(addAttachment:54) 24.07.2006 17:28:43 Found new attachment with name :att1
INFO info.magnolia.cms.mail.handlers.SimpleMailHandler SimpleMailHandler.java(sendMail:33) 24.07.2006 17:28:43 Mail has been sent to: [niko@macnica.com]
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.904 sec
Running info.magnolia.cms.mail.MgnlMailFactoryTest


FreeBSD 6.1-RELEASE i386
java version "1.5.0", Java(TM) 2 Runtime Environment, Standard Edition (build diablo-1.5.0-b00), Java HotSpot(TM) Server VM (build diablo-1.5.0_07-b00, mixed mode)

Comment by Nicolas Modrzyk [ 25/Jul/06 ]

agreed this is not documented, but it was said on the list, you need a locally running smtp server. The validation of the email being done only while packaging it to be sent, this was the way I was doing it to make at least useful tests.

Comment by Oliver Lietz [ 25/Jul/06 ]

Sorry, missed it on the list. Does anybody know the reason for this failure? Does it make sense if we have a working setup with SimpleSmtpServer? Should I try to debug SimpleSmtpServer (and friends)?

Maybe it's this bug "[ 1354551 ] Deadlock possible in SimpleSmtpServer.start()": http://sourceforge.net/tracker/index.php?func=detail&aid=1354551&group_id=78413&atid=553186

Comment by Oliver Lietz [ 29/Jul/06 ]

Replaced com.dumbster.smtp with org.subethamail.wiser. Testing works.

hasMatchingSubject(String message, String subject) could be improved or replaced by a simple parser - something like javax.mail.internet.MimeMessage.parse(java.io.InputStream is) "Parse the InputStream setting the headers and content fields appropriately", but without the need to setup a javax.mail.Session. Any suggestions?

License of Wiser is LGPL. Wiser hasn't a m2 repo yet.

Comment by Oliver Lietz [ 29/Jul/06 ]

Shame on me - WiserMessage wraps a proper MimeMessage, so we can use getMimeMessage().getSubject().
Drop AbstractMailTest.diff and use latest HtmlMailTest.diff and MgnlMailFactoryTest.diff instead.

Comment by Oliver Lietz [ 29/Jul/06 ]

Prepared a m2-package (rearranged files/directories and created three POMs) of SubEtha smtp and wiser (trunk/1.0.1).
Asked a developer to distribute SubEthaMail on a public m2 repo.

Comment by Fabrizio Giustina [ 13/Aug/06 ]

mail tests were not working anymore on windows, looks like wiser doesn't close sockects properly between tests.
It's now fixed by using a different port for each test, please let me know if it also work properly on OSX

Comment by Philipp Bracher [ 17/Aug/06 ]

Hi Fabrizio

in the latest pom there was the 1.0.3-SNAPSHOT version used for subethamail, which is not deployed in the maven repository. This was breaking the build. I moved the version back to 1.0.2 now, so that it builds again.

Can you veryfie quickly if this is ok. Can you deploy the jar otherwise.

Thanks

Comment by Oliver Lietz [ 27/Oct/06 ]

Testing (r6951) works on FreeBSD and Mac OS X with SubEthaMail 1.0.3 and 1.1.

Comment by Oliver Lietz [ 27/Oct/06 ]

This is a patch for using SubEthaMail 1.1 (not yet on public repo). Removed the java14 classifier for the retrotranslated version of SubEthaMail. We can use the java5 version for testing.

Comment by Magnolia International [ 27/Oct/06 ]

any idea when it's going to be in a public repo ?

Comment by Oliver Lietz [ 30/Oct/06 ]

No answer from Jon and Jeff on this yet. Can we put 1.1 on http://svn.magnolia.info/maven/m2/ ?

Comment by Magnolia International [ 31/May/07 ]

Oliver, if you still have no answer from these guys, maybe you want to follow this
http://maven.apache.org/guides/mini/guide-ibiblio-upload.html
? Anyhow, the tests haven't been failing for me in a while ...

Comment by Oliver Lietz [ 31/May/07 ]

Same here, tests are fine on Mac OS/FreeBSD (other platforms?). Haven't heard anything from them and it looks like they dropped Maven and use Ant again. We should update SubEthaMail to 1.2 because they fixed a bug and switched license from LGPL to ASFL 2.0. I will look into this as soon as possible, prepare a mavenized 1.2 package and ask them to add made changes to their svn repo/upload to public m2 repo.

btw: we shouldn't use private mail addresses for testing but follow RFC 2606 (http://www.ietf.org/rfc/rfc2606.txt) and use e.g. test@example.com instead. Private mail addresses smell a little bit like "home-phoning".

Comment by Magnolia International [ 31/May/07 ]

sure, fix away!

Comment by Magnolia International [ 27/Jun/08 ]

looking into this again - just a note: as far as I can tell, all patches attached so far have been applied.

Comment by Magnolia International [ 27/Jun/08 ]

after upgrading to subethamail 1.2, i can't seem to get these tests failing again. Please reopen if it happens again.

Generated at Mon Feb 12 03:22:32 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.