1   /*
2    * Created by IntelliJ IDEA.
3    * User: owen
4    * Date: Nov 25, 2002
5    * Time: 9:23:34 AM
6    * CVS Revision: $Revision: 1.7 $
7    * Last CVS Commit: $Date: 2004/01/06 05:43:19 $
8    * Author of last CVS Commit: $Author: dloeng $
9    * To change this template use Options | File Templates.
10   */
11  package test.mock.mail.server;
12  
13  import com.atlassian.mail.MailException;
14  import com.atlassian.mail.MailUtils;
15  import com.atlassian.mail.Email;
16  import com.atlassian.mail.server.impl.SMTPMailServerImpl;
17  import test.mock.mail.MockAuthenticator;
18  import test.mock.mail.MockSession;
19  
20  import javax.mail.Authenticator;
21  import javax.mail.internet.AddressException;
22  import javax.mail.internet.InternetAddress;
23  import javax.naming.NamingException;
24  
25  import alt.javax.mail.Session;
26  
27  public class MockSMTPMailServer extends SMTPMailServerImpl
28  {
29      Session mockSession;
30  
31      public MockSMTPMailServer(Long id, String name, String description, String from, String prefix, boolean isSession, String location, String username, String password)
32      {
33          super(id, name, description, from, prefix, isSession, location, username, password);
34      }
35  
36      public void send(Email email) throws MailException
37      {
38          super.send(email);
39      }
40  
41      public InternetAddress[] parseAddresses(String addresses) throws AddressException
42      {
43          return MailUtils.parseAddresses(addresses);
44      }
45  
46      public String getDefaultFrom()
47      {
48          return super.getDefaultFrom();
49      }
50  
51      public void setDefaultFrom(String from)
52      {
53          super.setDefaultFrom(from);
54      }
55  
56      public String getPrefix()
57      {
58          return super.getPrefix();
59      }
60  
61      public void setPrefix(String prefix)
62      {
63          super.setPrefix(prefix);
64      }
65  
66      public void setSessionServer(boolean sessionServer)
67      {
68          super.setSessionServer(sessionServer);
69      }
70  
71  
72      public Session getSession() throws NamingException, MailException
73      {
74          if (mockSession == null)
75              mockSession = new MockSession();
76          return mockSession;
77      }
78  }