Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuri Gorshenin <y@maps.me>2015-07-01 16:55:50 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 02:53:33 +0300
commit54e5990c7e4c65b0749c21ce4fe3866909a29668 (patch)
treeec9f80550c7402b7d5f577773353c0d7eb6fb0a7 /integration_tests
parent025f73ad85d489c4ea143b9d95dde4d308daf89b (diff)
Revert "Merge pull request #1068 from maps/revert-929-abstract-country-file"
This reverts commit 66aac38c3004d261ee06a16f7e9db372f67614df, reversing changes made to ad8708944070f6b32a17fbb944d3c493b3fb2a24.
Diffstat (limited to 'integration_tests')
-rw-r--r--integration_tests/osrm_test_tools.cpp58
-rw-r--r--integration_tests/osrm_test_tools.hpp4
2 files changed, 31 insertions, 31 deletions
diff --git a/integration_tests/osrm_test_tools.cpp b/integration_tests/osrm_test_tools.cpp
index 90f9dbeaa9..4bf6cd94b8 100644
--- a/integration_tests/osrm_test_tools.cpp
+++ b/integration_tests/osrm_test_tools.cpp
@@ -11,6 +11,8 @@
#include "map/feature_vec_model.hpp"
+#include "platform/local_country_file.hpp"
+#include "platform/local_country_file_utils.hpp"
#include "platform/platform.hpp"
#include "platform/preferred_languages.hpp"
@@ -20,6 +22,7 @@
using namespace routing;
+using platform::LocalCountryFile;
namespace
{
@@ -34,19 +37,19 @@ namespace
namespace integration
{
- shared_ptr<model::FeaturesFetcher> CreateFeaturesFetcher(vector<string> const & mapNames)
+ shared_ptr<model::FeaturesFetcher> CreateFeaturesFetcher(vector<LocalCountryFile> const & localFiles)
{
size_t const maxOpenFileNumber = 1024;
ChangeMaxNumberOfOpenFiles(maxOpenFileNumber);
shared_ptr<model::FeaturesFetcher> featuresFetcher(new model::FeaturesFetcher);
featuresFetcher->InitClassificator();
- for (auto const mapName : mapNames)
+ for (LocalCountryFile const & localFile : localFiles)
{
- pair<MwmSet::MwmLock, bool> result = featuresFetcher->RegisterMap(mapName);
+ pair<MwmSet::MwmLock, bool> result = featuresFetcher->RegisterMap(localFile);
if (!result.second)
{
- ASSERT(false, ());
+ ASSERT(false, ("Can't register", localFile));
return nullptr;
}
}
@@ -82,21 +85,27 @@ namespace integration
ASSERT(featuresFetcher, ());
ASSERT(searchEngine, ());
- shared_ptr<OsrmRouter> osrmRouter(new OsrmRouter(&featuresFetcher->GetIndex(),
- [searchEngine](m2::PointD const & pt)
- {
- return searchEngine->GetCountryFile(pt);
- }));
+ shared_ptr<OsrmRouter> osrmRouter(new OsrmRouter(
+ &featuresFetcher->GetIndex(), [searchEngine](m2::PointD const & pt)
+ {
+ return searchEngine->GetCountryFile(pt);
+ },
+ [](string const & countryFileName)
+ {
+ return make_shared<LocalCountryFile>(LocalCountryFile::MakeForTesting(countryFileName));
+ }));
return osrmRouter;
}
class OsrmRouterComponents
{
public:
- OsrmRouterComponents(vector<string> const & mapNames)
- : m_featuresFetcher(CreateFeaturesFetcher(mapNames)),
- m_searchEngine(CreateSearchEngine(m_featuresFetcher)),
- m_osrmRouter(CreateOsrmRouter(m_featuresFetcher, m_searchEngine)) {}
+ OsrmRouterComponents(vector<LocalCountryFile> const & localFiles)
+ : m_featuresFetcher(CreateFeaturesFetcher(localFiles)),
+ m_searchEngine(CreateSearchEngine(m_featuresFetcher)),
+ m_osrmRouter(CreateOsrmRouter(m_featuresFetcher, m_searchEngine))
+ {
+ }
OsrmRouter * GetOsrmRouter() const { return m_osrmRouter.get(); }
search::Engine * GetSearchEngine() const { return m_searchEngine.get(); }
@@ -106,28 +115,17 @@ namespace integration
shared_ptr<OsrmRouter> m_osrmRouter;
};
- void GetMapNames(vector<string> & maps)
- {
- Platform const & pl = GetPlatform();
-
- pl.GetFilesByExt(pl.ResourcesDir(), DATA_FILE_EXTENSION, maps);
- pl.GetFilesByExt(pl.WritableDir(), DATA_FILE_EXTENSION, maps);
-
- sort(maps.begin(), maps.end());
- maps.erase(unique(maps.begin(), maps.end()), maps.end());
- }
-
- shared_ptr<OsrmRouterComponents> LoadMaps(vector<string> const & mapNames)
+ shared_ptr<OsrmRouterComponents> LoadMaps(vector<LocalCountryFile> const & localFiles)
{
- return shared_ptr<OsrmRouterComponents>(new OsrmRouterComponents(mapNames));
+ return shared_ptr<OsrmRouterComponents>(new OsrmRouterComponents(localFiles));
}
shared_ptr<OsrmRouterComponents> LoadAllMaps()
{
- vector<string> maps;
- GetMapNames(maps);
- ASSERT(!maps.empty(), ());
- return LoadMaps(maps);
+ vector<LocalCountryFile> localFiles;
+ platform::FindAllLocalMaps(localFiles);
+ ASSERT(!localFiles.empty(), ());
+ return LoadMaps(localFiles);
}
OsrmRouterComponents & GetAllMaps()
diff --git a/integration_tests/osrm_test_tools.hpp b/integration_tests/osrm_test_tools.hpp
index 8bc5608e7a..b6d23146d7 100644
--- a/integration_tests/osrm_test_tools.hpp
+++ b/integration_tests/osrm_test_tools.hpp
@@ -8,6 +8,8 @@
#include "routing/osrm_router.hpp"
+#include "platform/local_country_file.hpp"
+
/*
* These tests are developed to simplify routing integration tests writing.
* You can use the interface bellow however you want but there are some hints.
@@ -46,7 +48,7 @@ namespace integration
OsrmRouterComponents & routerComponents);
OsrmRouterComponents & GetAllMaps();
- shared_ptr<OsrmRouterComponents> LoadMaps(vector<string> const & mapNames);
+ shared_ptr<OsrmRouterComponents> LoadMaps(vector<platform::LocalCountryFile> const & localFiles);
TRouteResult CalculateRoute(OsrmRouterComponents const & routerComponents,
m2::PointD const & startPoint, m2::PointD const & startDirection,
m2::PointD const & finalPoint);