Update of /cvsroot/mrpostman/mrpostman/src/org/mrbook/mrpostman/maildotcom
In directory sc8-pr-cvs1:/tmp/cvs-serv13660/mrpostman/src/org/mrbook/mrpostman/maildotcom
Modified Files:
MailDotComMessageParser.java MailDotComMessageParserTest.java
Log Message:
Ongoing fixes and tests.
Index: MailDotComMessageParser.java
===================================================================
RCS file: /cvsroot/mrpostman/mrpostman/src/org/mrbook/mrpostman/maildotcom/MailDotComMessageParser.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** MailDotComMessageParser.java 12 Jan 2004 22:27:39 -0000 1.1
--- MailDotComMessageParser.java 15 Jan 2004 10:35:32 -0000 1.2
***************
*** 287,291 ****
boolean addLineToBody = false;
!
if (bodyDelimiter.equals(TEXT_BODY_START_DELIM)) {
// check if we have finished the body part...
--- 287,292 ----
boolean addLineToBody = false;
! String line2 = line;
!
if (bodyDelimiter.equals(TEXT_BODY_START_DELIM)) {
// check if we have finished the body part...
***************
*** 297,300 ****
--- 298,303 ----
state = FINDING_ATTACHMENT;
} else {
+ // Text emails can contain HTML quoted characters e.g. > and "e...
+ line2 = unescape(line);
//Add this line to our body content...
addLineToBody = true;
***************
*** 317,321 ****
if (addLineToBody) {
! message.addBodyLine(line);
}
}
--- 320,324 ----
if (addLineToBody) {
! message.addBodyLine(line2);
}
}
Index: MailDotComMessageParserTest.java
===================================================================
RCS file: /cvsroot/mrpostman/mrpostman/src/org/mrbook/mrpostman/maildotcom/MailDotComMessageParserTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** MailDotComMessageParserTest.java 12 Jan 2004 22:27:39 -0000 1.1
--- MailDotComMessageParserTest.java 15 Jan 2004 10:35:32 -0000 1.2
***************
*** 41,57 ****
//FILE1 = HTML with TXT attachment...
! public static final String MSG_FILE1 = "test/mesg1.mail.htm";
//FILE2 = HTML with ZIP attachment...
! public static final String MSG_FILE2 = "test/mesg2.mail.htm";
//FILE3 = TEXT body...
! public static final String MSG_FILE3 = "test/mesg3.mail.htm";
//FILE4 = HTML with HTML attachment...
! public static final String MSG_FILE4 = "test/mesg4.mail.htm";
//FILE5 - HTML with image attachment...
! public static final String MSG_FILE5 = "test/mesg5.mail.htm";
//FILE6 - HTML with 2 zip attachments...
! public static final String MSG_FILE6 = "test/mesg6.mail.htm";
//FILE7 - Multipart/alternative HTML and TEXT
! public static final String MSG_FILE7 = "test/mesg7.mail.htm";
public MailDotComMessageParserTest(String name) {
--- 41,61 ----
//FILE1 = HTML with TXT attachment...
! public static final String MSG_FILE1 = "test/maildotcom/mesg1.mail.htm";
//FILE2 = HTML with ZIP attachment...
! public static final String MSG_FILE2 = "test/maildotcom/mesg2.mail.htm";
//FILE3 = TEXT body...
! public static final String MSG_FILE3 = "test/maildotcom/mesg3.mail.htm";
//FILE4 = HTML with HTML attachment...
! public static final String MSG_FILE4 = "test/maildotcom/mesg4.mail.htm";
//FILE5 - HTML with image attachment...
! public static final String MSG_FILE5 = "test/maildotcom/mesg5.mail.htm";
//FILE6 - HTML with 2 zip attachments...
! public static final String MSG_FILE6 = "test/maildotcom/mesg6.mail.htm";
//FILE7 - Multipart/alternative HTML and TEXT
! public static final String MSG_FILE7 = "test/maildotcom/mesg7.mail.htm";
! // FILE8 - TEXT with quoted HTML characters (reply)
! public static final String MSG_FILE8 = "test/maildotcom/mesg8.mail.htm";
! // FILE9 - TEXT with quoted HTML characters (reply)
! public static final String MSG_FILE9 = "test/maildotcom/mesg9.mail.htm";
public MailDotComMessageParserTest(String name) {
***************
*** 226,230 ****
}
}
!
private MailMessage runParser(String fileName) throws Exception {
BufferedReader br = new BufferedReader( new FileReader(fileName));
--- 230,264 ----
}
}
!
! /**
! * This test verifies that the Header code and the TEXT body code works correctly.
! * when the text message contains quoted HTML characters e.g. >
! * @throws Exception
! */
! public void testParserFile8() throws Exception {
! try {
! MailMessage msg = runParser(MSG_FILE8);
! // check headers...
! // correct!
! } catch (Exception e) {
! fail("Exception " + e.getMessage());
! }
! }
!
! /**
! * This test verifies that the Header code and the TEXT body code works correctly.
! * when the text message contains quoted HTML characters e.g. >
! * @throws Exception
! */
! public void testParserFile9() throws Exception {
! try {
! MailMessage msg = runParser(MSG_FILE9);
! // check headers...
! // correct!
! } catch (Exception e) {
! fail("Exception " + e.getMessage());
! }
! }
!
private MailMessage runParser(String fileName) throws Exception {
BufferedReader br = new BufferedReader( new FileReader(fileName));
|