Hi,

I'm trying to use the new "tests" target for JBoss-Media (CVS module: jboss-media).

I need to access files with media to do some unit testing. I'm doing it this way:

>From jboss-head/media/src/test/org/jboss/media/JBossMediaUnitTestCase.java:
...
 ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
 InputStream inputStream = classLoader.getResourceAsStream(resourceName);
...

Most of the code was copied from the 
"jboss-head/testsuite/src/main/org/jboss/test/cmp2/lob" testcase. In that testcase, 
getResourceAsStream works with files under src/resources

resourceName is in my case "data/image.png". I've tried putting the file in src/main, 
src/resources and src/test with no luck: I can't read the file.

I can run the test from Eclipse, running JBossMediaUnitTestCase as a Junit test, 
"build tests" gives me Errors:

<testcase name="testMediaBeanProperties" time="0.016">
  <error type="java.lang.NullPointerException">java.lang.NullPointerException at 
org.jboss.media.JBossMediaUnitTestCase.createFileFromResource(JBossMediaUnitTestCase.java:196)
 at 
org.jboss.media.JBossMediaUnitTestCase.setUp(JBossMediaUnitTestCase.java:61)</error> 
  </testcase>
<testcase name="testMediaFormatRegistry" time="0.0">
  <error type="java.lang.NullPointerException">java.lang.NullPointerException at 
org.jboss.media.JBossMediaUnitTestCase.createFileFromResource(JBossMediaUnitTestCase.java:196)
 at 
org.jboss.media.JBossMediaUnitTestCase.setUp(JBossMediaUnitTestCase.java:61)</error> 
  </testcase>
<testcase name="testHeaderExtraction" time="0.0">
  <error type="java.lang.NullPointerException">java.lang.NullPointerException at 
org.jboss.media.JBossMediaUnitTestCase.createFileFromResource(JBossMediaUnitTestCase.java:196)
 at 
org.jboss.media.JBossMediaUnitTestCase.setUp(JBossMediaUnitTestCase.java:61)</error> 


*Maybe* some change needs to be added to tools/etc/buildfragments/targets.ent?

Where should I put files to be readed with ClassLoader.getResourceAsStream(...) form 
within a JUnit testcase to be run with the new "tests" target?

You can find all the code in the jboss-media CVS module.

Thanks in advance,

Ricardo Arg�ello
[EMAIL PROTECTED]
www.freeroller.net/page/ricardo

-- 
I took the red pill.




-------------------------------------------------------
This SF.NET email is sponsored by: FREE  SSL Guide from Thawte
are you planning your Web Server Security? Click here to get a FREE
Thawte SSL guide and find the answers to all your  SSL security issues.
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to