lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r821382 - in /lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene: index/TestFieldsReader.java store/TestBufferedIndexInput.java
Date Sat, 03 Oct 2009 18:10:24 GMT
Author: uschindler
Date: Sat Oct  3 18:10:24 2009
New Revision: 821382

URL: http://svn.apache.org/viewvc?rev=821382&view=rev
Log:
remove some tests in BW branch that do no longer compile because of change in abstract methods

Modified:
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestFieldsReader.java
    lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/store/TestBufferedIndexInput.java

Modified: lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestFieldsReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestFieldsReader.java?rev=821382&r1=821381&r2=821382&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestFieldsReader.java
(original)
+++ lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/index/TestFieldsReader.java
Sat Oct  3 18:10:24 2009
@@ -310,114 +310,4 @@
     assertEquals((byte)  size      , sizebytes[3]);
   }
 
-  public static class FaultyFSDirectory extends Directory {
-
-    FSDirectory fsDir;
-    public FaultyFSDirectory(File dir) throws IOException {
-      fsDir = FSDirectory.open(dir);
-      lockFactory = fsDir.getLockFactory();
-    }
-    public IndexInput openInput(String name) throws IOException {
-      return new FaultyIndexInput(fsDir.openInput(name));
-    }
-    public String[] listAll() throws IOException {
-      return fsDir.listAll();
-    }
-    public boolean fileExists(String name) throws IOException {
-      return fsDir.fileExists(name);
-    }
-    public long fileModified(String name) throws IOException {
-      return fsDir.fileModified(name);
-    }
-    public void touchFile(String name) throws IOException {
-      fsDir.touchFile(name);
-    }
-    public void deleteFile(String name) throws IOException {
-      fsDir.deleteFile(name);
-    }
-    public long fileLength(String name) throws IOException {
-      return fsDir.fileLength(name);
-    }
-    public IndexOutput createOutput(String name) throws IOException {
-      return fsDir.createOutput(name);
-    }
-    public void close() throws IOException {
-      fsDir.close();
-    }
-  }
-
-  private static class FaultyIndexInput extends BufferedIndexInput {
-    IndexInput delegate;
-    static boolean doFail;
-    int count;
-    private FaultyIndexInput(IndexInput delegate) {
-      this.delegate = delegate;
-    }
-    private void simOutage() throws IOException {
-      if (doFail && count++ % 2 == 1) {
-        throw new IOException("Simulated network outage");
-      }
-    }
-    public void readInternal(byte[] b, int offset, int length) throws IOException {
-      simOutage();
-      delegate.readBytes(b, offset, length);
-    }
-    public void seekInternal(long pos) throws IOException {
-      //simOutage();
-      delegate.seek(pos);
-    }
-    public long length() {
-      return delegate.length();
-    }
-    public void close() throws IOException {
-      delegate.close();
-    }
-    public Object clone() {
-      return new FaultyIndexInput((IndexInput) delegate.clone());
-    }
-  }
-
-  // LUCENE-1262
-  public void testExceptions() throws Throwable {
-    String tempDir = System.getProperty("java.io.tmpdir");
-    if (tempDir == null)
-      throw new IOException("java.io.tmpdir undefined, cannot run test");
-    File indexDir = new File(tempDir, "testfieldswriterexceptions");
-
-    try {
-      Directory dir = new FaultyFSDirectory(indexDir);
-      IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
-      for(int i=0;i<2;i++)
-        writer.addDocument(testDoc);
-      writer.optimize();
-      writer.close();
-
-      IndexReader reader = IndexReader.open(dir, true);
-
-      FaultyIndexInput.doFail = true;
-
-      boolean exc = false;
-
-      for(int i=0;i<2;i++) {
-        try {
-          reader.document(i);
-        } catch (IOException ioe) {
-          // expected
-          exc = true;
-        }
-        try {
-          reader.document(i);
-        } catch (IOException ioe) {
-          // expected
-          exc = true;
-        }
-      }
-      assertTrue(exc);
-      reader.close();
-      dir.close();
-    } finally {
-      _TestUtil.rmDir(indexDir);
-    }
-
-  }
 }

Modified: lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/store/TestBufferedIndexInput.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/store/TestBufferedIndexInput.java?rev=821382&r1=821381&r2=821382&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/store/TestBufferedIndexInput.java
(original)
+++ lucene/java/branches/lucene_2_9_back_compat_tests/src/test/org/apache/lucene/store/TestBufferedIndexInput.java
Sat Oct  3 18:10:24 2009
@@ -240,128 +240,4 @@
 		}
     }
 
