james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r1078713 - /james/server/trunk/pop3server/src/test/java/org/apache/james/pop3server/POP3ServerTest.java
Date Mon, 07 Mar 2011 08:45:57 GMT
Author: norman
Date: Mon Mar  7 08:45:57 2011
New Revision: 1078713

URL: http://svn.apache.org/viewvc?rev=1078713&view=rev
Log:
Add junit test to prove that UIDL, LIST and STAT show the same message numbers. As it pass
it seem like the problem is in the JPA implementation. See JAMES-1202

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

Modified: james/server/trunk/pop3server/src/test/java/org/apache/james/pop3server/POP3ServerTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/pop3server/src/test/java/org/apache/james/pop3server/POP3ServerTest.java?rev=1078713&r1=1078712&r2=1078713&view=diff
==============================================================================
--- james/server/trunk/pop3server/src/test/java/org/apache/james/pop3server/POP3ServerTest.java
(original)
+++ james/server/trunk/pop3server/src/test/java/org/apache/james/pop3server/POP3ServerTest.java
Mon Mar  7 08:45:57 2011
@@ -446,6 +446,48 @@ public class POP3ServerTest extends Test
         mailbox.appendMessage(new ByteArrayInputStream(content2), new Date(), session, true,
new Flags());
     }
 
+    // Test for JAMES-1202
+    // Which shows that UIDL,STAT and LIST all show the same message numbers
+    public void testStatUidlList() throws Exception {
+        finishSetUp(m_testConfiguration);
+
+        m_pop3Protocol = new POP3Client();
+        m_pop3Protocol.connect("127.0.0.1",m_pop3ListenerPort);
+
+        m_usersRepository.addUser("foo2", "bar2");
+
+        MailboxPath mailboxPath = new MailboxPath(MailboxConstants.USER_NAMESPACE, "foo2",
"INBOX");
+        MailboxSession session = manager.login("foo2", "bar2", LoggerFactory.getLogger("Test"));
+        
+        if (manager.mailboxExists(mailboxPath, session) == false) {
+            manager.createMailbox(mailboxPath, session);
+        }
+        
+        int msgCount = 100;
+        for (int i = 0; i < msgCount;i++) {
+            manager.getMailbox(mailboxPath, session).appendMessage(new ByteArrayInputStream(("Subject:
test\r\n\r\n" +i).getBytes()), new Date(), session, true, new Flags());
+        }
+        
+        m_pop3Protocol.login("foo2", "bar2");
+        assertEquals(1, m_pop3Protocol.getState());
+
+        POP3MessageInfo[] listEntries = m_pop3Protocol.listMessages();
+        POP3MessageInfo[] uidlEntries = m_pop3Protocol.listUniqueIdentifiers();
+        POP3MessageInfo statInfo = m_pop3Protocol.status();
+        assertEquals(msgCount, listEntries.length);
+        assertEquals(msgCount, uidlEntries.length);
+        assertEquals(msgCount, statInfo.number);
+
+        m_pop3Protocol.sendCommand("quit");
+        m_pop3Protocol.disconnect();
+
+        m_pop3Protocol.connect("127.0.0.1",m_pop3ListenerPort);
+
+        m_pop3Protocol.login("foo2", "bar2");
+        assertEquals(1, m_pop3Protocol.getState());
+
+        manager.deleteMailbox(mailboxPath, session);
+    }
     /*
     public void testTwoSimultaneousMails() throws Exception {
         finishSetUp(m_testConfiguration);



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