1   /*
2    * Copyright 2001-2005 The Apache Software Foundation
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.apache.commons.mail.mocks;
17  
18  import java.util.List;
19  import java.util.Map;
20  
21  import javax.mail.Authenticator;
22  import javax.mail.Session;
23  import javax.mail.internet.InternetAddress;
24  import javax.mail.internet.MimeMessage;
25  import javax.mail.internet.MimeMultipart;
26  
27  import org.apache.commons.mail.Email;
28  import org.apache.commons.mail.EmailException;
29  
30  /**
31   * Concrete Implementation on the Abstract Email
32   * Class (used to allow testing only).  Supplies
33   * getters for methods that normally only have setters.
34   *
35   * @since 1.0
36   * @author <a href="mailto:corey.scott@gmail.com">Corey Scott</a>
37   * @version $Id: MockEmailConcrete.java 240033 2005-08-25 10:03:05Z henning $
38   */
39  public class MockEmailConcrete extends Email
40  {
41  
42      /**
43       * Not Implemented, should be implemented in subclasses of Email
44       * @param msg The email message
45       * @return Email msg.
46       */
47      public Email setMsg(String msg)
48      {
49          // This abstract method should be tested in the concrete
50          // implementation classes only.
51          return null;
52      }
53  
54      /**
55       * Retrieve the current debug setting
56       * @return debug
57       */
58      public boolean isDebug()
59      {
60          return this.debug;
61      }
62  
63      /**
64       * Retrieve the current authentication setting
65       * @return Authenticator Authenticator
66       */
67      public Authenticator getAuthenticator()
68      {
69          return this.authenticator;
70      }
71  
72      /**
73       * @return bccList
74       */
75      public List getBccList()
76      {
77          return this.bccList;
78      }
79  
80      /**
81       * @return ccList
82       */
83      public List getCcList()
84      {
85          return this.ccList;
86      }
87  
88      /**
89       * @return charset
90       */
91      public String getCharset()
92      {
93          return this.charset;
94      }
95  
96      /**
97       * @return content
98       */
99      public Object getContentObject()
100     {
101         return this.content;
102     }
103 
104     /**
105      * @return content
106      */
107     public MimeMultipart getContentMimeMultipart()
108     {
109         return this.emailBody;
110     }
111 
112     /**
113      * @return emailBody
114      */
115     public MimeMultipart getEmailBody()
116     {
117         return this.emailBody;
118     }
119 
120     /**
121      * @return fromAddress
122      */
123     public InternetAddress getFromAddress()
124     {
125         return this.fromAddress;
126     }
127 
128     /**
129      * @return headers
130      */
131     public Map getHeaders()
132     {
133         return this.headers;
134     }
135 
136     /**
137      * @return hostName
138      */
139     public String getHostName()
140     {
141         return this.hostName;
142     }
143 
144     /**
145      * @return message
146      */
147     public MimeMessage getMessage()
148     {
149         return this.message;
150     }
151 
152     /**
153      * @return popHost
154      */
155     public String getPopHost()
156     {
157         return this.popHost;
158     }
159 
160     /**
161      * @return popPassword
162      */
163     public String getPopPassword()
164     {
165         return this.popPassword;
166     }
167 
168     /**
169      * @return popUsername
170      */
171     public String getPopUsername()
172     {
173         return this.popUsername;
174     }
175 
176     /**
177      * @return replyList
178      */
179     public List getReplyList()
180     {
181         return this.replyList;
182     }
183 
184     /**
185      * @return smtpPort
186      */
187     public String getSmtpPort()
188     {
189         return this.smtpPort;
190     }
191 
192     /**
193      * @return subject
194      */
195     public String getSubject()
196     {
197         return this.subject;
198     }
199 
200     /**
201      * @return toList
202      */
203     public List getToList()
204     {
205         return this.toList;
206     }
207 
208     /**
209      * @return contentType
210      */
211     public String getContentType()
212     {
213         return contentType;
214     }
215 
216     /**
217      * @return popBeforeSmtp
218      */
219     public boolean isPopBeforeSmtp()
220     {
221         return popBeforeSmtp;
222     }
223 
224     /**
225      * @return Session
226      * @throws EmailException EmailException
227      */
228     public Session getSession()
229         throws EmailException
230     {
231         return this.getMailSession();
232     }
233 
234 }