On Tuesday, April 29, 2014 10:39:31 AM UTC+5:30, Thomas Mueller wrote:
>
>
> No, TestFileSystem works for me if run alone. What operating system and 
> file system do you use? Is your file system read-only maybe?
>

I'm running Fedora 18.  No, my file-system is not read-only -- this is the 
file-system of my developer workstation, the one I work on (so can't be 
readonly).


To get past the earlier, NonWritableChannelException exception that I was 
getting, I modified the H2 code as follows...

TestFileSystem.testSimple(String) {
    ...
    // new AssertThrows(IOException.class) {
    new AssertThrows(NonWritableChannelException.class) {
            new 
AssertThrows(java.nio.channels.NonWritableChannelException.class) {
                @Override
                public void test() throws Exception {
                    fc.truncate(10);
                }
            };


... and it was happy. 

But then I started getting this NPE:

java.lang.NullPointerException
at org.h2.test.unit.TestFileSystem.testClasspath(TestFileSystem.java:220)
at org.h2.test.unit.TestFileSystem.test(TestFileSystem.java:73)
at org.h2.test.unit.TestFileSystem.main(TestFileSystem.java:55)
at com.amritatech.rephrase.H2DatabaseTest.main(H2DatabaseTest.java:40)



which is the following code:

    private void testClasspath() throws IOException {
        String resource = "org/h2/test/testSimple.in.txt";
        InputStream in;
        in = getClass().getResourceAsStream("/" + resource);
        assertTrue(in != null);
        in.close();
        in = getClass().getClassLoader().getResourceAsStream(resource);  // 
line 220

I'm using version 1.3.174 codebase, btw. Is this unit testing exercise 
supposed to be run from some specialized test-jar bundle of H2? Fyi, I'm 
imported the codebase in Eclipse and I'm running it from there, so I'm not 
aware of any specialized path/classpath setups that may be required.

 

> Before you think about using your file system with a database, I suggest 
> to ensure the unit test (TestFileSystem) passes.
>

Yes, I definitely intend to do that.

But another basic question that I have is this: Once the TestFileSystem 
unit test begins to pass on the default ("file:/") file-system, and once I 
have register()'ed my file-system using my FilePath-subclass's register(), 
do I need to do anything else? For example, do I need to...
   a) comment out calls to file-systems (like zip/zip2, cache/cache2, ...) that 
seem 'irrelevant' to testing my own file-system?

   b) change TestBase.BASE_TEST_DIR and .TEMP_DIR to point to my 
file-system, like so...
             BASE_TEST_DIR = "myfs:/path/to/data"
             TEMP_DIR = "myfs:/path/to/data/tmp"

        ... early on in the control flow?

Regards,
/PN

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to