You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@depot.apache.org by "Adam R. B. Jack" <aj...@trysybase.com> on 2004/04/29 18:55:36 UTC

Loading test resources

I think we need to get src/resources/test into the classpath (in Eclipse and
Ant) for these to work. Or, can we add ./src/resources/test to them?
Thougts?

package org.apache.depot.update.util.security;

 ...

public void testGetDigest() throws Exception {
ClassLoader clazzLoader = this.getClass().getClassLoader();

URL urlHashFile =
clazzLoader.getResource("org/apache/depot/update/util/security/test.txt");

URL urlMetaFile =
clazzLoader.getResource("org/apache/depot/update/util/security/test.txt.md5"
);



regards

Adam

--
Experience the Unwired Enterprise:
http://www.sybase.com/unwiredenterprise
Try Sybase: http://www.try.sybase.com


Re: Loading test resources

Posted by Nick Chalko <ni...@chalko.com>.
Adam R. B. Jack wrote:

>>Why are we using a class loader here.
>>MD5 don't usually ship inside a jar.
>>    
>>
>
>This is part of a unit test. Are you saying we ought just use relative path?
>
>regards,
>
>Adam
>  
>

Well resource usually means add to the classpath,  but I see no reasons 
for these files to be on the classpath  so I would rename the dir and 
use relative path or move these somewhere else.

Re: Loading test resources

Posted by "Adam R. B. Jack" <aj...@trysybase.com>.
> Why are we using a class loader here.
> MD5 don't usually ship inside a jar.

This is part of a unit test. Are you saying we ought just use relative path?

regards,

Adam


Re: Loading test resources

Posted by Nick Chalko <ni...@chalko.com>.
Adam R. B. Jack wrote:

>I think we need to get src/resources/test into the classpath (in Eclipse and
>Ant) for these to work. Or, can we add ./src/resources/test to them?
>Thougts?
>  
>
Why are we using a class loader here. 
MD5 don't usually ship inside a jar.

>package org.apache.depot.update.util.security;
>
> ...
>
>public void testGetDigest() throws Exception {
>ClassLoader clazzLoader = this.getClass().getClassLoader();
>
>URL urlHashFile =
>clazzLoader.getResource("org/apache/depot/update/util/security/test.txt");
>
>URL urlMetaFile =
>clazzLoader.getResource("org/apache/depot/update/util/security/test.txt.md5"
>);
>
>
>
>regards
>
>Adam
>
>--
>Experience the Unwired Enterprise:
>http://www.sybase.com/unwiredenterprise
>Try Sybase: http://www.try.sybase.com
>  
>