Added noData parameter to search tests
This commit is contained in:
parent
86378cbc93
commit
820dbaec0e
1 changed files with 19 additions and 14 deletions
|
@ -114,21 +114,24 @@ public class SearchUICoreTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
JSONObject settingsJson = sourceJson.getJSONObject("settings");
|
JSONObject settingsJson = sourceJson.getJSONObject("settings");
|
||||||
|
BinaryMapIndexReader reader = null;
|
||||||
|
boolean useData = settingsJson.optBoolean("useData", true);
|
||||||
|
if (useData) {
|
||||||
|
boolean obfZipFileExists = obfZipFile.exists();
|
||||||
|
if (!obfZipFileExists) {
|
||||||
|
System.out.println(String.format("Could not find obf file: %s", obfZipFile.getPath()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//Assert.assertTrue(obfZipFileExists);
|
||||||
|
|
||||||
boolean obfZipFileExists = obfZipFile.exists();
|
GZIPInputStream gzin = new GZIPInputStream(new FileInputStream(obfZipFile));
|
||||||
if (!obfZipFileExists) {
|
FileOutputStream fous = new FileOutputStream(obfFile);
|
||||||
System.out.println(String.format("Could not find obf file: %s", obfZipFile.getPath()));
|
Algorithms.streamCopy(gzin, fous);
|
||||||
return;
|
fous.close();
|
||||||
|
gzin.close();
|
||||||
|
|
||||||
|
reader = new BinaryMapIndexReader(new RandomAccessFile(obfFile.getPath(), "r"), obfFile);
|
||||||
}
|
}
|
||||||
//Assert.assertTrue(obfZipFileExists);
|
|
||||||
|
|
||||||
GZIPInputStream gzin = new GZIPInputStream(new FileInputStream(obfZipFile));
|
|
||||||
FileOutputStream fous = new FileOutputStream(obfFile);
|
|
||||||
Algorithms.streamCopy(gzin, fous);
|
|
||||||
fous.close();
|
|
||||||
gzin.close();
|
|
||||||
|
|
||||||
BinaryMapIndexReader reader = new BinaryMapIndexReader(new RandomAccessFile(obfFile.getPath(), "r"), obfFile);
|
|
||||||
List<List<String>> results = new ArrayList<>();
|
List<List<String>> results = new ArrayList<>();
|
||||||
for (int i = 0; i < phrases.size(); i++) {
|
for (int i = 0; i < phrases.size(); i++) {
|
||||||
results.add(new ArrayList<String>());
|
results.add(new ArrayList<String>());
|
||||||
|
@ -146,7 +149,9 @@ public class SearchUICoreTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
SearchSettings s = SearchSettings.parseJSON(settingsJson);
|
SearchSettings s = SearchSettings.parseJSON(settingsJson);
|
||||||
s.setOfflineIndexes(Collections.singletonList(reader));
|
if (reader != null) {
|
||||||
|
s.setOfflineIndexes(Collections.singletonList(reader));
|
||||||
|
}
|
||||||
|
|
||||||
final SearchUICore core = new SearchUICore(MapPoiTypes.getDefault(), "en", false);
|
final SearchUICore core = new SearchUICore(MapPoiTypes.getDefault(), "en", false);
|
||||||
core.init();
|
core.init();
|
||||||
|
|
Loading…
Reference in a new issue