IMAP: additional test cases

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1507 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-10-14 21:40:00 +00:00
parent 7532c0f57a
commit fac66c021f
1 changed files with 23 additions and 15 deletions

View File

@ -32,12 +32,13 @@ import java.util.Random;
/** /**
* IMAP tests, an instance of DavMail Gateway must be available * IMAP tests, an instance of DavMail Gateway must be available
*/ */
@SuppressWarnings({"JavaDoc", "UseOfSystemOutOrSystemErr"})
public class TestImap extends AbstractDavMailTestCase { public class TestImap extends AbstractDavMailTestCase {
static Socket clientSocket; static Socket clientSocket;
static BufferedWriter socketWriter; static BufferedWriter socketWriter;
static BufferedReader socketReader; static BufferedReader socketReader;
static String messageUid = null; static String messageUid;
protected void write(String line) throws IOException { protected void write(String line) throws IOException {
socketWriter.write(line); socketWriter.write(line);
@ -98,11 +99,6 @@ public class TestImap extends AbstractDavMailTestCase {
assertEquals(". OK UID FETCH completed", readFullAnswer(".")); assertEquals(". OK UID FETCH completed", readFullAnswer("."));
} }
public void testFetchBodyStructure() throws IOException {
writeLine(". UID FETCH 1:* (FLAGS BODYSTRUCTURE)");
assertEquals(". OK UID FETCH completed", readFullAnswer("."));
}
public void testUidSearchUnDeleted() throws IOException { public void testUidSearchUnDeleted() throws IOException {
writeLine(". UID SEARCH UNDELETED"); writeLine(". UID SEARCH UNDELETED");
assertEquals(". OK SEARCH completed", readFullAnswer(".")); assertEquals(". OK SEARCH completed", readFullAnswer("."));
@ -310,15 +306,6 @@ public class TestImap extends AbstractDavMailTestCase {
clientSocket = null; clientSocket = null;
} }
public void testBrokenPipe() throws IOException, InterruptedException {
testSelectInbox();
writeLine(". UID FETCH 1:* (RFC822.SIZE BODY.TEXT)");
socketReader.readLine();
// force close connection
clientSocket.close();
Thread.sleep(5000);
}
public void testCopyMessage() throws IOException, InterruptedException, MessagingException { public void testCopyMessage() throws IOException, InterruptedException, MessagingException {
testCreateFolder(); testCreateFolder();
testCreateMessage(); testCreateMessage();
@ -336,4 +323,25 @@ public class TestImap extends AbstractDavMailTestCase {
testDeleteFolder(); testDeleteFolder();
} }
public void testFetchInboxEnvelope() throws IOException {
testSelectInbox();
writeLine(". UID FETCH 1:* (ENVELOPE)");
assertEquals(". OK UID FETCH completed", readFullAnswer("."));
}
public void testFetchInboxBodyStructure() throws IOException {
testSelectInbox();
writeLine(". UID FETCH 1:* (BODYSTRUCTURE)");
assertEquals(". OK UID FETCH completed", readFullAnswer("."));
}
public void testBrokenPipe() throws IOException, InterruptedException {
testSelectInbox();
writeLine(". UID FETCH 1:* (RFC822.SIZE BODY.TEXT)");
socketReader.readLine();
// force close connection
clientSocket.close();
Thread.sleep(5000);
}
} }