lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject cvs commit: jakarta-lucene/src/test/org/apache/lucene/index TestCompoundFile.java
Date Mon, 04 Oct 2004 19:46:23 GMT
cutting     2004/10/04 12:46:23

  Modified:    src/test/org/apache/lucene/index TestCompoundFile.java
  Log:
  Fix so that tests run with alternate Directory implementations.
  
  Revision  Changes    Path
  1.10      +43 -38    jakarta-lucene/src/test/org/apache/lucene/index/TestCompoundFile.java
  
  Index: TestCompoundFile.java
  ===================================================================
  RCS file: /home/cvs/jakarta-lucene/src/test/org/apache/lucene/index/TestCompoundFile.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- TestCompoundFile.java	28 Sep 2004 20:45:26 -0000	1.9
  +++ TestCompoundFile.java	4 Oct 2004 19:46:23 -0000	1.10
  @@ -365,46 +365,51 @@
   
           // basic clone
           IndexInput expected = dir.openInput("f11");
  -        assertTrue(_TestHelper.isFSIndexInputOpen(expected));
   
  -        IndexInput one = cr.openInput("f11");
  -        assertTrue(isCSIndexInputOpen(one));
  +        // this test only works for FSIndexInput
  +        if (_TestHelper.isFSIndexInput(expected)) {
   
  -        IndexInput two = (IndexInput) one.clone();
  -        assertTrue(isCSIndexInputOpen(two));
  +          assertTrue(_TestHelper.isFSIndexInputOpen(expected));
   
  -        assertSameStreams("basic clone one", expected, one);
  -        expected.seek(0);
  -        assertSameStreams("basic clone two", expected, two);
  -
  -        // Now close the first stream
  -        one.close();
  -        assertTrue("Only close when cr is closed", isCSIndexInputOpen(one));
  -
  -        // The following should really fail since we couldn't expect to
  -        // access a file once close has been called on it (regardless of
  -        // buffering and/or clone magic)
  -        expected.seek(0);
  -        two.seek(0);
  -        assertSameStreams("basic clone two/2", expected, two);
  -
  -
  -        // Now close the compound reader
  -        cr.close();
  -        assertFalse("Now closed one", isCSIndexInputOpen(one));
  -        assertFalse("Now closed two", isCSIndexInputOpen(two));
  -
  -        // The following may also fail since the compound stream is closed
  -        expected.seek(0);
  -        two.seek(0);
  -        //assertSameStreams("basic clone two/3", expected, two);
  -
  -
  -        // Now close the second clone
  -        two.close();
  -        expected.seek(0);
  -        two.seek(0);
  -        //assertSameStreams("basic clone two/4", expected, two);
  +          IndexInput one = cr.openInput("f11");
  +          assertTrue(isCSIndexInputOpen(one));
  +
  +          IndexInput two = (IndexInput) one.clone();
  +          assertTrue(isCSIndexInputOpen(two));
  +
  +          assertSameStreams("basic clone one", expected, one);
  +          expected.seek(0);
  +          assertSameStreams("basic clone two", expected, two);
  +
  +          // Now close the first stream
  +          one.close();
  +          assertTrue("Only close when cr is closed", isCSIndexInputOpen(one));
  +
  +          // The following should really fail since we couldn't expect to
  +          // access a file once close has been called on it (regardless of
  +          // buffering and/or clone magic)
  +          expected.seek(0);
  +          two.seek(0);
  +          assertSameStreams("basic clone two/2", expected, two);
  +
  +
  +          // Now close the compound reader
  +          cr.close();
  +          assertFalse("Now closed one", isCSIndexInputOpen(one));
  +          assertFalse("Now closed two", isCSIndexInputOpen(two));
  +
  +          // The following may also fail since the compound stream is closed
  +          expected.seek(0);
  +          two.seek(0);
  +          //assertSameStreams("basic clone two/3", expected, two);
  +
  +
  +          // Now close the second clone
  +          two.close();
  +          expected.seek(0);
  +          two.seek(0);
  +          //assertSameStreams("basic clone two/4", expected, two);
  +        }
   
           expected.close();
       }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org


Mime
View raw message