You are viewing a plain text version of this content. The canonical link for it is here.
Posted to watchdog-dev@jakarta.apache.org by Jules Gosnell <ju...@mortbay.com> on 2002/05/21 04:17:26 UTC

Watchdog ONLY testing unpacked WAR behaviour ???

Firstly - I couldn't find a reference to a user-list on the jakarta site 
- so apologies for barging in if this is a private party...

I am testing a servlet container running watchdog packed (i.e. stright 
from the war).


The spec (2.3) says :
"
SRV.4.5 Path Translation Methods

There are two convenience methods in the API which allow the Developer 
to obtain the file system path equivalent to a particular path. These 
methods are:

o ServletContext.getRealPath
o HttpServletRequest.getPathTranslated

The getRealPath method takes a String argument and returns a String 
representation of a file on the local file system to which a path 
corresponds. The getPathTranslated method computes the real path of the 
pathInfo of the request. In situations where the servlet container 
cannot determine a valid file path for these methods, such as when the 
web application is executed from an archive, on a remote file system not 
accessible locally, or in a database, these methods must return null.
"

Watchdog does not seem to be making allowances for this:

       [java]  [watchdog]  Response and golden files lengths do not match!
       [java]  [watchdog]  Server response length: 163
       [java]  [watchdog]  Goldenfile length: 28
       [java]  [watchdog]  Hex dump of server response and goldenfile below.
       [java]  [watchdog]
       [java]  [watchdog] ### RESPONSE FROM SERVER ###
       [java]  [watchdog] ----------------------------
       [java]  [watchdog]
       [java]  [watchdog] 0x0000: 47657452 65616c50 61746854 65737420 
GetRealPathTest.
       [java]  [watchdog] 0x0010: 74657374 20464149 4c45443c 42523e0a 
test.FAILED<BR>.
       [java]  [watchdog] 0x0020: 20202020 20536572 766c6574 436f6e74 
.....ServletCont
       [java]  [watchdog] 0x0030: 6578742e 67657452 65616c50 61746828 
ext.getRealPath(
       [java]  [watchdog] 0x0040: 2f736572 766c6574 2d746573 74732f47 
/servlet-tests/G
       [java]  [watchdog] 0x0050: 65745265 616c5061 74685465 73742920 
etRealPathTest).
       [java]  [watchdog] 0x0060: 64696420 6e6f7420 636f6e74 61696e20 
did.not.contain.
       [java]  [watchdog] 0x0070: 74686520 6e616d65 64206669 6c65733c 
the.named.files<
       [java]  [watchdog] 0x0080: 42523e0a 20202020 20416374 75616c20 
BR>......Actual.
       [java]  [watchdog] 0x0090: 72657375 6c74203d 206e756c 6c203c42 
result.=.null.<B
       [java]  [watchdog] 0x00a0: 523e0a                               R>.
       [java]  [watchdog]
       [java]  [watchdog] ### GOLDEN FILE ###
       [java]  [watchdog] -------------------
       [java]  [watchdog]
       [java]  [watchdog] 0x0000: 47657452 65616c50 61746854 65737420 
GetRealPathTest.
       [java]  [watchdog] 0x0010: 74657374 20504153 5345440a test.PASSED.
       [java]  [watchdog]
       [java]  [watchdog] ### END OF DUMP ###
       [java]  [watchdog]
       [java]  [watchdog]  FAILED GetRealPathTest

...

       [java]  [watchdog]  Response and golden files lengths do not match!
       [java]  [watchdog]  Server response length: 105
       [java]  [watchdog]  Goldenfile length: 34
       [java]  [watchdog]  Hex dump of server response and goldenfile below.
       [java]  [watchdog]
       [java]  [watchdog] ### RESPONSE FROM SERVER ###
       [java]  [watchdog] ----------------------------
       [java]  [watchdog]
       [java]  [watchdog] 0x0000: 47657450 61746854 72616e73 6c617465 
GetPathTranslate
       [java]  [watchdog] 0x0010: 64546573 74207465 73742046 41494c45 
dTest.test.FAILE
       [java]  [watchdog] 0x0020: 440a2020 20202048 74747053 6572766c 
D......HttpServl
       [java]  [watchdog] 0x0030: 65745265 71756573 742e6765 74506174 
etRequest.getPat
       [java]  [watchdog] 0x0040: 68547261 6e736c61 74656428 29207265 
hTranslated().re
       [java]  [watchdog] 0x0050: 7475726e 65642061 206e756c 6c207265 
turned.a.null.re
       [java]  [watchdog] 0x0060: 73756c74 3c42523e 0a sult<BR>.
       [java]  [watchdog]
       [java]  [watchdog] ### GOLDEN FILE ###
       [java]  [watchdog] -------------------
       [java]  [watchdog]
       [java]  [watchdog] 0x0000: 47657450 61746854 72616e73 6c617465 
GetPathTranslate
       [java]  [watchdog] 0x0010: 64546573 74207465 73742050 41535345 
dTest.test.PASSE
       [java]  [watchdog] 0x0020: 440a                                 D.
       [java]  [watchdog]
       [java]  [watchdog] ### END OF DUMP ###


If values returned from these methods may vary according to deployment, 
then apps should be prepared to deal with the possible values - and so 
should watchdog ??? Or have I missed a chance to configure watchdog, so 
that it knows that is running without a filesystem?


Jules



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Watchdog ONLY testing unpacked WAR behaviour ???

Posted by Jules Gosnell <ju...@mortbay.com>.
OK - before anyone wastes any time on this...

I've got down the source and had a look at it - It DOES take into 
account the fact that I may be running from a jar.

At the moment it looks like the webcontainer must be returning the 
String "null" for getRealPath() - hence my confusion over the watchdog 
error message.

