mirror of https://github.com/apache/lucene.git
remove slow download host; only download zip file once for all tests
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@759061 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
198aa70b35
commit
0f17904f1e
|
@ -46,7 +46,9 @@ public class TestCompoundWordTokenFilter extends TestCase {
|
||||||
"http://dfn.dl.sourceforge.net/sourceforge/offo/offo-hyphenation.zip",
|
"http://dfn.dl.sourceforge.net/sourceforge/offo/offo-hyphenation.zip",
|
||||||
"http://surfnet.dl.sourceforge.net/sourceforge/offo/offo-hyphenation.zip",
|
"http://surfnet.dl.sourceforge.net/sourceforge/offo/offo-hyphenation.zip",
|
||||||
"http://superb-west.dl.sourceforge.net/sourceforge/offo/offo-hyphenation.zip",
|
"http://superb-west.dl.sourceforge.net/sourceforge/offo/offo-hyphenation.zip",
|
||||||
"http://superb-east.dl.sourceforge.net/sourceforge/offo/offo-hyphenation.zip"};
|
"http://voxel.dl.sourceforge.net/sourceforge/offo/offo-hyphenation.zip"};
|
||||||
|
// too slow:
|
||||||
|
//"http://superb-east.dl.sourceforge.net/sourceforge/offo/offo-hyphenation.zip"};
|
||||||
|
|
||||||
private byte[] patternsFileContent;
|
private byte[] patternsFileContent;
|
||||||
|
|
||||||
|
@ -166,23 +168,25 @@ public class TestCompoundWordTokenFilter extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getHyphenationPatternFileContents() {
|
private void getHyphenationPatternFileContents() {
|
||||||
try {
|
if (patternsFileContent == null) {
|
||||||
List urls = new LinkedList(Arrays.asList(locations));
|
try {
|
||||||
Collections.shuffle(urls);
|
List urls = new LinkedList(Arrays.asList(locations));
|
||||||
URL url = new URL((String)urls.get(0));
|
Collections.shuffle(urls);
|
||||||
InputStream in = url.openStream();
|
URL url = new URL((String)urls.get(0));
|
||||||
byte[] buffer = new byte[1024];
|
InputStream in = url.openStream();
|
||||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
byte[] buffer = new byte[1024];
|
||||||
int count;
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||||
|
int count;
|
||||||
|
|
||||||
while ((count = in.read(buffer)) != -1) {
|
while ((count = in.read(buffer)) != -1) {
|
||||||
out.write(buffer, 0, count);
|
out.write(buffer, 0, count);
|
||||||
|
}
|
||||||
|
in.close();
|
||||||
|
out.close();
|
||||||
|
patternsFileContent = out.toByteArray();
|
||||||
|
} catch (IOException e) {
|
||||||
|
// we swallow all exceptions - the user might have no internet connection
|
||||||
}
|
}
|
||||||
in.close();
|
|
||||||
out.close();
|
|
||||||
patternsFileContent = out.toByteArray();
|
|
||||||
} catch (IOException e) {
|
|
||||||
// we swallow all exceptions - the user might have no internet connection
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue