1 package com.ozacc.mail.impl; 2 3 import junit.framework.TestCase; 4 5 import org.apache.log4j.BasicConfigurator; 6 7 import com.ozacc.mail.Mail; 8 import com.ozacc.mail.MailBuilder; 9 10 /*** 11 * SendMailImpl¥¯¥é¥¹¤Î¥Æ¥¹¥È¥±¡¼¥¹¡£¼ÂºÝ¤ËÁ÷¿®¤·¡¢¥á¡¼¥é¡¼¤Ç¼õ¿®¤·¤Æ³Îǧ¤¹¤?¥Æ¥¹¥È¤Ç¤¹¡£ 12 * 13 * @author Tomohiro Otsuka 14 * @version $Id: SendMailImplRealTest.java,v 1.5 2004/09/18 00:42:57 otsuka Exp $ 15 */ 16 public class SendMailImplRealTest extends TestCase { 17 18 private MailBuilder builder; 19 20 private String email; 21 22 private SendMailImpl sendMail; 23 24 /* 25 * @see TestCase#setUp() 26 */ 27 protected void setUp() throws Exception { 28 super.setUp(); 29 30 BasicConfigurator.configure(); 31 32 email = "to@example.com"; 33 34 String host = "192.168.0.10"; 35 sendMail = new SendMailImpl(host); 36 37 builder = new XMLMailBuilderImpl(); 38 } 39 40 /*** 41 * @see junit.framework.TestCase#tearDown() 42 */ 43 protected void tearDown() throws Exception { 44 BasicConfigurator.resetConfiguration(); 45 } 46 47 /* public void testSendMailWithAttachmentInputStream() throws Exception { 48 String classPath = "/com/ozacc/mail/test-mail4.xml"; 49 Mail mail = builder.buildMail(classPath); 50 mail.addTo(email); 51 52 File image1 = new File("src/test/com/ozacc/mail/image1.jpg"); 53 FileInputStream fis = new FileInputStream(image1); 54 55 mail.addFile(fis, "ÌûÖÚ²èÁ?.jpg"); 56 mail.setSubject("źÉÕ¥Õ¥¡¥¤¥?¤ÎInputStreamÁ÷¿®¥Æ¥¹¥È"); 57 58 sendMail.send(mail); 59 } 60 61 public void testSendMailSimpl() throws Exception { 62 String classPath = "/com/ozacc/mail/test-mail4.xml"; 63 Mail mail = builder.buildMail(classPath); 64 mail.addTo(email); 65 66 sendMail.send(mail); 67 } 68 69 public void testSendMailWithAttachmentFile() throws Exception { 70 String classPath = "/com/ozacc/mail/test-mail4.xml"; 71 Mail mail = builder.buildMail(classPath); 72 mail.addTo(email); 73 74 File image1 = new File("src/test/com/ozacc/mail/image1.jpg"); 75 File image2 = new File("src/test/com/ozacc/mail/image2.png"); 76 77 mail.addFile(image1); 78 mail.addFile(image2, "ÌûÖÚ²èÁ?.png"); 79 mail.setSubject("źÉÕ¥Õ¥¡¥¤¥?Á÷¿®¥Æ¥¹¥È"); 80 81 sendMail.send(mail); 82 } 83 84 public void testSendMailHTML() throws Exception { 85 String classPath = "/com/ozacc/mail/test-mail5-html.xml"; 86 Mail mail = builder.buildMail(classPath); 87 mail.addTo(email); 88 mail.setHtmlText(mail.getText()); 89 mail.setText("¥×¥?¡¼¥ó¥Æ¥¥¹¥È"); 90 sendMail.send(mail); 91 } 92 93 public void testSendMailHTMLWithAttachmentFile() throws Exception { 94 String classPath = "/com/ozacc/mail/test-mail5-html.xml"; 95 Mail mail = builder.buildMail(classPath); 96 mail.addTo(email); 97 mail.setHtmlText(mail.getText()); 98 mail.setText("¥×¥?¡¼¥ó¥Æ¥¥¹¥È"); 99 100 File image1 = new File("src/test/com/ozacc/mail/image1.jpg"); 101 mail.addFile(image1); 102 103 sendMail.send(mail); 104 }*/ 105 106 /*** 107 * ¥Æ¥¹¥È¥±¡¼¥¹¤¬¤Ò¤È¤Ä¤â¤Ê¤¤¤È¥¨¥é¡¼¤Ë¤Ê¤?¤Î¤Ç¡¢¥À¥ß¡¼¡£ 108 */ 109 public void testSendMailSuccess() { 110 Mail mail; 111 assertTrue(true); 112 } 113 114 }