Unit Test fails in ant only when parsing xml

0 views
Skip to first unread message

Randy

unread,
Oct 9, 2009, 10:17:37 PM10/9/09
to mxunit
Hello all,

I'm trying to run some code ant tests through Railo (3.1.1.x -
3.1.1.012) and it is working fine from the browser and through the
eclipse plugin, but when I try the same through the ant task it gives
me an exception.

Any ideas on what would be causing just the ant part to fail, and not
the web and plugin?

Here is the first part of the exception:

(No such file or directory)
at java.io.FileInputStream.open(Native Method):-2
at java.io.FileInputStream.><init>(FileInputStream.java:106):106...

Here is the code that I am using that seems to be killing it:

<cfsavecontent variable="xrds">
<?xml version="1.0" encoding="UTF-8"?>
<xrds:XRDS xmlns:xrds="xri://$xrds" xmlns="xri://$xrd*($v*2.0)"
xmlns:openid="http://openid.net/xmlns/1.0">
<xrd>
<Service priority="50">
<Type>http://openid.net/signon/1.0</Type>
<URI>http://www.myopenid.com/server</URI>
<openid:Delegate>http://smoker.myopenid.com/</openid:Delegate>
</Service>
<Service priority="10">
<Type>http://openid.net/signon/1.0</Type>
<URI priority="15">http://resolve2.example.com</URI>
<URI priority="10">http://resolve.example.com</URI>
<URI>https://resolve.example.com</URI>
<openid:Delegate>http://www.livejournal.com/users/frank/</
openid:Delegate>
</Service>
<Service priority="20">
<Type>http://lid.netmesh.org/sso/2.0</Type>
<URI>http://mylid.net/liddemouser</URI>
</Service>
<Service>
<Type>http://lid.netmesh.org/sso/1.0</Type>
</Service>
</xrd>
</xrds:XRDS>
</cfsavecontent>

<cfset xrds = xmlParse(trim(xrds)) />

Thanks!

Randy

Marc Esher

unread,
Oct 9, 2009, 10:33:12 PM10/9/09
to mxu...@googlegroups.com
Hey Randy,
  When you run the test with ant, it spits out the URL it's running to the console. If you copy that URL, run it in your browser, does it give you the same result?  If so, does that make it any easier to debug?

This is a good one, for sure. Let's dig in.

Marc

p.s. is smoker.myopenid.org a stogie smoker, by any chance?

Randy

unread,
Oct 9, 2009, 11:06:12 PM10/9/09
to mxunit
When I view the xml for the URL that it is running the tests It shows
the error in the xml just fine and the XML is complete, and valid.
Technically the build is still successful unless you fail on errors.
So I guess that it is an error that occurs only when run as the ant
task does it, not when the web or eclipse plugin runs the test.

I'm still ignorant on how it is different than how the web and eclipse
plugin calls.

Are you able to reproduce it?

Here is more of the actual exception:

/test/inc/resource/communication (No such file or directory)
at java.io.FileInputStream.open(Native Method):-2
at java.io.FileInputStream.><init>(FileInputStream.java:106):106
at railo.commons.io.res.type.file.FileResource.getInputStream
(FileResource.java:198):198
at railo.commons.io.IOUtil.getReader(IOUtil.java:405):405
at railo.commons.io.IOUtil.toString(IOUtil.java:622):622
at railo.runtime.text.xml.XMLUtil.toInputSource(XMLUtil.java:846):846
at railo.runtime.text.xml.XMLUtil.toInputSource(XMLUtil.java:893):893
at railo.runtime.text.xml.XMLUtil.toInputSource(XMLUtil.java:881):881
at railo.runtime.functions.xml.XmlParse.call(XmlParse.java:27):27
at railo.runtime.functions.xml.XmlParse.call(XmlParse.java:22):22
at railo.runtime.functions.xml.XmlParse.call(XmlParse.java:19):19
at cf_c135.test.inc.resource.communication.yadistest_cfc$cf.udfCall(/
trunk/test/inc/resource/communication/yadisTest.cfc:31):31

PS It comes from the appendix for the OpenID specification... or one
of the documents I was reading about it, so i'm not sure if he likes
stogies...

Daryl Banttari

unread,
Oct 10, 2009, 3:32:25 PM10/10/09
to mxu...@googlegroups.com
On Fri, Oct 9, 2009 at 9:17 PM, Randy <zora...@gmail.com> wrote:
> Here is the code that I am using that seems to be killing it:
>
> <cfsavecontent variable="xrds">
> ***SNIP!***

Randy,

Wrap your cfsavecontent in a cfoutput.

For reasons I haven't investigated, the ANT runner seems to run pages
as if <cfsetting enablecfoutputonly=yes> is set. Not sure if its one
of my other unit tests that does it, or something in MXUnit, but I
found that I have to put all my custom tags that use
thisTag.generatedContent in a cfoutput in order for them to work. I
figure that's the "safe" way to do it anyway, so I don't worry about
it.

--Daryl

Randy

unread,
Oct 10, 2009, 4:02:38 PM10/10/09
to mxunit
Ahh.,.. very interesting... That makes sense that they would use it
because they have no whitespace in the generated xml file.

I added that in and it seems to be working now, thanks!

Randy
Reply all
Reply to author
Forward
0 new messages