From: Jeff M. <cus...@us...> - 2002-06-19 15:26:53
|
Update of /cvsroot/mockobjects/mockobjects-java/src/j2ee/common/alt/javax/mail In directory usw-pr-cvs1:/tmp/cvs-serv12913/src/j2ee/common/alt/javax/mail Modified Files: Transport.java TransportImpl.java Added Files: Message.java MessageImpl.java Log Message: Lots of small changes to mocks --- NEW FILE: Message.java --- package alt.javax.mail; import javax.mail.Address; import javax.mail.MessagingException; import javax.mail.Flags; import javax.mail.Multipart; import java.util.Date; import java.util.Enumeration; import java.io.InputStream; import java.io.IOException; import java.io.OutputStream; import java.io.ObjectStreamException; public interface Message { javax.mail.Message getRealMessage(); Address[] getFrom() throws MessagingException; void setFrom() throws MessagingException; void setFrom(Address address) throws MessagingException; void addFrom(Address[] addresses) throws MessagingException; Address[] getRecipients(javax.mail.Message.RecipientType type) throws MessagingException; void setRecipients(javax.mail.Message.RecipientType type, Address[] addresses) throws MessagingException; void addRecipients(javax.mail.Message.RecipientType type, Address[] addresses) throws MessagingException; String getSubject() throws MessagingException; void setSubject(String s) throws MessagingException; Date getSentDate() throws MessagingException; void setSentDate(Date date) throws MessagingException; Date getReceivedDate() throws MessagingException; Flags getFlags() throws MessagingException; void setFlags(Flags flags, boolean b) throws MessagingException; Message reply(boolean b) throws MessagingException; void saveChanges() throws MessagingException; int getSize() throws MessagingException; int getLineCount() throws MessagingException; String getContentType() throws MessagingException; boolean isMimeType(String s) throws MessagingException; String getDisposition() throws MessagingException; void setDisposition(String s) throws MessagingException; String getDescription() throws MessagingException; void setDescription(String s) throws MessagingException; String getFileName() throws MessagingException; void setFileName(String s) throws MessagingException; InputStream getInputStream() throws IOException, MessagingException; javax.activation.DataHandler getDataHandler() throws MessagingException; Object getContent() throws IOException, MessagingException; void setDataHandler(javax.activation.DataHandler handler) throws MessagingException; void setContent(Object o, String s) throws MessagingException; void setText(String s) throws MessagingException; void setContent(Multipart multipart) throws MessagingException; void writeTo(OutputStream stream) throws IOException, MessagingException; String[] getHeader(String s) throws MessagingException; void setHeader(String s, String s1) throws MessagingException; void addHeader(String s, String s1) throws MessagingException; void removeHeader(String s) throws MessagingException; Enumeration getAllHeaders() throws MessagingException; Enumeration getMatchingHeaders(String[] strings) throws MessagingException; Enumeration getNonMatchingHeaders(String[] strings) throws MessagingException; } --- NEW FILE: MessageImpl.java --- package alt.javax.mail; import com.mockobjects.MockObject; import javax.mail.MessagingException; import javax.mail.Address; import javax.mail.Flags; import javax.mail.Multipart; import java.util.Date; import java.util.Enumeration; import java.io.InputStream; import java.io.IOException; import java.io.OutputStream; public class MessageImpl implements Message { private final javax.mail.Message message; public MessageImpl(javax.mail.Message message) { this.message = message; } public javax.mail.Message getRealMessage() { return message; } public final Address[] getFrom() throws MessagingException { return message.getFrom(); } public final void setFrom() throws MessagingException { message.setFrom(); } public final void setFrom(Address address) throws MessagingException { message.setFrom(address); } public final void addFrom(Address[] addresses) throws MessagingException { message.addFrom(addresses); } public final Address[] getRecipients(javax.mail.Message.RecipientType type) throws MessagingException { return message.getRecipients(type); } public final void setRecipients(javax.mail.Message.RecipientType type, Address[] addresses) throws MessagingException { message.setRecipients(type, addresses); } public final void addRecipients(javax.mail.Message.RecipientType type, Address[] addresses) throws MessagingException { message.addRecipients(type, addresses); } public final String getSubject() throws MessagingException { return message.getSubject(); } public final void setSubject(String s) throws MessagingException { message.setSubject(s); } public final Date getSentDate() throws MessagingException { return message.getSentDate(); } public final void setSentDate(Date date) throws MessagingException { message.setSentDate(date); } public final Date getReceivedDate() throws MessagingException { return message.getReceivedDate(); } public final Flags getFlags() throws MessagingException { return message.getFlags(); } public final void setFlags(Flags flags, boolean b) throws MessagingException { message.setFlags(flags, b); } public final Message reply(boolean b) throws MessagingException { return new MessageImpl(message.reply(b)); } public final void saveChanges() throws MessagingException { message.saveChanges(); } public final int getSize() throws MessagingException { return message.getSize(); } public final int getLineCount() throws MessagingException { return message.getLineCount(); } public final String getContentType() throws MessagingException { return message.getContentType(); } public final boolean isMimeType(String s) throws MessagingException { return message.isMimeType(s); } public final String getDisposition() throws MessagingException { return message.getDisposition(); } public final void setDisposition(String s) throws MessagingException { message.setDisposition(s); } public final String getDescription() throws MessagingException { return message.getDescription(); } public final void setDescription(String s) throws MessagingException { message.setDescription(s); } public final String getFileName() throws MessagingException { return message.getFileName(); } public final void setFileName(String s) throws MessagingException { message.setFileName(s); } public final InputStream getInputStream() throws IOException, MessagingException { return message.getInputStream(); } public final javax.activation.DataHandler getDataHandler() throws MessagingException { return message.getDataHandler(); } public final Object getContent() throws IOException, MessagingException { return message.getContent(); } public final void setDataHandler(javax.activation.DataHandler handler) throws MessagingException { message.setDataHandler(handler); } public final void setContent(Object o, String s) throws MessagingException { message.setContent(o, s); } public final void setText(String s) throws MessagingException { message.setText(s); } public final void setContent(Multipart multipart) throws MessagingException { message.setContent(multipart); } public final void writeTo(OutputStream stream) throws IOException, MessagingException { message.writeTo(stream); } public final String[] getHeader(String s) throws MessagingException { return message.getHeader(s); } public final void setHeader(String s, String s1) throws MessagingException { message.setHeader(s, s1); } public final void addHeader(String s, String s1) throws MessagingException { message.addHeader(s, s1); } public final void removeHeader(String s) throws MessagingException { message.removeHeader(s); } public final Enumeration getAllHeaders() throws MessagingException { return message.getAllHeaders(); } public final Enumeration getMatchingHeaders(String[] strings) throws MessagingException { return message.getAllHeaders(); } public final Enumeration getNonMatchingHeaders(String[] strings) throws MessagingException { return message.getNonMatchingHeaders(strings); } } Index: Transport.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/j2ee/common/alt/javax/mail/Transport.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Transport.java 30 Apr 2002 17:03:10 -0000 1.1 +++ Transport.java 19 Jun 2002 15:26:19 -0000 1.2 @@ -1,6 +1,6 @@ package alt.javax.mail; -import javax.mail.Message; +import alt.javax.mail.Message; import javax.mail.MessagingException; import javax.mail.Address; import javax.mail.event.TransportListener; Index: TransportImpl.java =================================================================== RCS file: /cvsroot/mockobjects/mockobjects-java/src/j2ee/common/alt/javax/mail/TransportImpl.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TransportImpl.java 30 Apr 2002 17:03:10 -0000 1.1 +++ TransportImpl.java 19 Jun 2002 15:26:20 -0000 1.2 @@ -1,6 +1,6 @@ package alt.javax.mail; -import javax.mail.Message; +import alt.javax.mail.Message; import javax.mail.MessagingException; import javax.mail.Address; import javax.mail.event.TransportListener; @@ -15,17 +15,17 @@ } public void send(Message message) throws MessagingException{ - transport.send(message); + transport.send(message.getRealMessage()); } public void send(Message message, Address[] addresses) throws MessagingException{ - transport.send(message, addresses); + transport.send(message.getRealMessage(), addresses); } public void sendMessage(Message message, Address[] addresses) throws MessagingException{ - transport.sendMessage(message, addresses); + transport.sendMessage(message.getRealMessage(), addresses); } public void addTransportListener(TransportListener transportListener){ |