james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r452895 - in /james/server/trunk/src/test/org/apache/james: pop3server/POP3ServerTest.java test/mock/javaxmail/MockMimeMessage.java
Date Wed, 04 Oct 2006 14:29:24 GMT
Author: norman
Date: Wed Oct  4 07:29:23 2006
New Revision: 452895

URL: http://svn.apache.org/viewvc?view=rev&rev=452895
Log:
Junit test for JAMES-649. 

Modified:
    james/server/trunk/src/test/org/apache/james/pop3server/POP3ServerTest.java
    james/server/trunk/src/test/org/apache/james/test/mock/javaxmail/MockMimeMessage.java

Modified: james/server/trunk/src/test/org/apache/james/pop3server/POP3ServerTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/test/org/apache/james/pop3server/POP3ServerTest.java?view=diff&rev=452895&r1=452894&r2=452895
==============================================================================
--- james/server/trunk/src/test/org/apache/james/pop3server/POP3ServerTest.java (original)
+++ james/server/trunk/src/test/org/apache/james/pop3server/POP3ServerTest.java Wed Oct  4
07:29:23 2006
@@ -42,6 +42,7 @@
 import org.apache.james.userrepository.MockUsersRepository;
 import org.apache.james.util.POP3BeforeSMTPHelper;
 import org.apache.james.util.connection.SimpleConnectionManager;
+import org.apache.mailet.Mail;
 import org.apache.mailet.MailAddress;
 
 import javax.mail.MessagingException;
@@ -458,5 +459,57 @@
         assertTrue(POP3BeforeSMTPHelper.isAuthorized("127.0.0.1"));
         ContainerUtil.dispose(mockMailRepository);
     }
+    
+    
+
+    /*
+     * See JAMES-649
+     * The same happens when using RETR
+     *     
+     * Comment to not broke the builds!
+     *
+    public void testOOMTop() throws Exception {
+        finishSetUp(m_testConfiguration);
+
+        int messageCount = 30000;
+        m_pop3Protocol = new POP3Client();
+        m_pop3Protocol.connect("127.0.0.1",m_pop3ListenerPort);
+
+        m_usersRepository.addUser("foo", "bar");
+        InMemorySpoolRepository mockMailRepository = new InMemorySpoolRepository();
+        
+        Mail m = new MailImpl();
+        m.setMessage(Util.createMimeMessage("X-TEST", "test"));
+        for (int i = 1; i < messageCount+1; i++ ) {
+            m.setName("test" + i);
+            mockMailRepository.store(m);
+        }
+
+        m_mailServer.setUserInbox("foo", mockMailRepository);
+
+        // not authenticated
+        POP3MessageInfo[] entries = m_pop3Protocol.listMessages();
+        assertNull(entries);
+
+        m_pop3Protocol.login("foo", "bar");
+        System.err.println(m_pop3Protocol.getState());
+        assertEquals(1, m_pop3Protocol.getState());
+
+        entries = m_pop3Protocol.listMessages();
+        assertEquals(1, m_pop3Protocol.getState());
+
+        assertNotNull(entries);
+        assertEquals(entries.length, messageCount);
+        
+        for (int i = 1; i < messageCount+1; i++ ) {
+            Reader r = m_pop3Protocol.retrieveMessageTop(i, 100);
+            assertNotNull(r);
+            r.close();
+        }
+        
+        ContainerUtil.dispose(mockMailRepository);
+    }
+    */
+    
 
 }

Modified: james/server/trunk/src/test/org/apache/james/test/mock/javaxmail/MockMimeMessage.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/test/org/apache/james/test/mock/javaxmail/MockMimeMessage.java?view=diff&rev=452895&r1=452894&r2=452895
==============================================================================
--- james/server/trunk/src/test/org/apache/james/test/mock/javaxmail/MockMimeMessage.java
(original)
+++ james/server/trunk/src/test/org/apache/james/test/mock/javaxmail/MockMimeMessage.java
Wed Oct  4 07:29:23 2006
@@ -28,6 +28,7 @@
 import javax.mail.search.SearchTerm;
 import javax.activation.DataHandler;
 import java.util.*;
+import java.io.ByteArrayInputStream;
 import java.io.InputStream;
 import java.io.IOException;
 import java.io.OutputStream;
@@ -263,7 +264,10 @@
     }
 
     public InputStream getRawInputStream() throws MessagingException {
-        return null; // trivial implementation
+        if (m_content instanceof String) {
+            return new ByteArrayInputStream(m_content.toString().getBytes());
+        }
+        throw new UnsupportedOperationException("Unimplementated method");
     }
 
     public synchronized DataHandler getDataHandler() throws MessagingException {



---------------------------------------------------------------------
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