package com.ozacc.mail.impl;

import junit.framework.TestCase;

import org.apache.log4j.BasicConfigurator;

import com.ozacc.mail.Mail;
import com.ozacc.mail.MailBuilder;

/**
 * SendMailProImplクラスのテストケース。実際に送信し、メーラーで受信して確認するテストです。
 * 
 * @author Tomohiro Otsuka
 * @version $Id: SendMailProImplRealTest.java,v 1.1.2.1 2005/01/23 06:51:27 otsuka Exp $
 */
public class SendMailProImplRealTest extends TestCase {

	private MailBuilder builder;

	private String email;

	private String envelopeTo;

	private SendMailProImpl sendMail;

	/*
	 * @see TestCase#setUp()
	 */
	protected void setUp() throws Exception {
		super.setUp();

		BasicConfigurator.configure();

		email = "to@example.com";
		envelopeTo = "to@example.com";

		String host = "localhost";
		sendMail = new SendMailProImpl(host);
		sendMail.setMessageId("example.com");

		builder = new XMLMailBuilderImpl();
	}

	/**
	 * @see junit.framework.TestCase#tearDown()
	 */
	protected void tearDown() throws Exception {
		BasicConfigurator.resetConfiguration();
	}

	/*	public void testSendMailWithAttachmentInputStream() throws Exception {
	 String classPath = "/com/ozacc/mail/test-mail4.xml";
	 Mail mail = builder.buildMail(classPath);
	 mail.addTo(email);

	 File image1 = new File("src/test/com/ozacc/mail/image1.jpg");
	 FileInputStream fis = new FileInputStream(image1);

	 mail.addFile(fis, "野菜画像.jpg");
	 mail.setSubject("添付ファイルのInputStream送信テスト");

	 sendMail.connect();
	 sendMail.send(mail);
	 sendMail.disconnect();
	 }

	 public void testSendMailEnvelopeTo() throws Exception {
	 String classPath = "/com/ozacc/mail/test-mail4.xml";
	 Mail mail = builder.buildMail(classPath);
	 mail.addTo(email);
	 mail.addEnvelopeTo(envelopeTo);

	 sendMail.connect();
	 sendMail.send(mail);
	 sendMail.disconnect();
	 }*/

	/**
	 * テストケースがひとつもないとエラーになるので、ダミー。
	 */
	public void testSendMailSuccess() {
		Mail mail;
		assertTrue(true);
	}

}