Methods Summary |
---|
public boolean | addUser(java.lang.String userName, java.lang.String password)
m_users.addUser(userName, password);
return true;
|
public synchronized java.lang.String | getId()
m_counter++;
return "MockMailServer-ID-" + m_counter;
|
public java.lang.Object[] | getLastMail()
if (mails.size() == 0) return null;
return (Object[])mails.get(mails.size()-1);
|
public java.util.Map | getRepositoryCounters()
return null; // trivial implementation
|
public org.apache.james.services.MailRepository | getUserInbox(java.lang.String userName)
if (inboxes==null) {
return null;
} else {
return (MailRepository) inboxes.get(userName);
}
|
public org.apache.james.userrepository.MockUsersRepository | getUsersRepository()
return m_users;
|
public boolean | isLocalServer(java.lang.String serverName)
return "localhost".equals(serverName);
|
public void | sendMail(org.apache.mailet.MailAddress sender, java.util.Collection recipients, javax.mail.internet.MimeMessage msg)
Object[] mailObjects = new Object[]{sender, recipients, new MimeMessageCopyOnWriteProxy(msg)};
mails.add(mailObjects);
|
public void | sendMail(org.apache.mailet.MailAddress sender, java.util.Collection recipients, java.io.InputStream msg)
Object[] mailObjects = new Object[]{sender, recipients, msg};
mails.add(mailObjects);
|
public void | sendMail(org.apache.mailet.Mail mail)
int bodySize = mail.getMessage().getSize();
try {
if (m_maxMessageSizeBytes != 0 && m_maxMessageSizeBytes < bodySize) throw new MessageSizeException();
} catch (MessageSizeException e) {
throw new MessagingException("message size exception is nested", e);
}
sendMail(mail.getSender(), mail.getRecipients(), mail.getMessage());
|
public void | sendMail(javax.mail.internet.MimeMessage message)
// taken from class org.apache.james.James
MailAddress sender = new MailAddress((InternetAddress)message.getFrom()[0]);
Collection recipients = new HashSet();
Address addresses[] = message.getAllRecipients();
if (addresses != null) {
for (int i = 0; i < addresses.length; i++) {
// Javamail treats the "newsgroups:" header field as a
// recipient, so we want to filter those out.
if ( addresses[i] instanceof InternetAddress ) {
recipients.add(new MailAddress((InternetAddress)addresses[i]));
}
}
}
sendMail(sender, recipients, message);
|
public void | setMaxMessageSizeBytes(int maxMessageSizeBytes)
m_maxMessageSizeBytes = maxMessageSizeBytes;
|
public void | setUserInbox(java.lang.String userName, org.apache.james.services.MailRepository inbox)
if (inboxes == null) {
inboxes = new HashMap();
}
inboxes.put(userName,inbox);
|