At 12:08 PM -0800 11/5/07, Hiroki Terashima wrote:
>Hi Stephen,
>
>      What makes the url invalid?  Is there some standard that you are using?
>
>      I found that one of our tests fail because of this new function in the 
> SDS that you added 3 days ago:
>
><<< BEGIN Stephen's email
>1.a When creating a jnlp resource in the sds if the url is not valid
>OR the content returned is not valid XML the jnlp resource is NOT
>created and a 404 error condition should be reported."
>
>1.b When a jnlp is rendered for an offering if the body of the jnlp
>is not valid xml a 404 error condition will be reported in the
>returned header and the content will look like this (the elements
>enclosed by "#{}" in the string below are replaced by evaluating the
>enclosed ruby objects.
>
><error>#{resource} #{id.to_s}: external resource: #{url} not
>well-formed xml.<error/>
>>>> END Stephen's email
>
>
>The test fails because it tries to make a "bogus offering" (valid curnit and 
>invalid jnlp).
><<< BEGIN part of createBogusOffering()
>        WebResponse webResponse = this.makeHttpRestPostRequest("/jnlp",
>                "<jnlp><name>" + "invalid jnlp" + "</name><url>"
>                        + "<http://www.invalid.com>http://www.invalid.com"; + 
> "</url></jnlp>");
>>>> END part of createBogusOffering()
>
>the prototype for makeHttpRestPostRequest is
>
>protected WebResponse makeHttpRestPostRequest(String urlRelativeToBaseUrl, 
>String body)
>
>I'm getting back a 400 Bad Request exception back, and I'm guessing that this 
>has something to do with your new changes to the SDS and the portal needing to 
>be updated to work with the new change.  I'm trying to figure out what needs 
>to be changed in the portal to make the test work: url or something else.


You need to change your test to expect an error when you are creating the jnlp.

When you create a new jnlp resource in the sds (just the dev sds at this point) 
a new validation done in the sds is to check that the jnlp referred to in the 
url is well-formed xml. If the url returns a body which is not well formed xml 
than the following validation error is reported:

(testing with curl is an easy way to find out what is happening)

$ curl -i -H 'Content-Type: application/xml' -X POST -d 
'<jnlp><name>testing</name><url>http://www.invalid.com</url></jnlp>' 
http://rails.dev.concord.org/sds/1/jnlp
HTTP/1.1 400 Bad Request
Date: Mon, 05 Nov 2007 21:49:07 GMT
Server: lighttpd/1.4.15
Content-Type: text/html; charset=UTF-8
Cache-Control: no-cache
Content-Length: 93
Connection: close

<validation-errors>
  <error>Body jnlp body not well-formed xml</error>
</validation-errors>

If the content is well-formed xml then the jnlp resource is created. This of 
course does not mean that the actual content is a valid jnlp -- only that it is 
at least well-formed xml.

Later after you create an offering with this jnlp resource and then ask for the 
sds to actually render the jnlp by calling the offering controller IF the 
content returned by accessing the jnlp url is NOW not well-formed a 404 Not 
Found error will be returned to the browser with a similar error message.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SAIL-Dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/SAIL-Dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to