Skip to content

Commit 98910b0

Browse files
ahornaceVladimir Kotal
authored andcommitted
Replace RAMDirectory with ByteBuffersDirectory in tests
fixes #2454
1 parent f0c8930 commit 98910b0

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

suggester/src/test/java/org/opengrok/suggest/SuggesterProjectDataTest.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
/*
21-
* Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
21+
* Copyright (c) 2018, 2019 Oracle and/or its affiliates. All rights reserved.
2222
*/
2323
package org.opengrok.suggest;
2424

@@ -30,6 +30,7 @@
3030
import org.apache.lucene.index.IndexWriterConfig;
3131
import org.apache.lucene.index.Term;
3232
import org.apache.lucene.search.suggest.Lookup;
33+
import org.apache.lucene.store.ByteBuffersDirectory;
3334
import org.apache.lucene.store.Directory;
3435
import org.apache.lucene.util.BytesRef;
3536
import org.hamcrest.Matchers;
@@ -66,9 +67,8 @@ public class SuggesterProjectDataTest {
6667
private SuggesterProjectData data;
6768

6869
@Before
69-
@SuppressWarnings("deprecation") // for RAMDirectory
7070
public void setUp() throws IOException {
71-
dir = new org.apache.lucene.store.RAMDirectory();
71+
dir = new ByteBuffersDirectory();
7272
tempDir = Files.createTempDirectory("test");
7373
}
7474

@@ -262,9 +262,8 @@ public void getSearchCountMapNullTest() throws IOException {
262262
}
263263

264264
@Test
265-
@SuppressWarnings("deprecation") // for RAMDirectory
266265
public void testRemove() throws IOException {
267-
Directory dir = new org.apache.lucene.store.RAMDirectory();
266+
Directory dir = new ByteBuffersDirectory();
268267
Path tempDir = Files.createTempDirectory("test");
269268

270269
try (IndexWriter iw = new IndexWriter(dir, new IndexWriterConfig())) {

suggester/src/test/java/org/opengrok/suggest/SuggesterSearcherTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
/*
21-
* Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
21+
* Copyright (c) 2018, 2019 Oracle and/or its affiliates. All rights reserved.
2222
*/
2323
package org.opengrok.suggest;
2424

@@ -31,6 +31,7 @@
3131
import org.apache.lucene.index.IndexWriterConfig;
3232
import org.apache.lucene.index.Term;
3333
import org.apache.lucene.search.TermQuery;
34+
import org.apache.lucene.store.ByteBuffersDirectory;
3435
import org.apache.lucene.store.Directory;
3536
import org.apache.lucene.util.BytesRef;
3637
import org.junit.AfterClass;
@@ -58,9 +59,8 @@ public class SuggesterSearcherTest {
5859
private static SuggesterSearcher searcher;
5960

6061
@BeforeClass
61-
@SuppressWarnings("deprecation") // for RAMDirectory
6262
public static void setUpClass() throws IOException {
63-
dir = new org.apache.lucene.store.RAMDirectory();
63+
dir = new ByteBuffersDirectory();
6464

6565
try (IndexWriter iw = new IndexWriter(dir, new IndexWriterConfig())) {
6666
Document doc1 = new Document();

suggester/src/test/java/org/opengrok/suggest/query/customized/CustomSloppyPhraseScorerTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
/*
21-
* Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
21+
* Copyright (c) 2018, 2019 Oracle and/or its affiliates. All rights reserved.
2222
*/
2323
package org.opengrok.suggest.query.customized;
2424

@@ -35,6 +35,7 @@
3535
import org.apache.lucene.search.Scorer;
3636
import org.apache.lucene.search.TwoPhaseIterator;
3737
import org.apache.lucene.search.Weight;
38+
import org.apache.lucene.store.ByteBuffersDirectory;
3839
import org.apache.lucene.store.Directory;
3940
import org.junit.Test;
4041
import org.opengrok.suggest.query.PhraseScorer;
@@ -47,7 +48,6 @@
4748
import static org.hamcrest.collection.IsIterableContainingInOrder.contains;
4849
import static org.junit.Assert.assertThat;
4950

50-
@SuppressWarnings("deprecation") // for RAMDirectory
5151
public class CustomSloppyPhraseScorerTest {
5252

5353
@SuppressWarnings("unchecked") // for contains()
@@ -57,7 +57,7 @@ public static void test(
5757
final String[] terms,
5858
final Integer[] expectedPositions
5959
) throws IOException {
60-
Directory dir = new org.apache.lucene.store.RAMDirectory();
60+
Directory dir = new ByteBuffersDirectory();
6161

6262
try (IndexWriter iw = new IndexWriter(dir, new IndexWriterConfig())) {
6363
Document doc = new Document();

0 commit comments

Comments
 (0)