-    public void testSetBufferSize() throws IOException {
-      File indexDir = new File(System.getProperty("tempDir"), "testSetBufferSize");
-      MockFSDirectory dir = new MockFSDirectory(indexDir, newRandom());
-      try {
-        IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
-        writer.setUseCompoundFile(false);
-        for(int i=0;i<37;i++) {
-          Document doc = new Document();
-          doc.add(new Field("content", "aaa bbb ccc ddd" + i, Field.Store.YES, Field.Index.ANALYZED));
-          doc.add(new Field("id", "" + i, Field.Store.YES, Field.Index.ANALYZED));
-          writer.addDocument(doc);
-        }
-        writer.close();
-
-        dir.allIndexInputs.clear();
-
-        IndexReader reader = IndexReader.open(dir, false);
-        Term aaa = new Term("content", "aaa");
-        Term bbb = new Term("content", "bbb");
-        Term ccc = new Term("content", "ccc");
-        assertEquals(37, reader.docFreq(ccc));
-        reader.deleteDocument(0);
-        assertEquals(37, reader.docFreq(aaa));
-        dir.tweakBufferSizes();
-        reader.deleteDocument(4);
-        assertEquals(reader.docFreq(bbb), 37);
-        dir.tweakBufferSizes();
-
-        IndexSearcher searcher = new IndexSearcher(reader);
-        ScoreDoc[] hits = searcher.search(new TermQuery(bbb), null, 1000).scoreDocs;
-        dir.tweakBufferSizes();
-        assertEquals(35, hits.length);
-        dir.tweakBufferSizes();
-        hits = searcher.search(new TermQuery(new Term("id", "33")), null, 1000).scoreDocs;
-        dir.tweakBufferSizes();
-        assertEquals(1, hits.length);
-        hits = searcher.search(new TermQuery(aaa), null, 1000).scoreDocs;
-        dir.tweakBufferSizes();
-        assertEquals(35, hits.length);
-        searcher.close();
-        reader.close();
-      } finally {
-        _TestUtil.rmDir(indexDir);
-      }
-    }
-
-    private static class MockFSDirectory extends Directory {
-
-      List allIndexInputs = new ArrayList();
-
-      Random rand;
-
-      private Directory dir;
-
-      public MockFSDirectory(File path, Random rand) throws IOException {
-        this.rand = rand;
-        lockFactory = new NoLockFactory();
-        dir = new SimpleFSDirectory(path, null);
-      }
-
-      public IndexInput openInput(String name) throws IOException {
-        return openInput(name, BufferedIndexInput.BUFFER_SIZE);
-      }
-
-      public void tweakBufferSizes() {
-        Iterator it = allIndexInputs.iterator();
-        //int count = 0;
-        while(it.hasNext()) {
-          BufferedIndexInput bii = (BufferedIndexInput) it.next();
-          int bufferSize = 1024+(int) Math.abs(rand.nextInt() % 32768);
-          bii.setBufferSize(bufferSize);
-          //count++;
-        }
-        //System.out.println("tweak'd " + count + " buffer sizes");
-      }
-      
-      public IndexInput openInput(String name, int bufferSize) throws IOException {
-        // Make random changes to buffer size
-        bufferSize = 1+(int) Math.abs(rand.nextInt() % 10);
-        IndexInput f = dir.openInput(name, bufferSize);
-        allIndexInputs.add(f);
-        return f;
-      }
-
-      public IndexOutput createOutput(String name) throws IOException {
-        return dir.createOutput(name);
-      }
-
-      public void close() throws IOException {
-        dir.close();
-      }
-
-      public void deleteFile(String name)
-        throws IOException
-      {
-        dir.deleteFile(name);
-      }
-      public void touchFile(String name)
-        throws IOException
-      {
-        dir.touchFile(name);
-      }
-      public long fileModified(String name)
-        throws IOException
-      {
-        return dir.fileModified(name);
-      }
-      public boolean fileExists(String name)
-        throws IOException
-      {
-        return dir.fileExists(name);
-      }
-      public String[] listAll()
-        throws IOException
-      {
-        return dir.listAll();
-      }
-
-      public long fileLength(String name) throws IOException {
-        return dir.fileLength(name);
-      }
-
-
-    }
 }



Mime
View raw message