Dion Gillard <[EMAIL PROTECTED]> writes: >I'm sure I always use maven.junit.fork=true in my ~/build.properties
I've tried both junit.fork=true and false and it still failed consistently for me on Linux. Easiest was to increment the port number on every test. Regards Henning >On 9/7/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> Author: henning >> Date: Wed Sep 7 04:43:52 2005 >> New Revision: 279300 >> >> URL: http://svn.apache.org/viewcvs?rev=279300&view=rev >> Log: >> Update the test cases to run each test on a different port. Else the >> tests will fail consistently with JDK 1.3.x >> >> >> Modified: >> >> jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/BaseEmailTestCase.java >> >> jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/EmailTest.java >> >> jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/HtmlEmailTest.java >> >> jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/MultiPartEmailTest.java >> >> jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/SendWithAttachmentsTest.java >> >> jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/SimpleEmailTest.java >> jakarta/commons/proper/email/trunk/xdocs/changes.xml >> >> Modified: >> jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/BaseEmailTestCase.java >> URL: >> http://svn.apache.org/viewcvs/jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/BaseEmailTestCase.java?rev=279300&r1=279299&r2=279300&view=diff >> ============================================================================== >> --- >> jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/BaseEmailTestCase.java >> (original) >> +++ >> jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/BaseEmailTestCase.java >> Wed Sep 7 04:43:52 2005 >> @@ -43,14 +43,13 @@ >> >> public class BaseEmailTestCase extends TestCase >> { >> + private static int mailServerPort = EmailConfiguration.MAIL_SERVER_PORT; >> >> /** The fake Dumbster email server */ >> protected SimpleSmtpServer fakeMailServer = null; >> >> /** Mail server used for testing */ >> protected String strTestMailServer = EmailConfiguration.MAIL_SERVER; >> - /** Mail server port used for testing */ >> - protected int intTestMailServerPort = >> EmailConfiguration.MAIL_SERVER_PORT; >> /** From address for the test email */ >> protected String strTestMailFrom = EmailConfiguration.TEST_FROM; >> /** Destination address for the test email */ >> @@ -70,6 +69,11 @@ >> /** Where to save email output **/ >> private File emailOutputDir; >> >> + protected int getMailServerPort() >> + { >> + return mailServerPort; >> + } >> + >> /** Test characters acceptable to email */ >> protected String[] testCharsValid = >> { >> @@ -111,6 +115,7 @@ >> if (this.fakeMailServer != null && !this.fakeMailServer.isStopped()) >> { >> this.fakeMailServer.stop(); >> + assertTrue(this.fakeMailServer.isStopped()); >> } >> >> this.fakeMailServer = null; >> @@ -157,8 +162,12 @@ >> { >> if (this.fakeMailServer == null || this.fakeMailServer.isStopped()) >> { >> + mailServerPort++; >> + >> this.fakeMailServer = >> - SimpleSmtpServer.start(EmailConfiguration.MAIL_SERVER_PORT); >> + SimpleSmtpServer.start(getMailServerPort()); >> + >> + assertFalse(this.fakeMailServer.isStopped()); >> >> Date dtStartWait = new Date(); >> while (this.fakeMailServer.isStopped()) >> >> Modified: >> jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/EmailTest.java >> URL: >> http://svn.apache.org/viewcvs/jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/EmailTest.java?rev=279300&r1=279299&r2=279300&view=diff >> ============================================================================== >> --- >> jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/EmailTest.java >> (original) >> +++ >> jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/EmailTest.java >> Wed Sep 7 04:43:52 2005 >> @@ -91,7 +91,7 @@ >> >> properties.setProperty( >> Email.MAIL_PORT, >> - String.valueOf(this.intTestMailServerPort)); >> + String.valueOf(this.getMailServerPort())); >> properties.setProperty(Email.MAIL_HOST, this.strTestMailServer); >> properties.setProperty(Email.MAIL_DEBUG, String.valueOf(false)); >> >> @@ -1490,7 +1490,7 @@ >> >> this.email = new MockEmailConcrete(); >> this.email.setHostName(this.strTestMailServer); >> - this.email.setSmtpPort(this.intTestMailServerPort); >> + this.email.setSmtpPort(this.getMailServerPort()); >> >> this.email.send(); >> fail("Should have thrown an exception"); >> @@ -1513,7 +1513,7 @@ >> >> this.email = new MockEmailConcrete(); >> this.email.setHostName(this.strTestMailServer); >> - this.email.setSmtpPort(this.intTestMailServerPort); >> + this.email.setSmtpPort(this.getMailServerPort()); >> this.email.setFrom("[EMAIL PROTECTED]"); >> this.email.send(); >> fail("Should have thrown an exception"); >> @@ -1536,7 +1536,7 @@ >> >> this.email = new MockEmailConcrete(); >> this.email.setHostName(this.strTestMailServer); >> - this.email.setSmtpPort(this.intTestMailServerPort); >> + this.email.setSmtpPort(this.getMailServerPort()); >> this.email.setFrom(this.strTestMailFrom); >> this.email.addTo(this.strTestMailTo); >> this.email.setAuthentication(null, null); >> >> Modified: >> jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/HtmlEmailTest.java >> URL: >> http://svn.apache.org/viewcvs/jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/HtmlEmailTest.java?rev=279300&r1=279299&r2=279300&view=diff >> ============================================================================== >> --- >> jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/HtmlEmailTest.java >> (original) >> +++ >> jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/HtmlEmailTest.java >> Wed Sep 7 04:43:52 2005 >> @@ -219,7 +219,7 @@ >> >> try >> { >> - /** File to used to test file attachmetns (Must be valid) */ >> + /** File to used to test file attachments (Must be valid) */ >> testFile = File.createTempFile("commons-email-testfile", >> ".txt"); >> } >> catch (IOException e) >> @@ -238,7 +238,7 @@ >> >> this.email = new MockHtmlEmailConcrete(); >> this.email.setHostName(this.strTestMailServer); >> - this.email.setSmtpPort(this.intTestMailServerPort); >> + this.email.setSmtpPort(this.getMailServerPort()); >> this.email.setFrom(this.strTestMailFrom); >> this.email.addTo(this.strTestMailTo); >> >> @@ -309,7 +309,7 @@ >> >> this.email = new MockHtmlEmailConcrete(); >> this.email.setHostName(this.strTestMailServer); >> - this.email.setSmtpPort(this.intTestMailServerPort); >> + this.email.setSmtpPort(this.getMailServerPort()); >> this.email.setFrom(this.strTestMailFrom); >> this.email.addTo(this.strTestMailTo); >> >> @@ -363,7 +363,7 @@ >> >> this.email = new MockHtmlEmailConcrete(); >> this.email.setHostName(this.strTestMailServer); >> - this.email.setSmtpPort(this.intTestMailServerPort); >> + this.email.setSmtpPort(this.getMailServerPort()); >> this.email.setFrom(this.strTestMailFrom); >> this.email.addTo(this.strTestMailTo); >> >> @@ -407,7 +407,7 @@ >> this.email = new MockHtmlEmailConcrete(); >> this.email.setHostName(this.strTestMailServer); >> this.email.setFrom(this.strTestMailFrom); >> - this.email.setSmtpPort(this.intTestMailServerPort); >> + this.email.setSmtpPort(this.getMailServerPort()); >> this.email.addTo(this.strTestMailTo); >> >> if (this.strTestUser != null && this.strTestPasswd != null) >> >> Modified: >> jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/MultiPartEmailTest.java >> URL: >> http://svn.apache.org/viewcvs/jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/MultiPartEmailTest.java?rev=279300&r1=279299&r2=279300&view=diff >> ============================================================================== >> --- >> jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/MultiPartEmailTest.java >> (original) >> +++ >> jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/MultiPartEmailTest.java >> Wed Sep 7 04:43:52 2005 >> @@ -144,7 +144,7 @@ >> MockMultiPartEmailConcrete testEmail = >> new MockMultiPartEmailConcrete(); >> testEmail.setHostName(this.strTestMailServer); >> - testEmail.setSmtpPort(this.intTestMailServerPort); >> + testEmail.setSmtpPort(this.getMailServerPort()); >> testEmail.setFrom(this.strTestMailFrom); >> testEmail.addTo(this.strTestMailTo); >> testEmail.attach(attachment); >> >> Modified: >> jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/SendWithAttachmentsTest.java >> URL: >> http://svn.apache.org/viewcvs/jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/SendWithAttachmentsTest.java?rev=279300&r1=279299&r2=279300&view=diff >> ============================================================================== >> --- >> jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/SendWithAttachmentsTest.java >> (original) >> +++ >> jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/SendWithAttachmentsTest.java >> Wed Sep 7 04:43:52 2005 >> @@ -63,7 +63,7 @@ >> >> this.email = new MockHtmlEmailConcrete(); >> this.email.setHostName(this.strTestMailServer); >> - this.email.setSmtpPort(this.intTestMailServerPort); >> + this.email.setSmtpPort(this.getMailServerPort()); >> this.email.setFrom(this.strTestMailFrom); >> this.email.addTo(this.strTestMailTo); >> >> @@ -154,7 +154,7 @@ >> >> this.email = new MockHtmlEmailConcrete(); >> this.email.setHostName(this.strTestMailServer); >> - this.email.setSmtpPort(this.intTestMailServerPort); >> + this.email.setSmtpPort(this.getMailServerPort()); >> this.email.setFrom(this.strTestMailFrom); >> this.email.addTo(this.strTestMailTo); >> >> >> Modified: >> jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/SimpleEmailTest.java >> URL: >> http://svn.apache.org/viewcvs/jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/SimpleEmailTest.java?rev=279300&r1=279299&r2=279300&view=diff >> ============================================================================== >> --- >> jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/SimpleEmailTest.java >> (original) >> +++ >> jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/SimpleEmailTest.java >> Wed Sep 7 04:43:52 2005 >> @@ -103,7 +103,7 @@ >> >> this.email = new MockSimpleEmail(); >> this.email.setHostName(this.strTestMailServer); >> - this.email.setSmtpPort(this.intTestMailServerPort); >> + this.email.setSmtpPort(this.getMailServerPort()); >> this.email.setFrom(this.strTestMailFrom); >> this.email.addTo(this.strTestMailTo); >> >> >> Modified: jakarta/commons/proper/email/trunk/xdocs/changes.xml >> URL: >> http://svn.apache.org/viewcvs/jakarta/commons/proper/email/trunk/xdocs/changes.xml?rev=279300&r1=279299&r2=279300&view=diff >> ============================================================================== >> --- jakarta/commons/proper/email/trunk/xdocs/changes.xml (original) >> +++ jakarta/commons/proper/email/trunk/xdocs/changes.xml Wed Sep 7 04:43:52 >> 2005 >> @@ -22,6 +22,10 @@ >> >> <body> >> <release version="1.0-rc8-SNAPSHOT" date="in Subversion"> >> + <action dev="henning" type="fix"> >> + Make sure that the unit tests don't fail under JDK 1.3.x with >> + java.net.BindException: Address already in use >> + </action> >> <action dev="henning" type="update" due-to="Niall Pemberton" >> issue="36536"> >> Replace our usage of address.validate() with simpler code that >> allows >> commons-email to work with javamail 1.2 / J2EE 1.3 environment. >> Added an >> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >-- >http://www.multitask.com.au/people/dion/ >"You are going to let the fear of poverty govern your life and your >reward will be that you will eat, but you will not live." - George >Bernard Shaw >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] -- Dipl.-Inf. (Univ.) Henning P. Schmiedehausen INTERMETA GmbH [EMAIL PROTECTED] +49 9131 50 654 0 http://www.intermeta.de/ RedHat Certified Engineer -- Jakarta Turbine Development -- hero for hire Linux, Java, perl, Solaris -- Consulting, Training, Development 4 - 8 - 15 - 16 - 23 - 42 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]