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
This commit is contained in:
Erik Hatcher 2003-10-20 18:07:57 +00:00
parent f08368a613
commit eda583780c
1 changed files with 8 additions and 23 deletions

View File

@ -82,26 +82,11 @@ public class TestRussianAnalyzer extends TestCase
private Reader sample1251; private Reader sample1251;
public TestRussianAnalyzer(String name) private File dataDir;
{
super(name);
}
/**
* @see TestCase#setUp()
*/
protected void setUp() throws Exception protected void setUp() throws Exception
{ {
super.setUp(); dataDir = new File(System.getProperty("dataDir"));
}
/**
* @see TestCase#tearDown()
*/
protected void tearDown() throws Exception
{
super.tearDown();
} }
public void testUnicode() throws IOException public void testUnicode() throws IOException
@ -109,12 +94,12 @@ public class TestRussianAnalyzer extends TestCase
RussianAnalyzer ra = new RussianAnalyzer(RussianCharsets.UnicodeRussian); RussianAnalyzer ra = new RussianAnalyzer(RussianCharsets.UnicodeRussian);
inWords = inWords =
new InputStreamReader( 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"); "Unicode");
sampleUnicode = sampleUnicode =
new InputStreamReader( 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"); "Unicode");
TokenStream in = ra.tokenStream("all", inWords); TokenStream in = ra.tokenStream("all", inWords);
@ -151,9 +136,9 @@ public class TestRussianAnalyzer extends TestCase
//System.out.println(new java.util.Date()); //System.out.println(new java.util.Date());
RussianAnalyzer ra = new RussianAnalyzer(RussianCharsets.KOI8); RussianAnalyzer ra = new RussianAnalyzer(RussianCharsets.KOI8);
// 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); TokenStream in = ra.tokenStream("all", inWordsKOI8);
RussianLetterTokenizer sample = RussianLetterTokenizer sample =
@ -187,9 +172,9 @@ public class TestRussianAnalyzer extends TestCase
public void test1251() throws IOException public void test1251() throws IOException
{ {
// 1251 // 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); RussianAnalyzer ra = new RussianAnalyzer(RussianCharsets.CP1251);
TokenStream in = ra.tokenStream("", inWords1251); TokenStream in = ra.tokenStream("", inWords1251);