I'm off to confirm this - if it is the case I will not clutter up your 
list with any more mails.

Cheers,



Jules


Jules Gosnell wrote:
> Firstly - I couldn't find a reference to a user-list on the jakarta site 
> - so apologies for barging in if this is a private party...
> 
> I am testing a servlet container running watchdog packed (i.e. stright 
> from the war).
> 
> 
> The spec (2.3) says :
> "
> SRV.4.5 Path Translation Methods
> 
> There are two convenience methods in the API which allow the Developer 
> to obtain the file system path equivalent to a particular path. These 
> methods are:
> 
> o ServletContext.getRealPath
> o HttpServletRequest.getPathTranslated
> 
> The getRealPath method takes a String argument and returns a String 
> representation of a file on the local file system to which a path 
> corresponds. The getPathTranslated method computes the real path of the 
> pathInfo of the request. In situations where the servlet container 
> cannot determine a valid file path for these methods, such as when the 
> web application is executed from an archive, on a remote file system not 
> accessible locally, or in a database, these methods must return null.
> "
> 
> Watchdog does not seem to be making allowances for this:
> 
>       [java]  [watchdog]  Response and golden files lengths do not match!
>       [java]  [watchdog]  Server response length: 163
>       [java]  [watchdog]  Goldenfile length: 28
>       [java]  [watchdog]  Hex dump of server response and goldenfile below.
>       [java]  [watchdog]
>       [java]  [watchdog] ### RESPONSE FROM SERVER ###
>       [java]  [watchdog] ----------------------------
>       [java]  [watchdog]
>       [java]  [watchdog] 0x0000: 47657452 65616c50 61746854 65737420 
> GetRealPathTest.
>       [java]  [watchdog] 0x0010: 74657374 20464149 4c45443c 42523e0a 
> test.FAILED<BR>.
>       [java]  [watchdog] 0x0020: 20202020 20536572 766c6574 436f6e74 
> .....ServletCont
>       [java]  [watchdog] 0x0030: 6578742e 67657452 65616c50 61746828 
> ext.getRealPath(
>       [java]  [watchdog] 0x0040: 2f736572 766c6574 2d746573 74732f47 
> /servlet-tests/G
>       [java]  [watchdog] 0x0050: 65745265 616c5061 74685465 73742920 
> etRealPathTest).
>       [java]  [watchdog] 0x0060: 64696420 6e6f7420 636f6e74 61696e20 
> did.not.contain.
>       [java]  [watchdog] 0x0070: 74686520 6e616d65 64206669 6c65733c 
> the.named.files<
>       [java]  [watchdog] 0x0080: 42523e0a 20202020 20416374 75616c20 
> BR>......Actual.
>       [java]  [watchdog] 0x0090: 72657375 6c74203d 206e756c 6c203c42 
> result.=.null.<B
>       [java]  [watchdog] 0x00a0: 523e0a                               R>.
>       [java]  [watchdog]
>       [java]  [watchdog] ### GOLDEN FILE ###
>       [java]  [watchdog] -------------------
>       [java]  [watchdog]
>       [java]  [watchdog] 0x0000: 47657452 65616c50 61746854 65737420 
> GetRealPathTest.
>       [java]  [watchdog] 0x0010: 74657374 20504153 5345440a test.PASSED.
>       [java]  [watchdog]
>       [java]  [watchdog] ### END OF DUMP ###
>       [java]  [watchdog]
>       [java]  [watchdog]  FAILED GetRealPathTest
> 
> ...
> 
>       [java]  [watchdog]  Response and golden files lengths do not match!
>       [java]  [watchdog]  Server response length: 105
>       [java]  [watchdog]  Goldenfile length: 34
>       [java]  [watchdog]  Hex dump of server response and goldenfile below.
>       [java]  [watchdog]
>       [java]  [watchdog] ### RESPONSE FROM SERVER ###
>       [java]  [watchdog] ----------------------------
>       [java]  [watchdog]
>       [java]  [watchdog] 0x0000: 47657450 61746854 72616e73 6c617465 
> GetPathTranslate
>       [java]  [watchdog] 0x0010: 64546573 74207465 73742046 41494c45 
> dTest.test.FAILE
>       [java]  [watchdog] 0x0020: 440a2020 20202048 74747053 6572766c 
> D......HttpServl
>       [java]  [watchdog] 0x0030: 65745265 71756573 742e6765 74506174 
> etRequest.getPat
>       [java]  [watchdog] 0x0040: 68547261 6e736c61 74656428 29207265 
> hTranslated().re
>       [java]  [watchdog] 0x0050: 7475726e 65642061 206e756c 6c207265 
> turned.a.null.re
>       [java]  [watchdog] 0x0060: 73756c74 3c42523e 0a sult<BR>.
>       [java]  [watchdog]
>       [java]  [watchdog] ### GOLDEN FILE ###
>       [java]  [watchdog] -------------------
>       [java]  [watchdog]
>       [java]  [watchdog] 0x0000: 47657450 61746854 72616e73 6c617465 
> GetPathTranslate
>       [java]  [watchdog] 0x0010: 64546573 74207465 73742050 41535345 
> dTest.test.PASSE
>       [java]  [watchdog] 0x0020: 440a                                 D.
>       [java]  [watchdog]
>       [java]  [watchdog] ### END OF DUMP ###
> 
> 
> If values returned from these methods may vary according to deployment, 
> then apps should be prepared to deal with the possible values - and so 
> should watchdog ??? Or have I missed a chance to configure watchdog, so 
> that it knows that is running without a filesystem?
> 
> 
> Jules
> 
> 
> 
> -- 
> To unsubscribe, e-mail:   
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>