Re: Referencing .properties files in the CLASSPATH in test

2006-06-01 Thread Doug Douglass
Step one completed -- the resources are being built/copied correctly. I used a little JUnit test to exercise the difference between using ClassLoader.getSystemResourceAsStream() and Kierans suggestion above. In Eclipse, both tests pass, but in Maven, the ClassLoader method fails, as you're obser

Re: Referencing .properties files in the CLASSPATH in test

2006-06-01 Thread Martin Aspeli
Kieran Brady-2 wrote: > > this.getClass().getClassLoader().getResourceAsStream(... > > rather than using the system classloader and it works in both Eclipse and > Maven. > Ah, beautiful - that does it! Thank you! Out of interest, why does one work and the other not? Martin -- View this mes

RE: Referencing .properties files in the CLASSPATH in test

2006-06-01 Thread Martin Aspeli
Edelson, Justin wrote: > > Depending on how much flexability you have to move files around, I would > suggest moving these property and xml files to src/test/resources and > removing the testResources block entirely. > Yeah, I did that, actually; however, the maven testrunner still can't find

Re: Referencing .properties files in the CLASSPATH in test

2006-06-01 Thread Martin Aspeli
Martin Aspeli wrote: > > I have some unit tests that do things like this: > > InputStream stream = > ClassLoader.getSystemResourceAsStream("TestDBSetup.properties"); > assertNotNull("Could not load TestDBSetup.properties from classpath", > stream); > Properties dbProperties = new Properties();

Re: Referencing .properties files in the CLASSPATH in test

2006-06-01 Thread Doug Douglass
Oooppps, I misspoke...you have overridden the default test resources directory, but I don't think you've done so correctly. On 6/1/06, Doug Douglass <[EMAIL PROTECTED]> wrote: On 6/1/06, Martin Aspeli <[EMAIL PROTECTED]> wrote: > > TestDBSetup.properties lives in src/main/test/resources. > >

Re: Referencing .properties files in the CLASSPATH in test

2006-06-01 Thread Doug Douglass
On 6/1/06, Martin Aspeli <[EMAIL PROTECTED]> wrote: TestDBSetup.properties lives in src/main/test/resources. Martin, I think your problem is that the above path is not the default test resources location, and it appears you have not overridden this in your POM. The default test resources di

RE: Referencing .properties files in the CLASSPATH in test

2006-06-01 Thread Edelson, Justin
Depending on how much flexability you have to move files around, I would suggest moving these property and xml files to src/test/resources and removing the testResources block entirely. -Original Message- From: Martin Aspeli [mailto:[EMAIL PROTECTED] Sent: Thursday, June 01, 2006 10:39 A

Re: Referencing .properties files in the CLASSPATH in test

2006-06-01 Thread Kieran Brady
I use this.getClass().getClassLoader().getResourceAsStream(... rather than using the system classloader and it works in both Eclipse and Maven. HTH - Original Message - From: "Martin Aspeli" <[EMAIL PROTECTED]> To: Sent: Thursday, June 01, 2006 3:38 PM Subject: Referencing .propert