james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r422770 - /james/server/trunk/src/test/org/apache/james/smtpserver/SMTPServerTest.java
Date Mon, 17 Jul 2006 17:41:10 GMT
Author: norman
Date: Mon Jul 17 10:41:09 2006
New Revision: 422770

URL: http://svn.apache.org/viewvc?rev=422770&view=rev
Log:
Add junit test to get sure it works with the new commit again

Modified:
    james/server/trunk/src/test/org/apache/james/smtpserver/SMTPServerTest.java

Modified: james/server/trunk/src/test/org/apache/james/smtpserver/SMTPServerTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/test/org/apache/james/smtpserver/SMTPServerTest.java?rev=422770&r1=422769&r2=422770&view=diff
==============================================================================
--- james/server/trunk/src/test/org/apache/james/smtpserver/SMTPServerTest.java (original)
+++ james/server/trunk/src/test/org/apache/james/smtpserver/SMTPServerTest.java Mon Jul 17
10:41:09 2006
@@ -1121,4 +1121,34 @@
         assertNotNull("mail received by mail server", m_mailServer
                 .getLastMail());
     }
+    
+   
+    public void testDNSRBLRejectWorks() throws Exception {
+        m_testConfiguration.setAuthorizedAddresses("192.168.0.1/32");
+        m_testConfiguration.useRBL(true);
+        finishSetUp(m_testConfiguration);
+
+        m_dnsServer.setLocalhostByName(InetAddress.getByName("127.0.0.1"));
+
+        SMTPClient smtpProtocol = new SMTPClient();
+        smtpProtocol.connect("127.0.0.1", m_smtpListenerPort);
+
+        smtpProtocol.sendCommand("ehlo", InetAddress.getLocalHost().toString());
+
+        String sender = "test_user_smtp@localhost";
+
+        smtpProtocol.setSender(sender);
+
+        smtpProtocol.addRecipient("mail@sample.com");
+        assertEquals("reject", 550, smtpProtocol
+                .getReplyCode());
+
+        smtpProtocol.sendShortMessageData("Subject: test\r\n\r\nTest body\r\n");
+
+        smtpProtocol.quit();
+
+        // mail was rejected by SMTPServer
+        assertNull("mail reject by mail server", m_mailServer
+                .getLastMail());
+    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message