From eda583780c8c62f0000adc2b127ac53e8394adcb Mon Sep 17 00:00:00 2001 From: Erik Hatcher Date: Mon, 20 Oct 2003 18:07:57 +0000 Subject: [PATCH] modify to use VM property for base data directory, so IDEs can run tests without Ant git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150108 13f79535-47bb-0310-9956-ffa450edef68 --- .../analysis/ru/TestRussianAnalyzer.java | 31 +++++-------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/src/test/org/apache/lucene/analysis/ru/TestRussianAnalyzer.java b/src/test/org/apache/lucene/analysis/ru/TestRussianAnalyzer.java index ab536fd590c..87c60fbc47e 100644 --- a/src/test/org/apache/lucene/analysis/ru/TestRussianAnalyzer.java +++ b/src/test/org/apache/lucene/analysis/ru/TestRussianAnalyzer.java @@ -82,26 +82,11 @@ public class TestRussianAnalyzer extends TestCase private Reader sample1251; - public TestRussianAnalyzer(String name) - { - super(name); - } + private File dataDir; - /** - * @see TestCase#setUp() - */ protected void setUp() throws Exception { - super.setUp(); - - } - - /** - * @see TestCase#tearDown() - */ - protected void tearDown() throws Exception - { - super.tearDown(); + dataDir = new File(System.getProperty("dataDir")); } public void testUnicode() throws IOException @@ -109,12 +94,12 @@ public class TestRussianAnalyzer extends TestCase RussianAnalyzer ra = new RussianAnalyzer(RussianCharsets.UnicodeRussian); inWords = new InputStreamReader( - new FileInputStream("src/test/org/apache/lucene/analysis/ru/testUnicode.txt"), + new FileInputStream(new File(dataDir, "/org/apache/lucene/analysis/ru/testUnicode.txt")), "Unicode"); sampleUnicode = new InputStreamReader( - new FileInputStream("src/test/org/apache/lucene/analysis/ru/resUnicode.htm"), + new FileInputStream(new File(dataDir, "/org/apache/lucene/analysis/ru/resUnicode.htm")), "Unicode"); TokenStream in = ra.tokenStream("all", inWords); @@ -151,9 +136,9 @@ public class TestRussianAnalyzer extends TestCase //System.out.println(new java.util.Date()); RussianAnalyzer ra = new RussianAnalyzer(RussianCharsets.KOI8); // KOI8 - inWordsKOI8 = new InputStreamReader(new FileInputStream("src/test/org/apache/lucene/analysis/ru/testKOI8.txt"), "iso-8859-1"); + inWordsKOI8 = new InputStreamReader(new FileInputStream(new File(dataDir, "/org/apache/lucene/analysis/ru/testKOI8.txt")), "iso-8859-1"); - sampleKOI8 = new InputStreamReader(new FileInputStream("src/test/org/apache/lucene/analysis/ru/resKOI8.htm"), "iso-8859-1"); + sampleKOI8 = new InputStreamReader(new FileInputStream(new File(dataDir, "/org/apache/lucene/analysis/ru/resKOI8.htm")), "iso-8859-1"); TokenStream in = ra.tokenStream("all", inWordsKOI8); RussianLetterTokenizer sample = @@ -187,9 +172,9 @@ public class TestRussianAnalyzer extends TestCase public void test1251() throws IOException { // 1251 - inWords1251 = new InputStreamReader(new FileInputStream("src/test/org/apache/lucene/analysis/ru/test1251.txt"), "iso-8859-1"); + inWords1251 = new InputStreamReader(new FileInputStream(new File(dataDir, "/org/apache/lucene/analysis/ru/test1251.txt")), "iso-8859-1"); - sample1251 = new InputStreamReader(new FileInputStream("src/test/org/apache/lucene/analysis/ru/res1251.htm"), "iso-8859-1"); + sample1251 = new InputStreamReader(new FileInputStream(new File(dataDir, "/org/apache/lucene/analysis/ru/res1251.htm")), "iso-8859-1"); RussianAnalyzer ra = new RussianAnalyzer(RussianCharsets.CP1251); TokenStream in = ra.tokenStream("", inWords1251);