You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Stuart Roebuck <st...@mac.com> on 2002/02/19 03:40:26 UTC

EmailTransformer and Mock Classes Update

The first real incarnation of our EmailTransformer has been uploaded with 
unit tests and associated mock classes to:

	<http://www.adolos.co.uk/temp/mocks_and_email_transformer2.tgz>

I've taken a look at the David Bigwood's Metatomix SendMailTransformer 
contribution and decided they are sufficiently different that attempting 
to merge them wasn't going to be a quick task.

David's code seems to be a good option for creating emails with HTML 
content - I've made no explicit provision for these in ours though it may 
just work with an included 'file' derived from an HTML source in the 
sitemap.

The key drive for our code was to be able to send emails with attachments 
and inline graphic files.   This version now does that by allowing you to 
reference any source file to be included in the email.  As the file is 
specified in the useful sitemap file reference syntax it is possible to 
include graphics or other files that have been generated through the 
sitemap.  (at least it seems to work :-) )

Here's an example of the syntax:

> <othertags>
>   <email:email xmlns:email="http://adolos.com/cocoon/email/1.0">
>     <email:from>test@somewhere.com</email:from>
>     <email:to>Fred Bloggs &lt;fredbloggs@somewhere.co.uk&gt;</email:to>
>     <email:cc>copyperson@overthere.com</email:cc>
>     <email:bcc>secretperson@myothercompany.com</email:bcc>
>     <email:subject>Test</email:subject>
>     <email:text>The body text</email:text>
>     <email:file source="cocoon:/graphic.jpg" name="graphic.jpg" 
> disposition="inline" />
>     <email:text>Some more text</email:text>
>     <email:file source="docs/include.pdf" name="document.pdf" disposition=
> "attachment" />
>   </email:email>
> </othertags>

For multiple recipients the email addresses can be comma delimited or you 
can supply multiple entries.

I've created a NonClosingBufferedInputStream class to enable an 
InputStreamDataHandler to be used to re-read from the same InputStream, 
which feels like a bit of a cludge, but it works.  Any suggestions of a 
more elegant solutions are most welcome!

I've also updated the Mock Classes a little to allow a Source to be 
pre-determined in unit tests.

Stuart.



            Public Key - 1024D/88DD65AF 2001-11-23 Stuart Roebuck (Adolos)
      Key fingerprint = 89D9 E405 F8B1 9B22 0FA2  F2C1 9E57 5AB1 88DD 65AF
-------------------------------------------------------------------------
Stuart Roebuck                                  stuart.roebuck@adolos.com
Systems Architect                             Java, XML, MacOS X, XP, etc.
ADOLOS                                           <http://www.adolos.com/>


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: EmailTransformer and Mock Classes Update

Posted by Stuart Roebuck <st...@adolos.co.uk>.
Yes it is a contribution, but being rushed off my feet at the moment I 
didn't want to spend ages re-packaging it only to find that it wasn't 
suitable or of interest.

If it is suitable and of interest, then can you confirm that the following 
would be a suitable approach re: re-packaging?

1. Put the new transform under 
"/src/scratchpad/src/org/apache/cocoon/transformation"
2. Put the utility classes under 
"/src/scratchpad/src/org/apache/cocoon/util"
3. Rename the namespace to "http://apache.org/cocoon/sendmail/1.0"
4. Put the test code in "/src/test/org/apache/cocoon/..."
5. Put the mock classes under their existing package names within 
"src/test"

What do you mean by a stand-alone illustration of the Transformer, and 
where should I put it? (perhaps you could point me at the equivalent for 
one of the existing transformers that I can use as a template)

In submitting diffs against the CVS at Bugzilla, how do I do this - do I 
enter it as a new bug and post the diffs as plain text in the description?

Finally, if the code is in scratchpad and the tests are outside of 
scratchpad I imagine we'll have build problems, do we need a scratchpad 
test area, or should I just put the tests side-by-side with the code in 
scratchpad for separation if/when it moves to the main code?

Thanks,

Stuart.


On Tuesday, February 19, 2002, at 01:27 pm, Davanum Srinivas wrote:

