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.3 2004/09/15 04:58:56 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  	
48  /*	public void testSendMailSimpl() throws Exception {
49  		String classPath = "/com/ozacc/mail/test-mail4.xml";
50  		Mail mail = builder.buildMail(classPath);
51  		mail.addTo(email);
52  
53  		sendMail.send(mail);
54  	}
55  
56  	
57  	public void testSendMailWithAttachmentFile() throws Exception {
58  		String classPath = "/com/ozacc/mail/test-mail4.xml";
59  		Mail mail = builder.buildMail(classPath);
60  		mail.addTo(email);
61  
62  		File image1 = new File("src/test/com/ozacc/mail/image1.jpg");
63  		File image2 = new File("src/test/com/ozacc/mail/image2.png");
64  
65  		MultipartMail mm = new MultipartMail(mail);
66  		mm.addFile(image1);
67  		mm.addFile(image2, "ÌûÖÚ²èÁ?.png");
68  		mm.setSubject("źÉÕ¥Õ¥¡¥¤¥?Á÷¿®¥Æ¥¹¥È");
69  
70  		sendMail.send(mm);
71  	}
72  
73  	public void testSendMailHTML() throws Exception {
74  		String classPath = "/com/ozacc/mail/test-mail5-html.xml";
75  		Mail mail = builder.buildMail(classPath);
76  		mail.addTo(email);
77  
78  		MultipartMail mm = new MultipartMail(mail);
79  		mm.setHtmlText(mm.getText());
80  		mm.setText("¥×¥?¡¼¥ó¥Æ¥­¥¹¥È");
81  		sendMail.send(mm);
82  	}
83  
84  	public void testSendMailHTMLWithAttachmentFile() throws Exception {
85  		String classPath = "/com/ozacc/mail/test-mail5-html.xml";
86  		Mail mail = builder.buildMail(classPath);
87  		mail.addTo(email);
88  
89  		MultipartMail mm = new MultipartMail(mail);
90  		mm.setHtmlText(mm.getText());
91  		mm.setText("¥×¥?¡¼¥ó¥Æ¥­¥¹¥È");
92  
93  		File image1 = new File("src/test/com/ozacc/mail/image1.jpg");
94  		mm.addFile(image1);
95  
96  		sendMail.send(mm);
97  	}*/
98  
99  	/***
100 	 * ¥Æ¥¹¥È¥±¡¼¥¹¤¬¤Ò¤È¤Ä¤â¤Ê¤¤¤È¥¨¥é¡¼¤Ë¤Ê¤?¤Î¤Ç¡¢¥À¥ß¡¼¡£
101 	 */
102 	public void testSendMailSuccess() {
103 		Mail mail;
104 		assertTrue(true);
105 	}
106 
107 }