[logback-dev] svn commit: r1930 - logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net
noreply.ceki at qos.ch
noreply.ceki at qos.ch
Sat Nov 1 17:11:46 CET 2008
Author: ceki
Date: Sat Nov 1 17:11:46 2008
New Revision: 1930
Modified:
logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/SMTPAppender_GreenTest.java
Log:
obtain a random port number through a dedicated method
Modified: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/SMTPAppender_GreenTest.java
==============================================================================
--- logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/SMTPAppender_GreenTest.java (original)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/net/SMTPAppender_GreenTest.java Sat Nov 1 17:11:46 2008
@@ -4,8 +4,6 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
-import java.util.Random;
-
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
@@ -22,6 +20,7 @@
import ch.qos.logback.classic.spi.LoggingEvent;
import ch.qos.logback.core.CoreConstants;
import ch.qos.logback.core.Layout;
+import ch.qos.logback.core.testUtil.RandomUtil;
import com.icegreen.greenmail.util.GreenMail;
import com.icegreen.greenmail.util.GreenMailUtil;
@@ -29,7 +28,7 @@
public class SMTPAppender_GreenTest {
- int diff = 1024 + new Random().nextInt(10000);
+ int port = RandomUtil.getRandomServerPort();
GreenMail greenMail;
SMTPAppender smtpAppender;
LoggerContext lc = new LoggerContext();
@@ -40,7 +39,7 @@
@Before
public void setUp() throws Exception {
- ServerSetup serverSetup = new ServerSetup(diff, "localhost",
+ ServerSetup serverSetup = new ServerSetup(port, "localhost",
ServerSetup.PROTOCOL_SMTP);
greenMail = new GreenMail(serverSetup);
greenMail.start();
@@ -53,7 +52,7 @@
smtpAppender.setName("smtp");
smtpAppender.setFrom("user at host.dom");
smtpAppender.setSMTPHost("localhost");
- smtpAppender.setSMTPPort(diff);
+ smtpAppender.setSMTPPort(port);
smtpAppender.setSubject(TEST_SUBJECT);
smtpAppender.addTo("nospam at qos.ch");
// smtpAppender.start();
More information about the logback-dev
mailing list