> Stuart,
>
> Is this a contribution? If yes, Thanks for your contribution. Can i ask 
> you for a few more
> changes?
>
> 1. Test cases should be under xml-cocoon2\src\test
> 2. Change com.adolos.cocoon to something more that appropriate.
> 3. A stand-alone sample that can be used for illustration of how to use 
> the Transformer as well as
> for testing...
> 4. Please submit diffs against the latest CVS at Bugzilla (http://nagoya.
> apache.org). So that
> things don't get lost in the email deluge.
>
> Thanks,
> dims
>

            Public Key - 1024D/88DD65AF 2001-11-23 Stuart Roebuck (Adolos)
      Key fingerprint = 89D9 E405 F8B1 9B22 0FA2  F2C1 9E57 5AB1 88DD 65AF
-------------------------------------------------------------------------
Stuart Roebuck                                  stuart.roebuck@adolos.com
Systems Architect                             Java, XML, MacOS X, XP, etc.
ADOLOS                                           <http://www.adolos.com/>


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: EmailTransformer and Mock Classes Update

Posted by Davanum Srinivas <di...@yahoo.com>.
Stuart,

Is this a contribution? If yes, Thanks for your contribution. Can i ask you for a few more
changes?

1. Test cases should be under xml-cocoon2\src\test
2. Change com.adolos.cocoon to something more that appropriate.
3. A stand-alone sample that can be used for illustration of how to use the Transformer as well as
for testing...
4. Please submit diffs against the latest CVS at Bugzilla (http://nagoya.apache.org). So that
things don't get lost in the email deluge.

Thanks,
dims

--- Stuart Roebuck <st...@mac.com> wrote:
> The first real incarnation of our EmailTransformer has been uploaded with 
> unit tests and associated mock classes to:
> 
> 	<http://www.adolos.co.uk/temp/mocks_and_email_transformer2.tgz>
> 
> I've taken a look at the David Bigwood's Metatomix SendMailTransformer 
> contribution and decided they are sufficiently different that attempting 
> to merge them wasn't going to be a quick task.
> 
> David's code seems to be a good option for creating emails with HTML 
> content - I've made no explicit provision for these in ours though it may 
> just work with an included 'file' derived from an HTML source in the 
> sitemap.
> 
> The key drive for our code was to be able to send emails with attachments 
> and inline graphic files.   This version now does that by allowing you to 
> reference any source file to be included in the email.  As the file is 
> specified in the useful sitemap file reference syntax it is possible to 
> include graphics or other files that have been generated through the 
> sitemap.  (at least it seems to work :-) )
> 
> Here's an example of the syntax:
> 
> > <othertags>
> >   <email:email xmlns:email="http://adolos.com/cocoon/email/1.0">
> >     <email:from>test@somewhere.com</email:from>
> >     <email:to>Fred Bloggs &lt;fredbloggs@somewhere.co.uk&gt;</email:to>
> >     <email:cc>copyperson@overthere.com</email:cc>
> >     <email:bcc>secretperson@myothercompany.com</email:bcc>
> >     <email:subject>Test</email:subject>
> >     <email:text>The body text</email:text>
> >     <email:file source="cocoon:/graphic.jpg" name="graphic.jpg" 
> > disposition="inline" />
> >     <email:text>Some more text</email:text>
> >     <email:file source="docs/include.pdf" name="document.pdf" disposition=
> > "attachment" />
> >   </email:email>
> > </othertags>
> 
> For multiple recipients the email addresses can be comma delimited or you 
> can supply multiple entries.
> 
> I've created a NonClosingBufferedInputStream class to enable an 
> InputStreamDataHandler to be used to re-read from the same InputStream, 
> which feels like a bit of a cludge, but it works.  Any suggestions of a 
> more elegant solutions are most welcome!
> 
> I've also updated the Mock Classes a little to allow a Source to be 
> pre-determined in unit tests.
> 
> Stuart.
> 
> 
> 
>             Public Key - 1024D/88DD65AF 2001-11-23 Stuart Roebuck (Adolos)
>       Key fingerprint = 89D9 E405 F8B1 9B22 0FA2  F2C1 9E57 5AB1 88DD 65AF
> -------------------------------------------------------------------------
> Stuart Roebuck                                  stuart.roebuck@adolos.com
> Systems Architect                             Java, XML, MacOS X, XP, etc.
> ADOLOS                                           <http://www.adolos.com/>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
> 


=====
Davanum Srinivas - http://jguru.com/dims/

__________________________________________________
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org