This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
testUsingNbfsProtocol openide/test/work/sys/tests/unit/classes/org/openide/execution/data/foo.xml (No such file or directory)
Created attachment 14404 [details] The failure
The test fails in its own consistency check, before it gets to testing the real functionality. The problem is that the test infrastructure doesn't copy the data file, while it probably used to copy it before. Jirko, do you have any idea what may be wrong and how to fix the test?
I am sure you didn't mean me to be the evaluator. Maybe Jirka Skrivanek ?
data/foo.xml is on test classpath but its physical location is other than expected. It is here openide/test/work/sys/tests/unit/src/org/openide/execution/data/foo.xml but the test expects it here openide/test/work/sys/tests/unit/classes/
Of course, I know. But for the sake of test, I need the .xml file to be next to classes or at least on the same classpath. This is the usual deployment: have all the resources next to the classes on the classpath, as the resources are accessed through ClassLoaders. Having it somewhere else is broken. So I need to setup xtest (or at leas my test) to have it there, essentially to copy everything but .java and .form to the area of compiled classes.
> But for the sake of test, I need the .xml file to be next to classes > or at least on the same classpath. This is the usual deployment: It is on the same classpath. getClass().getResource("data/foo.xml") returns a valid URL. > have all the resources next to the classes on the classpath, as the > resources are accessed through ClassLoaders. Having it somewhere > else is broken. > So I need to setup xtest (or at leas my test) to have it there, > essentially to copy everything but .java and .form to the area of > compiled classes. Not as easy. It would take some time to change XTest. If you need it immediatelly, please update your test.
> It is on the same classpath. getClass().getResource("data/foo.xml") > returns a valid URL. OK, it is not enough for this test. They have to be in the same hierarchy, as it simulates a classloader over that hierarchy. > Not as easy. It would take some time to change XTest. If you need it > immediatelly, please update your test. So how can I modify the test build script to copy the file for me? I'm not experienced in hacking the xtest infrastructure...
Actually you don't need to copy the file. You can create it in the test: Index: NbClassLoaderTest.java =================================================================== RCS file: /cvs/openide/test/unit/src/org/openide/execution/NbClassLoaderTest.java,v retrieving revision 1.4 diff -r1.4 NbClassLoaderTest.java 50a51,60 > > File dataDir = new File(new File(new File(new File(here, "org"), "openide"), "execution"), "data"); > if(!dataDir.exists()) { > dataDir.mkdir(); > } > File fooFile = new File(dataDir, "foo.xml"); > if(!fooFile.exists()) { > fooFile.createNewFile(); > } >
Fixed using provided patch. openide/test/unit/src/org/openide/execution/NbClassLoaderTest.java,v1.5 openide/test/unit/src/org/openide/execution/data/foo.xml,v1.2
verified