OSDN Git Service

CVS最新版の全ファイルを追加
[spring-ext/ozacc-mail.git] / src / test / com / ozacc / mail / impl / SendMailProImplRealTest.java
1 package com.ozacc.mail.impl;\r
2 \r
3 import junit.framework.TestCase;\r
4 \r
5 import org.apache.log4j.BasicConfigurator;\r
6 \r
7 import com.ozacc.mail.Mail;\r
8 import com.ozacc.mail.MailBuilder;\r
9 \r
10 /**\r
11  * SendMailProImplクラスのテストケース。実際に送信し、メーラーで受信して確認するテストです。\r
12  * \r
13  * @author Tomohiro Otsuka\r
14  * @version $Id: SendMailProImplRealTest.java,v 1.1.2.1 2005/01/23 06:51:27 otsuka Exp $\r
15  */\r
16 public class SendMailProImplRealTest extends TestCase {\r
17 \r
18         private MailBuilder builder;\r
19 \r
20         private String email;\r
21 \r
22         private String envelopeTo;\r
23 \r
24         private SendMailProImpl sendMail;\r
25 \r
26         /*\r
27          * @see TestCase#setUp()\r
28          */\r
29         protected void setUp() throws Exception {\r
30                 super.setUp();\r
31 \r
32                 BasicConfigurator.configure();\r
33 \r
34                 email = "to@example.com";\r
35                 envelopeTo = "to@example.com";\r
36 \r
37                 String host = "localhost";\r
38                 sendMail = new SendMailProImpl(host);\r
39                 sendMail.setMessageId("example.com");\r
40 \r
41                 builder = new XMLMailBuilderImpl();\r
42         }\r
43 \r
44         /**\r
45          * @see junit.framework.TestCase#tearDown()\r
46          */\r
47         protected void tearDown() throws Exception {\r
48                 BasicConfigurator.resetConfiguration();\r
49         }\r
50 \r
51         /*      public void testSendMailWithAttachmentInputStream() throws Exception {\r
52          String classPath = "/com/ozacc/mail/test-mail4.xml";\r
53          Mail mail = builder.buildMail(classPath);\r
54          mail.addTo(email);\r
55 \r
56          File image1 = new File("src/test/com/ozacc/mail/image1.jpg");\r
57          FileInputStream fis = new FileInputStream(image1);\r
58 \r
59          mail.addFile(fis, "野菜画像.jpg");\r
60          mail.setSubject("添付ファイルのInputStream送信テスト");\r
61 \r
62          sendMail.connect();\r
63          sendMail.send(mail);\r
64          sendMail.disconnect();\r
65          }\r
66 \r
67          public void testSendMailEnvelopeTo() throws Exception {\r
68          String classPath = "/com/ozacc/mail/test-mail4.xml";\r
69          Mail mail = builder.buildMail(classPath);\r
70          mail.addTo(email);\r
71          mail.addEnvelopeTo(envelopeTo);\r
72 \r
73          sendMail.connect();\r
74          sendMail.send(mail);\r
75          sendMail.disconnect();\r
76          }*/\r
77 \r
78         /**\r
79          * テストケースがひとつもないとエラーになるので、ダミー。\r
80          */\r
81         public void testSendMailSuccess() {\r
82                 Mail mail;\r
83                 assertTrue(true);\r
84         }\r
85 \r
86 }